[PATCH wayland] RFC: Require WAYLAND_DISPLAY to be set instead of using wayland-0 as the default

Ray Strode halfline at gmail.com
Fri Aug 14 08:22:55 PDT 2015


> thanks, and sorry I didn't see your reply before I pushed. :-D
So this commit totally broke gtk+.

Thread 1 (Thread 0x7f3813651980 (LWP 537)):
#0  g_logv (log_domain=0x7f38128b01ce "Gdk",
log_level=G_LOG_LEVEL_ERROR, format=<optimized out>, args=<optimized
    at ../../glib/gmessages.c:1078
#1  0x00007f380edd30cd in wl_log (fmt=fmt at entry=0x7f380edd31b8 "error:
WAYLAND_DISPLAY not set in the environment.\n")
    at ../src/wayland-util.c:385
#2  0x00007f380edd0115 in connect_to_socket (name=0x0) at
#3  wl_display_connect (name=name at entry=0x0) at ../src/wayland-client.c:899
#4  0x00007f38128a5f7e in _gdk_wayland_display_open (display_name=0x0)
at ../../../gdk/wayland/gdkdisplay-wayland.c:443
#5  0x00007f381285b357 in gdk_display_manager_open_display
(manager=<optimized out>, name=0x0)
    at ../../gdk/gdkdisplaymanager.c:463
#6  0x00007f3812d24c10 in gtk_init_check (argc=<optimized out>,
argv=<optimized out>) at ../../gtk/gtkmain.c:1011
#7  0x00007f3812d24c49 in gtk_init (argc=<optimized out>,
argv=<optimized out>) at ../../gtk/gtkmain.c:1068
#8  0x0000000000400e11 in main (argc=0, argv=0x0) at

gtk+ treats wl_log messages as fatal errors. See this commit from krh:


Gtk+ also uses its wayland backend by default, so after this change,
it now dies instead of falings back to the x11 backend on non-wayland sessions.

I've filed https://bugzilla.gnome.org/show_bug.cgi?id=753635 to change
gtk+'s default
behavior to treat wayland errors as debug messages now.

Still, I think this change is wrong headed.  We've been trying to
cleave ourselves from environment variables for years in the default
case.  Having to set this seems like a step backward.
This means having to jump through additional hoops when using systemd
--user sessions, it means
having to jump through an additional hoop when running a program from
a VT, and it means having
to jump through an additional hoop when ssh'ing in to debug something.

if a user runs a program it should show up on the default display in a
clean environment.  save the environment variables for fringe cases
like nested compositors.

The problem purportedly getting fixed gives this as a rationale:

> Now suppose you launch Weston while running the Gnome session. Suddenly, all of the Gtk+ apps
> launched from Gnome will show up inside Weston instead. That's unexpected. There's also no good
> way to prevent that from happening (other than perhaps setting WAYLAND_DISPLAY to an invalid value > when launching an app).
It's wrong to say there's no good way to prevent programs from
launching on weston.  This corner case, can be covered by setting the
GDK_BACKEND environment variable.  edge cases should use environment
variables not the default case.

Furthermore, the commit says it's trying to fix a scenario where the
user is logged into X, but the commit actually breaks X logins
(because of the above log handler issue)!  That means it wasn't

I don't think the commit is good idea at all, can we revert it ?

XDG_RUNTIME_DIR is supposed to free us from other environment variables.


More information about the wayland-devel mailing list