summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/windows/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/windows/window.cpp')
-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,