GNU bug report logs - #69083
Emacs's keyboard hook state is not reset on session lock (Windows)

Previous Next

Package: emacs;

Reported by: Raffael Stocker <r.stocker <at> mnet-mail.de>

Date: Mon, 12 Feb 2024 19:37:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #44 received at 69083 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Raffael Stocker <r.stocker <at> mnet-mail.de>
Cc: 69083 <at> debbugs.gnu.org
Subject: Re: bug#69083: Emacs's keyboard hook state is not reset on session
 lock (Windows)
Date: Sun, 03 Mar 2024 19:23:05 +0200
> From: Raffael Stocker <r.stocker <at> mnet-mail.de>
> Cc: 69083 <at> debbugs.gnu.org
> Date: Sun, 03 Mar 2024 17:43:56 +0100
> 
> >> I don't know much about the internals of Emacs frame handling.
> >> Could ‘w32_frame_list_z_order’ be used (from the input thread) for
> >> something like that?  Or is there a better approach?
> >
> > Why is the order important?  Can't you "hand" the registration to some
> > other frame, no matter which one?
> 
> The order is not important, I just didn't know where to look to get
> a frame; sorry for the noise.  I now use ‘Fnext_frame’.

Unfortunately, I don't think you cannot use Fnext_frame here.  The
function which calls it, w32_wnd_proc, runs in a separate thread, so
it generally cannot access Lisp objects safely.  However, it is okay
to traverse the list of the frames, as w32_window_to_frame does, see
the comment at the beginning of w32_wnd_proc.  So I think you could
use a similar loop with FOR_EACH_FRAME, and use some frame from there,
perhaps the first one?

Alternatively, and maybe more safely, you could call
maybe_pass_notification from w32_destroy_window, which is called from
the main (a.k.a. "Lisp") thread, so then you can use Fnext_frame
(actually, I would make next_frame extern instead of static and call
it directly).  This means the notifications are passed a bit before
the frame is actually deleted by the OS, but I think this is okay?

Otherwise, I think the patch is fine, at least from reading it.

Thanks.




This bug report was last modified 1 year and 162 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.