diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2021-02-23 00:47:21 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2021-02-23 00:47:21 +0300 |
commit | d447bd3e4a9a793364b5f4951ad280fe0293d79e (patch) | |
tree | c93faeeb70a800950a3fd34e23c481672df572b4 /source | |
parent | beb1f1b8053a0ace883506b2442381c616acaa98 (diff) |
Fix T85638: Child Window Positioning on Multiple Monitors
Constraint of new window position can be incorrect when using multiple monitors.
Differential Revision: https://developer.blender.org/D10469
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 733a9b74f2c..ada4093080c 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -158,37 +158,16 @@ void wm_get_desktopsize(int *r_width, int *r_height) *r_height = uiheight; } -/* keeps offset and size within monitor bounds */ -/* XXX solve dual screen... */ -static void wm_window_check_position(rcti *rect) +/* keeps size within monitor bounds */ +static void wm_window_check_size(rcti *rect) { int width, height; wm_get_screensize(&width, &height); - - if (rect->xmin < 0) { - rect->xmax -= rect->xmin; - rect->xmin = 0; - } - if (rect->ymin < 0) { - rect->ymax -= rect->ymin; - rect->ymin = 0; - } - if (rect->xmax > width) { - int d = rect->xmax - width; - rect->xmax -= d; - rect->xmin -= d; - } - if (rect->ymax > height) { - int d = rect->ymax - height; - rect->ymax -= d; - rect->ymin -= d; - } - - if (rect->xmin < 0) { - rect->xmin = 0; + if (BLI_rcti_size_x(rect) > width) { + BLI_rcti_resize_x(rect, width); } - if (rect->ymin < 0) { - rect->ymin = 0; + if (BLI_rcti_size_y(rect) > height) { + BLI_rcti_resize_y(rect, height); } } @@ -825,7 +804,7 @@ wmWindow *WM_window_open(bContext *C, rect.ymax = rect.ymin + sizey; /* changes rect to fit within desktop */ - wm_window_check_position(&rect); + wm_window_check_size(&rect); /* Reuse temporary windows when they share the same title. */ wmWindow *win = NULL; |