Fix T76481: Fast clicks over Dopesheet toggles trigger renaming

Making this work reliably on the event system side is difficult. So
instead, let the toggle icons take and swallow double-click events on
the UI handler level.

The second change in this patch seems to be only needed for touchpads.
Without it, renaming would still be triggered sometimes, because the
hovered button wasn't re-activated fast enough.
This commit is contained in:
Julian Eisel 2020-05-13 11:45:28 +02:00
parent 61a3d55d06
commit 099dd0690c
Notes: blender-bot 2023-02-14 02:43:21 +01:00
Referenced by issue #76481, GPencil: Fast clicks over Dopesheet left icons active layer renaming
1 changed files with 3 additions and 2 deletions

View File

@ -4446,7 +4446,8 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons
do_activate = (event->val == KM_RELEASE);
}
else {
do_activate = (event->val == KM_PRESS);
/* Also use double-clicks to prevent fast clicks to leak to other handlers (T76481). */
do_activate = ELEM(event->val, KM_PRESS, KM_DBL_CLICK);
}
}
@ -8874,7 +8875,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
* This is needed to make sure if a button was active,
* it stays active while the mouse is over it.
* This avoids adding mousemoves, see: [#33466] */
if (ELEM(state_orig, BUTTON_STATE_INIT, BUTTON_STATE_HIGHLIGHT)) {
if (ELEM(state_orig, BUTTON_STATE_INIT, BUTTON_STATE_HIGHLIGHT, BUTTON_STATE_WAIT_DRAG)) {
if (ui_but_find_mouse_over(region, event) == but) {
button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER);
}