diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index de169881bc4..8afeb8e7b3d 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -375,7 +375,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) } } -static void wm_window_set_dpi(wmWindow *win) +void WM_window_set_dpi(wmWindow *win) { int auto_dpi = GHOST_GetDPIHint(win->ghostwin); @@ -406,8 +406,10 @@ static void wm_window_set_dpi(wmWindow *win) U.pixelsize = GHOST_GetNativePixelSize(win->ghostwin) * pixelsize; U.dpi = dpi / pixelsize; U.virtual_pixel = (pixelsize == 1) ? VIRTUAL_PIXEL_NATIVE : VIRTUAL_PIXEL_DOUBLE; + U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72; - BKE_blender_userdef_refresh(); + /* update font drawing */ + BLF_default_dpi(U.pixelsize * U.dpi); } /* belongs to below */ @@ -483,7 +485,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm } /* needed here, because it's used before it reads userdef */ - wm_window_set_dpi(win); + WM_window_set_dpi(win); wm_window_swap_buffers(win); @@ -870,7 +872,7 @@ void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win) GHOST_ActivateWindowDrawingContext(win->ghostwin); /* this can change per window */ - wm_window_set_dpi(win); + WM_window_set_dpi(win); } } @@ -1070,7 +1072,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr WM_jobs_stop(wm, win->screen, NULL); } - wm_window_set_dpi(win); + WM_window_set_dpi(win); /* win32: gives undefined window size when minimized */ if (state != GHOST_kWindowStateMinimized) { @@ -1157,11 +1159,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr case GHOST_kEventWindowDPIHintChanged: { - wm_window_set_dpi(win); + WM_window_set_dpi(win); /* font's are stored at each DPI level, without this we can easy load 100's of fonts */ BLF_cache_clear(); - BKE_blender_userdef_refresh(); WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */ break; @@ -1247,7 +1248,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr { // only update if the actual pixel size changes float prev_pixelsize = U.pixelsize; - wm_window_set_dpi(win); + WM_window_set_dpi(win); if (U.pixelsize != prev_pixelsize) { // close all popups since they are positioned with the pixel |