(ui_cocoa.m) Cleanups

This commit is contained in:
twinaphex 2016-06-04 18:09:40 +02:00
parent 8e9bb03301
commit 242e3d6a9e

View File

@ -37,7 +37,7 @@
static id apple_platform; static id apple_platform;
void apple_rarch_exited(void) static void app_terminate(void)
{ {
[[NSApplication sharedApplication] terminate:nil]; [[NSApplication sharedApplication] terminate:nil];
} }
@ -103,9 +103,9 @@ void apple_rarch_exited(void)
} }
break; break;
case NSMouseMoved: case NSMouseMoved:
case NSLeftMouseDragged: case NSLeftMouseDragged:
case NSRightMouseDragged: case NSRightMouseDragged:
case NSOtherMouseDragged: case NSOtherMouseDragged:
{ {
NSPoint pos; NSPoint pos;
NSPoint mouse_pos; NSPoint mouse_pos;
@ -127,19 +127,19 @@ void apple_rarch_exited(void)
apple->window_pos_y = (int16_t)mouse_pos.y; apple->window_pos_y = (int16_t)mouse_pos.y;
} }
break; break;
case NSScrollWheel: case NSScrollWheel:
/* TODO/FIXME - properly implement. */ /* TODO/FIXME - properly implement. */
break; break;
case NSLeftMouseDown: case NSLeftMouseDown:
case NSRightMouseDown: case NSRightMouseDown:
case NSOtherMouseDown: case NSOtherMouseDown:
apple = (cocoa_input_data_t*)input_driver_get_data(); apple = (cocoa_input_data_t*)input_driver_get_data();
if (!apple) if (!apple)
return; 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*)input_driver_get_data(); apple = (cocoa_input_data_t*)input_driver_get_data();
@ -198,7 +198,7 @@ static char** waiting_argv;
} }
} }
if (rarch_main(waiting_argc, waiting_argv, NULL)) if (rarch_main(waiting_argc, waiting_argv, NULL))
apple_rarch_exited(); app_terminate();
waiting_argc = 0; waiting_argc = 0;
@ -555,7 +555,7 @@ static void ui_companion_cocoa_deinit(void *data)
{ {
ui_companion_cocoa_t *handle = (ui_companion_cocoa_t*)data; ui_companion_cocoa_t *handle = (ui_companion_cocoa_t*)data;
apple_rarch_exited(); app_terminate();
if (handle) if (handle)
free(handle); free(handle);