bugaevc / wl-clipboard

Command-line copy/paste utilities for Wayland
GNU General Public License v3.0
1.62k stars 59 forks source link

wl-copy and wl-paste hangs with Qt wayland compositor #119

Closed chakuzo closed 3 years ago

chakuzo commented 3 years ago

When wl-paste or wl-copy is used with QWayland Compositor, it hangs. With another compositor the problem does not appear.

It can be reproduced with the Qt example: https://doc.qt.io/qt-5/qtwaylandcompositor-minimal-qml-example.html

wl-paste output:

[1033730.607]  -> wl_display@1.get_registry(new id wl_registry@2)
[1033730.634]  -> wl_display@1.sync(new id wl_callback@3)
[1033731.054] wl_display@1.delete_id(3)
[1033731.096] wl_registry@2.global(1, "xdg_wm_base", 1)
[1033731.120]  -> wl_registry@2.bind(1, "xdg_wm_base", 1, new id [unknown]@4)
[1033731.150] wl_registry@2.global(2, "wl_compositor", 3)
[1033731.181]  -> wl_registry@2.bind(2, "wl_compositor", 2, new id [unknown]@5)
[1033731.222] wl_registry@2.global(3, "wl_subcompositor", 1)
[1033731.263] wl_registry@2.global(4, "wl_data_device_manager", 1)
[1033731.300]  -> wl_registry@2.bind(4, "wl_data_device_manager", 1, new id [unknown]@6)
[1033731.341] wl_registry@2.global(5, "wl_shm", 1)
[1033731.370]  -> wl_registry@2.bind(5, "wl_shm", 1, new id [unknown]@7)
[1033731.410] wl_registry@2.global(6, "qt_hardware_integration", 1)
[1033731.440] wl_registry@2.global(7, "wl_seat", 4)
[1033731.470]  -> wl_registry@2.bind(7, "wl_seat", 2, new id [unknown]@8)
[1033731.511] wl_registry@2.global(8, "wl_output", 2)
[1033731.540] wl_callback@3.done(0)
[1033731.556]  -> wl_display@1.sync(new id wl_callback@3)
[1033732.129] wl_display@1.delete_id(3)
[1033732.158] wl_seat@8.capabilities(7)
[1033732.174] wl_callback@3.done(0)
[1033732.201]  -> wl_data_device_manager@6.get_data_device(new id wl_data_device@3, wl_seat@8)
[1033732.213]  -> wl_seat@8.get_keyboard(new id wl_keyboard@9)
[1033732.435] wl_keyboard@9.keymap(1, fd 4, 47346)
[1033732.475]  -> wl_compositor@5.create_surface(new id wl_surface@10)
[1033732.484]  -> xdg_wm_base@4.get_xdg_surface(new id xdg_surface@11, wl_surface@10)
[1033732.493]  -> xdg_surface@11.get_toplevel(new id xdg_toplevel@12)
[1033732.500]  -> xdg_toplevel@12.set_title("wl-clipboard")
[1033732.505]  -> wl_surface@10.commit()
[1033732.509]  -> wl_display@1.sync(new id wl_callback@13)
[1033733.138] wl_display@1.delete_id(13)
[1033733.174] xdg_toplevel@12.configure(0, 0, array)
[1033733.186] xdg_surface@11.configure(1)
[1033733.192]  -> xdg_surface@11.ack_configure(1)
[1033733.197] wl_callback@13.done(1)
[1033733.218]  -> wl_shm@7.create_pool(new id wl_shm_pool@13, fd 5, 4)
[1033733.230]  -> wl_shm_pool@13.create_buffer(new id wl_buffer@14, 0, 1, 1, 4, 0)
[1033733.248]  -> wl_surface@10.attach(wl_buffer@14, 0, 0)
[1033733.275]  -> wl_surface@10.damage(0, 0, 1, 1)
[1033733.287]  -> wl_surface@10.commit()

Compositor output:

[1033730,764] wl_display@1.get_registry(new id wl_registry@2)
[1033730,828]  -> wl_registry@2.global(1, "xdg_wm_base", 1)
[1033730,843]  -> wl_registry@2.global(2, "wl_compositor", 3)
[1033730,853]  -> wl_registry@2.global(3, "wl_subcompositor", 1)
[1033730,883]  -> wl_registry@2.global(4, "wl_data_device_manager", 1)
[1033730,895]  -> wl_registry@2.global(5, "wl_shm", 1)
[1033730,906]  -> wl_registry@2.global(6, "qt_hardware_integration", 1)
[1033730,931]  -> wl_registry@2.global(7, "wl_seat", 4)
[1033730,943]  -> wl_registry@2.global(8, "wl_output", 2)
[1033730,969] wl_display@1.sync(new id wl_callback@3)
[1033730,977]  -> wl_callback@3.done(0)
[1033730,984]  -> wl_display@1.delete_id(3)
[1033731,741] wl_registry@2.bind(1, "xdg_wm_base", 1, new id [unknown]@4)
[1033731,808] wl_registry@2.bind(2, "wl_compositor", 2, new id [unknown]@5)
[1033731,825] wl_registry@2.bind(4, "wl_data_device_manager", 1, new id [unknown]@6)
[1033731,860] wl_registry@2.bind(5, "wl_shm", 1, new id [unknown]@7)
[1033731,878]  -> wl_shm@7.format(0)
[1033731,884]  -> wl_shm@7.format(1)
[1033731,905]  -> wl_shm@7.format(1)
[1033731,911]  -> wl_shm@7.format(0)
[1033731,916]  -> wl_shm@7.format(909199186)
[1033731,920]  -> wl_shm@7.format(892424792)
[1033731,941]  -> wl_shm@7.format(875710290)
[1033731,946]  -> wl_shm@7.format(842093144)
[1033731,951]  -> wl_shm@7.format(842093121)
[1033731,956]  -> wl_shm@7.format(875709016)
[1033731,961]  -> wl_shm@7.format(875708993)
[1033731,966]  -> wl_shm@7.format(808665688)
[1033731,986]  -> wl_shm@7.format(808665665)
[1033731,992]  -> wl_shm@7.format(808669784)
[1033731,997]  -> wl_shm@7.format(808669761)
[1033732,002]  -> wl_shm@7.format(538982467)
[1033732,008] wl_registry@2.bind(7, "wl_seat", 2, new id [unknown]@8)
[1033732,042]  -> wl_seat@8.capabilities(7)
[1033732,051] wl_display@1.sync(new id wl_callback@3)
[1033732,074]  -> wl_callback@3.done(0)
[1033732,080]  -> wl_display@1.delete_id(3)
[1033732,270] wl_data_device_manager@6.get_data_device(new id wl_data_device@3, wl_seat@8)
[1033732,310] wl_seat@8.get_keyboard(new id wl_keyboard@9)
[1033732,332]  -> wl_keyboard@9.keymap(1, fd 30, 47346)
[1033732,588] wl_compositor@5.create_surface(new id wl_surface@10)
[1033732,629] xdg_wm_base@4.get_xdg_surface(new id xdg_surface@11, wl_surface@10)
[1033732,656] xdg_surface@11.get_toplevel(new id xdg_toplevel@12)
[1033732,672]  -> xdg_toplevel@12.configure(0, 0, array)
[1033732,684]  -> xdg_surface@11.configure(1)
[1033732,993] xdg_toplevel@12.set_title("wl-clipboard")
[1033733,006] wl_surface@10.commit()
[1033733,015] wl_display@1.sync(new id wl_callback@13)
[1033733,022]  -> wl_callback@13.done(1)
[1033733,028]  -> wl_display@1.delete_id(13)
[1033733,392] xdg_surface@11.ack_configure(1)
[1033733,411] wl_shm@7.create_pool(new id wl_shm_pool@13, fd 30, 4)
[1033733,438] wl_shm_pool@13.create_buffer(new id wl_buffer@14, 0, 1, 1, 4, 0)
[1033733,459] wl_surface@10.attach(wl_buffer@14, 0, 0)
[1033733,483] wl_surface@10.damage(0, 0, 1, 1)
[1033733,498] wl_surface@10.commit()

Maybe someone has an idea where to look. Thx

bugaevc commented 3 years ago

Thanks for a detailed report!

This clearly indicates that the compositor does not focus new surfaces and doesn't implement the wlr-data-control protocol, so wl-clipboard can neither do the clean thing with data-control, nor do the stealing focus hack with the popup surface.

Nothing that can be done about this from my side :(

chakuzo commented 3 years ago

Thanks for the quick reply, I'll see if I can add the protocol to the Qt code. Would have been too nice if it would work directly.