Bug 1326304

Summary: [wayland][gtk3] pasting data that external apps put into the clipboard stops to work once I copy something into the clipboard with libreoffice itself
Product: [Fedora] Fedora Reporter: Thorsten Leemhuis <fedora>
Component: libreofficeAssignee: Caolan McNamara <caolanm>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: caolanm, dtardon, erack, mstahl, sbergman
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libreoffice-5.1.4.1-3.fc24 libreoffice-5.1.4.2-3.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-04 07:20:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Thorsten Leemhuis 2016-04-12 11:32:31 UTC
Pasting something from the clipboard into libreoffice stops working properly once I put something into the clipboards using libreoffice itself. After that point every time I paste something I only get the last thing I put there using libreoffice and not the things I copy into the clipboard with other apps.

Version-Release number of selected component (if applicable):
libreoffice-5.1.2.1-4.fc24.x86_64 with libreoffice-gtk3 installed and running under Gnome as wayland compositor

History: First reported in Bug 1323922 -- but as it turns out there seem to be two different bugs at hand.

Comment 1 Thorsten Leemhuis 2016-05-24 07:35:24 UTC
Just retested with libreoffice-5.1.3.2-6.fc24.x86_64.rpm (got it straight from Koji): Bug still present. Here is a updated description:

When running LibreOffice under Gnome in Wayland mode I can only paste things external apps put into the clipboard until I copy something to the clipboard with libreoffice itself. From that point on I can only paste the last thing I put there using libreoffice. Once I close the libreoffice window in question and reopen it I get the expected behavior.

If this sounds a bit confusing, here is a example of the problem

(1) copy "foo" into the clipboard with firefox -> pasting in libreoffice gives "foo"
(2) copy "bar" into the clipboard with firefox -> pasting in libreoffice gives "bar"
(3) copy "foobar" into the clipboard with libreoffice -> pasting in libreoffice gives "foobar"
(4) copy "baz" into the clipboard with firefox -> pasting in libreoffice still gives "foobar" (*bug here*: this should have been "baz")
(5) close libreoffice window and reopen the document -> pasting in libreoffice now gives "baz"

Same happens when I use gedit (gtk3 app and hence a wayland client) instead of firefox (which is running with Xwayland).

Side note: Due to the recently introduced hard dependency on libreoffice-gtk3 it is not possible anymore to easily work around this bug. So this for me becomes a show stopper for using the wayland mode. And I'd like to see it fixed, otherwise it will make the wayland support in f24 look bad :-/

Comment 2 Thorsten Leemhuis 2016-05-26 06:02:19 UTC
Just verified: the problem is also present on a fresh F24 beta install before and after updating.

Comment 3 Thorsten Leemhuis 2016-06-06 08:52:27 UTC
Problem still present in libreoffice-5.1.4.1-1.fc24.x86_64

Comment 4 Thorsten Leemhuis 2016-06-20 06:06:47 UTC
Problem still present in libreoffice-5.1.4.2-1.fc24.x86_64 when running in wayland-gnome

Side note: The problem makes it to reviews now. Quote from 
http://www.phoronix.com/scan.php?page=article&item=fedora-24-review&num=3
""" I could copy and paste a link from Firefox into its own address bar, but not into LibreOffice. Attempting to paste it into LibreOffice would instead paste the last thing I had copied inside LibreOffice... other times it would work, though. Restarting LibreOffice appeared to fix things, but further investigation is necessary. """
(The conclusion there that it has something to do with Xwindows is wrong afaics, that's why I left it out in the quote)

Comment 5 Caolan McNamara 2016-06-24 14:27:38 UTC
The various gtk_clipboard things which under X can be used to determine the ownership of the clipboard work differently under wayland. Seems one cannot really determine the ownership of the clipboard, so gave up on that and run everything through the system clipboard which seems to work for me.

Comment 6 Fedora Update System 2016-06-25 20:12:02 UTC
libreoffice-5.1.4.2-3.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-f2bf872a06

Comment 7 Fedora Update System 2016-06-26 19:26:18 UTC
libreoffice-5.1.4.2-3.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-f2bf872a06

Comment 8 Thorsten Leemhuis 2016-06-27 06:31:47 UTC
*** Bug 1323922 has been marked as a duplicate of this bug. ***

Comment 9 Thorsten Leemhuis 2016-06-27 06:32:33 UTC
many thx, seem to work fine so far; and primary selection works properly now, too :D

Comment 10 Thorsten Leemhuis 2016-06-27 14:41:30 UTC
(In reply to Caolan McNamara from comment #5)
> The various gtk_clipboard things which under X can be used to determine the
> ownership of the clipboard work differently under wayland. Seems one cannot
> really determine the ownership of the clipboard, so gave up on that and run
> everything through the system clipboard which seems to work for me.
I wonder if that might be the root of Bug 1350478 which turned up here today.

Comment 11 Fedora Update System 2016-06-27 18:24:53 UTC
libreoffice-5.1.4.2-3.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Thorsten Leemhuis 2016-07-04 06:04:28 UTC
(In reply to Thorsten Leemhuis from comment #10)
> (In reply to Caolan McNamara from comment #5)
> > The various gtk_clipboard things which under X can be used to determine the
> > ownership of the clipboard work differently under wayland. Seems one cannot
> > really determine the ownership of the clipboard, so gave up on that and run
> > everything through the system clipboard which seems to work for me.
> I wonder if that might be the root of Bug 1350478 which turned up here today.

This bug came back with libreoffice-5.1.4.2-4.fc24 The problem is just like described in Comment 1.

Comment 13 Caolan McNamara 2016-07-04 07:20:14 UTC
Yeah. There are a bunch of thing going on. Some were arguably on our side. And our side is fixed now. But there is a bug on the gtk side, which is https://bugzilla.gnome.org/show_bug.cgi?id=768177 which cannot be sanely worked around. Ideally I'd like to see that new fix backported to our gtk