summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/windows
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-09-12 22:45:06 +1000
committer Vas Crabb <vas@vastheman.com>2020-09-12 22:45:06 +1000
commitb1b3b92b4b7ba3e144e00fc62e234b293f646c4c (patch)
tree8e70cdbca8320d79ca9abad09418b699262604df /src/osd/windows
parent89ea3e1fd9b29b90b814c6e5e6a19c2c67d79707 (diff)
osd/windows: Don't restrict borderless full-screen windows to monitor work area (MT07745).
Diffstat (limited to 'src/osd/windows')
-rw-r--r--src/osd/windows/window.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp
index ac4349cf36b..6f8dc3671c9 100644
--- a/src/osd/windows/window.cpp
+++ b/src/osd/windows/window.cpp
@@ -1763,6 +1763,26 @@ void win_window_info::adjust_window_position_after_major_change()
// constrain the existing size to the aspect ratio
if (video_config.keepaspect)
newrect = constrain_to_aspect_ratio(newrect, WMSZ_BOTTOMRIGHT);
+
+ // restrict the window to one monitor and avoid toolbars if possible
+ HMONITOR const nearest_monitor = MonitorFromWindow(platform_window(), MONITOR_DEFAULTTONEAREST);
+ if (NULL != nearest_monitor)
+ {
+ MONITORINFO info;
+ std::memset(&info, 0, sizeof(info));
+ info.cbSize = sizeof(info);
+ if (GetMonitorInfo(nearest_monitor, &info))
+ {
+ if (newrect.right() > info.rcWork.right)
+ newrect = newrect.move_by(info.rcWork.right - newrect.right(), 0);
+ if (newrect.bottom() > info.rcWork.bottom)
+ newrect = newrect.move_by(0, info.rcWork.bottom - newrect.bottom());
+ if (newrect.left() < info.rcWork.left)
+ newrect = newrect.move_by(info.rcWork.left - newrect.left(), 0);
+ if (newrect.top() < info.rcWork.top)
+ newrect = newrect.move_by(0, info.rcWork.top - newrect.top());
+ }
+ }
}
else
{
@@ -1771,26 +1791,6 @@ void win_window_info::adjust_window_position_after_major_change()
newrect = monitor->position_size();
}
- // restrict the window to one monitor and avoid toolbars if possible
- HMONITOR const nearest_monitor = MonitorFromWindow(platform_window(), MONITOR_DEFAULTTONEAREST);
- if (NULL != nearest_monitor)
- {
- MONITORINFO info;
- std::memset(&info, 0, sizeof(info));
- info.cbSize = sizeof(info);
- if (GetMonitorInfo(nearest_monitor, &info))
- {
- if (newrect.right() > info.rcWork.right)
- newrect = newrect.move_by(info.rcWork.right - newrect.right(), 0);
- if (newrect.bottom() > info.rcWork.bottom)
- newrect = newrect.move_by(0, info.rcWork.bottom - newrect.bottom());
- if (newrect.left() < info.rcWork.left)
- newrect = newrect.move_by(info.rcWork.left - newrect.left(), 0);
- if (newrect.top() < info.rcWork.top)
- newrect = newrect.move_by(0, info.rcWork.top - newrect.top());
- }
- }
-
// adjust the position if different
if (RECT_to_osd_rect(oldrect) != newrect)
SetWindowPos(platform_window(), fullscreen() ? HWND_TOPMOST : HWND_TOP,