Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-05-19 11:22:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-19 11:25:52 +0300
commitd3c89f50a0167cb978daf3eda064bc7f36167de8 (patch)
treeac7931356704dc3cf3577011e30ab048deb0840a /source/blender/editors/interface/interface_region_popup.c
parent671797e22e1a5d2cb9f7df9d30012d8a38962ad2 (diff)
UI: Use popover for toolbar popup operator
- Currently the popup closes immediately, could be made configurable. - Support exiting popups when their submenu's are accessed.
Diffstat (limited to 'source/blender/editors/interface/interface_region_popup.c')
-rw-r--r--source/blender/editors/interface/interface_region_popup.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c
index db3c8742e09..654dc5e4d30 100644
--- a/source/blender/editors/interface/interface_region_popup.c
+++ b/source/blender/editors/interface/interface_region_popup.c
@@ -704,6 +704,21 @@ uiPopupBlockHandle *ui_popup_block_create(
void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
{
+ /* If this popup is created from a popover which does NOT have keep-open flag set,
+ * then close the popover too. We could extend this to other popup types too. */
+ ARegion *ar = handle->popup_create_vars.butregion;
+ if (ar != NULL) {
+ for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
+ if (block->handle &&
+ (block->flag & UI_BLOCK_POPOVER) &&
+ (block->flag & UI_BLOCK_KEEP_OPEN) == 0)
+ {
+ uiPopupBlockHandle *menu = block->handle;
+ menu->menuretval = UI_RETURN_OK;
+ }
+ }
+ }
+
if (handle->popup_create_vars.free_func) {
handle->popup_create_vars.free_func(handle, handle->popup_create_vars.arg);
}