Skip to content
Snippets Groups Projects
Commit 7eba31b0 authored by Simon McVittie's avatar Simon McVittie
Browse files

run-dbus: Don't call GetAddress() if AT_SPI_BUS_ADDRESS is set


In the real at-spi2-core client library, AT_SPI_BUS_ADDRESS is treated
as higher-precedence than the AT_SPI_BUS X11 atom or the GetAddress()
D-Bus method. Mimic this.

We don't currently implement querying the X11 atom because that would
require a libX11 dependency, so leave a comment indicating where it
would appear in precedence order.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
Forwarded: https://github.com/flatpak/flatpak/pull/6173
parent eab5a784
No related branches found
No related tags found
1 merge request!799run-dbus: Don't call GetAddress() if AT_SPI_BUS_ADDRESS is set
......@@ -419,6 +419,7 @@ flatpak_run_add_a11y_dbus_args (FlatpakBwrap *app_bwrap,
g_autoptr(GDBusMessage) reply = NULL;
g_autoptr(GDBusMessage) msg = NULL;
g_autofree char *proxy_socket = NULL;
const char *value;
if ((flags & FLATPAK_RUN_FLAG_NO_A11Y_BUS_PROXY) != 0)
return FALSE;
......@@ -427,26 +428,45 @@ flatpak_run_add_a11y_dbus_args (FlatpakBwrap *app_bwrap,
if (session_bus == NULL)
return FALSE;
msg = g_dbus_message_new_method_call ("org.a11y.Bus", "/org/a11y/bus", "org.a11y.Bus", "GetAddress");
g_dbus_message_set_body (msg, g_variant_new ("()"));
reply =
g_dbus_connection_send_message_with_reply_sync (session_bus, msg,
G_DBUS_SEND_MESSAGE_FLAGS_NONE,
30000,
NULL,
NULL,
NULL);
if (reply)
value = g_getenv ("AT_SPI_BUS_ADDRESS");
if (value != NULL && value[0] != '\0')
{
if (g_dbus_message_to_gerror (reply, &local_error))
{
if (!g_error_matches (local_error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN))
g_message ("Can't find a11y bus: %s", local_error->message);
}
else
a11y_address = g_strdup (value);
g_debug ("Retrieved AT-SPI bus address \"%s\" from environment",
a11y_address);
}
/* To have an accurate emulation of AT-SPI's behaviour, ideally we would
* also query the AT_SPI_BUS atom on the root window if a11y_address is
* still NULL here, but that would require a libX11 dependency, and
* isn't done when running under native Wayland anyway. */
if (a11y_address == NULL)
{
msg = g_dbus_message_new_method_call ("org.a11y.Bus", "/org/a11y/bus", "org.a11y.Bus", "GetAddress");
g_dbus_message_set_body (msg, g_variant_new ("()"));
reply =
g_dbus_connection_send_message_with_reply_sync (session_bus, msg,
G_DBUS_SEND_MESSAGE_FLAGS_NONE,
30000,
NULL,
NULL,
NULL);
if (reply)
{
g_variant_get (g_dbus_message_get_body (reply),
"(s)", &a11y_address);
if (g_dbus_message_to_gerror (reply, &local_error))
{
if (!g_error_matches (local_error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN))
g_message ("Can't find a11y bus: %s", local_error->message);
}
else
{
g_variant_get (g_dbus_message_get_body (reply),
"(s)", &a11y_address);
g_debug ("Retrieved AT-SPI bus address \"%s\" from session bus",
a11y_address);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment