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>
This commit is contained in:
Jonas Ådahl 2021-02-23 18:14:17 +01:00
parent 2432508db7
commit bd923035d4

View File

@ -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)
{