From 4e3956611801edb8678c1f6c031e9cee89bf53f9 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Wed, 30 Sep 2020 19:54:41 +1000 Subject: [PATCH] Rename vibrancy to appearance --- v2/internal/ffenestri/ffenestri_darwin.c | 14 +++++++------- v2/internal/ffenestri/ffenestri_darwin.go | 8 ++++---- v2/pkg/options/default.go | 2 +- v2/pkg/options/mac/appearance.go | 21 +++++++++++++++++++++ v2/pkg/options/mac/mac.go | 2 +- v2/pkg/options/mac/vibrancy.go | 21 --------------------- v2/test/runtime/main.go | 4 ++-- 7 files changed, 36 insertions(+), 36 deletions(-) create mode 100644 v2/pkg/options/mac/appearance.go delete mode 100644 v2/pkg/options/mac/vibrancy.go diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index de670b1e..0a775c75 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -120,7 +120,7 @@ struct Application { int blue; int alpha; int webviewIsTranparent; - const char *vibrancy; + const char *appearance; // Features int frame; @@ -174,10 +174,10 @@ void WebviewIsTransparent(struct Application *app) { app->webviewIsTranparent = 1; } -// SetVibrancy will set the window's vibrancy to the +// SetAppearance will set the window's Appearance to the // given value -void SetVibrancy(struct Application *app, const char *vibrancy) { - app->vibrancy = vibrancy; +void SetAppearance(struct Application *app, const char *appearance) { + app->appearance = appearance; } @@ -285,7 +285,7 @@ void* NewApplication(const char *title, int width, int height, int resizable, in result->fullSizeContent = 0; result->useToolBar = 0; result->hideToolbarSeparator = 0; - result->vibrancy = "NSAppearanceNameAqua"; + result->appearance = "NSAppearanceNameAqua"; result->titlebarAppearsTransparent = 0; result->webviewIsTranparent = 0; @@ -856,9 +856,9 @@ void Run(void *applicationPointer, int argc, char **argv) { msg(wkwebview, s("setValue:forKey:"), msg(c("NSNumber"), s("numberWithBool:"), 1), str("drawsTransparentBackground")); } - // Set Vibrancy + // Set Appearance msg(mainWindow, s("setAppearance:"), - msg(c("NSAppearance"), s("appearanceNamed:"), str(app->vibrancy)) + msg(c("NSAppearance"), s("appearanceNamed:"), str(app->appearance)) ); diff --git a/v2/internal/ffenestri/ffenestri_darwin.go b/v2/internal/ffenestri/ffenestri_darwin.go index 340512cb..62faf506 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.go +++ b/v2/internal/ffenestri/ffenestri_darwin.go @@ -11,7 +11,7 @@ extern void FullSizeContent(void *); extern void UseToolbar(void *); extern void HideToolbarSeparator(void *); extern void DisableFrame(void *); -extern void SetVibrancy(void *, const char *); +extern void SetAppearance(void *, const char *); extern void WebviewIsTransparent(void *); */ import "C" @@ -54,9 +54,9 @@ func (a *Application) processPlatformSettings() { C.DisableFrame(a.app) } - // Process window vibrancy - if mac.Vibrancy != "" { - C.SetVibrancy(a.app, a.string2CString(string(mac.Vibrancy))) + // Process window Appearance + if mac.Appearance != "" { + C.SetAppearance(a.app, a.string2CString(string(mac.Appearance))) } // Check if the webview should be transparent diff --git a/v2/pkg/options/default.go b/v2/pkg/options/default.go index 904a7e71..c0385929 100644 --- a/v2/pkg/options/default.go +++ b/v2/pkg/options/default.go @@ -11,7 +11,7 @@ var Default = &App{ RGBA: 0xFFFFFFFF, Mac: &mac.Options{ TitleBar: mac.TitleBarDefault(), - Vibrancy: mac.NSAppearanceNameAqua, + Appearance: mac.NSAppearanceNameAqua, WebviewIsTransparent: false, }, } diff --git a/v2/pkg/options/mac/appearance.go b/v2/pkg/options/mac/appearance.go new file mode 100644 index 00000000..074dc147 --- /dev/null +++ b/v2/pkg/options/mac/appearance.go @@ -0,0 +1,21 @@ +package mac + +// AppearanceType is a type of Appearance for Cocoa windows +type AppearanceType string + +const ( + // NSAppearanceNameAqua - The standard light system appearance. + NSAppearanceNameAqua AppearanceType = "NSAppearanceNameAqua" + // NSAppearanceNameDarkAqua - The standard dark system appearance. + NSAppearanceNameDarkAqua AppearanceType = "NSAppearanceNameDarkAqua" + // NSAppearanceNameVibrantLight - The light vibrant appearance + NSAppearanceNameVibrantLight AppearanceType = "NSAppearanceNameVibrantLight" + // NSAppearanceNameAccessibilityHighContrastAqua - A high-contrast version of the standard light system appearance. + NSAppearanceNameAccessibilityHighContrastAqua AppearanceType = "NSAppearanceNameAccessibilityHighContrastAqua" + // NSAppearanceNameAccessibilityHighContrastDarkAqua - A high-contrast version of the standard dark system appearance. + NSAppearanceNameAccessibilityHighContrastDarkAqua AppearanceType = "NSAppearanceNameAccessibilityHighContrastDarkAqua" + // NSAppearanceNameAccessibilityHighContrastVibrantLight - A high-contrast version of the light vibrant appearance. + NSAppearanceNameAccessibilityHighContrastVibrantLight AppearanceType = "NSAppearanceNameAccessibilityHighContrastVibrantLight" + // NSAppearanceNameAccessibilityHighContrastVibrantDark - A high-contrast version of the dark vibrant appearance. + NSAppearanceNameAccessibilityHighContrastVibrantDark AppearanceType = "NSAppearanceNameAccessibilityHighContrastVibrantDark" +) diff --git a/v2/pkg/options/mac/mac.go b/v2/pkg/options/mac/mac.go index 17dacc6b..66f546a1 100644 --- a/v2/pkg/options/mac/mac.go +++ b/v2/pkg/options/mac/mac.go @@ -3,6 +3,6 @@ package mac // Options ae options speific to Mac type Options struct { TitleBar *TitleBar - Vibrancy VibrancyType + Appearance AppearanceType WebviewIsTransparent bool } diff --git a/v2/pkg/options/mac/vibrancy.go b/v2/pkg/options/mac/vibrancy.go deleted file mode 100644 index 9759134f..00000000 --- a/v2/pkg/options/mac/vibrancy.go +++ /dev/null @@ -1,21 +0,0 @@ -package mac - -// VibrancyType is a type of vibrancy for Cocoa windows -type VibrancyType string - -const ( - // NSAppearanceNameAqua - The standard light system appearance. - NSAppearanceNameAqua VibrancyType = "NSAppearanceNameAqua" - // NSAppearanceNameDarkAqua - The standard dark system appearance. - NSAppearanceNameDarkAqua VibrancyType = "NSAppearanceNameDarkAqua" - // NSAppearanceNameVibrantLight - The light vibrant appearance - NSAppearanceNameVibrantLight VibrancyType = "NSAppearanceNameVibrantLight" - // NSAppearanceNameAccessibilityHighContrastAqua - A high-contrast version of the standard light system appearance. - NSAppearanceNameAccessibilityHighContrastAqua VibrancyType = "NSAppearanceNameAccessibilityHighContrastAqua" - // NSAppearanceNameAccessibilityHighContrastDarkAqua - A high-contrast version of the standard dark system appearance. - NSAppearanceNameAccessibilityHighContrastDarkAqua VibrancyType = "NSAppearanceNameAccessibilityHighContrastDarkAqua" - // NSAppearanceNameAccessibilityHighContrastVibrantLight - A high-contrast version of the light vibrant appearance. - NSAppearanceNameAccessibilityHighContrastVibrantLight VibrancyType = "NSAppearanceNameAccessibilityHighContrastVibrantLight" - // NSAppearanceNameAccessibilityHighContrastVibrantDark - A high-contrast version of the dark vibrant appearance. - NSAppearanceNameAccessibilityHighContrastVibrantDark VibrancyType = "NSAppearanceNameAccessibilityHighContrastVibrantDark" -) diff --git a/v2/test/runtime/main.go b/v2/test/runtime/main.go index c480afcd..b8349520 100644 --- a/v2/test/runtime/main.go +++ b/v2/test/runtime/main.go @@ -26,8 +26,8 @@ func main() { Mac: &mac.Options{ // TitleBar: mac.TitleBarHidden(), // TitleBar: mac.TitleBarHiddenInset(), - TitleBar: mac.TitleBarDefault(), - Vibrancy: mac.NSAppearanceNameDarkAqua, + TitleBar: mac.TitleBarDefault(), + Appearance: mac.NSAppearanceNameDarkAqua, }, })