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:
authorJulian Eisel <julian@blender.org>2020-08-05 20:34:11 +0300
committerJulian Eisel <julian@blender.org>2020-08-05 20:40:40 +0300
commit1b593edf1d898144ee591de0fbd3d1351d16d730 (patch)
tree479bb08b20120c6120bbce62d04a52f70609a29e /source/blender
parent38e9a349defcb4db51031782daac425b3828b122 (diff)
Fix T78907: Renaming file doesn't work while mouse is over file icon
The icons are label buttons. Usually these are not editable and can not become active. These are draggable ones though (so dragging files can be dragged by dragging the icon) which creates an exception to this rule. So hovering the icon would activate its label and when executing the rename operator via shortcut it wouldn't get exited properly. This broke the invariant of only allowing a single active button at a time. Added an assert to check that invariant now. Letting the code to activate the text button ensure any currently active button is exited seems sensible.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/editors/interface/interface_handlers.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index adb2e0e3b23..286cb1571bd 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -893,6 +893,12 @@ bool UI_but_active_only_ex(
}
}
if ((activate == true) || (found == false)) {
+ /* There might still be another active button. */
+ uiBut *old_active = ui_region_find_active_but(region);
+ if (old_active) {
+ ui_but_active_free(C, old_active);
+ }
+
ui_but_activate_event((bContext *)C, region, but);
}
else if ((found == true) && (isactive == false)) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 21cadec0d5f..bcb4f7c672f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8001,6 +8001,9 @@ static void button_activate_init(bContext *C,
{
uiHandleButtonData *data;
+ /* Only ever one active button! */
+ BLI_assert(ui_region_find_active_but(region) == NULL);
+
/* setup struct */
data = MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData");
data->wm = CTX_wm_manager(C);