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>2014-06-09 09:35:34 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-09 09:35:34 +0400
commitc04c6a3b8330901c12dc8c1695818497efa785cd (patch)
tree57fff6d1c5a3d00831f5b1592adb7c94520d164b /source/blender/editors/interface
parentb707b07c5b9f9c952ceab5135aab77ca58eb7d49 (diff)
Fix T40538: Multi-button canceling edit-text could leave edited value
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_handlers.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index f6df5a921d9..5f8538668b6 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2372,6 +2372,18 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
data->str = NULL;
}
+#ifdef USE_DRAG_MULTINUM
+ /* this can happen from multi-drag */
+ if (data->applied_interactive) {
+ /* remove any small changes so canceling edit doesn't restore invalid value: T40538 */
+ data->cancel = true;
+ ui_apply_button(C, but->block, but, data, true);
+ data->cancel = false;
+
+ data->applied_interactive = false;
+ }
+#endif
+
/* retrieve string */
data->maxlen = ui_get_but_string_max_length(but);
data->str = MEM_callocN(sizeof(char) * data->maxlen + 1, "textedit str");
@@ -2392,11 +2404,6 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
data->selextend = 0;
data->selstartx = 0.0f;
-#ifdef USE_DRAG_MULTINUM
- /* this can happen from multi-drag */
- data->applied_interactive = false;
-#endif
-
/* set cursor pos to the end of the text */
but->editstr = data->str;
but->pos = len;
@@ -3308,6 +3315,11 @@ static bool ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data,
if (data->draglock) {
if (abs(mx - data->dragstartx) <= 3)
return changed;
+#ifdef USE_DRAG_MULTINUM
+ if (ELEM(data->multi_data.init, BUTTON_MULTI_INIT_UNSET, BUTTON_MULTI_INIT_SETUP)) {
+ return changed;
+ }
+#endif
data->draglock = false;
data->dragstartx = mx; /* ignore mouse movement within drag-lock */