Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-05-02 13:18:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-02 13:20:11 +0300
commitadc17317c5af23c0986a449da6d0aef130d1f503 (patch)
tree7969dfc6a6f7cb5621c97c83df8739b0a6f54287
parent81175eb40ddbbd8ea9c98eb71f590b148012eb06 (diff)
UI: open toolbar hold buttons on drag
Allows for faster tool switching, no need to wait for it to open.
-rw-r--r--source/blender/editors/interface/interface_handlers.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index e0ee966cb34..7c04056ac93 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -128,7 +128,7 @@ static bool ui_mouse_motion_keynav_test(struct uiKeyNavLock *keynav, const wmEve
#define BUTTON_FLASH_DELAY 0.020
#define MENU_SCROLL_INTERVAL 0.1
#define PIE_MENU_INTERVAL 0.01
-#define BUTTON_AUTO_OPEN_THRESH 0.3
+#define BUTTON_AUTO_OPEN_THRESH 0.2
#define BUTTON_MOUSE_TOWARDS_THRESH 1.0
/* pixels to move the cursor to get out of keyboard navigation */
#define BUTTON_KEYNAV_PX_LIMIT 8
@@ -8369,6 +8369,19 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
/* deselect the button when moving the mouse away */
/* also de-activate for buttons that only show higlights */
if (ui_but_contains_point_px(ar, but, event->x, event->y)) {
+
+ /* Drag on a hold button (used in the toolbar) now opens it immediately. */
+ if (data->hold_action_timer) {
+ if (but->flag & UI_SELECT) {
+ if ((abs(event->x - event->prevx)) > 2 ||
+ (abs(event->y - event->prevy)) > 2)
+ {
+ WM_event_remove_timer(data->wm, data->window, data->hold_action_timer);
+ data->hold_action_timer = WM_event_add_timer(data->wm, data->window, TIMER, 0.0f);
+ }
+ }
+ }
+
if (!(but->flag & UI_SELECT)) {
but->flag |= (UI_SELECT | UI_ACTIVE);
data->cancel = false;