From 4bf59301e52fdb60ac4050a3fb877079d27ce74f Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Mon, 21 Sep 2020 17:13:23 +1000 Subject: [PATCH] Add HideTitleBar --- v2/internal/appoptions/mac.go | 1 + v2/internal/ffenestri/ffenestri_darwin.c | 13 +++++++++++-- v2/internal/ffenestri/ffenestri_darwin.go | 6 ++++++ v2/test/runtime/main.go | 3 ++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/v2/internal/appoptions/mac.go b/v2/internal/appoptions/mac.go index 95292eb8..f1f4c054 100644 --- a/v2/internal/appoptions/mac.go +++ b/v2/internal/appoptions/mac.go @@ -4,4 +4,5 @@ package appoptions type MacOptions struct { TitlebarAppearsTransparent bool HideTitle bool + HideTitleBar bool } diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index c4b1bc54..7048ce57 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -115,6 +115,7 @@ struct Application { int minimised; int titlebarAppearsTransparent; int hideTitle; + int hideTitleBar; // User Data char *HTML; @@ -139,6 +140,10 @@ void HideTitle(struct Application *app) { app->hideTitle = 1; } +void HideTitleBar(struct Application *app) { + app->hideTitleBar = 1; +} + void Hide(struct Application *app) { ON_MAIN_THREAD( msg(app->application, s("hide:")) @@ -198,6 +203,7 @@ void* NewApplication(const char *title, int width, int height, int resizable, in // Features result->frame = 1; result->hideTitle = 0; + result->hideTitleBar = 0; result->titlebarAppearsTransparent = 0; printf("[l] setTitlebarAppearsTransparent %d\n", result->titlebarAppearsTransparent); @@ -651,10 +657,13 @@ void disableBoolConfig(id config, const char *setting) { void Run(void *applicationPointer, int argc, char **argv) { struct Application *app = (struct Application*) applicationPointer; - int decorations; + int decorations = 0; if (app->frame == 1 ) { - decorations = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable; + if( app->hideTitleBar == 0) { + decorations |= NSWindowStyleMaskTitled; + } + decorations |= NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable; } if (app->resizable) { diff --git a/v2/internal/ffenestri/ffenestri_darwin.go b/v2/internal/ffenestri/ffenestri_darwin.go index 98081e0d..b34e6dce 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.go +++ b/v2/internal/ffenestri/ffenestri_darwin.go @@ -6,6 +6,7 @@ package ffenestri extern void TitlebarAppearsTransparent(void *); extern void HideTitle(void *); +extern void HideTitleBar(void *); */ import "C" @@ -16,6 +17,11 @@ func (a *Application) processPlatformSettings() { C.HideTitle(a.app) } + // HideTitleBar + if a.config.Mac.HideTitleBar { + C.HideTitleBar(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 72758e97..efe8e22e 100644 --- a/v2/test/runtime/main.go +++ b/v2/test/runtime/main.go @@ -21,7 +21,8 @@ func main() { DisableResize: false, Fullscreen: false, Mac: wails.MacOptions{ - HideTitle: true, + HideTitle: true, + HideTitleBar: true, }, })