diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-04-20 01:17:42 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-04-20 02:19:47 +0300 |
commit | 6c26911c3df6b02a0ee19899e71207f372b718b3 (patch) | |
tree | d33d30f221af3de6eff6abebbf46afb2aea660e9 /source/blender/windowmanager/intern | |
parent | 1873ea337c24e7a169c306a7467ce899a53eb0f8 (diff) |
Fix T51248: user preferences window size not adapted to DPI.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 17 |
2 files changed, 19 insertions, 6 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index d827ccafda8..d3ebd3e4d2c 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1799,13 +1799,13 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar if (version_suffix != NULL && version_suffix[0]) { /* placed after the version number in the image, * placing y is tricky to match baseline */ - int x = 260 - (2 * UI_DPI_WINDOW_FAC); - int y = 242 + (4 * UI_DPI_WINDOW_FAC); - int w = 240; + int x = 260 * U.pixelsize - (2 * UI_DPI_FAC); + int y = 242 * U.pixelsize + (4 * UI_DPI_FAC); + int w = 240 * U.pixelsize; /* hack to have text draw 'text_sel' */ UI_block_emboss_set(block, UI_EMBOSS_NONE); - but = uiDefBut(block, UI_BTYPE_LABEL, 0, version_suffix, x * U.pixelsize, y * U.pixelsize, w * U.pixelsize, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + but = uiDefBut(block, UI_BTYPE_LABEL, 0, version_suffix, x, y, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); /* XXX, set internal flag - UI_SELECT */ UI_but_flag_enable(but, 1); UI_block_emboss_set(block, UI_EMBOSS); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index aaf77946412..de169881bc4 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -642,14 +642,27 @@ wmWindow *WM_window_open(bContext *C, const rcti *rect) * \param type: WM_WINDOW_RENDER, WM_WINDOW_USERPREFS... * \return the window or NULL. */ -wmWindow *WM_window_open_temp(bContext *C, const rcti *rect_init, int type) +wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, int type) { wmWindow *win_prev = CTX_wm_window(C); wmWindow *win; ScrArea *sa; Scene *scene = CTX_data_scene(C); const char *title; - rcti rect = *rect_init; + + /* convert to native OS window coordinates */ + const float native_pixel_size = GHOST_GetNativePixelSize(win_prev->ghostwin); + x /= native_pixel_size; + y /= native_pixel_size; + sizex /= native_pixel_size; + sizey /= native_pixel_size; + + /* calculate postition */ + rcti rect; + rect.xmin = x + win_prev->posx - sizex / 2; + rect.ymin = y + win_prev->posy - sizey / 2; + rect.xmax = rect.xmin + sizex; + rect.ymax = rect.ymin + sizey; /* changes rect to fit within desktop */ wm_window_check_position(&rect); |