Bug 1590965 call gtk_clipboard_store() regardless of whether Gecko is providing the clipboard r=stransky
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 07 Nov 2019 22:42:15 +0000
changeset 501673 610f0e00fbbaf19e502b48b28d33c11e757c3526
parent 501672 ac88099aca2d631b5f1d79856c49b3ffb59e0d52
child 501674 e327b9536917f0247ba28d5e5f8c737f7338317a
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky
bugs1590965
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1590965 call gtk_clipboard_store() regardless of whether Gecko is providing the clipboard r=stransky This stores the clipboard even if it was set in a GTK dialog. Depends on D50764 Differential Revision: https://phabricator.services.mozilla.com/D50765
widget/gtk/nsClipboard.cpp
widget/gtk/nsClipboard.h
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -104,30 +104,21 @@ nsresult nsClipboard::Init(void) {
   if (os) {
     os->AddObserver(this, "quit-application", false);
     os->AddObserver(this, "xpcom-shutdown", false);
   }
 
   return NS_OK;
 }
 
-nsresult nsClipboard::Store(void) {
-  LOGCLIP(("nsClipboard::Store\n"));
-
-  if (mGlobalTransferable) {
-    GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
-    gtk_clipboard_store(clipboard);
-  }
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 nsClipboard::Observe(nsISupports* aSubject, const char* aTopic,
                      const char16_t* aData) {
-  Store();
+  // Save global clipboard content to CLIPBOARD_MANAGER
+  gtk_clipboard_store(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsClipboard::SetData(nsITransferable* aTransferable, nsIClipboardOwner* aOwner,
                      int32_t aWhichClipboard) {
   // See if we can short cut
   if ((aWhichClipboard == kGlobalClipboard &&
--- a/widget/gtk/nsClipboard.h
+++ b/widget/gtk/nsClipboard.h
@@ -57,19 +57,16 @@ class nsClipboard : public nsIClipboard,
   // Someone requested the selection
   void SelectionGetEvent(GtkClipboard* aGtkClipboard,
                          GtkSelectionData* aSelectionData);
   void SelectionClearEvent(GtkClipboard* aGtkClipboard);
 
  private:
   virtual ~nsClipboard();
 
-  // Save global clipboard content to gtk
-  nsresult Store(void);
-
   // Get our hands on the correct transferable, given a specific
   // clipboard
   nsITransferable* GetTransferable(int32_t aWhichClipboard);
 
   // Send clipboard data by nsITransferable
   void SetTransferableData(nsITransferable* aTransferable, nsCString& aFlavor,
                            const char* aClipboardData,
                            uint32_t aClipboardDataLength);