[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47251] branches/soc-2012-bratwurst/source /blender/editors/interface/interface_handlers.c: This is an experimental patch to remove the modality of menus and other popup regions .

Jorge Rodriguez bs.vino at gmail.com
Thu May 31 06:43:31 CEST 2012


Revision: 47251
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47251
Author:   vino
Date:     2012-05-31 04:43:25 +0000 (Thu, 31 May 2012)
Log Message:
-----------
This is an experimental patch to remove the modality of menus and other popup regions. It also activates and presses any button under the mouse cursor even though a menu is up. One effect of this is that the user can open one menu and then click to open a second without closing the first.

Modified Paths:
--------------
    branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c

Modified: branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c	2012-05-31 03:57:52 UTC (rev 47250)
+++ branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c	2012-05-31 04:43:25 UTC (rev 47251)
@@ -5522,6 +5522,7 @@
 static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
 {
 	uiBut *but;
+	int retval = WM_UI_HANDLER_CONTINUE;
 
 	if (event->type == MOUSEMOVE) {
 		but = ui_but_find_mouse_over(ar, event->x, event->y);
@@ -5535,8 +5536,17 @@
 			ui_do_button(C, but->block, but, event);
 		}
 	}
+	else if (event->type == LEFTMOUSE) {
+		but = ui_but_find_mouse_over(ar, event->x, event->y);
+		/* If the user clicked a button, quickly activate it and then run its ui stuff */
+		if (but)
+		{
+			button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
+			retval = ui_do_button(C, but->block, but, event);
+		}
+	}
 
-	return WM_UI_HANDLER_CONTINUE;
+	return retval;
 }
 
 /* exported to interface.c: uiButActiveOnly() */
@@ -6497,7 +6507,7 @@
 	ARegion *ar;
 	uiBut *but;
 	uiHandleButtonData *data;
-	int retval;
+	int retval = WM_UI_HANDLER_CONTINUE;
 
 	/* here we handle buttons at the window level, modal, for example
 	 * while number sliding, text editing, or when a menu block is open */
@@ -6537,8 +6547,7 @@
 	/* delayed apply callbacks */
 	ui_apply_but_funcs_after(C);
 
-	/* we block all events, this is modal interaction */
-	return WM_UI_HANDLER_BREAK;
+	return retval;
 }
 
 /* two types of popups, one with operator + enum, other with regular callbacks */




More information about the Bf-blender-cvs mailing list