Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wayland availability detection does not check for WAYLAND_SOCKET #3459

Closed
mstoeckl opened this issue Feb 7, 2024 · 4 comments · Fixed by #3460
Closed

Wayland availability detection does not check for WAYLAND_SOCKET #3459

mstoeckl opened this issue Feb 7, 2024 · 4 comments · Fixed by #3460
Labels
B - bug Dang, that shouldn't have happened DS - wayland

Comments

@mstoeckl
Copy link

mstoeckl commented Feb 7, 2024

Wayland clients have two methods of connecting to the compositor. If the environment variable WAYLAND_DISPLAY is set, they can connect() to the Unix socket at a path indicated by WAYLAND_DISPLAY. A much rarer case is when the environment variable WAYLAND_SOCKET is set; then the compositor will have provided one end of a socket pair through file descriptor inheritance, and the value of WAYLAND_SOCKET will indicate the file descriptor ID.

Currently, winit when autodetecting which backend to use only checks for WAYLAND_DISPLAY, not WAYLAND_SOCKET. (The code that does this check is in src/platform_impl/linux/mod.rs .) It should consider the Wayland backend to be usable if either of WAYLAND_DISPLAY or WAYLAND_SOCKET is available.

To test this, run a program using winit under a compositor or tool that provides a Wayland connection using WAYLAND_SOCKET. (The way I ran into this issue was with the command waypipe--oneshot ssh localhostalacritty.)

@kchibisov
Copy link
Member

#3460

@kchibisov
Copy link
Member

I have a feeling that if you set WAYLAND_DISPLAY to some garbage value it'll workaround the issue.

@kchibisov kchibisov added the B - bug Dang, that shouldn't have happened label Feb 7, 2024
kchibisov added a commit that referenced this issue Feb 7, 2024
@kchibisov
Copy link
Member

While I was testing it, I've discovered that empty WAYLAND_SOCKET prevents from running as will if you have e.g. WAYLAND_DISPLAY set Smithay/wayland-rs#697

The logic in wayland-rs follows the libwayland here, hence do you happen to know why it's like that there?

@kchibisov
Copy link
Member

kchibisov added a commit to kchibisov/winit that referenced this issue Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened DS - wayland
Development

Successfully merging a pull request may close this issue.

2 participants