UI: keep showing label tooltip once it's open
authorCampbell Barton <ideasman42@gmail.com>
Thu, 6 Sep 2018 04:22:12 +0000 (14:22 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 6 Sep 2018 04:22:12 +0000 (14:22 +1000)
This means dragging the cursor over the tools will show all labels
immediately, but only once a single label is displayed.

source/blender/editors/interface/interface_handlers.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_tooltip.c

index 86c73b72620a21a22185327a3e93dc57fc628940..00828bd0fdf9f7d5f713eab0532eb15ab76d0dde 100644 (file)
@@ -7319,14 +7319,18 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
                ui_numedit_set_active(but);
        }
 
-#if 0
        if (UI_but_has_tooltip_label(but)) {
                /* Show a label for this button. */
-               WM_tooltip_immediate_init(
-                       C, CTX_wm_window(C), ar,
-                       ui_but_tooltip_init);
+               bScreen *sc = WM_window_get_active_screen(data->window);
+               if ((PIL_check_seconds_timer() - WM_tooltip_time_closed()) < 0.1) {
+                       WM_tooltip_immediate_init(
+                               C, CTX_wm_window(C), ar,
+                               ui_but_tooltip_init);
+                       if (sc->tool_tip) {
+                               sc->tool_tip->pass = 1;
+                       }
+               }
        }
-#endif
 }
 
 static void button_activate_exit(
index 4a48aec2d68a6f576e232abf3c74d7dcc313aba8..65cb0f956a561942adf2ad0479ac841a44f2546f 100644 (file)
@@ -641,6 +641,7 @@ void WM_tooltip_timer_clear(struct bContext *C, struct wmWindow *win);
 void WM_tooltip_clear(struct bContext *C, struct wmWindow *win);
 void WM_tooltip_init(struct bContext *C, struct wmWindow *win);
 void WM_tooltip_refresh(struct bContext *C, struct wmWindow *win);
+double WM_tooltip_time_closed(void);
 
 #ifdef __cplusplus
 }
index dcf51c1d01506250665937166014f0810da7ef58..b0d621c2e446db4293d933e81ebd885605bef8fe 100644 (file)
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "PIL_time.h"
+
+static double g_tooltip_time_closed;
+double WM_tooltip_time_closed(void)
+{
+       return g_tooltip_time_closed;
+}
+
 void WM_tooltip_immediate_init(
         bContext *C, wmWindow *win, ARegion *ar,
         wmTooltipInitFn init)
@@ -95,6 +103,7 @@ void WM_tooltip_clear(bContext *C, wmWindow *win)
                if (screen->tool_tip->region) {
                        UI_tooltip_free(C, screen, screen->tool_tip->region);
                        screen->tool_tip->region = NULL;
+                       g_tooltip_time_closed = PIL_check_seconds_timer();
                }
                MEM_freeN(screen->tool_tip);
                screen->tool_tip = NULL;