(Apple) Style nits/cleanups

This commit is contained in:
twinaphex 2014-05-12 16:37:02 +02:00
parent 10c801b64e
commit 1d552c42ee
2 changed files with 26 additions and 24 deletions

View File

@ -56,7 +56,7 @@ static void* const associated_core_key = (void*)&associated_core_key;
else if (event_type == NSFlagsChanged) else if (event_type == NSFlagsChanged)
{ {
static uint32_t old_flags = 0; static uint32_t old_flags = 0;
uint32_t new_flags = [event modifierFlags]; uint32_t new_flags = event.modifierFlags;
bool down = (new_flags & old_flags) == old_flags; bool down = (new_flags & old_flags) == old_flags;
old_flags = new_flags; old_flags = new_flags;
@ -65,12 +65,13 @@ static void* const associated_core_key = (void*)&associated_core_key;
else if (event_type == NSMouseMoved || event_type == NSLeftMouseDragged || else if (event_type == NSMouseMoved || event_type == NSLeftMouseDragged ||
event_type == NSRightMouseDragged || event_type == NSOtherMouseDragged) event_type == NSRightMouseDragged || event_type == NSOtherMouseDragged)
{ {
NSPoint pos;
// Relative // Relative
g_current_input_data.mouse_delta[0] += event.deltaX; g_current_input_data.mouse_delta[0] += event.deltaX;
g_current_input_data.mouse_delta[1] += event.deltaY; g_current_input_data.mouse_delta[1] += event.deltaY;
// Absolute // Absolute
NSPoint pos = [[RAGameView get] convertPoint:[event locationInWindow] fromView:nil]; pos = [[RAGameView get] convertPoint:[event locationInWindow] fromView:nil];
g_current_input_data.touches[0].screen_x = pos.x; g_current_input_data.touches[0].screen_x = pos.x;
g_current_input_data.touches[0].screen_y = pos.y; g_current_input_data.touches[0].screen_y = pos.y;
} }
@ -208,7 +209,7 @@ static char** waiting_argv;
_isTerminating = true; _isTerminating = true;
if (apple_is_running) if (apple_is_running)
apple_event_basic_command(QUIT); g_extern.system.shutdown = true;
return apple_is_running ? NSTerminateCancel : NSTerminateNow; return apple_is_running ? NSTerminateCancel : NSTerminateNow;
} }
@ -236,7 +237,7 @@ static char** waiting_argv;
- (void)openDocument:(id)sender - (void)openDocument:(id)sender
{ {
NSOpenPanel* panel = [NSOpenPanel openPanel]; NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
#if defined(MAC_OS_X_VERSION_10_5) #if defined(MAC_OS_X_VERSION_10_5)
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) [panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
{ {
@ -327,7 +328,9 @@ static char** waiting_argv;
- (IBAction)basicEvent:(id)sender - (IBAction)basicEvent:(id)sender
{ {
if (apple_is_running) if (!apple_is_running)
return;
apple_event_basic_command([sender tag]); apple_event_basic_command([sender tag]);
} }

View File

@ -34,17 +34,16 @@ extern void apple_rarch_exited(void);
static void do_iteration(void) static void do_iteration(void)
{ {
bool iterate = iterate_observer && apple_is_running && !g_extern.is_paused; if (!(iterate_observer && apple_is_running && !g_extern.is_paused))
if (!iterate)
return; return;
if (main_entry_iterate(0, NULL, NULL)) if (main_entry_iterate(0, NULL, NULL))
{ {
main_exit(NULL); main_exit(NULL);
apple_rarch_exited(); apple_rarch_exited();
return;
} }
else
CFRunLoopWakeUp(CFRunLoopGetMain()); CFRunLoopWakeUp(CFRunLoopGetMain());
} }
@ -93,12 +92,12 @@ void apple_refresh_config(void)
memset(g_settings.input.overlay, 0, sizeof(g_settings.input.overlay)); memset(g_settings.input.overlay, 0, sizeof(g_settings.input.overlay));
memset(g_settings.video.shader_path, 0, sizeof(g_settings.video.shader_path)); memset(g_settings.video.shader_path, 0, sizeof(g_settings.video.shader_path));
if (apple_is_running) if (!apple_is_running)
{ return;
uninit_drivers(); uninit_drivers();
config_load(); config_load();
init_drivers(); init_drivers();
}
} }
int apple_rarch_load_content(int argc, char* argv[]) int apple_rarch_load_content(int argc, char* argv[])