summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorWoochan Lee <wc0917.lee@samsung.com>2017-12-18 13:23:32 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-12-18 13:23:32 +0900
commit845d6d1b57b207f09b351a923b02c5330907a5d4 (patch)
treebe9d69f575e4312ab67e36a1de2cfbe70100ec8b /src/lib
parent7ae10303833f4ab29fc0e2dd58f6ecd38f45ccba (diff)
efl_ui_spin_button: Fix can't input number in case of the min value is bigger than 1.
Summary: Min Max validate logic has been changed to support decimal point counting. It makes this side effect. Test Plan: elementary_test -> efl_ui_spin_button sample. (On the min max filter enabled.) Reviewers: jpeg, Jaehyun_Cho, woohyun Reviewed By: Jaehyun_Cho Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5580
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_spin_button.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c
index d8d0f9ddb6..42667938eb 100644
--- a/src/lib/elementary/efl_ui_spin_button.c
+++ b/src/lib/elementary/efl_ui_spin_button.c
@@ -285,7 +285,7 @@ _min_max_validity_filter(void *data, Evas_Object *obj, char **text)
285 const char *str, *point; 285 const char *str, *point;
286 char *insert, *new_str = NULL; 286 char *insert, *new_str = NULL;
287 double val; 287 double val;
288 int max_len, len; 288 int max_len = 0, len;
289 289
290 EINA_SAFETY_ON_NULL_RETURN(data); 290 EINA_SAFETY_ON_NULL_RETURN(data);
291 EINA_SAFETY_ON_NULL_RETURN(obj); 291 EINA_SAFETY_ON_NULL_RETURN(obj);
@@ -299,15 +299,9 @@ _min_max_validity_filter(void *data, Evas_Object *obj, char **text)
299 insert = *text; 299 insert = *text;
300 new_str = _text_insert(str, insert, elm_entry_cursor_pos_get(obj)); 300 new_str = _text_insert(str, insert, elm_entry_cursor_pos_get(obj));
301 if (!new_str) return; 301 if (!new_str) return;
302 max_len = log10(fabs(pd->val_max)) + 1; 302 if (strchr(new_str, '-')) max_len++;
303 303
304 new_str = _text_insert(str, insert, elm_entry_cursor_pos_get(obj)); 304 if (pd->format_type == SPIN_FORMAT_FLOAT)
305 if (pd->format_type == SPIN_FORMAT_INT)
306 {
307 len = strlen(new_str);
308 if (len < max_len) goto end;
309 }
310 else if (pd->format_type == SPIN_FORMAT_FLOAT)
311 { 305 {
312 point = strchr(new_str, '.'); 306 point = strchr(new_str, '.');
313 if (point) 307 if (point)
@@ -320,6 +314,11 @@ _min_max_validity_filter(void *data, Evas_Object *obj, char **text)
320 } 314 }
321 } 315 }
322 316
317 max_len += (fabs(pd->val_max) > fabs(pd->val_min)) ?
318 (log10(fabs(pd->val_max)) + 1) : (log10(fabs(pd->val_min)) + 1);
319 len = strlen(new_str);
320 if (len < max_len) goto end;
321
323 val = strtod(new_str, NULL); 322 val = strtod(new_str, NULL);
324 if ((val < pd->val_min) || (val > pd->val_max)) 323 if ((val < pd->val_min) || (val > pd->val_max))
325 *insert = 0; 324 *insert = 0;