From 2c2ce66ec4726bf4b61d946d7ff302b82f8d160e Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 5 Sep 2021 22:40:34 +1000 Subject: [PATCH] [windows] Fix bug with windows options --- .../frontend/desktop/windows/window.go | 21 ++++++++++++------- v2/pkg/options/default.go | 13 +++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/v2/internal/frontend/desktop/windows/window.go b/v2/internal/frontend/desktop/windows/window.go index 3c4b2aaa7..4406a1a19 100644 --- a/v2/internal/frontend/desktop/windows/window.go +++ b/v2/internal/frontend/desktop/windows/window.go @@ -23,9 +23,12 @@ func NewWindow(parent winc.Controller, options *options.App) *Window { result.frontendOptions = options result.SetIsForm(true) - exStyle := w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW - if options.Windows.WindowBackgroundIsTranslucent { - exStyle |= w32.WS_EX_NOREDIRECTIONBITMAP + var exStyle int + if options.Windows != nil { + exStyle = w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW + if options.Windows.WindowBackgroundIsTranslucent { + exStyle |= w32.WS_EX_NOREDIRECTIONBITMAP + } } var dwStyle = w32.WS_OVERLAPPEDWINDOW @@ -54,12 +57,14 @@ func NewWindow(parent winc.Controller, options *options.App) *Window { result.SetFont(winc.DefaultFont) - if options.Windows.WindowBackgroundIsTranslucent { - result.SetTranslucentBackground() - } + if options.Windows != nil { + if options.Windows.WindowBackgroundIsTranslucent { + result.SetTranslucentBackground() + } - if options.Windows.DisableWindowIcon { - result.DisableIcon() + if options.Windows.DisableWindowIcon { + result.DisableIcon() + } } if options.Fullscreen { diff --git a/v2/pkg/options/default.go b/v2/pkg/options/default.go index cb32c70a6..79165401a 100644 --- a/v2/pkg/options/default.go +++ b/v2/pkg/options/default.go @@ -2,20 +2,13 @@ package options import ( "github.com/wailsapp/wails/v2/pkg/logger" - "github.com/wailsapp/wails/v2/pkg/options/mac" ) // Default options for creating the App var Default = &App{ - Width: 1024, - Height: 768, - RGBA: 0xFFFFFFFF, - Mac: &mac.Options{ - TitleBar: mac.TitleBarDefault(), - Appearance: mac.DefaultAppearance, - WebviewIsTransparent: false, - WindowBackgroundIsTranslucent: false, - }, + Width: 1024, + Height: 768, + RGBA: 0xFFFFFFFF, Logger: logger.NewDefaultLogger(), LogLevel: logger.INFO, }