Commit b68e60b7 authored by Carlos Garnacho's avatar Carlos Garnacho

Resort to WAYLAND_DISPLAY checks to avoid X11 connections

Same reasoning applies (Opening and closing X11 displays may be from
ineffective to harmful there), but the XDG_SESSION_TYPE check breaks
for startx.

Explicitly check that DISPLAY is present but WAYLAND_DISPLAY is not,
in order to avoid this behavior.

Pointed out at
!12
parent ffba513d
...@@ -1601,7 +1601,8 @@ atspi_get_a11y_bus (void) ...@@ -1601,7 +1601,8 @@ atspi_get_a11y_bus (void)
if (address_env != NULL && *address_env != 0) if (address_env != NULL && *address_env != 0)
address = g_strdup (address_env); address = g_strdup (address_env);
#ifdef HAVE_X11 #ifdef HAVE_X11
if (!address && g_strcmp0 (g_getenv ("XDG_SESSION_TYPE"), "x11") == 0) if (!address && g_getenv ("DISPLAY") != NULL &&
g_getenv ("WAYLAND_DISPLAY") == NULL)
address = get_accessibility_bus_address_x11 (); address = get_accessibility_bus_address_x11 ();
#endif #endif
if (!address) if (!address)
......
...@@ -466,7 +466,7 @@ ensure_a11y_bus (A11yBusLauncher *app) ...@@ -466,7 +466,7 @@ ensure_a11y_bus (A11yBusLauncher *app)
#endif #endif
#ifdef HAVE_X11 #ifdef HAVE_X11
if (g_strcmp0 (g_getenv ("XDG_SESSION_TYPE"), "x11") == 0) if (g_getenv ("DISPLAY") != NULL && g_getenv ("WAYLAND_DISPLAY") == NULL)
{ {
Display *display = XOpenDisplay (NULL); Display *display = XOpenDisplay (NULL);
if (display) if (display)
...@@ -885,7 +885,7 @@ main (int argc, ...@@ -885,7 +885,7 @@ main (int argc,
* we don't want early login processes to pick up the stale address. * we don't want early login processes to pick up the stale address.
*/ */
#ifdef HAVE_X11 #ifdef HAVE_X11
if (g_strcmp0 (g_getenv ("XDG_SESSION_TYPE"), "x11") == 0) if (g_getenv ("DISPLAY") != NULL && g_getenv ("WAYLAND_DISPLAY") == NULL)
{ {
Display *display = XOpenDisplay (NULL); Display *display = XOpenDisplay (NULL);
if (display) if (display)
......
...@@ -1856,7 +1856,7 @@ spi_device_event_controller_class_init (SpiDEControllerClass *klass) ...@@ -1856,7 +1856,7 @@ spi_device_event_controller_class_init (SpiDEControllerClass *klass)
object_class->finalize = spi_device_event_controller_object_finalize; object_class->finalize = spi_device_event_controller_object_finalize;
#ifdef HAVE_X11 #ifdef HAVE_X11
if (g_strcmp0 (g_getenv ("XDG_SESSION_TYPE"), "x11") == 0) if (g_getenv ("DISPLAY") != NULL && g_getenv ("WAYLAND_DISPLAY") == NULL)
spi_dec_setup_x11 (klass); spi_dec_setup_x11 (klass);
else else
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment