Subject: Re: bug#20804: 24.4; XdndDrop does not use time stamp

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 01 Aug 2019 23:40:06 +0200

Urs Fleisch <[email-masked]> writes:

[...]

> However, I think that also the behavior of Emacs could
> be improved. It does not use the time stamp which can be found in the
> XdndDrop message when requesting the selection. The XDND specification
> <http://www.newplanetsoftware.com/xdnd/> states:
>
> XdndDrop
>
> Sent from source to target to complete the drop.
>
>     data.l[0] contains the XID of the source window.
>     data.l[1] is reserved for future use (flags).
>     data.l[2] contains the time stamp for retrieving the data. (new in
>     version 1)
>
> When passing the value found in data.l[2] as the optional time stamp
> argument to x-get-selection-internal, dropping from Qt 5 works with
> Emacs. I have attached a patch fixing this.
>
> ~~~~
> --- x-dnd.el.orig	2015-06-13 09:52:02.999811917 +0200
> +++ x-dnd.el	2015-06-13 09:53:30.808247335 +0200
> @@ -496,10 +496,12 @@
>  	((equal "XdndDrop" message)
>  	 (if (windowp window) (select-window window))
>  	 (let* ((dnd-source (aref data 0))
> +		(timestamp (aref data 2))
>  		(value (and (x-dnd-current-type window)
>  			    (x-get-selection-internal
>  			     'XdndSelection
> -			     (intern (x-dnd-current-type window)))))
> +			     (intern (x-dnd-current-type window))
> +			     timestamp)))
>  		success action)

(I'm going through old bug reports that have unfortunately not gotten
any responses.)

I'm not really familiar with how drag and drop works, but I think this
sounds like it makes sense.  Does anybody else with more knowledge (than
me) about this area think so too?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no