Correct macOS window activation from hidden state (#6575)

* Fix #6234 - properly set NSApplication activation policies when the window is hidden and shown
This commit is contained in:
Jonathan White 2021-06-01 06:19:47 -04:00
parent 5cfbde0bb7
commit 205ffd30ed
No known key found for this signature in database
GPG key ID: 440FC65F2E0C6E01
2 changed files with 3 additions and 3 deletions

View file

@ -203,11 +203,10 @@
- (void) toggleForegroundApp:(bool) foreground
{
ProcessSerialNumber psn = {0, kCurrentProcess};
if (foreground) {
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
} else {
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
}
}

View file

@ -69,6 +69,7 @@ bool MacUtils::raiseWindow(WId pid)
bool MacUtils::raiseOwnWindow()
{
m_appkit->toggleForegroundApp(true);
return m_appkit->activateProcess(m_appkit->ownProcessId());
}