Use MONITOR_DEFAULTTONEAREST so we can restore properly from minimized (#5213)
## Summary of the Pull Request When we're restoring from minimized, that `MonitorFromWindow` call is returning null. Curious that we're getting null here, when [MSDN states](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-monitorfromwindow): > If the window is currently minimized, MonitorFromWindow uses the rectangle of the window before it was minimized. Turns out, `MONITOR_DEFAULTTONEAREST` just fixes this. ## References * #4857 - original PR that added this code block ## PR Checklist * [x] Closes #5209 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed Verified manually
This commit is contained in:
parent
713550d56c
commit
584e4498ee
|
@ -366,7 +366,9 @@ int NonClientIslandWindow::_GetResizeHandleHeight() const noexcept
|
|||
// GH#1438 - Attempt to detect if there's an autohide taskbar, and if there
|
||||
// is, reduce our size a bit on the side with the taskbar, so the user can
|
||||
// still mouse-over the taskbar to reveal it.
|
||||
HMONITOR hMon = MonitorFromWindow(_window.get(), MONITOR_DEFAULTTONULL);
|
||||
// GH#5209 - make sure to use MONITOR_DEFAULTTONEAREST, so that this will
|
||||
// still find the right monitor even when we're restoring from minimized.
|
||||
HMONITOR hMon = MonitorFromWindow(_window.get(), MONITOR_DEFAULTTONEAREST);
|
||||
if (hMon && (_isMaximized || _fullscreen))
|
||||
{
|
||||
MONITORINFO monInfo{ 0 };
|
||||
|
|
Loading…
Reference in a new issue