| 272 | } |
| 273 | |
| 274 | UserSettings::WindowState WindowController::snapshot() { |
| 275 | UserSettings::WindowState state{}; |
| 276 | state.fullscreen = isFullscreen; |
| 277 | state.maximized = windowedWasMaximized; |
| 278 | state.monitorIndex = isFullscreen ? windowedMonitorIndex : monitorIndex(currentMonitor()); |
| 279 | state.x = windowedX; |
| 280 | state.y = windowedY; |
| 281 | state.width = windowedWidth; |
| 282 | state.height = windowedHeight; |
| 283 | |
| 284 | if (!state.fullscreen && window) { |
| 285 | syncWindowedStateFromWindow(); |
| 286 | state.maximized = glfwGetWindowAttrib(window, GLFW_MAXIMIZED) == GLFW_TRUE; |
| 287 | state.monitorIndex = monitorIndex(currentMonitor()); |
| 288 | if (state.maximized) { |
| 289 | GLFWmonitor* monitor = monitorByIndex(state.monitorIndex); |
| 290 | if (!monitorWorkArea(monitor, state.x, state.y, state.width, state.height)) { |
| 291 | glfwGetWindowPos(window, &state.x, &state.y); |
| 292 | glfwGetWindowSize(window, &state.width, &state.height); |
| 293 | } |
| 294 | } |
| 295 | else { |
| 296 | glfwGetWindowPos(window, &state.x, &state.y); |
| 297 | glfwGetWindowSize(window, &state.width, &state.height); |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | return state; |
| 302 | } |
nothing calls this directly
no test coverage detected