Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_WindowWin32.cpp
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* Monitor details. */ | /* Monitor details. */ | ||||
| MONITORINFOEX monitor; | MONITORINFOEX monitor; | ||||
| monitor.cbSize = sizeof(MONITORINFOEX); | monitor.cbSize = sizeof(MONITORINFOEX); | ||||
| monitor.dwFlags = 0; | monitor.dwFlags = 0; | ||||
| GetMonitorInfo(MonitorFromRect(&win_rect, MONITOR_DEFAULTTONEAREST), &monitor); | GetMonitorInfo(MonitorFromRect(&win_rect, MONITOR_DEFAULTTONEAREST), &monitor); | ||||
| /* Adjust our requested size to allow for caption and borders and constrain to monitor. */ | /* Constrain our requested values to fit within this monitor. */ | ||||
| AdjustWindowRectEx(&win_rect, WS_CAPTION, FALSE, 0); | IntersectRect(&win_rect, &win_rect, &monitor.rcWork); | ||||
nicholas_rishel: Intersecting with the monitor rect will be subtly different from clamping the origin and… | |||||
| width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect.right - win_rect.left); | |||||
| left = min(max(monitor.rcWork.left, win_rect.left), monitor.rcWork.right - width); | /* Adjust our requested values to allow for caption, borders, shadows, etc. | ||||
| height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect.bottom - win_rect.top); | Windows API Note: You cannot specify WS_OVERLAPPED when calling. */ | ||||
| top = min(max(monitor.rcWork.top, win_rect.top), monitor.rcWork.bottom - height); | AdjustWindowRectEx(&win_rect, style & ~WS_OVERLAPPED, FALSE, extended_style); | ||||
nicholas_rishelUnsubmitted Not Done Inline ActionsDid you rule out monitor.rcWork being the issue here? I haven't dived into it but the symptoms are in line with what would happen if monitor.rcMonitor was the intended clip space. nicholas_rishel: Did you rule out monitor.rcWork being the issue here? I haven't dived into it but the symptoms… | |||||
| m_hWnd = ::CreateWindowExW(extended_style, // window extended style | m_hWnd = ::CreateWindowExW(extended_style, // window extended style | ||||
| s_windowClassName, // pointer to registered class name | s_windowClassName, // pointer to registered class name | ||||
| title_16, // pointer to window name | title_16, // pointer to window name | ||||
| style, // window style | style, // window style | ||||
| left, // horizontal position of window | win_rect.left, // horizontal position of window | ||||
| top, // vertical position of window | win_rect.top, // vertical position of window | ||||
| width, // window width | win_rect.right - win_rect.left, // window width | ||||
| height, // window height | win_rect.bottom - win_rect.top, // window height | ||||
| m_parentWindowHwnd, // handle to parent or owner window | m_parentWindowHwnd, // handle to parent or owner window | ||||
| 0, // handle to menu or child-window identifier | 0, // handle to menu or child-window identifier | ||||
| ::GetModuleHandle(0), // handle to application instance | ::GetModuleHandle(0), // handle to application instance | ||||
| 0); // pointer to window-creation data | 0); // pointer to window-creation data | ||||
| free(title_16); | free(title_16); | ||||
| m_user32 = ::LoadLibrary("user32.dll"); | m_user32 = ::LoadLibrary("user32.dll"); | ||||
| if (m_hWnd) { | if (m_hWnd) { | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||
Intersecting with the monitor rect will be subtly different from clamping the origin and width/height; a change in origin now changes the clipped width/height. I'm not sure which behavior is preferable but I'd call this change in behavior out in the commit message if kept.