[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52015] trunk/blender/source/blender/ editors/interface: Bugfix #29072 (Color pickers don' t close properly when moving the mouse away)

Ton Roosendaal ton at blender.org
Thu Nov 8 17:50:31 CET 2012


Revision: 52015
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52015
Author:   ton
Date:     2012-11-08 16:50:31 +0000 (Thu, 08 Nov 2012)
Log Message:
-----------
Bugfix #29072 (Color pickers don't close properly when moving the mouse away)

This rewinds the fix for revision 50483. 

- the removed code there (as comment said) closes menus on hoovering over another
  button in panels. Is unfinished feature to allow quick inspecting menus
  by mouse-hold going over menu popup buttons. 

- It added yet another check for closing menus - should be done with ->saferct

- The actual bug was simple; the block flag with UI_BLOCK_MOVEMOUSE_QUIT was
  accidentally cleared for colorpickers.

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50483

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_handlers.c
    trunk/blender/source/blender/editors/interface/interface_regions.c

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c	2012-11-08 16:35:28 UTC (rev 52014)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c	2012-11-08 16:50:31 UTC (rev 52015)
@@ -6050,38 +6050,22 @@
 		switch (event->type) {
 			case MOUSEMOVE:
 			{
-				/* if the mouse is over the button, do nothing */
-				if (ui_mouse_inside_button(data->region, but, event->x, event->y)) {
-					break;
-				}
+				uiBut *bt;
 
-				/* if the mouse is over the menu, also do nothing */
 				if (data->menu && data->menu->region) {
 					if (ui_mouse_inside_region(data->menu->region, event->x, event->y)) {
 						break;
 					}
-					else {
-						/* make a rectangle between the menu and the button that opened it,
-						 * this avoids any space between them exiting the popup. see [#29072] - campbell */
-						rctf rct_all = but->rect;
-						rctf rct_win;
+				}
 
-						ui_block_to_window_fl(ar, block, &rct_all.xmin, &rct_all.ymin);
-						ui_block_to_window_fl(ar, block, &rct_all.xmax, &rct_all.ymax);
-
-						BLI_rctf_rcti_copy(&rct_win, &data->menu->region->winrct);
-						BLI_rctf_union(&rct_all, &rct_win);
-
-						if (BLI_rctf_isect_pt(&rct_all, event->x, event->y)) {
-							break;
-						}
+				bt = ui_but_find_mouse_over(ar, event->x, event->y);
+				
+				if (bt && bt->active != data) {
+					if (but->type != COLOR) {  /* exception */
+						data->cancel = TRUE;
 					}
+					button_activate_state(C, but, BUTTON_STATE_EXIT);
 				}
-
-				if (but->type != COLOR) {  /* exception */
-					data->cancel = TRUE;
-				}
-				button_activate_state(C, but, BUTTON_STATE_EXIT);
 				break;
 			}
 		}

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2012-11-08 16:35:28 UTC (rev 52014)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2012-11-08 16:50:31 UTC (rev 52015)
@@ -2254,13 +2254,11 @@
 		show_picker = (but->block->flag & UI_BLOCK_POPUP) == 0;
 	}
 	
-	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
-	
 	copy_v3_v3(handle->retvec, but->editvec);
 	
 	uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop, show_picker);
 	
-	block->flag = UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1;
+	block->flag = UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1 | UI_BLOCK_MOVEMOUSE_QUIT;
 	uiBoundsBlock(block, 10);
 	
 	block->block_event_func = ui_picker_small_wheel_cb;




More information about the Bf-blender-cvs mailing list