GNU bug report logs - #61319
30.0.50; 'M-x select-frame-by-name' --with-pgtk does not switch focused frame

Previous Next

Package: emacs;

Reported by: Protesilaos Stavrou <info <at> protesilaos.com>

Date: Mon, 6 Feb 2023 10:53:01 UTC

Severity: normal

Found in version 30.0.50

Full log


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

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Protesilaos Stavrou <info <at> protesilaos.com>, 61319 <at> debbugs.gnu.org,
 joseph <at> ferano.io
Subject: Re: bug#61319: 30.0.50; 'M-x select-frame-by-name' --with-pgtk does
 not switch focused frame
Date: Mon, 06 Feb 2023 21:40:59 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: Joseph Ferano <joseph <at> ferano.io>
>> From: Protesilaos Stavrou <info <at> protesilaos.com>
>> Date: Mon, 06 Feb 2023 12:52:35 +0200
>> 
>> When using Emacs PGTK, the command 'select-frame-by-name' does not
>> switch focus to the selected frame.  Instead, it selects the buffer on
>> the specified frame, but keeps the current frame in focus.
>> 
>> Steps to reproduce with 'emacs -Q':
>> 
>> 1. In the scratch buffer, do 'M-x make-frame'
>> 2. In one of the two frames, switch to another buffer, such as "*Messages*".
>> 3. Do 'M-x select-frame-by-name' and select the other frame.
>
> You are saying that select-frame-set-input-focus doesn't move the
> input focus to the newly-selected frame?  But that is only "best
> effort":
>
>   select-frame-set-input-focus is a byte-compiled Lisp function in
>   ‘frame.el’.
>
>   (select-frame-set-input-focus FRAME &optional NORECORD)
>
>   Select FRAME, raise it, and set input focus, if possible.
>                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Perhaps Po Lu could try fixing this, but in general Lisp programs and
> users should not rely on success in these cases, because the WM can
> actively prevent Emacs from giving the frame input focus.

The Wayland protocol itself prevents Emacs from doing this.

GTK 3 uses a private Wayland protocol extension named ``gtk-shell''
which is implemented only by GNOME's Wayland compositor; it does not
support the other extension typically used to activate toplevels.

Unless you're using GNOME Shell, I don't think we will be able to make
this work, sorry.  If you do, however, it should already work.  So
please tell us what Wayland compositor you are using.

Thanks.





This bug report was last modified 2 years and 127 days ago.

Previous Next


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