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

Implement data-control-unstable-v1 #1423

Merged
merged 8 commits into from Jan 7, 2019

Conversation

Projects
None yet
4 participants
@emersion
Copy link
Member

emersion commented Dec 7, 2018

@emersion emersion changed the title Implement data-control-unstable-v1 [DO NOT MERGE] Implement data-control-unstable-v1 Dec 7, 2018

@emersion emersion force-pushed the emersion:data-control branch from beb3426 to 86bdb3e Dec 7, 2018

@bugaevc

This comment has been minimized.

Copy link

bugaevc commented Dec 11, 2018

So I've implemented initial WIP support for this in wl-clipboard (see bugaevc/wl-clipboard#12, branch data-control), and so far it doesn't work.

rootston either segfaults at this:

Core was generated by `rootston/rootston'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f523eea4c87 in wl_list_insert () from /lib64/libwayland-server.so.0
[Current thread is 1 (Thread 0x7f523deafa80 (LWP 13271))]
(gdb) bt
#0  0x00007f523eea4c87 in wl_list_insert () at /lib64/libwayland-server.so.0
#1  0x00007f523ef46a03 in wl_signal_add (signal=0x2838940, listener=0x29a2940) at /usr/include/wayland-server-core.h:431
#2  0x00007f523ef47436 in manager_handle_get_data_control (client=0x2ad7f00, manager_resource=0x29ce1e0, id=13, seat_resource=0x29ce4b0) at ../types/wlr_data_control_v1.c:314
#3  0x00007f523e704ace in ffi_call_unix64 () at /lib64/libffi.so.6
#4  0x00007f523e70448f in ffi_call () at /lib64/libffi.so.6
#5  0x00007f523eea431d in  () at /lib64/libwayland-server.so.0
#6  0x00007f523eea0c69 in  () at /lib64/libwayland-server.so.0
#7  0x00007f523eea22e2 in wl_event_loop_dispatch () at /lib64/libwayland-server.so.0
#8  0x00007f523eea0e62 in wl_display_run () at /lib64/libwayland-server.so.0
#9  0x0000000000411382 in main (argc=1, argv=0x7ffde0041188) at ../rootston/main.c:74

or disconnects wl-copy/wl-paste with this in the log:

error marshalling arguments for selection (signature o): null value passed for arg 0
error in client communication (pid 14471)

Here's what wl-copy is doing:

[4209253.964] wl_registry@2.global(29, "zwlr_data_control_manager_v1", 1)
[4209253.981]  -> wl_registry@2.bind(29, "zwlr_data_control_manager_v1", 1, new id [unknown]@10)
[4209254.003] wl_registry@2.global(30, "wl_seat", 6)
[4209254.018]  -> wl_registry@2.bind(30, "wl_seat", 1, new id [unknown]@11)
[4209254.041] wl_registry@2.global(31, "wl_output", 3)
[4209254.059] wl_callback@3.done(0)
[4209254.075]  -> wl_data_device_manager@4.get_data_device(new id wl_data_device@3, wl_seat@11)
[4209254.094]  -> gtk_primary_selection_device_manager@9.get_device(new id gtk_primary_selection_device@12, wl_seat@11)
[4209254.155]  -> zwlr_data_control_manager_v1@10.get_data_control(new id zwlr_data_control_v1@13, wl_seat@11)
[4209254.187]  -> zwlr_data_control_manager_v1@10.create_data_source(new id zwlr_data_control_source_v1@14)
[4209254.212]  -> zwlr_data_control_source_v1@14.offer("text/plain")
[4209254.231]  -> zwlr_data_control_source_v1@14.offer("text/plain;charset=utf-8")
[4209254.242]  -> zwlr_data_control_source_v1@14.offer("TEXT")
[4209254.250]  -> zwlr_data_control_source_v1@14.offer("STRING")
[4209254.259]  -> zwlr_data_control_source_v1@14.offer("UTF8_STRING")
[4209254.267]  -> zwlr_data_control_v1@13.set_selection(zwlr_data_control_source_v1@14)
[4209282.412] wl_seat@11.capabilities(3)
[4209282.501]  -> wl_seat@11.get_keyboard(new id wl_keyboard@15)
wl_display_dispatch: Connection reset by peer

Same for wl-paste:

[387433.290] wl_registry@2.global(29, "zwlr_data_control_manager_v1", 1)
[387433.369]  -> wl_registry@2.bind(29, "zwlr_data_control_manager_v1", 1, new id [unknown]@10)
[387433.446] wl_registry@2.global(30, "wl_seat", 6)
[387433.487]  -> wl_registry@2.bind(30, "wl_seat", 1, new id [unknown]@11)
[387433.557] wl_registry@2.global(31, "wl_output", 3)
[387433.696] wl_callback@3.done(0)
[387433.728]  -> wl_data_device_manager@4.get_data_device(new id wl_data_device@3, wl_seat@11)
[387433.778]  -> gtk_primary_selection_device_manager@9.get_device(new id gtk_primary_selection_device@12, wl_seat@11)
[387433.853]  -> zwlr_data_control_manager_v1@10.get_data_control(new id zwlr_data_control_v1@13, wl_seat@11)
[387434.174] wl_seat@11.capabilities(3)
[387434.232]  -> wl_seat@11.get_keyboard(new id wl_keyboard@14)
wl_display_dispatch: Broken pipe

(this could very well be a bug on my side, so just letting you know until I debug it further)

@emersion emersion changed the title [DO NOT MERGE] Implement data-control-unstable-v1 [WIP] Implement data-control-unstable-v1 Dec 12, 2018

@emersion

This comment has been minimized.

Copy link
Member

emersion commented Dec 12, 2018

rootston either segfaults at this

Fixed. Sorry, I haven't had the chance to test this branch because I didn't have a test client.

or disconnects wl-copy/wl-paste

I forgot to add allow-null="true" in the protocol. This is now fixed in the wlr-protocols PR and in this PR. Can you update your client with this new protocol?

@bugaevc

This comment has been minimized.

Copy link

bugaevc commented Dec 12, 2018

Sorry, I haven't had the chance to test this branch because I didn't have a test client.

Yeah, of course. It's actually really nice how we're helping each other to test our implementations.

I forgot to add allow-null="true" in the protocol. This is now fixed in the wlr-protocols PR and in this PR. Can you update your client with this new protocol?

It works, yay!

Fixed.

I'm still getting the crash:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f36d01f5c87 in wl_list_insert () from /lib64/libwayland-server.so.0
[Current thread is 1 (Thread 0x7f36cf200a80 (LWP 19243))]
(gdb) bt
#0  0x00007f36d01f5c87 in wl_list_insert () at /lib64/libwayland-server.so.0
#1  0x00007f36d0297a03 in wl_signal_add (signal=0x17f73b0, listener=0x1942550) at /usr/include/wayland-server-core.h:431
#2  0x00007f36d0298458 in manager_handle_get_data_control (client=0x1aa4c30, manager_resource=0x1971420, id=13, seat_resource=0x1aa2e40) at ../types/wlr_data_control_v1.c:317
#3  0x00007f36cfa55ace in ffi_call_unix64 () at /lib64/libffi.so.6
#4  0x00007f36cfa5548f in ffi_call () at /lib64/libffi.so.6
#5  0x00007f36d01f531d in  () at /lib64/libwayland-server.so.0
#6  0x00007f36d01f1c69 in  () at /lib64/libwayland-server.so.0
#7  0x00007f36d01f32e2 in wl_event_loop_dispatch () at /lib64/libwayland-server.so.0
#8  0x00007f36d01f1e62 in wl_display_run () at /lib64/libwayland-server.so.0
#9  0x0000000000411382 in main (argc=1, argv=0x7ffc4ed0a708) at ../rootston/main.c:74
@emersion

This comment has been minimized.

Copy link
Member

emersion commented Dec 12, 2018

I'm still getting the crash

Hmm, can you provide reproduction steps?

@bugaevc

This comment has been minimized.

Copy link

bugaevc commented Dec 12, 2018

I don't think it happens deterministically, just play with it for some time (various copy-pastes between wl-clipboard and gedit, w/ regular and primary clipboard) and it crashes.

Perhaps this would be helpful:

(gdb) p control->seat_destroy 
$9 = {link = {prev = 0x18fc1c8, next = 0x1}, notify = 0x7fbd304f311b <control_handle_seat_destroy>}

...but I see you've pushed a fix already

@bugaevc

This comment has been minimized.

Copy link

bugaevc commented Dec 12, 2018

Oh, I've found another crash, triggered by wl-copy --clear and then trying to paste:

(gdb) bt
#0  0x0000000000000071 in  ()
#1  0x00007ff3a73750eb in wlr_data_source_accept (source=0xf3d3e0, serial=31, mime_type=0xf8c240 "text/plain;charset=utf-8") at ../types/data_device/wlr_data_source.c:66
#2  0x00007ff3a73749c5 in data_offer_handle_accept (client=0xf879e0, resource=0x1085960, serial=31, mime_type=0xf8c240 "text/plain;charset=utf-8") at ../types/data_device/wlr_data_offer.c:83
#3  0x00007ff3a6b4aace in ffi_call_unix64 () at /lib64/libffi.so.6
#4  0x00007ff3a6b4a48f in ffi_call () at /lib64/libffi.so.6
#5  0x00007ff3a72ea31d in  () at /lib64/libwayland-server.so.0
#6  0x00007ff3a72e6c69 in  () at /lib64/libwayland-server.so.0
#7  0x00007ff3a72e82e2 in wl_event_loop_dispatch () at /lib64/libwayland-server.so.0
#8  0x00007ff3a72e6e62 in wl_display_run () at /lib64/libwayland-server.so.0
#9  0x0000000000411382 in main (argc=1, argv=0x7ffd60ccfae8) at ../rootston/main.c:74
@bugaevc

This comment has been minimized.

Copy link

bugaevc commented Dec 12, 2018

Everything seems to work now!

BTW, wl-copy -c does not actually send set_selection(NULL), because that crashes Mutter, and they're not as eager to fix it. Instead, I just claim the selection and then exit.

@emersion emersion changed the title [WIP] Implement data-control-unstable-v1 Implement data-control-unstable-v1 Dec 12, 2018

@zetorian

This comment has been minimized.

Copy link

zetorian commented Dec 29, 2018

thanks for awesome work on this!!

is there anything in particular that needs to be tested or any way in which I can help get this merged?

a proper clipboard manager has been the one thing I miss since ditching X.

@emersion

This comment has been minimized.

Copy link
Member

emersion commented Dec 29, 2018

I'd like to rename zwlr_data_control_v1 to zwlr_data_control_device_v1. @bugaevc, would you have some time to do this change?

@bugaevc

This comment has been minimized.

Copy link

bugaevc commented Dec 29, 2018

Yeah, sure, s/data_control/data_control_device/g'ing shouldn't take much time anyway, and potential last-minute changes to the protocol is exactly the reason why I've been keeping the branch unmerged. You go ahead and push the changed version to the wlr-protocols PR, I guess?

emersion added some commits Dec 7, 2018

@emersion emersion force-pushed the emersion:data-control branch from 2743783 to 69e7fd6 Dec 30, 2018

@bugaevc

This comment has been minimized.

Copy link

bugaevc commented Dec 30, 2018

Done

@emersion emersion requested a review from ddevault Dec 30, 2018

@emersion

This comment has been minimized.

Copy link
Member

emersion commented Jan 6, 2019

Bump

@ddevault ddevault merged commit e61ea77 into swaywm:master Jan 7, 2019

3 checks passed

builds.sr.ht: alpine.yml builds.sr.ht job completed successfully
Details
builds.sr.ht: archlinux.yml builds.sr.ht job completed successfully
Details
builds.sr.ht: freebsd.yml builds.sr.ht job completed successfully
Details
@ddevault

This comment has been minimized.

Copy link
Member

ddevault commented Jan 7, 2019

Thanks!

@emersion emersion referenced this pull request Jan 7, 2019

Merged

Add data-control-v1 #3383

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment