Merge pull request #10611 from AlexKornitzer/master

cocoa: disable clipping cursor to window
This commit is contained in:
Autechre 2020-05-11 02:31:32 +02:00 committed by GitHub
commit 57cd3fdf06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 12 deletions

View File

@ -201,16 +201,12 @@ static int16_t cocoa_mouse_state(cocoa_input_data_t *apple,
switch (id)
{
case RETRO_DEVICE_ID_MOUSE_X:
val = apple->mouse_rel_x;
// NOTE: Because cocoa events are effectively handled async we reset
// the delta which we cumulate on each event
apple->mouse_rel_x = 0;
val = apple->window_pos_x - apple->mouse_x_last;
apple->mouse_x_last = apple->window_pos_x;
return val;
case RETRO_DEVICE_ID_MOUSE_Y:
val = apple->mouse_rel_y;
// NOTE: Because cocoa events are effectively handled async we reset
// the delta which we cumulate on each event
apple->mouse_rel_y = 0;
val = apple->window_pos_y - apple->mouse_y_last;
apple->mouse_y_last = apple->window_pos_y;
return val;
case RETRO_DEVICE_ID_MOUSE_LEFT:
return apple->mouse_buttons & 1;

View File

@ -137,10 +137,11 @@ static void app_terminate(void)
pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
#endif
NSInteger window_number = [[[NSApplication sharedApplication] keyWindow] windowNumber];
if ([NSWindow windowNumberAtPoint:pos belowWindowWithWindowNumber:0] != window_number) {
return;
}
// FIXME: Disable clipping until graphical offset issues are fixed
//NSInteger window_number = [[[NSApplication sharedApplication] keyWindow] windowNumber];
//if ([NSWindow windowNumberAtPoint:pos belowWindowWithWindowNumber:0] != window_number) {
// return;
//}
/* Relative */
apple->mouse_rel_x += (int16_t)event.deltaX;