Subject: bug#76414: 31.0.50; can't paste images with yank-media

From: Visuwesh <[email-masked]>
Date: Sat, 22 Feb 2025 20:23:59 +0530

[சனி பிப்ரவரி 22, 2025] Eli Zaretskii wrote:

>> Date: Wed, 19 Feb 2025 14:44:05 +0000
>> From:  the_wurfkreuz via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <[email-masked]>
>> 
>> I was previously using Emacs that I built from commit b568ff418ce. Now I've tried to use the latest one, and I
>> can't paste images using yank-media after using this command 'grim -g "$(slurp)" - | wl-copy'. If I go back to
>> the b568ff418ce commit, then everything works fine.

This commit was pushed after Po Lu's fix for bug#72254 so it is not a
regression from that fix.

>> I have instances of Emacs opened right now, and evaluating (gui-get-selection 'CLIPBOARD 'TARGETS) on
>> the one built from the b568ff418ce commit returns '[image/png]' and i can paste the image. The one built
>> from the latest commit returns '[]'.

What version of Org do you have loaded?  A recent workaround for
bug#72254 was pushed for Emacs≤29 to the bugfix branch (I think?).  It
shouldn't be enabled when you run the master branch but I might have
messed up the logic of the test.  To be sure this isn't the case, can
you tell what

    (pgtk-get-selection-internal 'CLIPBOARD 'TARGETS)

returns?  If it returns the same thing, then we can rule out this
possibility.  You can skip this if you're using the version that ships
with Emacs.

The only commit that touched src/pgtkselect.c after b568ff418ce is
Paul's commit intended to pacify GCC warnings.  It seems to have changed
a function that is used by pgtk-get-selection-internal, could you please
check if reverting ff65cc9944dc0b37986d512ee8b9817c6913db36 fixes the
issue?

> Visuwesh, could you please see if you can reproduce, and if so, try to
> find the offending change?  This is before I installed your yank-media
> changes.

Thanks for reminding me, Eli.  I neglected to allot time to look at this
bug when I came across it earlier.

It would be nice if someone could check if they can reproduce the bug on
Wayland in a pgtk build.  I am still on Xorg.