elm_slider: Reduce the number of atspi events 19/287919/4
authorArtur Świgoń <a.swigon@samsung.com>
Tue, 7 Feb 2023 18:44:20 +0000 (19:44 +0100)
committerArtur Świgoń <a.swigon@samsung.com>
Fri, 10 Feb 2023 11:15:05 +0000 (12:15 +0100)
There was a double emission of the value-changed event on D-Bus when the value
had been changed by the user. In case of a self-rounding slider (which resets
its own value on the 'changed' event) there were three events instead of two.
This patch fixes this.

@tizen_only

Change-Id: Ia4c5096fe6fc95fd314d73aa69b4cc1c3ff16cee

src/lib/elementary/elm_slider.c

index feed06e..f5bbeb9 100644 (file)
@@ -347,8 +347,10 @@ _wheel_indicator_timer_cb(void *data)
    return ECORE_CALLBACK_CANCEL;
 }
 
+//TIZEN_ONLY(20230207): Reduce the number of atspi events
 static void
-_val_set(Evas_Object *obj)
+_val_set(Evas_Object *obj, Eina_Bool user_event)
+//
 {
    double pos, pos2;
 
@@ -392,8 +394,8 @@ _val_set(Evas_Object *obj)
    //
 
    // emit accessibility event also if value was changed by API
-   //TIZEN_ONLY(20221003): Add _elm_object_accessibility_should_emit_events()
-   if (_elm_object_accessibility_should_emit_events(obj))
+   //TIZEN_ONLY(20230207): Reduce the number of atspi events
+   if (!user_event && _elm_object_accessibility_should_emit_events(obj))
      efl_access_value_changed_signal_emit(obj);
    //
 
@@ -411,7 +413,9 @@ _user_value_update(Evas_Object *obj, double value)
      {
         sd->val = val;
         sd->intvl_from = val;
-        _val_set(obj);
+        //TIZEN_ONLY(20230207): Reduce the number of atspi events
+        _val_set(obj, EINA_TRUE);
+        //
 
         evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
         ecore_timer_del(sd->delay);
@@ -480,12 +484,16 @@ _val_fetch(Evas_Object *obj, Eina_Bool user_event)
              if (val > sd->intvl_to)
                {
                   val = sd->intvl_to;
-                  _val_set(obj);
+                  //TIZEN_ONLY(20230207): Reduce the number of atspi events
+                  _val_set(obj, user_event);
+                  //
                }
              else if (val2 < sd->intvl_from)
                {
                   val2 = sd->intvl_from;
-                  _val_set(obj);
+                  //TIZEN_ONLY(20230207): Reduce the number of atspi events
+                  _val_set(obj, user_event);
+                  //
                }
           }
         else
@@ -493,12 +501,16 @@ _val_fetch(Evas_Object *obj, Eina_Bool user_event)
              if (val < sd->intvl_to)
                {
                   val = sd->intvl_to;
-                  _val_set(obj);
+                  //TIZEN_ONLY(20230207): Reduce the number of atspi events
+                  _val_set(obj, user_event);
+                  //
                }
              else if (val2 > sd->intvl_from)
                {
                   val2 = sd->intvl_from;
-                  _val_set(obj);
+                  //TIZEN_ONLY(20230207): Reduce the number of atspi events
+                  _val_set(obj, user_event);
+                  //
                }
           }
      }
@@ -916,7 +928,9 @@ _elm_slider_efl_ui_widget_theme_apply(Eo *obj, Elm_Slider_Data *sd)
    _min_max_set(obj);
    _units_set(obj);
    _indicator_set(obj);
-   _val_set(obj);
+   //TIZEN_ONLY(20230207): Reduce the number of atspi events
+   _val_set(obj, EINA_FALSE);
+   //
 
    edje_object_message_signal_process(wd->resize_obj);
    if (sd->popup)
@@ -1672,7 +1686,9 @@ elm_slider_value_set(Evas_Object *obj, double val)
    if (sd->val < sd->val_min) sd->val = sd->val_min;
    if (sd->val > sd->val_max) sd->val = sd->val_max;
 
-   _val_set(obj);
+   //TIZEN_ONLY(20230207): Reduce the number of atspi events
+   _val_set(obj, EINA_FALSE);
+   //
 }
 
 EAPI double
@@ -1791,7 +1807,9 @@ elm_slider_range_set(Evas_Object *obj, double from, double to)
    }
    if (sd->intvl_to > sd->val_max) sd->intvl_to = sd->val_max;
 
-   _val_set(obj);
+   //TIZEN_ONLY(20230207): Reduce the number of atspi events
+   _val_set(obj, EINA_FALSE);
+   //
 }
 
 EAPI void
@@ -1824,7 +1842,9 @@ elm_slider_min_max_set(Evas_Object *obj, double min, double max)
    if (sd->val < sd->val_min) sd->val = sd->val_min;
    if (sd->val > sd->val_max) sd->val = sd->val_max;
 
-   _val_set(obj);
+   //TIZEN_ONLY(20230207): Reduce the number of atspi events
+   _val_set(obj, EINA_FALSE);
+   //
 }
 
 EAPI void
@@ -1986,7 +2006,9 @@ _elm_slider_efl_access_value_value_and_text_set(Eo *obj, Elm_Slider_Data *sd, do
 
    evas_object_smart_callback_call(obj, SIG_DRAG_START, NULL);
    sd->val = value;
-   _val_set(obj);
+   //TIZEN_ONLY(20230207): Reduce the number of atspi events
+   _val_set(obj, EINA_TRUE);
+   //
    sd->val = oldval;
    _slider_update(obj, EINA_TRUE);
    evas_object_smart_callback_call(obj, SIG_DRAG_STOP, NULL);