elm_conform: [Accessibility]: 1. To learn the geometry of keyboard, used ATSPI role...
authorShilpa Singh <shilpa.singh@samsung.com>
Mon, 27 Nov 2017 14:43:09 +0000 (20:13 +0530)
committerJiyoun Park <jy0703.park@samsung.com>
Thu, 21 Dec 2017 10:07:30 +0000 (19:07 +0900)
2. Emitted bounds-changed when keyboard geometry is changed.

Change-Id: I5a223bfd8c5c61c1af8a497f54f912564021f0eb

src/lib/elementary/elm_conform.c

index 7d1990f..8f1a9fe 100644 (file)
@@ -236,6 +236,13 @@ _conformant_part_sizing_eval(Evas_Object *obj,
         // END of TIZEN_ONLY(20150707)
 
         DBG("[KEYPAD]: size(%d,%d, %dx%d).", sx, sy, sw, sh);
+        if (_elm_config->atspi_mode)
+          {
+             Evas_Object *access;
+             access = evas_object_data_get(sd->virtualkeypad, "_part_access_obj");
+             if (access)
+               efl_access_bounds_changed_signal_emit(access, sx, sy, sw, sh);
+          }
         _conformant_part_size_hints_set
            (obj, sd->virtualkeypad, sx, sy, sw, sh);
      }
@@ -272,6 +279,58 @@ _conformant_part_sizing_eval(Evas_Object *obj,
      }
 }
 
+//TIZEN ONLY(20160628): expose virtual keypad rect as at-spi object
+static void
+_conformant_atspi_bridge_on_connect_cb(void *data, const Efl_Event *event EINA_UNUSED)
+{
+   ELM_CONFORMANT_DATA_GET(data, sd);
+   Evas_Object *access;
+
+   if (sd->virtualkeypad)
+     {
+        access = elm_access_object_register(sd->virtualkeypad, data);
+        efl_access_role_set(access, EFL_ACCESS_ROLE_INPUT_METHOD_WINDOW);
+     }
+}
+
+static void
+_conformant_atspi_bridge_on_disconnect_cb(void *data, const Efl_Event *event EINA_UNUSED)
+{
+   ELM_CONFORMANT_DATA_GET(data, sd);
+   elm_access_object_unregister(sd->virtualkeypad);
+}
+
+static void
+_unregister_conformant_atspi_bridge_callbacks(Evas_Object *obj)
+{
+   if (!_elm_config->atspi_mode) return;
+
+   Eo *bridge = _elm_atspi_bridge_get();
+   if (!bridge) return;
+
+   efl_event_callback_del(bridge, ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _conformant_atspi_bridge_on_connect_cb, obj);
+   efl_event_callback_del(bridge, ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, _conformant_atspi_bridge_on_disconnect_cb, obj);
+}
+
+static void
+_atspi_expose_keypad_area(Evas_Object *obj)
+{
+   Eina_Bool connected = EINA_FALSE;
+   Eo *bridge = _elm_atspi_bridge_get();
+   if (!bridge) return;
+
+   // If bridge is connected expose it now
+   connected = elm_obj_atspi_bridge_connected_get(bridge);
+   if (connected)
+     _conformant_atspi_bridge_on_connect_cb(obj, NULL);
+
+   // Register for bridge connect/disconnect
+   _unregister_conformant_atspi_bridge_callbacks(obj);
+   efl_event_callback_add(bridge, ELM_ATSPI_BRIDGE_EVENT_CONNECTED, _conformant_atspi_bridge_on_connect_cb, obj);
+   efl_event_callback_add(bridge, ELM_ATSPI_BRIDGE_EVENT_DISCONNECTED, _conformant_atspi_bridge_on_disconnect_cb, obj);
+}
+//
+
 static void
 _conformant_parts_swallow(Evas_Object *obj)
 {
@@ -290,6 +349,8 @@ _conformant_parts_swallow(Evas_Object *obj)
              sd->virtualkeypad = evas_object_rectangle_add(e);
              elm_widget_sub_object_add(obj, sd->virtualkeypad);
              evas_object_size_hint_max_set(sd->virtualkeypad, -1, 0);
+             if (_elm_config->atspi_mode)
+               _atspi_expose_keypad_area(obj);
           }
         else
           _conformant_part_sizing_eval(obj, ELM_CONFORMANT_VIRTUAL_KEYPAD_PART);
@@ -979,7 +1040,7 @@ _on_prop_change(void *data,
 // TIZEN_ONLY(20150707): elm_conform for wayland, and signal if parts are changed
 static void
 _on_conformant_changed(void *data,
-                     Evas_Object *obj,
+                     Evas_Object *obj EINA_UNUSED,
                      void *event_info EINA_UNUSED)
 {
    Conformant_Part_Type part_type;
@@ -1029,6 +1090,9 @@ _elm_conformant_efl_canvas_group_group_del(Eo *obj, Elm_Conformant_Data *sd)
 
    efl_event_callback_del(sd->win, EFL_UI_WIN_EVENT_INDICATOR_PROP_CHANGED, _on_indicator_mode_changed, obj);
    efl_event_callback_del(sd->win, EFL_UI_WIN_EVENT_ROTATION_CHANGED, _on_rotation_changed, obj);
+   // TIZEN_ONLY(20160628): Unregister callbacks for ATSPI bridge enable/disable
+   _unregister_conformant_atspi_bridge_callbacks(obj);
+   //
 
    efl_canvas_group_del(efl_super(obj, MY_CLASS));
 }