From 427e41f1907543efebc24cefbc1c3b6ce6179fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Z=C3=A1mb=C3=B3=2C=20Levente?= Date: Sun, 27 Aug 2023 23:40:28 +0100 Subject: [PATCH] fix disable window resize (#2863) * fix disable window resize * change issue number in changelog * change pull request number in changelog --- v2/internal/frontend/desktop/linux/window.go | 6 +++++- website/src/pages/changelog.mdx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/v2/internal/frontend/desktop/linux/window.go b/v2/internal/frontend/desktop/linux/window.go index 07237453..d4329513 100644 --- a/v2/internal/frontend/desktop/linux/window.go +++ b/v2/internal/frontend/desktop/linux/window.go @@ -110,7 +110,7 @@ func NewWindow(appoptions *options.App, debug bool, devtools bool) *Window { // Setup window result.SetKeepAbove(appoptions.AlwaysOnTop) result.SetResizable(!appoptions.DisableResize) - result.SetSize(appoptions.Width, appoptions.Height) + result.SetDefaultSize(appoptions.Width, appoptions.Height) result.SetDecorated(!appoptions.Frameless) result.SetTitle(appoptions.Title) result.SetMinSize(appoptions.MinWidth, appoptions.MinHeight) @@ -315,6 +315,10 @@ func (w *Window) SetResizable(resizable bool) { C.gtk_window_set_resizable(w.asGTKWindow(), gtkBool(resizable)) } +func (w *Window) SetDefaultSize(width int, height int) { + C.gtk_window_set_default_size(w.asGTKWindow(), C.int(width), C.int(height)) +} + func (w *Window) SetSize(width int, height int) { C.gtk_window_resize(w.asGTKWindow(), C.gint(width), C.gint(height)) } diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 3d3582e3..5b5ed788 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -24,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix issue where app would exit before main() on linux if $DISPLAY env var was not set. Fixed by @phildrip in [PR](https://github.com/wailsapp/wails/pull/2841) - Fixed a race condition when positioning the window on Linux. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2850) - Fixed `SetBackgroundColour` so it sets the window's background color to reduce resize flickering on Linux. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2853) - +- Fixed disable window resize option and wrong initial window size when its enabled. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2863) ### Added