mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
(ui_cocoa.m ) Cleanups
This commit is contained in:
parent
1c867cedf0
commit
ea18f0f5e3
@ -53,12 +53,8 @@ void apple_rarch_exited(void)
|
|||||||
return;
|
return;
|
||||||
[super sendEvent:event];
|
[super sendEvent:event];
|
||||||
|
|
||||||
apple = (cocoa_input_data_t*)driver->input_data;
|
|
||||||
event_type = event.type;
|
event_type = event.type;
|
||||||
|
|
||||||
if (!apple)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch ((int32_t)event_type)
|
switch ((int32_t)event_type)
|
||||||
{
|
{
|
||||||
case NSKeyDown:
|
case NSKeyDown:
|
||||||
@ -110,36 +106,41 @@ void apple_rarch_exited(void)
|
|||||||
case NSLeftMouseDragged:
|
case NSLeftMouseDragged:
|
||||||
case NSRightMouseDragged:
|
case NSRightMouseDragged:
|
||||||
case NSOtherMouseDragged:
|
case NSOtherMouseDragged:
|
||||||
{
|
{
|
||||||
NSPoint pos;
|
NSPoint pos;
|
||||||
NSPoint mouse_pos;
|
NSPoint mouse_pos;
|
||||||
/* Relative */
|
|
||||||
apple->mouse_rel_x = event.deltaX;
|
apple = (cocoa_input_data_t*)driver->input_data;
|
||||||
apple->mouse_rel_y = event.deltaY;
|
if (!apple)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Relative */
|
||||||
|
apple->mouse_rel_x = event.deltaX;
|
||||||
|
apple->mouse_rel_y = event.deltaY;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_10_7
|
#if MAC_OS_X_VERSION_10_7
|
||||||
NSScreen *screen = (NSScreen*)get_chosen_screen();
|
NSScreen *screen = (NSScreen*)get_chosen_screen();
|
||||||
CGFloat backing_scale_factor = screen.backingScaleFactor;
|
CGFloat backing_scale_factor = screen.backingScaleFactor;
|
||||||
#else
|
#else
|
||||||
CGFloat backing_scale_factor = 1.0f;
|
CGFloat backing_scale_factor = 1.0f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Absolute */
|
/* Absolute */
|
||||||
pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
|
pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||||
apple->touches[0].screen_x = pos.x * backing_scale_factor;
|
apple->touches[0].screen_x = pos.x * backing_scale_factor;
|
||||||
apple->touches[0].screen_y = pos.y * backing_scale_factor;
|
apple->touches[0].screen_y = pos.y * backing_scale_factor;
|
||||||
|
|
||||||
//window is a variable containing your window
|
//window is a variable containing your window
|
||||||
//mouse_pos = [self.window mouseLocationOutsideOfEventStream];
|
//mouse_pos = [self.window mouseLocationOutsideOfEventStream];
|
||||||
//convert to screen coordinates
|
//convert to screen coordinates
|
||||||
//mouse_pos = [[self.window convertBaseToScreen:mouse_pos];
|
//mouse_pos = [[self.window convertBaseToScreen:mouse_pos];
|
||||||
|
|
||||||
//mouse_pos = [event locationInWindow];
|
//mouse_pos = [event locationInWindow];
|
||||||
//mouse_pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:[CocoaView get] ];
|
//mouse_pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:[CocoaView get] ];
|
||||||
mouse_pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
|
mouse_pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];
|
||||||
apple->window_pos_x = (int16_t)mouse_pos.x * backing_scale_factor;
|
apple->window_pos_x = (int16_t)mouse_pos.x * backing_scale_factor;
|
||||||
apple->window_pos_y = (int16_t)mouse_pos.y * backing_scale_factor;
|
apple->window_pos_y = (int16_t)mouse_pos.y * backing_scale_factor;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NSScrollWheel:
|
case NSScrollWheel:
|
||||||
/* TODO/FIXME - properly implement. */
|
/* TODO/FIXME - properly implement. */
|
||||||
@ -147,12 +148,18 @@ void apple_rarch_exited(void)
|
|||||||
case NSLeftMouseDown:
|
case NSLeftMouseDown:
|
||||||
case NSRightMouseDown:
|
case NSRightMouseDown:
|
||||||
case NSOtherMouseDown:
|
case NSOtherMouseDown:
|
||||||
|
apple = (cocoa_input_data_t*)driver->input_data;
|
||||||
|
if (!apple)
|
||||||
|
return;
|
||||||
apple->mouse_buttons |= 1 << event.buttonNumber;
|
apple->mouse_buttons |= 1 << event.buttonNumber;
|
||||||
apple->touch_count = 1;
|
apple->touch_count = 1;
|
||||||
break;
|
break;
|
||||||
case NSLeftMouseUp:
|
case NSLeftMouseUp:
|
||||||
case NSRightMouseUp:
|
case NSRightMouseUp:
|
||||||
case NSOtherMouseUp:
|
case NSOtherMouseUp:
|
||||||
|
apple = (cocoa_input_data_t*)driver->input_data;
|
||||||
|
if (!apple)
|
||||||
|
return;
|
||||||
apple->mouse_buttons &= ~(1 << event.buttonNumber);
|
apple->mouse_buttons &= ~(1 << event.buttonNumber);
|
||||||
apple->touch_count = 0;
|
apple->touch_count = 0;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user