[at-spi2-core/wip/carlosg/x11-session-checks: 1/3] bus-launch: Do not poke X11 to check at-spi-bus-launcher is running
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core/wip/carlosg/x11-session-checks: 1/3] bus-launch: Do not poke X11 to check at-spi-bus-launcher is running
- Date: Mon, 6 May 2019 14:35:21 +0000 (UTC)
commit 25f1cc6c3e9138e3f27f4879a20546e0c56d4b6b
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon May 6 15:55:27 2019 +0200
bus-launch: Do not poke X11 to check at-spi-bus-launcher is running
The already_running() check first gets the AT_SPI_BUS root window property,
then tries to open it to check if it exists. For it to exist though there
must be another at-spi-bus-launcher process around with the org.a11y.Bus
name.
It seems we can just defer the uniqueness check to g_bus_own_name(), as
we will get the "name lost" callback right after failing to acquire the
unique name. Doing it this way works for both x11 and non-x11, and avoids
assumptions on what the current windowing actually is.
bus/at-spi-bus-launcher.c | 47 -----------------------------------------------
1 file changed, 47 deletions(-)
---
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index 17f01c0..f00dc9a 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -771,50 +771,6 @@ init_sigterm_handling (A11yBusLauncher *app)
app);
}
-static gboolean
-already_running ()
-{
-#ifdef HAVE_X11
- Atom AT_SPI_BUS;
- Atom actual_type;
- Display *bridge_display;
- int actual_format;
- unsigned char *data = NULL;
- unsigned long nitems;
- unsigned long leftover;
- gboolean result = FALSE;
-
- bridge_display = XOpenDisplay (NULL);
- if (!bridge_display)
- return FALSE;
-
- AT_SPI_BUS = XInternAtom (bridge_display, "AT_SPI_BUS", False);
- XGetWindowProperty (bridge_display,
- XDefaultRootWindow (bridge_display),
- AT_SPI_BUS, 0L,
- (long) BUFSIZ, False,
- (Atom) 31, &actual_type, &actual_format,
- &nitems, &leftover, &data);
-
- if (data)
- {
- GDBusConnection *bus;
- bus = g_dbus_connection_new_for_address_sync ((const gchar *)data, 0,
- NULL, NULL, NULL);
- if (bus != NULL)
- {
- result = TRUE;
- g_object_unref (bus);
- }
- }
-
- XCloseDisplay (bridge_display);
- return result;
-#else
- return FALSE;
-#endif
-}
-
static GSettings *
get_schema (const gchar *name)
{
@@ -860,9 +816,6 @@ main (int argc,
gboolean screen_reader_set = FALSE;
gint i;
- if (already_running ())
- return 0;
-
_global_app = g_slice_new0 (A11yBusLauncher);
_global_app->loop = g_main_loop_new (NULL, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]