Fix T59946: multiple quit dialogs possible.
Differential Revision: https://developer.blender.org/D4147
This commit is contained in:
parent
f2ebb7bb79
commit
e571f0255f
Notes:
blender-bot
2023-02-14 05:59:31 +01:00
Referenced by issue #59946, Multiple quit dialogs possible
|
@ -493,6 +493,8 @@ void UI_popup_block_ex(struct bContext *C, uiBlockCreateFunc func, uiBlockHandle
|
|||
|
||||
void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block);
|
||||
|
||||
bool UI_popup_block_name_exists(struct bContext *C, const char *name);
|
||||
|
||||
/* Blocks
|
||||
*
|
||||
* Functions for creating, drawing and freeing blocks. A Block is a
|
||||
|
|
|
@ -648,4 +648,20 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
|
|||
}
|
||||
}
|
||||
|
||||
bool UI_popup_block_name_exists(bContext *C, const char *name)
|
||||
{
|
||||
bScreen *sc = CTX_wm_screen(C);
|
||||
uiBlock *block;
|
||||
ARegion *ar;
|
||||
|
||||
for (ar = sc->regionbase.first; ar; ar = ar->next) {
|
||||
for (block = ar->uiblocks.first; block; block = block->next) {
|
||||
if (STREQ(block->name, name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -444,7 +444,9 @@ static void wm_confirm_quit(bContext *C)
|
|||
wmWindow *win = CTX_wm_window(C);
|
||||
|
||||
if (GHOST_SupportsNativeDialogs() == 0) {
|
||||
UI_popup_block_invoke(C, block_create_confirm_quit, NULL);
|
||||
if (!UI_popup_block_name_exists(C, "confirm_quit_popup")) {
|
||||
UI_popup_block_invoke(C, block_create_confirm_quit, NULL);
|
||||
}
|
||||
}
|
||||
else if (GHOST_confirmQuit(win->ghostwin)) {
|
||||
wm_exit_schedule_delayed(C);
|
||||
|
|
Loading…
Reference in New Issue