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
This commit is contained in:
Jesse Y 2021-01-12 12:00:58 +01:00 committed by Brecht Van Lommel
parent 8964c02348
commit dc170a6d67
2 changed files with 8 additions and 6 deletions

View File

@ -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) {

View File

@ -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);