[Bf-blender-cvs] [18aaae1] master: Fix T44477: Overlapping tooltips in Outliner

Julian Eisel noreply at git.blender.org
Wed Apr 22 13:43:02 CEST 2015


Commit: 18aaae101afe7ae4c120d656e85bd078d0995ea7
Author: Julian Eisel
Date:   Wed Apr 22 13:41:26 2015 +0200
Branches: master
https://developer.blender.org/rB18aaae101afe7ae4c120d656e85bd078d0995ea7

Fix T44477: Overlapping tooltips in Outliner

Tooltips for buttons in the Outliner could overlap the Outliner's RMB
menu in some cases (and there's no way to get rid of the tooltip again).
This disables the button's tooltip before creating the menu (as we do it
for the normal RMB menu)

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/space_outliner/outliner_tools.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 4ca0be7..66b9468 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -675,6 +675,7 @@ void    UI_but_func_drawextra_set(
         void *arg1, void *arg2);
 
 void    UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN);
+void    UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but);
 
 bool UI_textbutton_activate_rna(const struct bContext *C, struct ARegion *ar,
                                 const void *rna_poin_data, const char *rna_prop_id);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 7d34754..57a26ce 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -332,7 +332,6 @@ static void button_activate_exit(bContext *C, uiBut *but, uiHandleButtonData *da
                                  const bool mousemove, const bool onfree);
 static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *userdata);
 static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type);
-static void button_timers_tooltip_remove(bContext *C, uiBut *but);
 
 #ifdef USE_DRAG_MULTINUM
 static void ui_multibut_restore(uiHandleButtonData *data, uiBlock *block);
@@ -5956,7 +5955,7 @@ static void menu_add_shortcut_cancel(struct bContext *C, void *arg1)
 static void popup_change_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
 {
 	uiBut *but = (uiBut *)arg1;
-	button_timers_tooltip_remove(C, but);
+	UI_but_tooltip_timer_remove(C, but);
 	UI_popup_block_invoke(C, menu_change_shortcut, but);
 }
 
@@ -5977,7 +5976,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
 static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
 {
 	uiBut *but = (uiBut *)arg1;
-	button_timers_tooltip_remove(C, but);
+	UI_but_tooltip_timer_remove(C, but);
 	UI_popup_block_ex(C, menu_add_shortcut, NULL, menu_add_shortcut_cancel, but);
 }
 
@@ -6026,7 +6025,7 @@ static bool ui_but_menu(bContext *C, uiBut *but)
 		return false;
 	}
 	
-	button_timers_tooltip_remove(C, but);
+	UI_but_tooltip_timer_remove(C, but);
 
 	/* highly unlikely getting the label ever fails */
 	UI_but_string_info_get(C, but, &label, NULL);
@@ -6965,7 +6964,8 @@ static bool button_modal_state(uiHandleButtonState state)
 	            BUTTON_STATE_MENU_OPEN);
 }
 
-static void button_timers_tooltip_remove(bContext *C, uiBut *but)
+/* removes tooltip timer from active but (meaning tooltip is disabled until it's reenabled again) */
+void UI_but_tooltip_timer_remove(bContext *C, uiBut *but)
 {
 	uiHandleButtonData *data;
 
@@ -7049,7 +7049,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
 	}
 	else {
 		but->flag |= UI_SELECT;
-		button_timers_tooltip_remove(C, but);
+		UI_but_tooltip_timer_remove(C, but);
 	}
 	
 	/* text editing */
@@ -7678,7 +7678,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
 			case WHEELDOWNMOUSE:
 			case MIDDLEMOUSE:
 			case MOUSEPAN:
-				button_timers_tooltip_remove(C, but);
+				UI_but_tooltip_timer_remove(C, but);
 				/* fall-through */
 			default:
 				/* handle button type specific events */
@@ -8653,7 +8653,7 @@ static int ui_handle_menu_event(
 			{
 				if (!but || !ui_but_contains_point_px(ar, but, event->x, event->y)) {
 					if (but) {
-						button_timers_tooltip_remove(C, but);
+						UI_but_tooltip_timer_remove(C, but);
 					}
 
 					menu->is_grab = true;
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index e583310..4c4378e 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -1654,9 +1654,14 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent
 	Scene *scene = CTX_data_scene(C);
 	ARegion *ar = CTX_wm_region(C);
 	SpaceOops *soops = CTX_wm_space_outliner(C);
+	uiBut *but = UI_context_active_but_get(C);
 	TreeElement *te;
 	float fmval[2];
 
+	if (but) {
+		UI_but_tooltip_timer_remove(C, but);
+	}
+
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
 	
 	for (te = soops->tree.first; te; te = te->next) {




More information about the Bf-blender-cvs mailing list