[mutter] x11-display: Set NO_AT_BRIDGE to 1 while opening the GDK display



commit bd923035d484956340f47674013a1518268172f8
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Feb 23 18:14:17 2021 +0100

    x11-display: Set NO_AT_BRIDGE to 1 while opening the GDK display
    
    gnome-shell has this hack where it sets the environment variable
    "NO_AT_BRIDGE" to "1" before calling meta_init() and then unsets it
    after meta_init() returns.
    
    This variable being set to "1" will then cause the ATK bridge in
    at-spi2-gtk to fail to load, which GTK then ignores. This is on purpose,
    since accessibility is supposed to be done done by GNOME Shell via
    Clutter, not via GTK.
    
    The problem is that, now, by default, setting "NO_AT_BRIDGE" to
    "1" during meta_init() only has the desired effect on an X11 session,
    where we always connect to the X11 server on startup (i.e. during
    meta_init()). With Xwayland on-demand, we do not attempt to create the
    GDK display during meta_init(), thus this hack falls apart.
    
    Since there are no real altenatives to this hack, just move it to
    mutter, which have a better idea when GDK displays are created or not.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1744>

 src/x11/meta-x11-display.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 156304d6b4..e25e3a3680 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -1059,6 +1059,7 @@ meta_x11_init_gdk_display (GError **error)
   const char *xdisplay_name;
   GdkDisplay *gdk_display;
   const char *gdk_gl_env = NULL;
+  const char *old_no_at_bridge;
   Display *xdisplay;
 
   xdisplay_name = meta_x11_get_display_name ();
@@ -1082,7 +1083,10 @@ meta_x11_init_gdk_display (GError **error)
       return FALSE;
     }
 
+  old_no_at_bridge = g_getenv ("NO_AT_BRIDGE");
+  g_setenv ("NO_AT_BRIDGE", "1", TRUE);
   gdk_display = gdk_display_open (xdisplay_name);
+  g_setenv ("NO_AT_BRIDGE", old_no_at_bridge, TRUE);
 
   if (!gdk_display)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]