GNOME Bugzilla – Bug 769619
St unable the use the Clipboard under Wayland
Last modified: 2016-10-09 09:07:27 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?
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.
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.
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
Sorry, I messed up. It is also broken in Ubuntu 16.04.1
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?
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
Test 4 is using extension https://extensions.gnome.org/extension/825/password-calculator/
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.
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
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!
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.
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 ***