diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-26 12:13:21 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-26 12:13:21 +0300 |
commit | beee7d208c48d82bfe31d9616f382c4d0ca9df33 (patch) | |
tree | 5050d2192d50673c0a7796591926a1f15f726739 | |
parent | 870d3317eb6c03d4191837fb3e29e8c03acc7317 (diff) |
macOS: Try to prevent SDL from being weird at launch
There appears to be some hacks in SDL regarding launch-time app activation. At least on my Macs, this leads to the forced unhiding of the dock in what appears to be mostly random behavior.
Attempting to disable the hack via an SDL hint and activate the app manually.
-rw-r--r-- | src/macos.m | 6 | ||||
-rw-r--r-- | src/main.c | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/macos.m b/src/macos.m index a4f2b079..35594b7b 100644 --- a/src/macos.m +++ b/src/macos.m | |||
@@ -402,8 +402,10 @@ void registerURLHandler_MacOS(void) { | |||
402 | [handler release]; | 402 | [handler release]; |
403 | } | 403 | } |
404 | 404 | ||
405 | void setupApplication_MacOS(void) { | 405 | void setupApplication_MacOS(void) { |
406 | NSApplication *app = [NSApplication sharedApplication]; | 406 | NSApplication *app = [NSApplication sharedApplication]; |
407 | [app setActivationPolicy:NSApplicationActivationPolicyRegular]; | ||
408 | [app activateIgnoringOtherApps:YES]; | ||
407 | /* Our delegate will override SDL's delegate. */ | 409 | /* Our delegate will override SDL's delegate. */ |
408 | MyDelegate *myDel = [[MyDelegate alloc] initWithSDLDelegate:app.delegate]; | 410 | MyDelegate *myDel = [[MyDelegate alloc] initWithSDLDelegate:app.delegate]; |
409 | [myDel setAppearance:currentSystemAppearance_()]; | 411 | [myDel setAppearance:currentSystemAppearance_()]; |
@@ -539,7 +541,7 @@ enum iColorId removeColorEscapes_String(iString *d) { | |||
539 | return color; | 541 | return color; |
540 | } | 542 | } |
541 | 543 | ||
542 | // returns the selected item, if any | 544 | /* returns the selected item, if any */ |
543 | static NSMenuItem *makeMenuItems_(NSMenu *menu, MenuCommands *commands, const iMenuItem *items, size_t n) { | 545 | static NSMenuItem *makeMenuItems_(NSMenu *menu, MenuCommands *commands, const iMenuItem *items, size_t n) { |
544 | NSMenuItem *selectedItem = nil; | 546 | NSMenuItem *selectedItem = nil; |
545 | for (size_t i = 0; i < n && items[i].label; ++i) { | 547 | for (size_t i = 0; i < n && items[i].label; ++i) { |
@@ -68,6 +68,7 @@ int main(int argc, char **argv) { | |||
68 | SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1"); | 68 | SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1"); |
69 | SDL_SetHint(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, "1"); | 69 | SDL_SetHint(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, "1"); |
70 | SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); | 70 | SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); |
71 | SDL_SetHint(SDL_HINT_MAC_BACKGROUND_APP, "1"); | ||
71 | #if 0 | 72 | #if 0 |
72 | SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "1"); /* debugging! */ | 73 | SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "1"); /* debugging! */ |
73 | #endif | 74 | #endif |