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

Both wl-copy and wl-paste hang in SailfishOS #85

Closed
Kabouik opened this issue May 27, 2020 · 9 comments
Closed

Both wl-copy and wl-paste hang in SailfishOS #85

Kabouik opened this issue May 27, 2020 · 9 comments
Labels
cant-grab-focus Compositor disallows stealing focus but does not support wlr-data-control

Comments

@Kabouik
Copy link

Kabouik commented May 27, 2020

I tried building wl-clipboard on Sailfish OS (which uses an ancient version of Wayland) because we don't have xclip/xsel and I was hoping to use wl-clipboard as a replacement in combination with the wl-clipboard-x11 wrapper for applications that specifically look for xclip/xsel.

I'm putting here the build logs because there were some dependencies missing apparently, but if I understood correctly the README, only wayland-client should be mandatory:

[nemo@Sailfish wl-clipboard]$ meson build
The Meson build system
Version: 0.50.1
Source dir: /home/nemo/Templates/wl-clipboard
Build dir: /home/nemo/Templates/wl-clipboard/build
Build type: native build
Project name: wl-clipboard
Project version: 2.0.0
Native C compiler: ccache cc (gcc 8.3.0 "cc (Linaro GCC 8.2-2018.08~dev) 8.3.0 20190222 (Sailfish OS gcc 8.3.0-3)")
Build machine cpu family: arm
Build machine cpu: arm
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Dependency wayland-client found: YES 1.17.0
Program wayland-scanner found: YES (/usr/bin/wayland-scanner)
Dependency wayland-protocols found: YES 1.17
Header <sys/syscall.h> has symbol "SYS_memfd_create" : YES
Header <sys/mman.h> has symbol "SHM_ANON" : NO
Configuring config.h using configuration
Found CMake: /usr/bin/cmake (3.11.4)
Dependency fish found: NO (tried pkgconfig and cmake)
Build targets in project: 15
Found ninja-1.8.2 at /usr/bin/ninja
[nemo@Sailfish wl-clipboard]$ cd build/
[nemo@Sailfish build]$ ninja
[35/35] Linking target src/wl-paste.
[nemo@Sailfish build]$ devel-su ninja install
Password: 
[0/1] Installing files.
Installing src/wl-copy to /usr/local/bin
Installing src/wl-paste to /usr/local/bin
Installing /home/nemo/Templates/wl-clipboard/data/wl-copy.1 to /usr/local/share/man/man1
Installing /home/nemo/Templates/wl-clipboard/data/wl-paste.1 to /usr/local/share/man/man1
Installing /home/nemo/Templates/wl-clipboard/data/wl-clipboard.1 to /usr/local/share/man/man1
Installing /home/nemo/Templates/wl-clipboard/completions/bash/wl-copy to /usr/local/share/bash-completion/completions
Installing /home/nemo/Templates/wl-clipboard/completions/bash/wl-paste to /usr/local/share/bash-completion/completions
Installing /home/nemo/Templates/wl-clipboard/completions/zsh/_wl-copy to /usr/local/share/zsh/site-functions
Installing /home/nemo/Templates/wl-clipboard/completions/zsh/_wl-paste to /usr/local/share/zsh/site-functions
Installing /home/nemo/Templates/wl-clipboard/completions/fish/wl-copy.fish to /usr/share/fish/vendor_completions.d
Installing /home/nemo/Templates/wl-clipboard/completions/fish/wl-paste.fish to /usr/share/fish/vendor_completions.d
[nemo@Sailfish build]$ wl-copy Hello World
^C
[nemo@Sailfish build]$ wl-paste
^C
[nemo@Sailfish build]$ devel-su zypper search wayland-devel
Password: 
Loading repository data...
Reading installed packages...

S  | Name                           | Summary                                           | Type   
---+--------------------------------+---------------------------------------------------+--------
   | maliit-framework-wayland-devel | Maliit Framework Input Method Development Package | package
i+ | wayland-devel                  | wayland devel library                             | package
[nemo@Sailfish build]$ wl-copy test
^C
[nemo@Sailfish build]$ wl-copy --help
Usage:
	wl-copy [options] text to copy
	wl-copy [options] < file-to-copy

Copy content to the Wayland clipboard.

Options:
	-o, --paste-once	Only serve one paste request and then exit.
	-f, --foreground	Stay in the foreground instead of forking.
	-c, --clear		Instead of copying anything, clear the clipboard.
	-p, --primary		Use the "primary" clipboard.
	-n, --trim-newline	Do not copy the trailing newline character.
	-t, --type mime/type	Override the inferred MIME type for the content.
	-s, --seat seat-name	Pick the seat to work with.
	-v, --version		Display version info.
	-h, --help		Display this message.
Mandatory arguments to long options are mandatory for short options too.

See wl-clipboard(1) for more details.
[nemo@Sailfish build]$ wl-copy test tsts t

Do I need other dependencies?

@bugaevc
Copy link
Owner

bugaevc commented May 27, 2020

Hi!

I'm putting here the build logs because there were some dependencies missing apparently, but if I understood correctly the README, only wayland-client should be mandatory
Do I need other dependencies?

You understood README correctly, only wayland-client should be mandatory (as you can see, the configuration stage didn't fail — it would if you were missing a required dependency). And yes, I intend to support ancient versions of Wayland.

Both wl-copy and wl-paste hang in SailfishOS

Now that is the real bug. Please get me the WAYLAND_DEBUG logs 🙂, and perhaps point me to a way to build/install the compositor you're using to try and reproduce this on my machine.

@bugaevc bugaevc added the bug Something isn't working label May 27, 2020
@Kabouik
Copy link
Author

Kabouik commented May 27, 2020

Thanks for your fast answer!

Here are the debug logs (I had to interrupt at the end):

[nemo@Sailfish build]$ WAYLAND_DEBUG=1 wl-copy lalala li
[3387521.598]  -> wl_display@1.get_registry(new id wl_registry@2)
[3387521.931]  -> wl_display@1.sync(new id wl_callback@3)
[3387528.604] wl_display@1.delete_id(3)
[3387529.002] wl_registry@2.global(1, "wl_compositor", 3)
[3387529.427]  -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
[3387529.809] wl_registry@2.global(2, "wl_data_device_manager", 1)
[3387530.090]  -> wl_registry@2.bind(2, "wl_data_device_manager", 1, new id [unknown]@5)
[3387530.181] wl_registry@2.global(3, "wl_shm", 1)
[3387530.328]  -> wl_registry@2.bind(3, "wl_shm", 1, new id [unknown]@6)
[3387530.438] wl_registry@2.global(4, "wl_output", 2)
[3387530.502] wl_registry@2.global(5, "qt_hardware_integration", 1)
[3387530.724] wl_registry@2.global(6, "android_wlegl", 2)
[3387530.789] wl_registry@2.global(7, "qt_output_extension", 1)
[3387530.953] wl_registry@2.global(8, "qt_surface_extension", 2)
[3387531.016] wl_registry@2.global(9, "qt_touch_extension", 1)
[3387531.221] wl_registry@2.global(10, "qt_windowmanager", 1)
[3387531.298] wl_registry@2.global(11, "wl_seat", 2)
[3387531.359]  -> wl_registry@2.bind(11, "wl_seat", 2, new id [unknown]@7)
[3387531.678] wl_registry@2.global(12, "wl_shell", 1)
[3387531.898]  -> wl_registry@2.bind(12, "wl_shell", 1, new id [unknown]@8)
[3387532.066] wl_registry@2.global(13, "lipstick_recorder_manager", 1)
[3387532.149] wl_registry@2.global(14, "alien_manager", 1)
[3387532.313] wl_callback@3.done(5422)
[3387532.395]  -> wl_display@1.sync(new id wl_callback@3)
[3387533.654] wl_display@1.delete_id(3)
[3387533.756] wl_seat@7.capabilities(7)
[3387533.797] wl_callback@3.done(5422)
[3387533.859]  -> wl_data_device_manager@5.get_data_device(new id wl_data_device@3, wl_seat@7)
[3387533.925]  -> wl_data_device_manager@5.create_data_source(new id wl_data_source@9)
[3387533.986]  -> wl_data_source@9.offer("text/plain")
[3387534.027]  -> wl_data_source@9.offer("text/plain;charset=utf-8")
[3387534.064]  -> wl_data_source@9.offer("TEXT")
[3387534.099]  -> wl_data_source@9.offer("STRING")
[3387534.136]  -> wl_data_source@9.offer("UTF8_STRING")
[3387534.186]  -> wl_seat@7.get_keyboard(new id wl_keyboard@10)
[3387535.437] wl_keyboard@10.keymap(1, fd 4, 52056)
[3387535.598]  -> wl_compositor@4.create_surface(new id wl_surface@11)
[3387535.673]  -> wl_shell@8.get_shell_surface(new id wl_shell_surface@12, wl_surface@11)
[3387535.731]  -> wl_shell_surface@12.set_toplevel()
[3387535.760]  -> wl_shell_surface@12.set_title("wl-clipboard")
[3387535.826]  -> wl_surface@11.commit()
[3387535.861]  -> wl_display@1.sync(new id wl_callback@13)
[3387537.632] wl_display@1.delete_id(13)
[3387537.767] wl_callback@13.done(5422)
[3387537.994]  -> wl_shm@6.create_pool(new id wl_shm_pool@13, fd 5, 4)
[3387538.242]  -> wl_shm_pool@13.create_buffer(new id wl_buffer@14, 0, 1, 1, 4, 0)
[3387538.345]  -> wl_surface@11.attach(wl_buffer@14, 0, 0)
[3387538.409]  -> wl_surface@11.damage(0, 0, 1, 1)
[3387538.479]  -> wl_surface@11.commit()
[3387563.398] wl_shell_surface@12.ping(5423)
[3387563.482]  -> wl_shell_surface@12.pong(5423)
^C
[nemo@Sailfish build]$ 

The compositor in Sailfish is Lipstick, but it's a mobile OS so I'm not sure it can be built/installed easily on a desktop distribution (I'm not a developer and might just be wrong, sorry). However, there is a Sailfish SDK that runs through Virtualbox: https://sailfishos.org/wiki/Application_SDK_Installation/. Mayve this could help?

@bugaevc
Copy link
Owner

bugaevc commented May 27, 2020

Looking at the log, it it's clear that the compositor (Lipstick) doesn't give newly opened windows focus by default. This means wl-clipboard cannot do its focus stealing hack.

The proper solution for this is for Lipstick to implement the wlr-data-control protocol; in that case wl-clipboard will work with it (without having to resort to focus stealing). Perhaps you could communicate it to Lipstick developers.

There's nothing I could do for this on wl-clipboard side, so closing.

@bugaevc bugaevc closed this as completed May 27, 2020
@bugaevc bugaevc removed the bug Something isn't working label May 27, 2020
@Kabouik
Copy link
Author

Kabouik commented May 27, 2020

Thanks. I'll try to report it.

@bugaevc
Copy link
Owner

bugaevc commented May 27, 2020

I see @rburchell is listed as one of the authors of Lipstick, perhaps we could summon him here 😉

@Kabouik
Copy link
Author

Kabouik commented May 27, 2020

I reported the issue here: https://together.jolla.com/question/227899/implement-wlr-data-control-protocol-into-lipstick-to-allow-system-clipboard/

Maybe this should be reported on mer.project too. To be honest I'm not sure exactly where Lipstick development for the version deployed on SailfishOS takes place.

@rburchell
Copy link

I see @rburchell is listed as one of the authors of Lipstick, perhaps we could summon him here wink

I consider myself summoned, but I don't bring too much good news :)

I wrote the initial implementation of both lipstick, and Jolla's compositor -- lipstick-jolla-home -- and (together with others) maintained them for some time subsequently, but I left there a long while ago now, and don't really have anything to do with it anymore. My guess is that the Jolla version is "authoritative", but I'm not certain. I think that raising it on TJC is probably the best way to get an answer.

Separately from that, some information from what I recall (in the case that it is helpful): lipstick was mostly a layering on top of QtWayland's compositor support. That is, for the compositor (and underlying Wayland support), QtWayland was the place to look[1]. That may still be the case, but Jolla doesn't follow upstream very closely for some packages, so it may be worth checking their own copy of QtWayland first, to see what it supports/how it is patched, before checking upstream.

[1]: However, I also have some recollection that this got more complicated in the subsequent time after Sailfish's initial release, due to Jolla's management being somewhat skeptical of/averse to GPLv3-related licenses, so it may well not be the case anymore, too.

@bugaevc
Copy link
Owner

bugaevc commented May 27, 2020

Thanks 🙂

Side note: what a small world

@Kabouik
Copy link
Author

Kabouik commented May 27, 2020

Thanks a lot for your answer @rburchell! Let's see if someone at Jolla picks the question on TJC, fingers crossed.

Small world indeed, I knew you as w00t on TMO!

@bugaevc bugaevc added the cant-grab-focus Compositor disallows stealing focus but does not support wlr-data-control label Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cant-grab-focus Compositor disallows stealing focus but does not support wlr-data-control
Projects
None yet
Development

No branches or pull requests

3 participants