feat: hide menu bar on windows fullscreen (#43402)
* feat: hide menu bar on windows fullscreen * test: state prior to html fullscreen transition * refactor: restore `#ifdef` for readability Reference: https://github.com/electron/electron/pull/43402#discussion_r1729356262 * docs: menu bar behavior changed --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
parent
3dd7e46291
commit
29c2744e57
3 changed files with 53 additions and 0 deletions
|
@ -746,6 +746,24 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
|||
// Note: the following must be after "widget()->SetFullscreen(fullscreen);"
|
||||
if (leaving_fullscreen && !IsVisible())
|
||||
FlipWindowStyle(GetAcceleratedWidget(), true, WS_VISIBLE);
|
||||
|
||||
// Auto-hide menubar when in fullscreen.
|
||||
if (fullscreen) {
|
||||
menu_bar_visible_before_fullscreen_ = IsMenuBarVisible();
|
||||
SetMenuBarVisibility(false);
|
||||
} else {
|
||||
// No fullscreen -> fullscreen video -> un-fullscreen video results
|
||||
// in `NativeWindowViews::SetFullScreen(false)` being called twice.
|
||||
// `menu_bar_visible_before_fullscreen_` is always false on the
|
||||
// second call which results in `SetMenuBarVisibility(false)` no
|
||||
// matter what. We check `leaving_fullscreen` to avoid this.
|
||||
if (!leaving_fullscreen)
|
||||
return;
|
||||
|
||||
SetMenuBarVisibility(!IsMenuBarAutoHide() &&
|
||||
menu_bar_visible_before_fullscreen_);
|
||||
menu_bar_visible_before_fullscreen_ = false;
|
||||
}
|
||||
#else
|
||||
if (IsVisible())
|
||||
widget()->SetFullscreen(fullscreen);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue