From 35ec76e516f6751a07639104d875a5bb5b7b334e Mon Sep 17 00:00:00 2001 From: Marcel Juffermans Date: Wed, 23 Apr 2025 10:12:10 +1000 Subject: [PATCH] app: [Windows] correctly center window on startup When the window is created position it *before* processing the actions to perform (which may include system.ActionCenter). Note that the actions are performed in the callback windowProc(). Fixes: https://todo.sr.ht/~eliasnaur/gio/646 Signed-off-by: Marcel Juffermans --- app/os_windows.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/os_windows.go b/app/os_windows.go index e99b829a..239c7443 100644 --- a/app/os_windows.go +++ b/app/os_windows.go @@ -760,8 +760,10 @@ func (w *window) Configure(options []Option) { } } - windows.SetWindowLong(w.hwnd, windows.GWL_STYLE, style) + // Note: these invocation all trigger the windows callback method which may process a pending system.ActionCenter + // action, so SetWindowPos should come first so as to not "overwrite" system.ActionCenter. windows.SetWindowPos(w.hwnd, 0, x, y, width, height, swpStyle) + windows.SetWindowLong(w.hwnd, windows.GWL_STYLE, style) windows.ShowWindow(w.hwnd, showMode) }