From 7fab62158d2dc9b1ab149b19b0cf28be7e70391e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 1 Sep 2022 22:48:36 +0900 Subject: [PATCH] internal/glfwwin: bug fix: do not allow maximizing window when the max size is specified Closes #2289 --- internal/glfwwin/win32window_windows.go | 5 ++++- internal/glfwwin/window_windows.go | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/glfwwin/win32window_windows.go b/internal/glfwwin/win32window_windows.go index f6fe49519..9ff1015f3 100644 --- a/internal/glfwwin/win32window_windows.go +++ b/internal/glfwwin/win32window_windows.go @@ -28,7 +28,10 @@ func (w *Window) getWindowStyle() uint32 { if w.decorated { style |= _WS_CAPTION if w.resizable { - style |= _WS_MAXIMIZEBOX | _WS_THICKFRAME + style |= _WS_THICKFRAME + if w.maxwidth == DontCare && w.maxheight == DontCare { + style |= _WS_MAXIMIZEBOX + } } } else { style |= _WS_POPUP diff --git a/internal/glfwwin/window_windows.go b/internal/glfwwin/window_windows.go index 036e715f2..c0ab9b23a 100644 --- a/internal/glfwwin/window_windows.go +++ b/internal/glfwwin/window_windows.go @@ -420,6 +420,11 @@ func (w *Window) SetSizeLimits(minwidth, minheight, maxwidth, maxheight int) err if err := w.platformSetWindowSizeLimits(minwidth, minheight, maxwidth, maxheight); err != nil { return err } + + if err := w.updateWindowStyles(); err != nil { + return err + } + return nil }