@@ -133,18 +133,14 @@ void LoadWindowSettings()
133133 DWORD size = sizeof (x);
134134 if (RegQueryValueExW (hKey, WINDOW_X_VALUE, nullptr , nullptr , reinterpret_cast <LPBYTE>(&x), &size) == ERROR_SUCCESS)
135135 {
136- // Cast DWORD to int - on Windows, this preserves negative coordinates correctly
137136 g_state.windowX = static_cast <int >(x);
138137 }
139-
140138 DWORD y = 0 ;
141139 size = sizeof (y);
142140 if (RegQueryValueExW (hKey, WINDOW_Y_VALUE, nullptr , nullptr , reinterpret_cast <LPBYTE>(&y), &size) == ERROR_SUCCESS)
143141 {
144- // Cast DWORD to int - on Windows, this preserves negative coordinates correctly
145142 g_state.windowY = static_cast <int >(y);
146143 }
147-
148144 DWORD width = 0 ;
149145 size = sizeof (width);
150146 if (RegQueryValueExW (hKey, WINDOW_WIDTH_VALUE, nullptr , nullptr , reinterpret_cast <LPBYTE>(&width), &size) == ERROR_SUCCESS)
@@ -154,7 +150,6 @@ void LoadWindowSettings()
154150 g_state.windowWidth = static_cast <int >(width);
155151 }
156152 }
157-
158153 DWORD height = 0 ;
159154 size = sizeof (height);
160155 if (RegQueryValueExW (hKey, WINDOW_HEIGHT_VALUE, nullptr , nullptr , reinterpret_cast <LPBYTE>(&height), &size) == ERROR_SUCCESS)
@@ -167,13 +162,10 @@ void LoadWindowSettings()
167162
168163 RegCloseKey (hKey);
169164 }
170-
171- // Validate that the window position is visible on at least one monitor
172165 RECT rc = {g_state.windowX , g_state.windowY , g_state.windowX + g_state.windowWidth , g_state.windowY + g_state.windowHeight };
173166 HMONITOR hMonitor = MonitorFromRect (&rc, MONITOR_DEFAULTTONULL);
174167 if (!hMonitor)
175168 {
176- // Window would be off-screen, reset to default
177169 g_state.windowX = CW_USEDEFAULT;
178170 g_state.windowY = CW_USEDEFAULT;
179171 }
@@ -184,7 +176,6 @@ void SaveWindowSettings()
184176 HKEY hKey;
185177 if (RegCreateKeyExW (HKEY_CURRENT_USER, SETTINGS_KEY, 0 , nullptr , 0 , KEY_WRITE, nullptr , &hKey, nullptr ) == ERROR_SUCCESS)
186178 {
187- // Store coordinates as REG_DWORD - static_cast preserves bit pattern for negative values
188179 DWORD x = static_cast <DWORD>(g_state.windowX );
189180 RegSetValueExW (hKey, WINDOW_X_VALUE, 0 , REG_DWORD,
190181 reinterpret_cast <const BYTE *>(&x),
0 commit comments