After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 769619 - St unable the use the Clipboard under Wayland
St unable the use the Clipboard under Wayland
Status: RESOLVED DUPLICATE of bug 760745
Product: gnome-shell
Classification: Core
Component: st
unspecified
Other Linux
: Normal major
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2016-08-08 09:16 UTC by Thilo Maurer
Modified: 2016-10-09 09:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
st-clipboard: use GtkClipboard instead of its own implementation (13.99 KB, patch)
2016-08-16 17:12 UTC, Hyungwon Hwang
none Details | Review

Description Thilo Maurer 2016-08-08 09:16:08 UTC
When running Wayland, text written by ST to the clipboard does not end up in the clipboard buffer. (Tests done using Fedora 24 on Wayland)

Multiple gnome shell extensions are therefore unable to use the clipboard.
Here are two:
https://github.com/thilomaurer/pwcalc/issues/8
https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator/issues/41

For example

St.Clipboard.get_default().set_text(St.ClipboardType.CLIPBOARD,"text for the clipboard");

does seem to have no effect.
Debugging into the code leads to the function st_clipboard_set_text in https://github.com/GNOME/gnome-shell/blob/master/src/st/st-clipboard.c 

This function calls a bunch of X server functions which should finally deliver the clipboard text to the clipboard buffer, but

    Can the same code be valid when running on Wayland?
    Should the FIXME be resolved?
Comment 1 Thilo Maurer 2016-08-09 22:50:16 UTC
I see the issue when using Wayland in Fedora 24 and Fedora 23.
There is however NO issue using Wayland in Ubuntu 16.04.1 LTS.
Comment 2 Hyungwon Hwang 2016-08-10 12:51:45 UTC
It is the same as https://bugzilla.gnome.org/show_bug.cgi?id=758958.

Now, st-clipboard is implemented specifically to X11.

Also, now it uses gdk_window_add_filter() for hooking the event for windows which is not usable for Wayland (https://bugzilla.gnome.org/show_bug.cgi?id=697558). I think that we need to find the right way for it first.
Comment 3 Thilo Maurer 2016-08-15 11:02:17 UTC
I don't see why this is an issue with st-clipboard being implemented specifically to X11, since there is NO issue with st-clipboard using Wayland in Ubuntu 16.04.1 LTS. For this reason I posted the bug the fedora bugzilla as well: https://bugzilla.redhat.com/show_bug.cgi?id=1365764
Comment 4 Thilo Maurer 2016-08-16 11:18:51 UTC
Sorry, I messed up. It is also broken in Ubuntu 16.04.1
Comment 5 Hyungwon Hwang 2016-08-16 17:12:20 UTC
Created attachment 333436 [details] [review]
st-clipboard: use GtkClipboard instead of its own implementation

I made a patch for solving this problem. It makes st-clipboard to use GtkClipboard instead of its own implementation.

I tested and checked it,
X:
  1. Possible to copy and paste to stEntry (using Ctrl + C/V or menu)
  2. Not possible to copy, but possible to paste to passwordEntry
  3. Possible to paste using mouse middle button

Wayland:
  1. Possible to copy and paste to stEntry
(I couldn't check the 2. and 3. in Wayland, because I cannot login thought gdm now. I tested it by executing 'gnome-shell --wayland' as root. I'm trying to fix my latest jhbuild build environment)

Is there more things which I should check except the 2. and 3. in above?
Comment 6 Thilo Maurer 2016-08-17 11:31:59 UTC
Thanks, your patch also looks much cleaner than the original implementation!

Test 4: type text into stEntry, type text into passwordEntry, press <RETURN>, observe notification "generated password copied to clipboard", check if pasting of text inside clipboard to somewhere (e.g. gedit) is working as expected
Comment 7 Thilo Maurer 2016-08-17 11:33:15 UTC
Test 4 is using extension https://extensions.gnome.org/extension/825/password-calculator/
Comment 8 Hyungwon Hwang 2016-08-17 12:08:36 UTC
I confirmed that Test 4 is OK in X, but unfortunately because of same reason as I said, I couldn't test it in Wayland. (the extension doesn't show up in notification area even after it's enabled)

Plus, I think that I wrote the sentence easy to misread. The test 2 must be
2. Not possible to copy from passwordEntry to somewhere, but possible to paste to passwordEntry.
Comment 9 Thilo Maurer 2016-08-17 12:40:48 UTC
Test 2 is OK: Same behavior with original X implementation. One should not be able to copy from a passwordEntry. I use Clutter::Text::set_password_char to obfuscate entered text. I believe this also disables copying the text. Plus, I like this feature. 

Can't find where is it implemented though.. was looking though https://github.com/GNOME/clutter/blob/master/clutter/clutter-text.c
Comment 10 Thilo Maurer 2016-09-09 10:27:49 UTC
Finally found where the feature is implemented: 
Copy & Cut is disabled by St.Entry wrapping Clutter.Text when a password char is set. See occurrences of clutter_text_get_password_char in function st_entry_key_press_event in file https://github.com/GNOME/gnome-shell/blob/master/src/st/st-entry.c

So the patch works as expected. Please merge into master branch!
Comment 11 Hyungwon Hwang 2016-09-12 06:02:12 UTC
I fixed my dekstop environment, and tested it.

With gnome-wayland, copy & paste inside StEntry is OK after applying this patch. But pasting the text from gedit to StEntry makes gnome-shell freezing. It seems to be related with mutter uses only X11 gdk backend. I am not sure what the problem is yet.
Comment 12 Florian Müllner 2016-10-09 09:07:27 UTC
Thanks for taking the time to report this.
This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 760745 ***