From 65d591e2a6eec093868f60183006aedb040cf194 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Tue, 22 Sep 2020 17:19:35 +1000 Subject: [PATCH] Support more mac window options --- v2/internal/appoptions/mac.go | 1 + v2/internal/ffenestri/ffenestri_darwin.c | 11 +++++++++-- v2/internal/ffenestri/ffenestri_darwin.go | 12 +++++++++--- v2/test/runtime/main.go | 6 ++++-- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/v2/internal/appoptions/mac.go b/v2/internal/appoptions/mac.go index f1f4c0545..988745d00 100644 --- a/v2/internal/appoptions/mac.go +++ b/v2/internal/appoptions/mac.go @@ -5,4 +5,5 @@ type MacOptions struct { TitlebarAppearsTransparent bool HideTitle bool HideTitleBar bool + FullSizeContent bool } diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index 7048ce57e..ffcbd36e9 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -116,6 +116,7 @@ struct Application { int titlebarAppearsTransparent; int hideTitle; int hideTitleBar; + int fullSizeContent; // User Data char *HTML; @@ -144,6 +145,10 @@ void HideTitleBar(struct Application *app) { app->hideTitleBar = 1; } +void FullSizeContent(struct Application *app) { + app->fullSizeContent = 1; +} + void Hide(struct Application *app) { ON_MAIN_THREAD( msg(app->application, s("hide:")) @@ -204,6 +209,7 @@ void* NewApplication(const char *title, int width, int height, int resizable, in result->frame = 1; result->hideTitle = 0; result->hideTitleBar = 0; + result->fullSizeContent = 0; result->titlebarAppearsTransparent = 0; printf("[l] setTitlebarAppearsTransparent %d\n", result->titlebarAppearsTransparent); @@ -674,7 +680,8 @@ void Run(void *applicationPointer, int argc, char **argv) { decorations |= NSWindowStyleMaskFullscreen; } - if( app->frame == 0) { + if( app->fullSizeContent || app->frame == 0) { + Debug("FULLSIZECONTENTT!!!!!!"); decorations |= NSWindowStyleMaskFullSizeContentView; } @@ -748,7 +755,7 @@ void Run(void *applicationPointer, int argc, char **argv) { // [[window standardWindowButton:NSWindowCloseButton] setHidden:YES]; } else { Debug("setTitlebarAppearsTransparent %d", app->titlebarAppearsTransparent ? YES :NO); - // msg(mainWindow, s("setTitlebarAppearsTransparent:"), app->titlebarAppearsTransparent ? YES : NO); + msg(mainWindow, s("setTitlebarAppearsTransparent:"), app->titlebarAppearsTransparent ? YES : NO); msg(app->mainWindow, s("setTitleVisibility:"), app->hideTitle); } diff --git a/v2/internal/ffenestri/ffenestri_darwin.go b/v2/internal/ffenestri/ffenestri_darwin.go index b34e6dce1..44445211c 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.go +++ b/v2/internal/ffenestri/ffenestri_darwin.go @@ -7,6 +7,7 @@ package ffenestri extern void TitlebarAppearsTransparent(void *); extern void HideTitle(void *); extern void HideTitleBar(void *); +extern void FullSizeContent(void *); */ import "C" @@ -22,7 +23,12 @@ func (a *Application) processPlatformSettings() { C.HideTitleBar(a.app) } - // if a.config.Mac.TitlebarAppearsTransparent { - // C.TitlebarAppearsTransparent(a.app) - // } + // Full Size Content + if a.config.Mac.FullSizeContent { + C.FullSizeContent(a.app) + } + + if a.config.Mac.TitlebarAppearsTransparent { + C.TitlebarAppearsTransparent(a.app) + } } diff --git a/v2/test/runtime/main.go b/v2/test/runtime/main.go index efe8e22ef..9b67e7d45 100644 --- a/v2/test/runtime/main.go +++ b/v2/test/runtime/main.go @@ -21,8 +21,10 @@ func main() { DisableResize: false, Fullscreen: false, Mac: wails.MacOptions{ - HideTitle: true, - HideTitleBar: true, + HideTitle: true, + HideTitleBar: false, + TitlebarAppearsTransparent: true, + FullSizeContent: true, }, })