5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-06 21:40:12 +08:00

Improved fullscreen support

This commit is contained in:
Lea Anthony 2020-11-15 15:08:46 +11:00
parent a737d85fa5
commit 32ba9e78fe
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -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 // Fullscreen sets the main window to be fullscreen
void Fullscreen(struct Application *app) { void Fullscreen(struct Application *app) {
Debug(app, "Fullscreen Called"); Debug(app, "Fullscreen Called");
if( app->fullscreen == 0) { if( ! isFullScreen(app) ) {
ToggleFullscreen(app); ToggleFullscreen(app);
} }
} }
@ -441,7 +447,7 @@ void Fullscreen(struct Application *app) {
// UnFullscreen resets the main window after a fullscreen // UnFullscreen resets the main window after a fullscreen
void UnFullscreen(struct Application *app) { void UnFullscreen(struct Application *app) {
Debug(app, "UnFullscreen Called"); Debug(app, "UnFullscreen Called");
if( app->fullscreen == 1) { if( isFullScreen(app) ) {
ToggleFullscreen(app); ToggleFullscreen(app);
} }
} }