Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: simpleFullscreen window should be on top of other OS X menu bars. #15183

Merged
merged 1 commit into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions atom/browser/native_window_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class NativeWindowMac : public NativeWindow {
bool was_maximizable_ = false;
bool was_movable_ = false;
NSRect original_frame_;
NSInteger original_level_;
NSUInteger simple_fullscreen_mask_;

base::scoped_nsobject<NSColor> background_color_before_vibrancy_;
Expand Down
14 changes: 13 additions & 1 deletion atom/browser/native_window_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
// Default content view.
SetContentView(new views::View());
AddContentViewLayers();

original_frame_ = [window_ frame];
original_level_ = [window_ level];
}

NativeWindowMac::~NativeWindowMac() {
Expand Down Expand Up @@ -859,8 +862,9 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
if (simple_fullscreen && !is_simple_fullscreen_) {
is_simple_fullscreen_ = true;

// Take note of the current window size
// Take note of the current window size and level
original_frame_ = [window frame];
original_level_ = [window level];

simple_fullscreen_options_ = [NSApp currentSystemPresentationOptions];
simple_fullscreen_mask_ = [window styleMask];
Expand All @@ -877,6 +881,13 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {

NSRect fullscreenFrame = [window.screen frame];

// If our app has dock hidden, set the window level higher so another app's
// menu bar doesn't appear on top of our fullscreen app.
if ([[NSRunningApplication currentApplication] activationPolicy] !=
NSApplicationActivationPolicyRegular) {
window.level = NSPopUpMenuWindowLevel;
}

if (!fullscreen_window_title()) {
// Hide the titlebar
SetStyleMask(false, NSTitledWindowMask);
Expand Down Expand Up @@ -912,6 +923,7 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
}

[window setFrame:original_frame_ display:YES animate:YES];
window.level = original_level_;

[NSApp setPresentationOptions:simple_fullscreen_options_];

Expand Down