UI: don't allow disabled popovers to open w/ drag
authorCampbell Barton <ideasman42@gmail.com>
Wed, 2 May 2018 10:02:50 +0000 (12:02 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 2 May 2018 10:02:50 +0000 (12:02 +0200)
First dragging over active menu items could be used to open a disabled
popover.

source/blender/editors/interface/interface_handlers.c

index 622c76079c0ee3f4c45db22df37abdd9f3d9c59f..e0ee966cb34a136aaae39d20b8a5c6f523e9e99a 100644 (file)
@@ -10008,8 +10008,10 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
                {
                        /* if mouse moves to a different root-level menu button,
                         * open it to replace the current menu */
-                       ui_handle_button_activate(C, ar, but_other, BUTTON_ACTIVATE_OVER);
-                       button_activate_state(C, but_other, BUTTON_STATE_MENU_OPEN);
+                       if ((but_other->flag & UI_BUT_DISABLED) == 0) {
+                               ui_handle_button_activate(C, ar, but_other, BUTTON_ACTIVATE_OVER);
+                               button_activate_state(C, but_other, BUTTON_STATE_MENU_OPEN);
+                       }
                }
                else if (data->state == BUTTON_STATE_MENU_OPEN) {
                        int retval;