Cleanup: remove button flag for forced tool-tips

This commit is contained in:
Campbell Barton 2016-03-09 19:13:20 +11:00
parent 01d3afaf3d
commit 6a5b636b56
2 changed files with 8 additions and 10 deletions

View File

@ -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

View File

@ -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) {
/* display tooltips if holding alt on mouseover when tooltips are off in prefs */
but->flag |= UI_BUT_TIP_FORCE;
}
else {
but->flag &= ~UI_BUT_TIP_FORCE;
}
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->active->tooltip_force = true;
}
}
}
else if (event->type == EVT_BUT_OPEN) {