wl_display_connect() falling back to wayland-0

Bill Spitzak spitzak at gmail.com
Wed Dec 11 11:16:22 PST 2013


I certainly like that there is a fallback. The user should not have to 
set environment variables to get something to work.

In our software using X we always check if DISPLAY is set and if not set 
it to ":0". This is so the program just works even if the user's setup 
is wrong. (The primary reason though was because we need access to 
OpenGL even if there is no GUI running, which I assume (and hope) will 
not be a problem with EGL/Gl/Wayland, ie you can get access to this 
hardware if it exists, even if you are not allowed to talk to a wayland 
compositor).

I do think the proper solution is for gtk+ to check the environment 
variables before calling it. Thus it can make up the rules for which one 
takes precedence if neither $WAYLAND_DISPLAY or $DISPLAY is set.

Jason Ekstrand wrote:

> How do you work around it?  What you got from Pekka is half right. You 
> need to check for both WAYLAND_DISPLAY and WAYLAND_SOCKET.  The former 
> is the catch-all "connect to this socket; it lives in XDG_RUNTIME_DIR."  
> The other is a mechanism for passing the client a specific file 
> descriptor that it is expected to use for it's connection. This is 
> usually used for launching trusted clients such as the panel.

It might be nice if WAYLAND_SOCKET was instead a special value in 
WAYLAND_DISPLAY. Or is there a reason a program would need 
WAYLAND_DISPLAY if WAYLAND_SOCKET was set?


More information about the wayland-devel mailing list