app: [Windows] hide the maximize button when MaxSize is set

Also, disable window frame resizing when MaxSize equals MinSize.

Fixes: https://todo.sr.ht/~eliasnaur/gio/631
Signed-off-by: vasijob225 <vasijob225@protonmail.com>
This commit is contained in:
vasijob225
2025-01-30 21:01:55 +01:00
committed by Elias Naur
parent a5068a1996
commit 95354d80bd
+10
View File
@@ -750,6 +750,16 @@ func (w *window) Configure(options []Option) {
swpStyle |= windows.SWP_NOMOVE | windows.SWP_NOSIZE
showMode = windows.SW_SHOWMAXIMIZED
}
// Disable maximize button if MaxSize is set.
if cnf.MaxSize != (image.Point{X: 0, Y: 0}) {
style &^= windows.WS_MAXIMIZEBOX
// Disable window resizing if MinSize and MaxSize are equal.
if cnf.MinSize == cnf.MaxSize {
style &^= windows.WS_THICKFRAME
}
}
windows.SetWindowLong(w.hwnd, windows.GWL_STYLE, style)
windows.SetWindowPos(w.hwnd, 0, x, y, width, height, swpStyle)
windows.ShowWindow(w.hwnd, showMode)