*/
void keyboard_tracker_shutdown(KeyboardTrackerData *ktd);
-/*
- * @brief Sets keyboard geometry
- *
- * @param ktd internal data struct
- * @param x int coordinate of left top corner
- * @param y int coordinate of left top corner
- * @param width
- * @param height
- */
-void keyboard_geometry_set(KeyboardTrackerData *ktd, int x, int y, int width, int height);
-
-/*
- * @brief Gets keyboard geometry
- *
- * @param ktd internal keyboard tracker data struct
- * @param x int pointer to coordinate of left top corner
- * @param y int pointer to coordinate of left top corner
- * @param width int pointer
- * @param height int pointer
- *
- * @return EINA_TRUE on success, EINA_FALSE otherwise
- *
- * @note One cannot pass NULL as a parameter
- */
-Eina_Bool keyboard_geometry_get(const KeyboardTrackerData *ktd, int *x, int *y, int *width, int *height);
-
/*
* @brief Return EINA_TRUE if the top window is Quickpanel Window
*
* @param ktd internal keyboard tracker data struct
- * @param x int coordinate
- * @param y int coordinate
+ * @param resource_id uint32_t resource id of window
*
* @return Eina_Bool status
*
* @note If SCREEN_READER_TV is undefined returns EINA_FALSE
*/
-Eina_Bool keyboard_event_status(KeyboardTrackerData *ktd, int x, int y);
+Eina_Bool keyboard_event_status(KeyboardTrackerData *ktd, uint32_t resource_id);
/*
* @brief Emits signal to eldbus interface
typedef struct {
AtspiAccessible *window;
- AtspiRect *rect;
Eina_Bool keyboard_window_is;
Eina_Bool view_change_need; /* Would be not necessary, keep this for later usage */
WindowActivateInfoType window_activate_info_type;
AtspiDeviceListener *async_listener;
Eldbus_Connection *conn;
Eldbus_Service_Interface *iface;
- int keyboardX;
- int keyboardY;
- int keyboardW;
- int keyboardH;
int prev_keyboard_state;
TopWindowInfoGetCb top_window_info_get;
void *top_window_info_get_user_data;
return NULL;
}
- ktd->keyboardX = 0;
- ktd->keyboardY = 0;
- ktd->keyboardW = 0;
- ktd->keyboardH = 0;
ktd->prev_keyboard_state = VCONFKEY_ISF_INPUT_PANEL_STATE_HIDE;
ktd->top_window_info_get = NULL;
ktd->top_window_info_get_user_data = NULL;
free(ktd);
}
-void keyboard_geometry_set(KeyboardTrackerData *ktd, int x, int y, int width, int height)
-{
- if (!ktd)
- return;
-
- ktd->keyboardX = x;
- ktd->keyboardY = y;
- ktd->keyboardW = width;
- ktd->keyboardH = height;
-}
-
-Eina_Bool keyboard_geometry_get(const KeyboardTrackerData *ktd, int *x, int *y, int *width, int *height)
-{
- if (!ktd) {
- ERROR("invalid parameter!");
- return EINA_FALSE;
- }
-
- if (x) *x = ktd->keyboardX;
- if (y) *y = ktd->keyboardY;
- if (width) *width = ktd->keyboardW;
- if (height) *height = ktd->keyboardH;
-
- return EINA_TRUE;
-}
-
-Eina_Bool keyboard_event_status(KeyboardTrackerData *ktd, const int x, const int y)
+Eina_Bool keyboard_event_status(KeyboardTrackerData *ktd, uint32_t resource_id)
{
#ifndef SCREEN_READER_TV
if (ktd->prev_keyboard_state == VCONFKEY_ISF_INPUT_PANEL_STATE_SHOW) {
}
gchar *name = atspi_accessible_get_name(top_win_info->window, NULL);
- if (name && g_strcmp0(name, "ISF Popup")) {
- int kX = top_win_info->rect->x;
- int kY = top_win_info->rect->y;
- int kW = top_win_info->rect->width;
- int kH = top_win_info->rect->height;
- if ((y >= kY) && (y <= (kY + kH)) && (x >= kX) && (x <= (kX + kW))) {
- g_free(name);
- DEBUG("Event (%d, %d) on keyboard window", x, y);
+ Eina_Bool is_isf_popup = !g_strcmp0(name, "ISF Popup");
+ g_free(name);
+ if (!is_isf_popup) {
+ if (top_win_info->resource_id == resource_id) {
+ DEBUG("Event on keyboard window (resID = %d)", resource_id);
return EINA_TRUE;
}
}
- g_free(name);
}
#endif
return EINA_FALSE;
g_object_unref(comp);
}
- keyboard_status = keyboard_event_status(nd->keyboard_tracker_data, info->x_end, info->y_end);
+ keyboard_status = keyboard_event_status(nd->keyboard_tracker_data, info->resource_id);
if (keyboard_status) {
highlighted_object_x = info->x_end;
highlighted_object_y = info->y_end;
return;
}
nd->last_hover_event_time = info->state != 1 ? -1 : info->event_time;
- keyboard_status = keyboard_event_status(nd->keyboard_tracker_data, info->x_end, info->y_end);
+ keyboard_status = keyboard_event_status(nd->keyboard_tracker_data, info->resource_id);
if (keyboard_status) {
keyboard_signal_emit(nd->keyboard_tracker_data, info->type, info->x_end, info->y_end);
/*TODO: Check if break is necessary or not.
}
break;
case ONE_FINGER_SINGLE_TAP:
- keyboard_status = keyboard_event_status(nd->keyboard_tracker_data, info->x_end, info->y_end);
+ keyboard_status = keyboard_event_status(nd->keyboard_tracker_data, info->resource_id);
if (keyboard_status) {
keyboard_signal_emit(nd->keyboard_tracker_data, info->type, info->x_end, info->y_end);
/*TODO: Check if break is necessary or not.
_focus_widget(nd, info);
break;
case ONE_FINGER_DOUBLE_TAP:
- keyboard_status = keyboard_event_status(nd->keyboard_tracker_data, info->x_end, info->y_end);
+ keyboard_status = keyboard_event_status(nd->keyboard_tracker_data, info->resource_id);
if (keyboard_status) {
keyboard_signal_emit(nd->keyboard_tracker_data, info->type, info->x_end, info->y_end);
if (!_current_highlight_on_keyboard_is(nd))
keyboard_window_is = wi->keyboard_window_is;
}
g_object_unref(wi->window);
- g_free(wi->rect);
g_free(wi);
wtd->window_infos = eina_list_remove_list(wtd->window_infos, l);
removed_index++;
}
}
+static bool _window_extents_get(AtspiAccessible *window, AtspiRect *extents)
+{
+ AtspiComponent *comp = atspi_accessible_get_component_iface(window);
+ if (!comp) {
+ DEBUG("window is not a component");
+ return false;
+ }
+ AtspiRect *rect = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, NULL);
+ g_object_unref(comp);
+ if (!rect) {
+ DEBUG("window has no extents");
+ return false;
+ }
+ *extents = *rect;
+ g_free(rect);
+ return true;
+}
+
+static void _window_info_print(WindowInfo *wi)
+{
+ if (!wi) return;
+ gchar *id = atspi_accessible_get_unique_id(wi->window, NULL);
+ AtspiRect extents;
+ if (_window_extents_get(wi->window, &extents)) {
+ DEBUG("Window: %s (%d, %d, %d, %d) view change need: %d, keyboard window: %d",
+ id, extents.x, extents.y, extents.width, extents.height,
+ wi->view_change_need, wi->keyboard_window_is);
+ } else {
+ DEBUG("Window: %s (no extents available) view change need: %d, keyboard window: %d",
+ id, wi->view_change_need, wi->keyboard_window_is);
+ }
+ g_free(id);
+}
+
static void _window_stack_print(WindowTrackerData *wtd)
{
Eina_List *l;
EINA_LIST_FOREACH(wtd->window_infos, l, wi) {
if (!wi) continue;
- gchar *id = atspi_accessible_get_unique_id(wi->window, NULL);
- DEBUG("Window: %s (%d, %d, %d, %d) view change need: %d, keyboard window: %d",
- id, wi->rect->x, wi->rect->y, wi->rect->width, wi->rect->height,
- wi->view_change_need, wi->keyboard_window_is);
- g_free(id);
+ _window_info_print(wi);
}
}
if (!wi) continue;
if (atspi_accessible_is_equal(wi->window, window)) {
g_object_unref(wi->window);
- g_free(wi->rect);
g_free(wi);
wtd->window_infos = eina_list_remove_list(wtd->window_infos, l);
break;
}
}
- AtspiRect *rect = NULL;
- AtspiComponent *comp = NULL;
- comp = atspi_accessible_get_component_iface(window);
- if (!comp) {
- DEBUG("window is not a component");
- return;
- }
- /* should be ATSPI_COORD_TYPE_SCREEN, but it seems that evas_object_geometry
- would be same with ecore_evas_geometry for window. so the value is doubled */
- rect = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, NULL);
- g_object_unref(comp);
-
wi = g_malloc0(sizeof(WindowInfo));
if (!wi) {
DEBUG("Memory allocation by g_malloc0 is failed");
- g_free(rect);
- g_object_unref(window);
return;
}
- wi->window = window;
- wi->rect = rect;
+ wi->window = g_object_ref(window);
wi->keyboard_window_is = keyboard_window_is;
wi->view_change_need = view_change_need;
wi->window_activate_info_type = window_activate_info_type;
view_change_need = wi->view_change_need;
keyboard_window_is = wi->keyboard_window_is;
g_object_unref(wi->window);
- g_free(wi->rect);
g_free(wi);
wtd->window_infos = eina_list_remove_list(wtd->window_infos, l);
window_removed = EINA_TRUE;
EINA_LIST_FREE(wtd->window_infos, wi) {
if (!wi) continue;
g_object_unref(wi->window);
- g_free(wi->rect);
g_free(wi);
}
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, point: %d, %d",
- id, rect->x, rect->y, rect->width, rect->height,
- wi->view_change_need, wi->keyboard_window_is, x, y);
- g_free(id);
-
- if ((rect->x <= x && rect->x + rect->width >= x) &&
- (rect->y <= y && rect->y + rect->height >= y)) {
+ _window_info_print(wi);
+ AtspiRect extents;
+ if (!_window_extents_get(wi->window, &extents)) continue;
+ if ((extents.x <= x && extents.x + extents.width >= x) &&
+ (extents.y <= y && extents.y + extents.height >= y)) {
return wi->window;
}
}
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);
-
+ _window_info_print(wi);
if (wi->resource_id == resource_id) {
return wi->window;
}
if (!wi) continue;
if (wi->keyboard_window_is) {
g_object_unref(wi->window);
- g_free(wi->rect);
g_free(wi);
wtd->window_infos = eina_list_remove_list(wtd->window_infos, l);
break;
IMPLEMENT_FUNCTION_MOCK2(mock_flat_navi_is_valid, flat_navi_is_valid, FlatNaviContextValidity(FlatNaviContext *, AtspiAccessible *));
IMPLEMENT_FUNCTION_MOCK3(mock_generate_what_to_read_and_speak, generate_what_to_read_and_speak, void(NavigatorData *, AtspiAccessible *, Eina_Bool));
IMPLEMENT_FUNCTION_MOCK0(mock_get_pointer_to_service_data_struct, get_pointer_to_service_data_struct, Service_Data *());
-IMPLEMENT_FUNCTION_MOCK3(mock_keyboard_event_status, keyboard_event_status, Eina_Bool(KeyboardTrackerData *, const int, const int));
-IMPLEMENT_FUNCTION_MOCK5(mock_keyboard_geometry_get, keyboard_geometry_get, Eina_Bool(const KeyboardTrackerData *, int *, int *, int *, int *));
-IMPLEMENT_FUNCTION_MOCK5(mock_keyboard_geometry_set, keyboard_geometry_set, void(KeyboardTrackerData *, int, int, int, int));
+IMPLEMENT_FUNCTION_MOCK3(mock_keyboard_event_status, keyboard_event_status, Eina_Bool(KeyboardTrackerData *, uint32_t resource_id));
IMPLEMENT_FUNCTION_MOCK4(mock_keyboard_signal_emit, keyboard_signal_emit, void(KeyboardTrackerData *, int, int, int));
IMPLEMENT_FUNCTION_MOCK0(mock_keyboard_tracker_init, keyboard_tracker_init, KeyboardTrackerData *());
IMPLEMENT_FUNCTION_MOCK3(mock_keyboard_tracker_register_top_window_info_get, keyboard_tracker_register_top_window_info_get, void(KeyboardTrackerData *, TopWindowInfoGetCb, void *));
DECLARE_FUNCTION_MOCK2(mock_flat_navi_is_valid, flat_navi_is_valid, FlatNaviContextValidity(FlatNaviContext *, AtspiAccessible *));
DECLARE_FUNCTION_MOCK3(mock_generate_what_to_read_and_speak, generate_what_to_read_and_speak, void(NavigatorData *, AtspiAccessible *, Eina_Bool));
DECLARE_FUNCTION_MOCK0(mock_get_pointer_to_service_data_struct, get_pointer_to_service_data_struct, Service_Data *());
-DECLARE_FUNCTION_MOCK3(mock_keyboard_event_status, keyboard_event_status, Eina_Bool(KeyboardTrackerData *, const int, const int));
-DECLARE_FUNCTION_MOCK5(mock_keyboard_geometry_get, keyboard_geometry_get, Eina_Bool(const KeyboardTrackerData *, int *, int *, int *, int *));
-DECLARE_FUNCTION_MOCK5(mock_keyboard_geometry_set, keyboard_geometry_set, void(KeyboardTrackerData *, int, int, int, int));
+DECLARE_FUNCTION_MOCK3(mock_keyboard_event_status, keyboard_event_status, Eina_Bool(KeyboardTrackerData *, uint32_t resource_id));
DECLARE_FUNCTION_MOCK4(mock_keyboard_signal_emit, keyboard_signal_emit, void(KeyboardTrackerData *, int, int, int));
DECLARE_FUNCTION_MOCK0(mock_keyboard_tracker_init, keyboard_tracker_init, KeyboardTrackerData *());
DECLARE_FUNCTION_MOCK3(mock_keyboard_tracker_register_top_window_info_get, keyboard_tracker_register_top_window_info_get, void(KeyboardTrackerData *, TopWindowInfoGetCb, void *));
IMPLEMENT_FUNCTION_MOCK0(mock_haptic_module_init, haptic_module_init, void());
IMPLEMENT_FUNCTION_MOCK2(mock_haptic_vibrate_start, haptic_vibrate_start, void(int, int));
IMPLEMENT_FUNCTION_MOCK0(mock_haptic_vibrate_stop, haptic_vibrate_stop, void());
-IMPLEMENT_FUNCTION_MOCK3(mock_keyboard_event_status, keyboard_event_status, Eina_Bool(KeyboardTrackerData *, const int, const int));
-IMPLEMENT_FUNCTION_MOCK5(mock_keyboard_geometry_get, keyboard_geometry_get, Eina_Bool(const KeyboardTrackerData *, int *, int *, int *, int *));
-IMPLEMENT_FUNCTION_MOCK5(mock_keyboard_geometry_set, keyboard_geometry_set, void(KeyboardTrackerData *, int, int, int, int));
+IMPLEMENT_FUNCTION_MOCK3(mock_keyboard_event_status, keyboard_event_status, Eina_Bool(KeyboardTrackerData *, uint32_t resource_id));
IMPLEMENT_FUNCTION_MOCK4(mock_keyboard_signal_emit, keyboard_signal_emit, void(KeyboardTrackerData *, int, int, int));
IMPLEMENT_FUNCTION_MOCK0(mock_keyboard_tracker_init, keyboard_tracker_init, KeyboardTrackerData *());
IMPLEMENT_FUNCTION_MOCK3(mock_keyboard_tracker_register_top_window_info_get, keyboard_tracker_register_top_window_info_get, void(KeyboardTrackerData *, TopWindowInfoGetCb, void *));
DECLARE_FUNCTION_MOCK0(mock_haptic_module_init, haptic_module_init, void());
DECLARE_FUNCTION_MOCK2(mock_haptic_vibrate_start, haptic_vibrate_start, void(int, int));
DECLARE_FUNCTION_MOCK0(mock_haptic_vibrate_stop, haptic_vibrate_stop, void());
-DECLARE_FUNCTION_MOCK3(mock_keyboard_event_status, keyboard_event_status, Eina_Bool(KeyboardTrackerData *, const int, const int));
-DECLARE_FUNCTION_MOCK5(mock_keyboard_geometry_get, keyboard_geometry_get, Eina_Bool(const KeyboardTrackerData *, int *, int *, int *, int *));
-DECLARE_FUNCTION_MOCK5(mock_keyboard_geometry_set, keyboard_geometry_set, void(KeyboardTrackerData *, int, int, int, int));
+DECLARE_FUNCTION_MOCK3(mock_keyboard_event_status, keyboard_event_status, Eina_Bool(KeyboardTrackerData *, uint32_t resource_id));
DECLARE_FUNCTION_MOCK4(mock_keyboard_signal_emit, keyboard_signal_emit, void(KeyboardTrackerData *, int, int, int));
DECLARE_FUNCTION_MOCK0(mock_keyboard_tracker_init, keyboard_tracker_init, KeyboardTrackerData *());
DECLARE_FUNCTION_MOCK3(mock_keyboard_tracker_register_top_window_info_get, keyboard_tracker_register_top_window_info_get, void(KeyboardTrackerData *, TopWindowInfoGetCb, void *));