-
Notifications
You must be signed in to change notification settings - Fork 73
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
Selection ownership gets lost immediately on weston-xwayland setup #139
Comments
Have you found any workarounds? I'm not sure how xclip could address this issue. |
@quartzjer I haven't found any workarounds. I'm sure you'll agree that this is not really xclip's fault here. I'm not sure why Xwayland clears the selection during init. I also don't know if this is a wsl specific issue or Weston in general. I don't have a Linux setup, so could you check if this also happens in a non-WSL Wayland environment? To see the bug you need to make sure the xclip selection triggers xwayland init (i.e. xwayland must not be init'd until then). |
I've got Debian GNU/Linux but am not familiar with Weston. I was able to run Weston from a virtual terminal, but trying xclip just gives me an error that it cannot open the DISPLAY. Is there some set up needed to get it to run Xwayland automatically? With Gnome (using the Mutter compositor), Xwayland is launched correctly as needed and the selection is not cleared. |
You need to enable xwayland using @quartzjer Looks like this is a weston issue and not WSL-specific, but WSL is certainly the edge case since xclip is often the only xclient installed on the system since there's no GUI. Weston starts a proxy x-server which only listens for clients until one of the clients wants to talk to an xserver. At this point, Weston starts the actual x-server to serve the client. Once xserver has started two things happen: the client gets its request fulfilled (E.g. XSetSelectionOwner) and at the same time Weston is preparing the window manager (wm) for Xwayland. These happen at the same time, asynchronously, and lead to race. If XSetSelectionOwner happens first and then wm is ready, WM will clear the selection during the init. |
The bug does not occur under Debian GNU/Linux (Sid) which currently has Weston 14.0.1 and Xwayland 24.1.4. I am running a custom development version of xclip, but it should not matter. Update: I should mention, Weston looks graphical to me, so perhaps wm is already running? I tried using
and it still seemed to work fine. |
Does the same problem happen when you try |
I can't repro it anymore on wsl. It seems wsl startup now eagerly starts xwayland (and xserver) which makes this issue virtually non-existent. If you run grep on weston's log, it shows Xwayland server is already running: $ grep -i xwayland /mnt/wslg/weston.log
[11:33:21.407] Command line: /usr/bin/weston --backend=rdp-backend.so --modules=wslgd-notify.so --xwayland --socket=wayland-0 --shell=rdprail-shell.so --log=/mnt/wslg/weston.log --logger-scopes=log,rdp-backend,rdprail-shell
[11:33:21.443] Loading module '/usr/lib/libweston-9/xwayland.so'
[11:33:21.445] Registered plugin API 'weston_xwayland_v1' of size 32
[11:33:21.445] Registered plugin API 'weston_xwayland_surface_v1' of size 48
[11:33:21.445] Not using abstract fd for Xwayland
[11:33:21.529] Spawned Xwayland server, pid 46 |
When xclip is used with Wayland compositor Weston, xclip loses selection ownership immediately and returns without waiting for
SelectionRequest
. Weston usually takes ownership before any X client on the server, due to which when xclip creates a window on the server and sets selection ownership together (b/c window creation request remains buffered untilXGetSelectionOwner()
), the xclip receivesSelectionClear
immediately after it.Debug log:
Note: window id 0x200001 belongs to xwayland.
I have also tested the behaviour against master.
other reference issues:
microsoft/terminal#11945
The text was updated successfully, but these errors were encountered: