We need to support multi window case.
Using window resource id would be more correct way to get window
under x, y position.
This will work well only with following patch.
https://review.tizen.org/gerrit/#/c/platform/core/uifw/e-mod-tizen-screen-reader/+/274553/
and patch of each toolkit providing window attribute "ResID".
Change-Id: I4bae851422858e2db76611d8c3e959ed657984a2
*/
AtspiAccessible* app_tracker_at_point_window_get(App_Tracker_Data *atd, int x, int y);
+/**
+ * @brief This function allows access to submodule functinality of app_tracker.
+ *
+ * @param atd internal data of app tracker module
+ */
+AtspiAccessible* app_tracker_resource_id_window_get(App_Tracker_Data *atd, uint32_t resource_id);
+
/**
* @brief This function allows access to submodule functinality of app_tracker.
*
pid_t pid; // pid of process on which gesture took place.
int state; // 0 - begin, 1 - ongoing, 2 - ended, 3 - aborted
int event_time;
- int resource_id; // unique value identifying the window on which gesture took place in multi-window environment
+ uint32_t resource_id; // unique value identifying the window on which gesture took place in multi-window environment
} Gesture_Info;
typedef void (*GestureCB)(void *data, const Eldbus_Message *msg);
Eina_Bool keyboard_window_is;
Eina_Bool view_change_need; /* Would be not necessary, keep this for later usage */
WindowActivateInfoType window_activate_info_type;
+ uint32_t resource_id;
} WindowInfo;
#endif
*/
AtspiAccessible *window_tracker_at_point_window_get(WindowTrackerData *wtd, int x, int y);
+/*
+ * @brief Returns window of resource id
+ */
+AtspiAccessible *window_tracker_resource_id_window_get(WindowTrackerData *wtd, uint32_t resource_id);
+
/*
* @brief Removes keyboard window from window list
*/
return atd ? window_tracker_at_point_window_get(atd->window_tracker_data, x, y) : NULL;
}
+AtspiAccessible* app_tracker_resource_id_window_get(App_Tracker_Data *atd, uint32_t resource_id)
+{
+ return atd ? window_tracker_resource_id_window_get(atd->window_tracker_data, resource_id) : NULL;
+}
+
WindowInfo* app_tracker_top_window_info_get(App_Tracker_Data *atd)
{
return atd ? window_tracker_top_window_info_get(atd->window_tracker_data) : NULL;
g_object_unref(parent);
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
/* change context root if bus name of window at point is different from bus name of context root */
TIZEN_PROD_STATIC void _window_at_point_check(NavigatorData *nd, int x, int y)
{
g_free(touched_window_bus_name);
g_free(context_root_bus_name);
}
+#pragma GCC diagnostic pop
+
+TIZEN_PROD_STATIC void _window_of_resource_id_check(NavigatorData *nd, uint32_t resource_id)
+{
+ AtspiAccessible *touched_window = NULL;
+ AtspiAccessible *context_root = NULL;
+
+ touched_window = app_tracker_resource_id_window_get(nd->app_tracker_data, resource_id);
+ context_root = flat_navi_context_root_get(nd->flat_navi_context);
+
+ if (!touched_window || !context_root) return;
+
+ if (touched_window && !atspi_accessible_is_equal(touched_window, context_root)) {
+ gchar *id = atspi_accessible_get_unique_id(touched_window, NULL);
+ gchar *id2 = atspi_accessible_get_unique_id(context_root, NULL);
+ DEBUG("Changing navigation context root FROM: %s TO: %s (touched window with resID: %u)", id2, id, resource_id);
+ g_free(id);
+ g_free(id2);
+ flat_navi_context_root_change(nd->flat_navi_context, touched_window);
+ }
+}
TIZEN_PROD_STATIC void _focus_widget(NavigatorData *nd, Gesture_Info *info)
{
DEBUG("START");
AtspiAccessible *obj = NULL;
- // TODO: use info->resource_id instead of (x_beg, y_beg) in order to determine window
- _window_at_point_check(nd, info->x_beg, info->y_beg);
+ _window_of_resource_id_check(nd, info->resource_id);
if ((nd->last_focus.x == info->x_beg) && (nd->last_focus.y == info->y_beg))
return;
return;
}
info->type = (Gesture)g_type;
- DEBUG("Incoming gesture name is %s : %d %d %d %d %d %d", utils_enum_to_string(info->type),
+ DEBUG("Incoming gesture name is %s : %d %d %d %d %d %u", utils_enum_to_string(info->type),
info->x_beg, info->y_beg, info->x_end, info->y_end, info->state, info->resource_id);
_on_auto_review_stop(nd);
return EINA_FALSE;
}
+static uint32_t _window_resource_id_get(AtspiAccessible *window)
+{
+ uint32_t resource_id = 0;
+ GHashTable *hash_table = atspi_accessible_get_attributes(window, NULL);
+ if (hash_table) {
+ gchar *resID = g_hash_table_lookup(hash_table, "resID");
+ if (resID) {
+ DEBUG("Resource id: %s", resID);
+ resource_id = (uint32_t)atoi(resID);
+ }
+ else
+ ERROR("Window does not have Resource id");
+
+ g_hash_table_unref(hash_table);
+ }
+ return resource_id;
+}
+
static void _window_append(WindowTrackerData *wtd, AtspiAccessible *window, Eina_Bool view_change_need,
Eina_Bool keyboard_window_is, WindowActivateInfoType window_activate_info_type)
{
wi->keyboard_window_is = keyboard_window_is;
wi->view_change_need = view_change_need;
wi->window_activate_info_type = window_activate_info_type;
+ wi->resource_id = _window_resource_id_get(window);
wtd->window_infos = eina_list_append(wtd->window_infos, wi);
return NULL;
}
+AtspiAccessible *window_tracker_resource_id_window_get(WindowTrackerData *wtd, uint32_t resource_id)
+{
+ WindowInfo *wi;
+ Eina_List *l;
+
+ DEBUG("Number of window: %d, resource id: %u", eina_list_count(wtd->window_infos), resource_id);
+
+ EINA_LIST_REVERSE_FOREACH(wtd->window_infos, l, wi) {
+ if (!wi) continue;
+ AtspiRect *rect = wi->rect;
+ gchar *id = atspi_accessible_get_unique_id(wi->window, NULL);
+ DEBUG("Window: %s (%d, %d, %d, %d), view change need: %d, keyboard window: %d, resource id: %u",
+ id, rect->x, rect->y, rect->width, rect->height,
+ wi->view_change_need, wi->keyboard_window_is, wi->resource_id);
+ g_free(id);
+
+ if (wi->resource_id == resource_id) {
+ return wi->window;
+ }
+ }
+ return NULL;
+}
+
void window_tracker_keyboard_window_remove(WindowTrackerData *wtd)
{
WindowInfo *wi;