Persist current window geometry to settings. Used both on real exit and before hiding to tray, so that on the next launch the window restores to the user's last visible position even if exit happens while tray-hidden.
| 250 | // before hiding to tray, so that on the next launch the window restores to |
| 251 | // the user's last visible position even if exit happens while tray-hidden. |
| 252 | static void SaveCurrentGeometry(Win32UiShell::Impl* p, ManagerService& mgr) { |
| 253 | if (!p->hwnd) return; |
| 254 | if (!IsWindowVisible(p->hwnd)) return; // would read 0,0 / hidden coords |
| 255 | RECT wr; |
| 256 | GetWindowRect(p->hwnd, &wr); |
| 257 | auto& geo = mgr.app_settings().window; |
| 258 | geo.x = wr.left; |
| 259 | geo.y = wr.top; |
| 260 | geo.width = wr.right - wr.left; |
| 261 | geo.height = wr.bottom - wr.top; |
| 262 | mgr.SaveAppSettings(); |
| 263 | } |
| 264 | |
| 265 | static void ShowMainWindow(Win32UiShell::Impl* p) { |
| 266 | if (!p->hwnd) return; |
no test coverage detected