fix: only exit fullscreen conditionally with setKiosk (#38219)

fix: only exit fullscreen conditionally with setKiosk
This commit is contained in:
Shelley Vohr 2023-05-09 18:28:37 +02:00 committed by GitHub
parent f432245456
commit 13e309e1fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 8 deletions

View file

@ -234,6 +234,7 @@ class NativeWindowMac : public NativeWindow,
// The views::View that fills the client area.
std::unique_ptr<RootViewMac> root_view_;
bool fullscreen_before_kiosk_ = false;
bool is_kiosk_ = false;
bool zoom_to_page_width_ = false;
absl::optional<gfx::Point> traffic_light_position_;

View file

@ -1029,10 +1029,13 @@ void NativeWindowMac::SetKiosk(bool kiosk) {
NSApplicationPresentationDisableHideApplication;
[NSApp setPresentationOptions:options];
is_kiosk_ = true;
SetFullScreen(true);
fullscreen_before_kiosk_ = IsFullscreen();
if (!fullscreen_before_kiosk_)
SetFullScreen(true);
} else if (!kiosk && is_kiosk_) {
is_kiosk_ = false;
SetFullScreen(false);
if (!fullscreen_before_kiosk_)
SetFullScreen(false);
// Set presentation options *after* asynchronously exiting
// fullscreen to ensure they take effect.