diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-18 01:12:21 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-18 11:31:10 +0300 |
commit | 14f00e11fe4289c7ce16810faa7c5806869cd988 (patch) | |
tree | 0973cf788112a2648fad7c0512d386f572842dcd /source | |
parent | 47189985781ec9dfc4c9899bc2c08482fddc8ef3 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_playanim.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 21 |
2 files changed, 20 insertions, 3 deletions
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); |