feat: add option to not transform processes on win.SetVisibleOnAllWorkspaces (#27200)

* fix: optionally transform processes on win.SetVisibleOnAllWorkspaces on macOS, making it backwards-compatible with v9.2.1 (#27101)

* fix: optionally transform processes on win.SetVisibleOnAllWorkspaces on macOS, making it backwards-compatible with v9.2.1 (#27101)

Co-authored-by: Cyrus Roshan <cyrusroshan@users.noreply.github.com>
This commit is contained in:
Cyrus Roshan 2021-02-02 04:24:04 -08:00 committed by GitHub
parent 272611cc82
commit 444ad26f89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 16 deletions

View file

@ -1161,18 +1161,21 @@ void NativeWindowMac::SetOverlayIcon(const gfx::Image& overlay,
const std::string& description) {}
void NativeWindowMac::SetVisibleOnAllWorkspaces(bool visible,
bool visibleOnFullScreen) {
bool visibleOnFullScreen,
bool skipTransformProcessType) {
// In order for NSWindows to be visible on fullscreen we need to functionally
// mimic app.dock.hide() since Apple changed the underlying functionality of
// NSWindows starting with 10.14 to disallow NSWindows from floating on top of
// fullscreen apps.
ProcessSerialNumber psn = {0, kCurrentProcess};
if (visibleOnFullScreen) {
[window_ setCanHide:NO];
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
} else {
[window_ setCanHide:YES];
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
if (!skipTransformProcessType) {
ProcessSerialNumber psn = {0, kCurrentProcess};
if (visibleOnFullScreen) {
[window_ setCanHide:NO];
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
} else {
[window_ setCanHide:YES];
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
}
}
SetCollectionBehavior(visible, NSWindowCollectionBehaviorCanJoinAllSpaces);