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

Kitty passes invalid serials to wp_primary_selection_device_v1.set_selection on Wayland #6785

Closed
ifreund opened this issue Nov 3, 2023 · 1 comment
Labels

Comments

@ifreund
Copy link

ifreund commented Nov 3, 2023

Originally reported here on the river issue tracker https://github.com/riverwm/river/issues/843

Describe the bug
See the following snippet of a WAYLAND_DEBUG=1 log of kitty running under river:

[2732566.564] wl_pointer@19.button(2014637, 3287197511, 272, 0)
[2732566.630]  -> zwp_primary_selection_device_manager_v1@10.create_source(new id zwp_primary_selection_source_v1@29)
[2732566.639]  -> zwp_primary_selection_source_v1@29.offer("application/glfw+clipboard-1469")
[2732566.643]  -> zwp_primary_selection_source_v1@29.offer("TEXT")
[2732566.646]  -> zwp_primary_selection_source_v1@29.offer("STRING")
[2732566.649]  -> zwp_primary_selection_source_v1@29.offer("UTF8_STRING")
[2732566.651]  -> zwp_primary_selection_source_v1@29.offer("text/plain;charset=utf-8")
[2732566.654]  -> zwp_primary_selection_source_v1@29.offer("text/plain")
[2732566.657]  -> wl_display@1.sync(new id wl_callback@30)
[2732566.667] wl_pointer@19.frame()
[2732567.174] wl_display@1.delete_id(30)
[2732567.184] wl_callback@30.done(2014639)
[2732567.189]  -> zwp_primary_selection_device_v1@14.set_selection(zwp_primary_selection_source_v1@29, 2014639)

The correct serial to pass to set_selection is the serial from the wl_pointer.button event, 2014637.
However, kitty passes the serial from the wl_callback.done event, 2014639.

See https://github.com/riverwm/river/issues/843#issuecomment-1792309466 for more context.

To Reproduce
Steps to reproduce the behavior:

  1. Run kitty under river's master branch
  2. Select text in kitty
  3. Attempt to paste the selected text with the middle mouse button
  4. Notice that the text isn't pasted
  5. Run with WAYLAND_DEBUG=1 set to reproduce the log above.

Environment details

kitty 0.30.1 created by Kovid Goyal
Linux trantor 6.1.34_1 #1 SMP PREEMPT_DYNAMIC Wed Jun 21 10:32:52 UTC 2023 x86_64
Void 6.1.34_1 (trantor) (/dev/tty)

Running under: Wayland
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /usr/bin/zsh

Config options different from defaults:

Important environment variables seen by the kitty process:
	PATH                                /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/texlive/2023/bin/x86_64-linux
	LANG                                en_US.UTF-8
	VISUAL                              kak
	EDITOR                              kak
	SHELL                               /usr/bin/zsh
	DISPLAY                             :0
	WAYLAND_DISPLAY                     wayland-1
	USER                                ifreund
	XCURSOR_SIZE                        24
	XDG_SESSION_TYPE                    wayland
	LC_COLLATE                          C
	XDG_RUNTIME_DIR                     /run/user/1000
	XDG_CURRENT_DESKTOP                 river
	XDG_CONFIG_HOME                     /home/ifreund/.config

@ifreund ifreund added the bug label Nov 3, 2023
@ifreund
Copy link
Author

ifreund commented Nov 3, 2023

If I may suggest a fix, I don't see any reason for kitty to call wl_display_sync here:

struct wl_callback *callback = wl_display_sync(_glfw.wl.display);
Eliminating that call and inlining the callbacks would make using the correct serial trivial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant