elm_calendar: Fix to activate accessibility 34/279134/3
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Tue, 2 Aug 2022 11:14:27 +0000 (20:14 +0900)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 5 Aug 2022 07:16:57 +0000 (07:16 +0000)
It has been fixed that month buttons and date items are activated by
double tap of accessibility highlight.

Change-Id: Ia771c832952e85a6aa4bebd395aab374f64b67aa

src/lib/elementary/elm_calendar.c

index 9197529..a74abd1 100644 (file)
@@ -69,6 +69,18 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {NULL, NULL}
 };
 
+static Eina_Bool
+_update_focused_it(Evas_Object *obj, int focused_it);
+
+static void
+_update_unfocused_it(Evas_Object *obj, int focused_it);
+
+static void
+_day_selected(void *data,
+              Evas_Object *obj EINA_UNUSED,
+              const char *emission EINA_UNUSED,
+              const char *source);
+
 /* Originally, the button functionalities of month, year spinners were
  * implemented by its own edc. There was a bunch of callback functions
  * for handle the signals. The following functions are the old callback
@@ -588,6 +600,15 @@ _month_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
 }
 //
 
+static void _date_access_activated(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+   int part_num = (int)data;
+   char source[3];
+
+   snprintf(source, sizeof(source), "%i", part_num);
+   _day_selected(efl_parent_get(obj), NULL, "elm,action,selected", source);
+}
+
 //TIZEN_ONLY(20160822): When atspi mode is dynamically switched on/off,
 //register/unregister access objects accordingly.
 static void
@@ -630,6 +651,7 @@ _atspi_expose_objects(Evas_Object *obj, Eina_Bool is_atspi)
                   snprintf(day_s, sizeof(day_s), "%i", day++);
                   elm_access_info_set(ao, ELM_ACCESS_INFO, (const char*)day_s);
                   elm_access_info_cb_set(ao, ELM_ACCESS_CONTEXT_INFO, _localized_access_info_cb, E_("calendar item"));
+                  evas_object_smart_callback_add(ao, "access,activated", _date_access_activated, (void *)ii);
                }
            }
      }
@@ -1357,10 +1379,25 @@ _button_year_stop(void *data,
 }
 
 static void
-_inc_dec_button_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED)
+_inc_dec_button_clicked_cb(void *data, const Efl_Event *event)
 {
    ELM_CALENDAR_DATA_GET(data, sd);
 
+   if (_elm_atspi_enabled())
+     {
+        _inc_dec_button_pressed_cb(data, event);
+        _inc_dec_button_unpressed_cb(data, event);
+
+        if (efl_ui_focus_object_focus_get(data))
+          {
+             _update_focused_it(data, sd->selected_it);
+          }
+        else
+          {
+             _update_unfocused_it(data, sd->focused_it);
+          }
+     }
+
    sd->interval = sd->first_interval;
    ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);