From 14f00e11fe4289c7ce16810faa7c5806869cd988 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 18 May 2019 00:12:21 +0200 Subject: macOS: always use the Blender quit dialog, like other platforms The same was done for Windows, but some extra changes were needed to make it work on macOS. This is required because the Blender quit dialog now contains additional settings for image saving. --- source/blender/windowmanager/intern/wm_playanim.c | 2 +- source/blender/windowmanager/intern/wm_window.c | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index 844316bc925..7cc44bcad99 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -1063,7 +1063,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) break; } - case GHOST_kEventQuit: + case GHOST_kEventQuitRequest: case GHOST_kEventWindowClose: { ps->go = false; break; diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index c7168673f26..1ac23754972 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1117,8 +1117,25 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr GHOST_TEventType type = GHOST_GetEventType(evt); int time = GHOST_GetEventTime(evt); - if (type == GHOST_kEventQuit) { - WM_exit(C); + if (type == GHOST_kEventQuitRequest) { + /* Find an active window to display quit dialog in. */ + GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt); + wmWindow *win; + + if (ghostwin && GHOST_ValidWindow(g_system, ghostwin)) { + win = GHOST_GetWindowUserData(ghostwin); + } + else { + win = wm->winactive; + } + + /* Display quit dialog or quit immediately. */ + if (win) { + wm_quit_with_optional_confirmation_prompt(C, win); + } + else { + wm_exit_schedule_delayed(C); + } } else { GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt); -- cgit v1.2.3