[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47301] branches/soc-2012-bratwurst/source /blender: Fix for using the scroll wheel on and around color pickers and menus, after the non-modal change.
Jorge Rodriguez
bs.vino at gmail.com
Thu May 31 23:45:47 CEST 2012
Revision: 47301
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47301
Author: vino
Date: 2012-05-31 21:45:46 +0000 (Thu, 31 May 2012)
Log Message:
-----------
Fix for using the scroll wheel on and around color pickers and menus, after the non-modal change. Hovering the mouse over the color picker/menu will scroll in the picker/menu, and hovering the mouse elsewhere will scroll whatever's underneath. Relies on r47251
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47251
Modified Paths:
--------------
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c
branches/soc-2012-bratwurst/source/blender/windowmanager/intern/wm_event_system.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 21:25:52 UTC (rev 47300)
+++ branches/soc-2012-bratwurst/source/blender/editors/interface/interface_handlers.c 2012-05-31 21:45:46 UTC (rev 47301)
@@ -6045,6 +6045,12 @@
ui_menu_scroll(ar, block, my);
}
else {
+ // For these types to be called the mouse must be inside the block event.
+ int mousewheels = event->type == WHEELUPMOUSE || event->type == WHEELDOWNMOUSE;
+ int callblockevent = TRUE;
+ if (!inside && mousewheels)
+ callblockevent = FALSE;
+
/* for ui_mouse_motion_towards_block */
if (event->type == MOUSEMOVE) {
ui_mouse_motion_towards_init(menu, mx, my, 0);
@@ -6056,8 +6062,11 @@
WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, MENU_SCROLL_INTERVAL);
}
- /* first block own event func */
- if (block->block_event_func && block->block_event_func(C, block, event)) ;
+ /* If we shouldn't call the block event function, it's because we're running mouse wheels outside the block,
+ * so don't run other stuff either. We don't want it to cycle buttons in this case. */
+ if (!callblockevent);
+ /* run the block event func */
+ else if (block->block_event_func && block->block_event_func(C, block, event)) ;
/* events not for active search menu button */
else if (but == NULL || but->type != SEARCH_MENU) {
switch (event->type) {
@@ -6359,7 +6368,7 @@
/* if we set a menu return value, ensure we continue passing this on to
* lower menus and buttons, so always set continue then, and if we are
* inside the region otherwise, ensure we swallow the event */
- if (menu->menuretval)
+ if (menu->menuretval != UI_RETURN_UPDATE)
return WM_UI_HANDLER_CONTINUE;
else if (inside)
return WM_UI_HANDLER_BREAK;
@@ -6533,6 +6542,9 @@
else
ui_handle_button_event(C, event, but);
}
+ /* If the menu keeps the input but wants an update anyway... */
+ else if (retval == WM_UI_HANDLER_BREAK && data->menu->menuretval == UI_RETURN_UPDATE)
+ ui_handle_button_return_submenu(C, event, but);
}
else {
/* handle events for the activated button */
Modified: branches/soc-2012-bratwurst/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/windowmanager/intern/wm_event_system.c 2012-05-31 21:25:52 UTC (rev 47300)
+++ branches/soc-2012-bratwurst/source/blender/windowmanager/intern/wm_event_system.c 2012-05-31 21:45:46 UTC (rev 47301)
@@ -331,19 +331,8 @@
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
ARegion *menu = CTX_wm_menu(C);
- static int do_wheel_ui = TRUE;
- int is_wheel = ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE);
int retval;
- /* UI is quite aggressive with swallowing events, like scrollwheel */
- /* I realize this is not extremely nice code... when UI gets keymaps it can be maybe smarter */
- if (do_wheel_ui == FALSE) {
- if (is_wheel)
- return WM_HANDLER_CONTINUE;
- else if (wm_event_always_pass(event) == 0)
- do_wheel_ui = TRUE;
- }
-
/* we set context to where ui handler came from */
if (handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
if (handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
@@ -367,10 +356,6 @@
if (retval == WM_UI_HANDLER_BREAK)
return WM_HANDLER_BREAK;
- /* event not handled in UI, if wheel then we temporarily disable it */
- if (is_wheel)
- do_wheel_ui = FALSE;
-
return WM_HANDLER_CONTINUE;
}
More information about the Bf-blender-cvs
mailing list