Merge branch 'upstream' into tizen 90/254890/1
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>
Wed, 10 Mar 2021 08:50:28 +0000 (09:50 +0100)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Wed, 10 Mar 2021 08:50:28 +0000 (09:50 +0100)
Change-Id: Ie83d1576e026d82e7484cba6ec71cd8ed24345ae

1  2 
NEWS
atk-adaptor/bridge.c
atk-adaptor/event.c
atk-adaptor/object.c

diff --combined NEWS
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -1,3 -1,19 +1,19 @@@
+ What's new in at-spi2-atk 2.37.90:
+ * Add support for the new mark and suggestion roles (!21).
+ * Meson: add tests option (!22).
+ What's new in at-spi2-atk 2.34.2:
+ * Meson: don't hard-code shared_library (!19).
+ * Mitigate missing window events at startup.
+ * Set C standard to gnu99 (#10).
+ * Tests: include sys/time.h (#14).
  What's new in at-spi2-atk 2.34.1:
  
  * socket_embed_hook: Make plug_id parameter const.
@@@ -8,7 -24,7 +24,7 @@@ What's new in at-spi2-atk 2.34.0
  
  What's new in at-spi2-atk 2.33.92:
  
- * License is now lGPL-2.1+.
+ * License is now LGPL-2.1+.
  * Several test fixes (thanks to Samuel THibault).
  * Initialize desktop name/path early; needed since we now defer
    registration.
@@@ -267,7 -283,7 +283,7 @@@ What's new in at-spi2-atk 2.7.2
  
  * atk-adaptor: don't emit a critical in case the bridge was not initialized
    (BGO#684334).
 -    
 +
  * Remove dbind (it was only used for the droute test).
  
  * Fix a crash in socket_embed_hook if spi_global_register is NULL.
@@@ -409,7 -425,7 +425,7 @@@ What's new in at-spi2-atk 2.3.2
  
  * Fix for BGO#663876: Make sure the a11y hierarchy under an AtkPlug is
    generated when embedding.
 -    
 +
  What's new in at-spi2-atk 2.3.1:
  
  * Fix a small coding error that could generate compiler warnings.
diff --combined atk-adaptor/bridge.c
@@@ -201,11 -201,7 +201,11 @@@ add_property_to_event (event_data *evda
    }
  
    prop->name = g_strdup (property);
 -  evdata->properties = g_slist_append (evdata->properties, prop);
 +
 +  if (evdata)
 +  {
 +    evdata->properties = g_slist_append (evdata->properties, prop);
 +  }
  }
  
  static void
@@@ -307,7 -303,6 +307,7 @@@ get_registered_event_listeners (SpiBrid
  {
    DBusMessage *message;
    DBusPendingCall *pending = NULL;
 +  dbus_bool_t result;
  
    message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
                                           ATSPI_DBUS_PATH_REGISTRY,
    if (!message)
      return;
  
 -  dbus_connection_send_with_reply (app->bus, message, &pending, -1);
 +  result = dbus_connection_send_with_reply (app->bus, message, &pending, -1);
    dbus_message_unref (message);
 -  if (!pending)
 +  if (!result || !pending)
      {
        spi_global_app_data->events_initialized = TRUE;
        return;
    if (!message)
      return;
    pending = NULL;
 -  dbus_connection_send_with_reply (app->bus, message, &pending, -1);
 +  result = dbus_connection_send_with_reply (app->bus, message, &pending, -1);
    dbus_message_unref (message);
 -  if (!pending)
 +  if (!result || !pending)
      {
        spi_global_app_data->events_initialized = TRUE;
        return;
    if (!message)
      return;
    pending = NULL;
 -  dbus_connection_send_with_reply (app->bus, message, &pending, -1);
 +  result = dbus_connection_send_with_reply (app->bus, message, &pending, -1);
    dbus_message_unref (message);
 -  if (!pending)
 +  if (!result || !pending)
      {
        spi_global_app_data->events_initialized = TRUE;
        return;
@@@ -408,8 -403,8 +408,8 @@@ register_reply (DBusPendingCall *pendin
      get_registered_event_listeners (spi_global_app_data);
  }
  
- gboolean
_atk_bridge_register_application (gpointer data)
static gboolean
+ register_application (gpointer data)
  {
    SpiBridge * app = data;
    DBusMessage *message;
  
    dbus_message_iter_init_append (message, &iter);
    spi_object_append_reference (&iter, app->root);
 -  
 +
      if (!dbus_connection_send_with_reply (app->bus, message, &pending, -1)
          || !pending)
      {
    return FALSE;
  }
  
+ void
+ _atk_bridge_schedule_application_registration (SpiBridge *app)
+ {
+   /* We need the callback to be called first thing, before any other of ours
+    * (and possibly of client apps), so use a high priority and a short timeout
+    * to try and be called first by the main loop. */
+   if (!app->registration_pending)
+     app->registration_pending = spi_timeout_add_full (G_PRIORITY_HIGH, 0,
+                                                       register_application,
+                                                       app, NULL);
+ }
+ gboolean
+ _atk_bridge_remove_pending_application_registration (SpiBridge *app)
+ {
+   if (app->registration_pending)
+   {
+     g_source_remove (app->registration_pending);
+     app->registration_pending = 0;
+     return TRUE;
+   }
+   return FALSE;
+ }
  /*---------------------------------------------------------------------------*/
  
  static void
@@@ -475,12 -495,8 +500,8 @@@ deregister_application (SpiBridge * app
    DBusMessageIter iter;
    const char *uname;
  
-   if (spi_global_app_data->registration_pending)
-   {
-     g_source_remove (spi_global_app_data->registration_pending);
-     spi_global_app_data->registration_pending = 0;
+   if (_atk_bridge_remove_pending_application_registration (spi_global_app_data))
      return;
-   }
  
    message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
                                            ATSPI_DBUS_PATH_REGISTRY,
@@@ -855,7 -871,7 +876,7 @@@ signal_filter (DBusConnection *bus, DBu
              {
                if (registry_lost && !old[0])
                  {
-                   _atk_bridge_register_application (spi_global_app_data);
+                   register_application (spi_global_app_data);
                    registry_lost = FALSE;
                  }
                else if (!new[0])
@@@ -1056,7 -1072,7 +1077,7 @@@ atk_bridge_adaptor_init (gint * argc, g
    /* Hook our plug-and socket functions */
    install_plug_hooks ();
  
 -  /* 
 +  /*
     * Create the leasing, register and cache objects.
     * The order is important here, the cache depends on the
     * register object.
                                NULL);
  
    /* Register this app by sending a signal out to AT-SPI registry daemon */
-   if (!atspi_no_register && (!root || !ATK_IS_PLUG (root)) &&
-       !spi_global_app_data->registration_pending)
-     spi_global_app_data->registration_pending = spi_idle_add (_atk_bridge_register_application, spi_global_app_data);
+   if (!atspi_no_register && (!root || !ATK_IS_PLUG (root)))
+     _atk_bridge_schedule_application_registration (spi_global_app_data);
    else
      get_registered_event_listeners (spi_global_app_data);
  
diff --combined atk-adaptor/event.c
@@@ -73,11 -73,8 +73,8 @@@ switch_main_context (GMainContext *cnx
    for (list = spi_global_app_data->direct_connections; list; list = list->next)
      atspi_dbus_connection_setup_with_g_main (list->data, cnx);
  
-   if (spi_global_app_data->registration_pending)
-   {
-     g_source_remove (spi_global_app_data->registration_pending);
-     spi_global_app_data->registration_pending = spi_idle_add (_atk_bridge_register_application, spi_global_app_data);
-   }
+   if (_atk_bridge_remove_pending_application_registration (spi_global_app_data))
+     _atk_bridge_schedule_application_registration (spi_global_app_data);
  }
  
  guint
@@@ -108,6 -105,22 +105,22 @@@ spi_timeout_add_seconds (gint interval
    return id;
  }
  
+ guint
+ spi_timeout_add_full (gint priority, guint interval, GSourceFunc function,
+                       gpointer data, GDestroyNotify notify)
+ {
+   GSource *source;
+   guint id;
+   source = g_timeout_source_new (interval);
+   g_source_set_priority (source, priority);
+   g_source_set_callback (source, function, data, notify);
+   id = g_source_attach (source, spi_context);
+   g_source_unref (source);
+   return id;
+ }
  static void
  set_reply (DBusPendingCall * pending, void *user_data)
  {
@@@ -959,7 -972,7 +972,7 @@@ text_insert_event_listener (GSignalInvo
    guint text_changed_signal_id;
    GSignalQuery signal_query;
    const gchar *name;
 -  const gchar *minor_raw, *text;
 +  const gchar *minor_raw, *text = NULL;
    gchar *minor;
    gint detail1 = 0, detail2 = 0;
  
    else
      text = "";
  
 -  emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
 -              DBUS_TYPE_STRING_AS_STRING, text, append_basic);
 +  if (text != NULL)
 +    emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
 +                DBUS_TYPE_STRING_AS_STRING, text, append_basic);
    g_free (minor);
    return TRUE;
  }
@@@ -1011,7 -1023,7 +1024,7 @@@ text_remove_event_listener (GSignalInvo
    guint text_changed_signal_id;
    GSignalQuery signal_query;
    const gchar *name;
 -  const gchar *minor_raw, *text;
 +  const gchar *minor_raw, *text = NULL;
    gchar *minor;
    gint detail1 = 0, detail2 = 0;
  
    else
      text = "";
  
 -  emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
 -              DBUS_TYPE_STRING_AS_STRING, text, append_basic);
 +  if (text != NULL)
 +    emit_event (accessible, ITF_EVENT_OBJECT, name, minor, detail1, detail2,
 +                DBUS_TYPE_STRING_AS_STRING, text, append_basic);
    g_free (minor);
    return TRUE;
  }
diff --combined atk-adaptor/object.c
@@@ -114,7 -114,7 +114,7 @@@ spi_object_append_reference (DBusMessag
    dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
    dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
    dbus_message_iter_close_container (iter, &iter_struct);
 -  
 +
    g_free (path);
  }
  
@@@ -145,7 -145,7 +145,7 @@@ spi_hyperlink_append_reference (DBusMes
    dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name);
    dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_OBJECT_PATH, &path);
    dbus_message_iter_close_container (iter, &iter_struct);
 -  
 +
    g_free (path);
  }
  
@@@ -485,6 -485,8 +485,8 @@@ init_role_lookup_table (AtspiRole * rol
    role_table[ATK_ROLE_FOOTNOTE] = ATSPI_ROLE_FOOTNOTE;
    role_table[ATK_ROLE_CONTENT_DELETION] = ATSPI_ROLE_CONTENT_DELETION;
    role_table[ATK_ROLE_CONTENT_INSERTION] = ATSPI_ROLE_CONTENT_INSERTION;
+   role_table[ATK_ROLE_MARK] = ATSPI_ROLE_MARK;
+   role_table[ATK_ROLE_SUGGESTION] = ATSPI_ROLE_SUGGESTION;
  
    return TRUE;
  }