From 32ba9e78fe8b1e8a79fb2bc716934c52b8cba276 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 15 Nov 2020 15:08:46 +1100 Subject: [PATCH] Improved fullscreen support --- v2/internal/ffenestri/ffenestri_darwin.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index 5f64bf0cc..6f243894d 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -430,10 +430,16 @@ void ToggleFullscreen(struct Application *app) { ); } +bool isFullScreen(struct Application *app) { + int mask = (int)msg(app->mainWindow, s("styleMask")); + bool result = (mask & NSWindowStyleMaskFullscreen) == NSWindowStyleMaskFullscreen; + return result; +} + // Fullscreen sets the main window to be fullscreen void Fullscreen(struct Application *app) { Debug(app, "Fullscreen Called"); - if( app->fullscreen == 0) { + if( ! isFullScreen(app) ) { ToggleFullscreen(app); } } @@ -441,7 +447,7 @@ void Fullscreen(struct Application *app) { // UnFullscreen resets the main window after a fullscreen void UnFullscreen(struct Application *app) { Debug(app, "UnFullscreen Called"); - if( app->fullscreen == 1) { + if( isFullScreen(app) ) { ToggleFullscreen(app); } }