/* keyboard_window_is would be always FASLE because the
window_tracker_keyboard_window_remove does not use this function */
if (wtd->user_cb && !keyboard_window_is) {
- top_window = _top_window_get(wtd);
- if (top_window) {
- /* The current top could be keypad window,
- if so, use the second top window */
- wi = eina_list_last_data_get(wtd->window_infos);
- if (wi->keyboard_window_is) {
- int count = eina_list_count(wtd->window_infos);
- wi = eina_list_nth(wtd->window_infos, count - 2);
- if (wi)
- top_window = wi->window;
- else
- top_window = NULL;
- }
- if (top_window)
- wtd->user_cb(wtd->user_data, top_window);
- }
-
- if (!top_window)
- app_tracker_null_context_switch(wtd->user_data);
-
- gchar *id = atspi_accessible_get_unique_id(top_window, NULL);
- DEBUG("top window: %s", id);
- g_free(id);
+ _switch_context_to_non_keyboard_top(wtd);
}
- } else {
+ } else if (removed_index > 0 && keyboard_index == removed_index - 1) {
/* The removed window could be under the keyboard window,
in this case the keyboard window should be removed from the list */
- if (removed_index != 0) {
- int count = eina_list_count(wtd->window_infos);
- wi = eina_list_nth(wtd->window_infos, count - removed_index - 1);
- if (wi) {
- gchar *id = atspi_accessible_get_unique_id(wi->window, NULL);
- DEBUG("Check upper window: %s, keyboard window: %d", id, wi->keyboard_window_is);
- g_free(id);
- if (wi->keyboard_window_is) {
- wtd->window_infos = eina_list_remove(wtd->window_infos, wi);
- g_object_unref(wi->window);
- g_free(wi);
- }
- } else
- DEBUG("Current window info list is emtpy");
- }
+ window_tracker_keyboard_window_remove(wtd);
}
gchar *id = atspi_accessible_get_unique_id(window, NULL);