[Bf-blender-cvs] [6a5b636] master: Cleanup: remove button flag for forced tool-tips

Campbell Barton noreply at git.blender.org
Wed Mar 9 09:25:29 CET 2016


Commit: 6a5b636b562994d7941666482ee020e6ad3bb0bb
Author: Campbell Barton
Date:   Wed Mar 9 19:13:20 2016 +1100
Branches: master
https://developer.blender.org/rB6a5b636b562994d7941666482ee020e6ad3bb0bb

Cleanup: remove button flag for forced tool-tips

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

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

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 89c50a4..a240881 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -179,10 +179,9 @@ enum {
 	UI_BUT_DRAG_MULTI      = (1 << 25),  /* edit this button as well as the active button (not just dragging) */
 	UI_BUT_SCA_LINK_GREY   = (1 << 26),  /* used to flag if sca links shoud be gray out */
 	UI_BUT_HAS_SEP_CHAR    = (1 << 27),  /* but->str contains UI_SEP_CHAR, used for key shortcuts */
-	UI_BUT_TIP_FORCE       = (1 << 28),  /* force show tooltips when holding option/alt if U's USER_TOOLTIPS is off */
+	UI_BUT_UPDATE_DELAY    = (1 << 28),  /* don't run updates while dragging (needed in rare cases). */
 	UI_BUT_TEXTEDIT_UPDATE = (1 << 29),  /* when widget is in textedit mode, update value on each char stroke */
 	UI_BUT_SEARCH_UNLINK   = (1 << 30),  /* show unlink for search button */
-	UI_BUT_UPDATE_DELAY    = (1 << 31),  /* don't run updates while dragging (needed in rare cases). */
 };
 
 #define UI_PANEL_WIDTH          340
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index bccecde..1a099f0 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -296,6 +296,7 @@ typedef struct uiHandleButtonData {
 	/* tooltip */
 	ARegion *tooltip;
 	wmTimer *tooltiptimer;
+	unsigned int tooltip_force : 1;
 	
 	/* auto open */
 	bool used_mouse;
@@ -7603,7 +7604,7 @@ static void button_tooltip_timer_reset(bContext *C, uiBut *but)
 		data->tooltiptimer = NULL;
 	}
 
-	if ((U.flag & USER_TOOLTIPS) || (but->flag & UI_BUT_TIP_FORCE)) {
+	if ((U.flag & USER_TOOLTIPS) || (data->tooltip_force)) {
 		if (!but->block->tooltipdisabled) {
 			if (!wm->drags.first) {
 				data->tooltiptimer = WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
@@ -8131,14 +8132,12 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar)
 	if (event->type == MOUSEMOVE) {
 		but = ui_but_find_mouse_over(ar, event);
 		if (but) {
-			if (event->alt) {
+			button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
+
+			if (event->alt && but->active) {
 				/* display tooltips if holding alt on mouseover when tooltips are off in prefs */
-				but->flag |= UI_BUT_TIP_FORCE;
+				but->active->tooltip_force = true;
 			}
-			else {
-				but->flag &= ~UI_BUT_TIP_FORCE;
-			}
-			button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
 		}
 	}
 	else if (event->type == EVT_BUT_OPEN) {




More information about the Bf-blender-cvs mailing list