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>2014-02-10 21:23:44 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-10 21:23:44 +0400
commitc046cb80ed06e349fd38cdf02c72dd50cd97c325 (patch)
tree60f9124ecedfcfd2af9ae666a8f99c4b6bfd9150
parentd2b5f0f6c26b7c5568203b4427537fe9ab80055c (diff)
UI: allow clicking to close menus and popups (but not submenus).
-rw-r--r--source/blender/editors/interface/interface_handlers.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 2f47b70e644..c6b0782309e 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8065,12 +8065,22 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH
/* here we check return conditions for menus */
if (block->flag & UI_BLOCK_LOOP) {
/* if we click outside the block, verify if we clicked on the
- * button that opened us, otherwise we need to close */
+ * button that opened us, otherwise we need to close,
+ *
+ * note that there is an exception for root level menus and
+ * popups which you can click again to close.
+ */
if (inside == 0) {
uiSafetyRct *saferct = block->saferct.first;
- if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val == KM_PRESS) {
- if (saferct && !BLI_rctf_isect_pt(&saferct->parent, event->x, event->y)) {
+ if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) &&
+ ELEM(event->val, KM_PRESS, KM_DBL_CLICK))
+ {
+ if ((level == 0) && (U.uiflag & USER_MENUOPENAUTO) == 0) {
+ /* for root menus, allow clicking to close */
+ menu->menuretval = UI_RETURN_OUT;
+ }
+ else if (saferct && !BLI_rctf_isect_pt(&saferct->parent, event->x, event->y)) {
if (block->flag & (UI_BLOCK_OUT_1))
menu->menuretval = UI_RETURN_OK;
else