Revert "Extended check for being active window object" 53/286553/1
authorArtur Świgoń <a.swigon@samsung.com>
Mon, 9 Jan 2023 15:31:02 +0000 (16:31 +0100)
committerArtur Świgoń <a.swigon@samsung.com>
Mon, 9 Jan 2023 15:46:12 +0000 (16:46 +0100)
This reverts commit 27ad6f0016c19962614b061c0af3aebc1aaec0d8.

Change-Id: Ib3ae2a4baa730aab3596aa15e918a0d0c81e1564

src/screen_reader_spi.c

index 348fe16fb8f7b043869596bdf05a9f901209bda1..998f62236fe50f74ed0ce5032483f5e0aeafd8c2 100644 (file)
@@ -204,59 +204,20 @@ static char *spi_on_text_delete(SpiData *spi, AtspiEvent *event)
        return g_strdup(ret);
 }
 
-static void clear(gpointer d)
-{
-       AtspiAccessible **data = d;
-       AtspiAccessible *obj = *data;
-       g_object_unref(obj);
-}
-
 static bool is_active_window_object(AtspiAccessible *accessible)
 {
-       AtspiAccessible *active_window = atspi_get_active_window();
-       if (!active_window)
+       AtspiAccessible *window = atspi_get_active_window();
+       if (!window)
                return false;
 
        gchar *accessible_bus_name = atspi_accessible_get_bus_name(accessible, NULL);
-       gchar *active_window_bus_name = atspi_accessible_get_bus_name(active_window, NULL);
-
-       bool result = is_same_str(accessible_bus_name, active_window_bus_name);
-
-       if (!result) {
-               GHashTable *attributes = g_hash_table_new(g_str_hash, g_str_equal);
-               g_hash_table_insert(attributes, "child_bus", accessible_bus_name);
-
-               AtspiMatchRule *rule = atspi_match_rule_new(
-                                                                       NULL,
-                                                                       ATSPI_Collection_MATCH_INVALID,
-                                                                       attributes,
-                                                                       ATSPI_Collection_MATCH_ANY,
-                                                                       NULL,
-                                                                       ATSPI_Collection_MATCH_INVALID,
-                                                                       NULL,
-                                                                       ATSPI_Collection_MATCH_INVALID,
-                                                                       FALSE);
-               AtspiCollection *col_iface = atspi_accessible_get_collection_iface(active_window);
-               GArray *query_result = atspi_collection_get_matches(
-                                                                       col_iface,
-                                                                       rule,
-                                                                       ATSPI_Collection_SORT_ORDER_CANONICAL,
-                                                                       0,
-                                                                       TRUE,
-                                                                       NULL);
-               g_hash_table_destroy(attributes);
-               g_object_unref(col_iface);
-
-               if (query_result) {
-                       result = query_result->len > 0;
-                       g_array_set_clear_func(query_result, clear);
-                       g_array_free(query_result, TRUE);
-               }
-               g_object_unref(rule);
-       }
-       g_free(active_window_bus_name);
+       gchar *window_bus_name = atspi_accessible_get_bus_name(window, NULL);
+
+       bool result = is_same_str(accessible_bus_name, window_bus_name);
+
+       g_free(window_bus_name);
        g_free(accessible_bus_name);
-       g_object_unref(active_window);
+       g_object_unref(window);
 
        return result;
 }