Fix T47782: popups with wrong size when switching from retina to non-retina on OS X.

This commit is contained in:
Brecht Van Lommel 2016-08-04 01:05:27 +02:00
parent 7830ec5418
commit 42f6252f2d
Notes: blender-bot 2023-02-14 08:45:09 +01:00
Referenced by issue #47782, Crash on MacBook Pro 2015 Retina when start to render on 2nd non retina display
1 changed files with 11 additions and 0 deletions

View File

@ -69,6 +69,8 @@
#include "ED_screen.h"
#include "ED_fileselect.h"
#include "UI_interface.h"
#include "PIL_time.h"
#include "GPU_draw.h"
@ -1194,11 +1196,19 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
break;
}
case GHOST_kEventNativeResolutionChange:
{
// printf("change, pixel size %f\n", GHOST_GetNativePixelSize(win->ghostwin));
U.pixelsize = wm_window_pixelsize(win);
BKE_blender_userdef_refresh();
// close all popups since they are positioned with the pixel
// size baked in and it's difficult to correct them
wmWindow *oldWindow = CTX_wm_window(C);
CTX_wm_window_set(C, win);
UI_popup_handlers_remove_all(C, &win->modalhandlers);
CTX_wm_window_set(C, oldWindow);
wm_window_make_drawable(wm, win);
wm_draw_window_clear(win);
@ -1206,6 +1216,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
break;
}
case GHOST_kEventTrackpad:
{
GHOST_TEventTrackpadData *pd = data;