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 <campbell@blender.org>2022-05-13 16:41:03 +0300
committerCampbell Barton <campbell@blender.org>2022-05-13 16:41:03 +0300
commit05b56d55e8578c79080083cb4177a8846f82af14 (patch)
treebc108b1a0bb00a7ddcbd2b7b71864e1705d2a9ab /source/blender/editors/interface/interface_query.cc
parentcbc024c3cac29dd17a9e5338162792d8fadc82ee (diff)
Fix T97386: Node socket labels swallow click/drag events
Regression caused by [0] which made `ui_but_is_interactive` consider label buttons with tool-tips to be interactive. This prevented the clicks to pass through to the nodes for selecting/dragging. Resolve this by allowing buttons to be activated for the purpose of showing tool-tips but otherwise considering them disabled (as if the UI_BUT_DISABLED is set when handling events). [0]: 484a9146479e05946d291e9886cdf3febca6d05d Reviewed By: Severin Ref D14932
Diffstat (limited to 'source/blender/editors/interface/interface_query.cc')
-rw-r--r--source/blender/editors/interface/interface_query.cc32
1 files changed, 25 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface_query.cc b/source/blender/editors/interface/interface_query.cc
index 337b2852d57..ea1fe3923e4 100644
--- a/source/blender/editors/interface/interface_query.cc
+++ b/source/blender/editors/interface/interface_query.cc
@@ -58,12 +58,23 @@ bool ui_but_is_toggle(const uiBut *but)
UI_BTYPE_TREEROW);
}
-bool ui_but_is_interactive(const uiBut *but, const bool labeledit)
+bool ui_but_is_interactive_ex(const uiBut *but, const bool labeledit, const bool for_tooltip)
{
/* NOTE: #UI_BTYPE_LABEL is included for highlights, this allows drags. */
- if ((but->type == UI_BTYPE_LABEL) && but->dragpoin == nullptr && but->tip_func == nullptr) {
- return false;
+ if (but->type == UI_BTYPE_LABEL) {
+ if (for_tooltip) {
+ /* It's important labels are considered interactive for the purpose of showing tooltip. */
+ if (but->dragpoin == nullptr && but->tip_func == nullptr) {
+ return false;
+ }
+ }
+ else {
+ if (but->dragpoin == nullptr) {
+ return false;
+ }
+ }
}
+
if (ELEM(but->type, UI_BTYPE_ROUNDBOX, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_LISTBOX)) {
return false;
}
@@ -84,6 +95,11 @@ bool ui_but_is_interactive(const uiBut *but, const bool labeledit)
return true;
}
+bool ui_but_is_interactive(const uiBut *but, const bool labeledit)
+{
+ return ui_but_is_interactive_ex(but, labeledit, false);
+}
+
bool UI_but_is_utf8(const uiBut *but)
{
if (but->rnaprop) {
@@ -266,6 +282,7 @@ static uiBut *ui_but_find(const ARegion *region,
uiBut *ui_but_find_mouse_over_ex(const ARegion *region,
const int xy[2],
const bool labeledit,
+ const bool for_tooltip,
const uiButFindPollFn find_poll,
const void *find_custom_data)
{
@@ -282,7 +299,7 @@ uiBut *ui_but_find_mouse_over_ex(const ARegion *region,
if (find_poll && find_poll(but, find_custom_data) == false) {
continue;
}
- if (ui_but_is_interactive(but, labeledit)) {
+ if (ui_but_is_interactive_ex(but, labeledit, for_tooltip)) {
if (but->pie_dir != UI_RADIAL_NONE) {
if (ui_but_isect_pie_seg(block, but)) {
butover = but;
@@ -310,7 +327,8 @@ uiBut *ui_but_find_mouse_over_ex(const ARegion *region,
uiBut *ui_but_find_mouse_over(const ARegion *region, const wmEvent *event)
{
- return ui_but_find_mouse_over_ex(region, event->xy, event->modifier & KM_CTRL, nullptr, nullptr);
+ return ui_but_find_mouse_over_ex(
+ region, event->xy, event->modifier & KM_CTRL, false, nullptr, nullptr);
}
uiBut *ui_but_find_rect_over(const struct ARegion *region, const rcti *rect_px)
@@ -414,7 +432,7 @@ static bool ui_but_is_listrow(const uiBut *but, const void *UNUSED(customdata))
uiBut *ui_list_row_find_mouse_over(const ARegion *region, const int xy[2])
{
- return ui_but_find_mouse_over_ex(region, xy, false, ui_but_is_listrow, nullptr);
+ return ui_but_find_mouse_over_ex(region, xy, false, false, ui_but_is_listrow, nullptr);
}
struct ListRowFindIndexData {
@@ -446,7 +464,7 @@ static bool ui_but_is_treerow(const uiBut *but, const void *UNUSED(customdata))
uiBut *ui_tree_row_find_mouse_over(const ARegion *region, const int xy[2])
{
- return ui_but_find_mouse_over_ex(region, xy, false, ui_but_is_treerow, nullptr);
+ return ui_but_find_mouse_over_ex(region, xy, false, false, ui_but_is_treerow, nullptr);
}
static bool ui_but_is_active_treerow(const uiBut *but, const void *customdata)