From 248fff12c982cef0b0e8030a3c8d1959da5c82a1 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 16 Mar 2021 20:11:54 +0900 Subject: [PATCH] elementary slider: gurantee scroll hold push/pop match. Mouse In/Out is not guranteed for paired event calls, Users could prevent that exception case by flaging its condition. Otherwise slider screen could be blocked in scrolling. Thus, this patch is better for safety. Change-Id: I753fbb3638b854d05945bdc8a1d372ca029d7f5a --- src/lib/elementary/elm_slider.c | 16 ++++++++++++++-- src/lib/elementary/elm_widget_slider.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/elm_slider.c b/src/lib/elementary/elm_slider.c index 4ced3ab..829e0e1 100644 --- a/src/lib/elementary/elm_slider.c +++ b/src/lib/elementary/elm_slider.c @@ -1156,7 +1156,13 @@ _mouse_in_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { - efl_ui_widget_scroll_hold_push(obj); + ELM_SLIDER_DATA_GET(data, sd); + + if (!sd->scroll_hold) + { + efl_ui_widget_scroll_hold_push(obj); + sd->scroll_hold = EINA_TRUE; + } } static void @@ -1165,7 +1171,13 @@ _mouse_out_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { - efl_ui_widget_scroll_hold_pop(obj); + ELM_SLIDER_DATA_GET(data, sd); + + if (sd->scroll_hold) + { + efl_ui_widget_scroll_hold_pop(obj); + sd->scroll_hold = EINA_FALSE; + } } EOLIAN static void diff --git a/src/lib/elementary/elm_widget_slider.h b/src/lib/elementary/elm_widget_slider.h index 203b5f5..8d32a67 100644 --- a/src/lib/elementary/elm_widget_slider.h +++ b/src/lib/elementary/elm_widget_slider.h @@ -62,6 +62,7 @@ struct _Elm_Slider_Data Eina_Bool intvl_enable : 1; Eina_Bool spacer_down : 1; Eina_Bool frozen : 1; + Eina_Bool scroll_hold : 1; }; /** -- 2.7.4