[Bf-blender-cvs] [8660a0c] master: UI: auto-open other menus by hovering over, once a menu is already open

Campbell Barton noreply at git.blender.org
Fri Jun 20 09:34:39 CEST 2014


Commit: 8660a0cab3e0f5b05a14b362e9a5174acf969c54
Author: Campbell Barton
Date:   Fri Jun 20 17:30:02 2014 +1000
https://developer.blender.org/rB8660a0cab3e0f5b05a14b362e9a5174acf969c54

UI: auto-open other menus by hovering over, once a menu is already open

D590 by Matthew Reid

===================================================================

M	source/blender/editors/interface/interface_handlers.c

===================================================================

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 229bc76..9189f14 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8370,12 +8370,24 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
 	but = ui_but_find_activated(ar);
 
 	if (but) {
+		uiBut *but_other;
 		uiHandleButtonData *data;
 
 		/* handle activated button events */
 		data = but->active;
 
-		if (data->state == BUTTON_STATE_MENU_OPEN) {
+		if ((data->state == BUTTON_STATE_MENU_OPEN) &&
+		    (but->type == PULLDOWN) &&
+		    (but_other = ui_but_find_mouse_over(ar, event)) &&
+		    (but != but_other) &&
+		    (but->type == but_other->type))
+		{
+			/* 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);
+		}
+		else if (data->state == BUTTON_STATE_MENU_OPEN) {
 			int retval;
 
 			/* handle events for menus and their buttons recursively,




More information about the Bf-blender-cvs mailing list