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 <mjuffermans@paradigmone.com.au>
This commit is contained in:
Marcel Juffermans
2025-04-23 10:12:10 +10:00
committed by Elias Naur
parent cc6048bc25
commit 35ec76e516
+3 -1
View File
@@ -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)
}