Bug 100688

Summary: Copy paste doesn't work reliably in Xwayland -> Wayland
Product: Wayland Reporter: Ilia Bozhinov <iliyabo>
Component: westonAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: normal    
Priority: medium CC: bugseforuns, iliyabo, jadahl
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Ilia Bozhinov 2017-04-15 05:32:29 UTC
I've encountered the following bug, which I couldn't find anywhere in bugzilla. I'm currently using weston and I want to copy something from chrome(Xwayland) to gedit(Wayland). As far as I understand, this should be possible, but actually the data that is copied is just an empty string. Gedit sees that there is an active data source, when right-clicking the paste option is active, though when I use it, no text is inserted. This works if I launch gedit with GDK_BACKEND=x11
Comment 1 Ilia Bozhinov 2017-04-18 13:48:12 UTC
After digging around it seems that the problem is either with GTK/mutter or with weston, because when trying to copy from weston-terminal in GNOME it crashes (says "listener function for opcode 5 of wl_data_source is NULL").
Comment 2 Jonas Ådahl 2017-04-18 13:57:56 UTC
(In reply to Ilia Bozhinov from comment #1)
> After digging around it seems that the problem is either with GTK/mutter or
> with weston, because when trying to copy from weston-terminal in GNOME it
> crashes (says "listener function for opcode 5 of wl_data_source is NULL").

weston-terminal crashes? That is most likely an issue with weston-terminal and/or toytoolkit, rather than with Xwayland integration. Does it crash when copying to any client or just some? Is that happening only under mutter/gnome-shell or also under weston?
Comment 3 Ilia Bozhinov 2017-04-18 14:29:29 UTC
The situation is the following:

1) Under weston I can't paste from, lets say, chromium(Xwayland client) or weston-terminal to any GTK app(gedit, gnome-terminal). However, I can copy-paste in the reversed direction

2) Under GNOME shell I can't even copy from weston-terminal, it crashes. I don't know whether this is related or no. But under Gnome I can paste from chromium to GTK apps, that's why I thought the bug is in weston (not the terminal crash, but the copy-paste in weston)
Comment 4 Jonas Ådahl 2017-04-19 10:25:13 UTC
(In reply to Ilia Bozhinov from comment #3)
> The situation is the following:
> 
> 1) Under weston I can't paste from, lets say, chromium(Xwayland client) or
> weston-terminal to any GTK app(gedit, gnome-terminal). However, I can
> copy-paste in the reversed direction

This sounds like a weston Xwayland clipboard integration bug.

> 
> 2) Under GNOME shell I can't even copy from weston-terminal, it crashes. I
> don't know whether this is related or no. But under Gnome I can paste from
> chromium to GTK apps, that's why I thought the bug is in weston (not the
> terminal crash, but the copy-paste in weston)

This *sounds* like a weston-terminal bug. Either weston-terminal is advertising a higher version of wl_data_device than it supports, or its implementation is missing one of the event vfunction implementation.
Comment 5 Ilia Bozhinov 2017-04-27 05:18:36 UTC
I debugged it and found out that the problem was that xwayland clipboard exports only the "text/plain;charset=utf-8" mimetype, however GTK apps don't want to receive it for some reason. I opened a bug in gnome bugzilla, we'll see if that's their fault or not. For now I have a workaround to simply send "UTF8_STRING" mimetype as well.
Comment 6 Hyungwon Hwang 2017-05-06 23:22:13 UTC
I think that I'm experiencing the same issue. Can you tell me the URL of the issue you made in gnome bugzilla?

I tried to find, but failed.
Comment 7 Ilia Bozhinov 2017-05-07 03:42:47 UTC
https://bugzilla.gnome.org/show_bug.cgi?id=781814
This is the GTK bug, I'll close the issue for now as the bug is not in weston, but GTK.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.