diff options
| author | Andre Weissflog <floooh@gmail.com> | 2021-05-27 20:29:03 +0200 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2021-05-27 20:29:03 +0200 |
| commit | 3eba4fbb13799e919dcc25f0c561fdfa2a2a8d86 (patch) | |
| tree | f21ab4d508e3146bd21e77fbac8d4270d665f85a /sokol_app.h | |
| parent | 770583bf82ce605e3049ae38fd6bebf098a305a5 (diff) | |
sokol_app.h macos: applicationShouldHandleReopen
This application delegate method is called when the dock icon
is clicked and will unminimize the main window in case
multiple windows are open.
Diffstat (limited to 'sokol_app.h')
| -rw-r--r-- | sokol_app.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sokol_app.h b/sokol_app.h index ae62ed10..b2ed70f0 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -4227,6 +4227,18 @@ _SOKOL_PRIVATE CVReturn _sapp_macos_displaylink_callback( _SOKOL_UNUSED(notification); _sapp_discard_state(); } + +- (BOOL)applicationShouldHandleReopen:(NSApplication*)sender hasVisibleWindows:(BOOL)flag { + _SOKOL_UNUSED(sender); + _SOKOL_UNUSED(flag); + /* unminimize the main window when clicking the dock icon (which doesn't + happen automatically if the application has multiple open windows) + */ + _sapp_window_t* win = _sapp_lookup_window(_sapp.main_window_id); + SOKOL_ASSERT(win); + [win->macos.window makeKeyAndOrderFront:nil]; + return YES; +} @end @implementation _sapp_macos_window_delegate |