Subject: bug#57012: Activating versus raising frames

From: Daniel Colascione <[email-masked]>
Date: Sat, 06 Aug 2022 22:52:20 -0400

On August 6, 2022 22:45:26 Po Lu <[email-masked]> wrote:

> Daniel Colascione <[email-masked]> writes:
>
>> The GDK code specifically mentions that programs that handle events
>> themselves (like Emacs) need to explicitly update the event time (as
>> my patch does)
>
> The GDK documentation is unclear.  You only have to update the event
> time if the event is not passed to GDK, by setting *finish to
> X_EVENT_DROP, which really only happens with key press events.
>
>> What is the bug?
>
> Client messages sent to x-dnd.el did not automatically update the user
> time, causing various selection-related functions to use an outdated
> timestamp.
>
>> Sorry, but I strongly disagree. The concept of signaling to the
>> underlying window system that the user has interacted in some manner
>> with a frame is generic and not X-specific. In fact --- doesn't the
>> pgtk backend need an implementation of this hook too? It, like the
>> conventional GTK backend, is blind to interactions with the frame
>> performed using emacsclient.
>
> No, the PGTK backend doesn't have a concept of "server time".  The GDK
> Wayland backend implements them via event serials, which cannot be
> generated.  It is also unnecessary to specify the server time when
> trying to activate a toplevel window.
>
> The only window system I know of that requires that to be specified is
> X, so let's keep the code specific to X.

pgtk also runs on X, and the problem must be solved there in some manner. 
GTK has no magic facility for knowing that emacsclient ran. Regardless, a 
terminal hook is not expensive, and I don't want to add yet more window 
system typecases to the code. Terminal access should be polymorphic. It's 
through terminal hooks that we make them polymorphic. I'm not removing the 
terminal hook.