From 47d783291d879e90fc03e5a81fb9f5d9dc9bca39 Mon Sep 17 00:00:00 2001 From: stffabi Date: Wed, 1 Dec 2021 15:06:46 +0100 Subject: [PATCH] [windows] Support drawing a frame for frameless to support hiding the titlebar --- v2/internal/frontend/desktop/windows/window.go | 3 +++ v2/pkg/options/windows/windows.go | 3 +++ website/docs/reference/options.mdx | 17 +++++++++++++---- .../current/reference/options.mdx | 7 ++++--- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/v2/internal/frontend/desktop/windows/window.go b/v2/internal/frontend/desktop/windows/window.go index 6e765fc9a..28dc7af65 100644 --- a/v2/internal/frontend/desktop/windows/window.go +++ b/v2/internal/frontend/desktop/windows/window.go @@ -34,6 +34,9 @@ func NewWindow(parent winc.Controller, appoptions *options.App) *Window { var dwStyle = w32.WS_OVERLAPPEDWINDOW if appoptions.Frameless { dwStyle = w32.WS_POPUP + if winoptions := appoptions.Windows; winoptions != nil && winoptions.EnableFramelessBorder { + dwStyle |= w32.WS_BORDER + } } winc.RegClassOnlyOnce("wailsWindow") diff --git a/v2/pkg/options/windows/windows.go b/v2/pkg/options/windows/windows.go index 33c842b2a..4dc92cfee 100644 --- a/v2/pkg/options/windows/windows.go +++ b/v2/pkg/options/windows/windows.go @@ -5,4 +5,7 @@ type Options struct { WebviewIsTransparent bool WindowIsTranslucent bool DisableWindowIcon bool + + // Draw a border around the window, even if the window is frameless + EnableFramelessBorder bool } diff --git a/website/docs/reference/options.mdx b/website/docs/reference/options.mdx index 1c92205af..9744afe6f 100644 --- a/website/docs/reference/options.mdx +++ b/website/docs/reference/options.mdx @@ -41,9 +41,10 @@ func main() { app, }, Windows: &windows.Options{ - WebviewIsTransparent: false, - WindowIsTranslucent: false, - DisableWindowIcon: false, + WebviewIsTransparent: false, + WindowIsTranslucent: false, + DisableWindowIcon: false, + EnableFramelessBorder: false, }, Mac: &mac.Options{ TitleBar: &mac.TitleBar{ @@ -316,8 +317,16 @@ Name: DisableWindowIcon Type: bool -Setting this to true will remove the icon in the top left corner of the title bar. +Setting this to `true` will remove the icon in the top left corner of the title bar. +### EnableFramelessBorder + +Name: EnableFramelessBorder + +Type: bool + +Setting this to `true` will add a border around the window if [Frameless](#Frameless) has been activated. +This allows hiding the title bar but still having a border around the window. ## Mac Specific Options diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/options.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/options.mdx index 883952ec6..cb82bc1c0 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/options.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/options.mdx @@ -40,9 +40,10 @@ func main() { app, }, Windows: &windows.Options{ - WebviewIsTransparent: false, - WindowIsTranslucent: false, - DisableWindowIcon: false, + WebviewIsTransparent: false, + WindowIsTranslucent: false, + DisableWindowIcon: false, + EnableFramelessBorder: false, }, Mac: &mac.Options{ TitleBar: &mac.TitleBar{