diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/osx/os_osx.mm | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index dbe9a11471..bde0b4e898 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -541,7 +541,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; } - (void)cursorUpdate:(NSEvent *)event { - //setModeCursor(window, window->cursorMode); + OS::CursorShape p_shape = OS_OSX::singleton->cursor_shape; + OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX; + OS_OSX::singleton->set_cursor_shape(p_shape); } static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) { @@ -656,11 +658,12 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) { return; if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED) OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER); - if (OS_OSX::singleton->input) { + if (OS_OSX::singleton->input) OS_OSX::singleton->input->set_mouse_in_window(true); - OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX; - OS_OSX::singleton->set_cursor_shape(OS::CURSOR_ARROW); - } + + OS::CursorShape p_shape = OS_OSX::singleton->cursor_shape; + OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX; + OS_OSX::singleton->set_cursor_shape(p_shape); } - (void)magnifyWithEvent:(NSEvent *)event { @@ -847,16 +850,16 @@ struct _KeyCodeMap { static const _KeyCodeMap _keycodes[55] = { { '`', KEY_QUOTELEFT }, { '~', KEY_ASCIITILDE }, - { '0', KEY_KP_0 }, - { '1', KEY_KP_1 }, - { '2', KEY_KP_2 }, - { '3', KEY_KP_3 }, - { '4', KEY_KP_4 }, - { '5', KEY_KP_5 }, - { '6', KEY_KP_6 }, - { '7', KEY_KP_7 }, - { '8', KEY_KP_8 }, - { '9', KEY_KP_9 }, + { '0', KEY_0 }, + { '1', KEY_1 }, + { '2', KEY_2 }, + { '3', KEY_3 }, + { '4', KEY_4 }, + { '5', KEY_5 }, + { '6', KEY_6 }, + { '7', KEY_7 }, + { '8', KEY_8 }, + { '9', KEY_9 }, { '-', KEY_MINUS }, { '_', KEY_UNDERSCORE }, { '=', KEY_EQUAL }, @@ -2424,12 +2427,21 @@ void OS_OSX::run() { //int frames=0; //uint64_t frame=0; - while (!force_quit) { + bool quit = false; - process_events(); // get rid of pending events - joypad_osx->process_joypads(); - if (Main::iteration() == true) - break; + while (!force_quit && !quit) { + + @try { + + process_events(); // get rid of pending events + joypad_osx->process_joypads(); + + if (Main::iteration() == true) { + quit = true; + } + } @catch (NSException *exception) { + ERR_PRINTS("NSException: " + String([exception reason].UTF8String)); + } }; main_loop->finish(); |