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 size to fit within this monitor. */ | ||||
| AdjustWindowRectEx(&win_rect, WS_CAPTION, FALSE, 0); | |||||
| width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect.right - win_rect.left); | 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); | |||||
| height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect.bottom - win_rect.top); | height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect.bottom - win_rect.top); | ||||
| top = min(max(monitor.rcWork.top, win_rect.top), monitor.rcWork.bottom - height); | |||||
nicholas_rishel: Did you rule out monitor.rcWork being the issue here? I haven't dived into it but the symptoms… | |||||
| win_rect.left = min(max(monitor.rcWork.left, win_rect.left), monitor.rcWork.right - width); | |||||
Not Done Inline ActionsIntersecting 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. nicholas_rishel: Intersecting with the monitor rect will be subtly different from clamping the origin and… | |||||
| m_hWnd = ::CreateWindowExW(extended_style, // window extended style | win_rect.right = win_rect.left + width; | ||||
| s_windowClassName, // pointer to registered class name | win_rect.top = min(max(monitor.rcWork.top, win_rect.top), monitor.rcWork.bottom - height); | ||||
| title_16, // pointer to window name | win_rect.bottom = win_rect.top + height; | ||||
| style, // window style | |||||
| left, // horizontal position of window | /* Adjust our requested values to allow for caption, borders, shadows, etc. | ||||
| top, // vertical position of window | Windows API Note: You cannot specify WS_OVERLAPPED when calling. */ | ||||
| width, // window width | AdjustWindowRectEx(&win_rect, style & ~WS_OVERLAPPED, FALSE, extended_style); | ||||
| height, // window height | |||||
| m_parentWindowHwnd, // handle to parent or owner window | m_hWnd = ::CreateWindowExW(extended_style, // window extended style | ||||
| s_windowClassName, // pointer to registered class name | |||||
| title_16, // pointer to window name | |||||
| style, // window style | |||||
| win_rect.left, // horizontal position of window | |||||
| win_rect.top, // vertical position of window | |||||
| win_rect.right - win_rect.left, // window width | |||||
| win_rect.bottom - win_rect.top, // window height | |||||
| 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 | |||||
Did 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.