diff options
author | Jesse Y <deadpin> | 2021-01-12 14:00:58 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-01-13 14:12:36 +0300 |
commit | dc170a6d67826ee4201384f90065141ef4fae96e (patch) | |
tree | e223095778f2b584c487381658bd97a64e04e118 /source/blender | |
parent | 8964c02348f61c2ce8046c09478180ddfbd0f8e5 (diff) |
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
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 10 |
2 files changed, 8 insertions, 6 deletions
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); |