[Bf-blender-cvs] [d447bd3e4a9] master: Fix T85638: Child Window Positioning on Multiple Monitors

Harley Acheson noreply at git.blender.org
Mon Feb 22 22:48:15 CET 2021


Commit: d447bd3e4a9a793364b5f4951ad280fe0293d79e
Author: Harley Acheson
Date:   Mon Feb 22 13:47:21 2021 -0800
Branches: master
https://developer.blender.org/rBd447bd3e4a9a793364b5f4951ad280fe0293d79e

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

===================================================================

M	source/blender/windowmanager/intern/wm_window.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list