[Bf-blender-cvs] [dc170a6d678] master: Fix: popout windows are sized incorrectly on high DPI screens
Jesse Y
noreply at git.blender.org
Wed Jan 13 12:13:05 CET 2021
Commit: dc170a6d67826ee4201384f90065141ef4fae96e
Author: Jesse Y
Date: Tue Jan 12 12:00:58 2021 +0100
Branches: master
https://developer.blender.org/rBdc170a6d67826ee4201384f90065141ef4fae96e
Fix: popout windows are sized incorrectly on high DPI screens
There should be a conversion to native pixel size as expected by GHOST at the
window manager level, the dimensions at screen level do not need a conversion.
Differential Revision: https://developer.blender.org/D9976
===================================================================
M source/blender/editors/screen/screen_ops.c
M source/blender/windowmanager/intern/wm_window.c
===================================================================
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index bdb2ffb8610..ca1c75be0a1 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1354,8 +1354,8 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* adds window to WM */
rcti rect = area->totrct;
BLI_rcti_translate(&rect, win->posx, win->posy);
- rect.xmax = rect.xmin + BLI_rcti_size_x(&rect) / U.pixelsize;
- rect.ymax = rect.ymin + BLI_rcti_size_y(&rect) / U.pixelsize;
+ rect.xmax = rect.xmin + BLI_rcti_size_x(&rect);
+ rect.ymax = rect.ymin + BLI_rcti_size_y(&rect);
wmWindow *newwin = WM_window_open(C, &rect);
if (newwin == NULL) {
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 14798653a31..42fd214543f 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -801,10 +801,12 @@ wmWindow *WM_window_open(bContext *C, const rcti *rect)
wmWindow *win_prev = CTX_wm_window(C);
wmWindow *win = wm_window_new(CTX_data_main(C), wm, win_prev, false);
- win->posx = rect->xmin;
- win->posy = rect->ymin;
- win->sizex = BLI_rcti_size_x(rect);
- win->sizey = BLI_rcti_size_y(rect);
+ const float native_pixel_size = GHOST_GetNativePixelSize(win_prev->ghostwin);
+
+ win->posx = rect->xmin / native_pixel_size;
+ win->posy = rect->ymin / native_pixel_size;
+ win->sizex = BLI_rcti_size_x(rect) / native_pixel_size;
+ win->sizey = BLI_rcti_size_y(rect) / native_pixel_size;
WM_check(C);
More information about the Bf-blender-cvs
mailing list