Subject: Re: bug#72254: 29.4; Cannot yank media when image come from Gnome-shell screenshot

From: Robert Pluim <[email-masked]>
Date: Wed, 24 Jul 2024 09:16:49 +0200

>>>>> On Tue, 23 Jul 2024 19:16:23 +0200, Sébastien Gendre <[email-masked]> said:

    Sébastien> If I evaluate this `cl-defmethod', and then evaluate (gui-get-selection
    Sébastien> 'CLIPBOARD 'TARGETS) from an Org-mode buffer after taking an screenshot,
    Sébastien> I get this error:

My bad. Try this instead:

diff --git a/lisp/term/pgtk-win.el b/lisp/term/pgtk-win.el
index 505174048f6..06f962ff714 100644
--- a/lisp/term/pgtk-win.el
+++ b/lisp/term/pgtk-win.el
@@ -140,6 +140,14 @@ gui-backend-get-selection
                                          &context (window-system pgtk))
   (pgtk-get-selection-internal selection-symbol target-type))
 
+(cl-defmethod gui-backend-get-selection ((selection-symbol (eql 'CLIPBOARD))
+                                         (target-type (eql 'TARGETS))
+                                         &context (window-system pgtk))
+  (let ((sel (pgtk-get-selection-internal selection-symbol target-type)))
+    (if (vectorp sel)
+        sel
+      (vector sel))))
+
 
 (defvar pgtk-preedit-overlay nil)

Po Lu, is this the right level to fix this? Or should we handle
'CLIPBOARD + 'TARGETS specially in `pgtk-get-selection-internal'? (And
maybe we should add "&optional time_stamp terminal" to the
`cl-defmethods' in pgtk-win.el)

Robert
--