Skip to content

Commit

Permalink
fix: invoke app.dock.{hide|show} instead of duplicating logic (#37624)
Browse files Browse the repository at this point in the history
fix: invoke app.dock.{hide|show} instead of duplicating logic

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
  • Loading branch information
trop[bot] and codebytere committed Mar 21, 2023
1 parent 596cb9d commit 67788dd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions shell/browser/native_window_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/desktop_media_id.h"
#include "shell/browser/browser.h"
#include "shell/browser/javascript_environment.h"
#include "shell/browser/native_browser_view_mac.h"
#include "shell/browser/ui/cocoa/electron_native_widget_mac.h"
Expand Down Expand Up @@ -1277,18 +1278,15 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
void NativeWindowMac::SetVisibleOnAllWorkspaces(bool visible,
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
// In order for NSWindows to be visible on fullscreen we need to invoke
// 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.
if (!skipTransformProcessType) {
ProcessSerialNumber psn = {0, kCurrentProcess};
if (visibleOnFullScreen) {
[window_ setCanHide:NO];
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
Browser::Get()->DockHide();
} else {
[window_ setCanHide:YES];
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
Browser::Get()->DockShow(JavascriptEnvironment::GetIsolate());
}
}

Expand Down

0 comments on commit 67788dd

Please sign in to comment.