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 committed by GitHub
parent 33bf6eb892
commit 11afd73117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -206,11 +206,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

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