[Bf-blender-cvs] [fb875786987] master: Fix T96255: Node socket fails to drag

Campbell Barton noreply at git.blender.org
Mon Mar 21 08:21:36 CET 2022


Commit: fb8757869871872a1c1bb66bb45e59c780539c74
Author: Campbell Barton
Date:   Mon Mar 21 17:49:53 2022 +1100
Branches: master
https://developer.blender.org/rBfb8757869871872a1c1bb66bb45e59c780539c74

Fix T96255: Node socket fails to drag

This is a general issue exposed by moving from tweak to click-drag
events [0], however this bug would have existed for both click &
click-drag events beforehand.

Since [1] the following behavior could occur:

- Click-drag the cursor away from the button.
- Leaving the button would flag it as disabled.
- The disabled button would then break
  causing the event to be considered handled.
- Once handled no click / click-drag action would be tested.

The bug would only happen if the cursor left the button before the drag
threshold was reached which tended to happen with an UI-scale 2 or more.
Or with an increased drag threshold.

Revert [1] (fix for T78503), which is no longer needed since as of [2].

[0]: 4986f718482b061082936f1f6aa13929741093a2
[1]: 6f96dd85766a8159d5ffb761cbb4dbd20b7cad00
[2]: 87c13ac68c477486adecd8d548a016309fc2b54d

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

M	source/blender/editors/interface/interface_handlers.c

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 8677b1ed78a..8935df7b581 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -7969,7 +7969,16 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
   }
 
   if (but->flag & UI_BUT_DISABLED) {
-    return WM_UI_HANDLER_BREAK;
+    /* It's important to continue here instead of breaking since breaking causes the event to be
+     * considered "handled", preventing further click/drag events from being generated.
+     *
+     * An example of where this is needed is dragging node-sockets, where dragging a node-socket
+     * could exit the button before the drag threshold was reached, disable the button then break
+     * handling of the #MOUSEMOVE event preventing the socket being dragged entirely, see: T96255.
+     *
+     * Region level event handling is responsible for preventing events being passed
+     * through to parts of the UI that are logically behind this button, see: T92364. */
+    return WM_UI_HANDLER_CONTINUE;
   }
 
   switch (but->type) {



More information about the Bf-blender-cvs mailing list