GNU bug report logs - #24803
Redirection problem with separate minibuffer frame

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Stefan Monnier <monnier@HIDDEN>; dated Wed, 26 Oct 2016 18:10:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 24803 <at> debbugs.gnu.org:


Received: (at 24803) by debbugs.gnu.org; 30 Oct 2016 08:47:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 30 04:47:34 2016
Received: from localhost ([127.0.0.1]:36980 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1c0lmA-0002u7-Ht
	for submit <at> debbugs.gnu.org; Sun, 30 Oct 2016 04:47:34 -0400
Received: from mout.gmx.net ([212.227.17.20]:54740)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1c0lm9-0002tf-Dp
 for 24803 <at> debbugs.gnu.org; Sun, 30 Oct 2016 04:47:33 -0400
Received: from [192.168.1.100] ([212.95.7.5]) by mail.gmx.com (mrgmx101) with
 ESMTPSA (Nemesis) id 0MI9n0-1c2QjK0PB0-003wjP;
 Sun, 30 Oct 2016 09:47:24 +0100
Message-ID: <5815B395.9030905@HIDDEN>
Date: Sun, 30 Oct 2016 09:47:17 +0100
From: martin rudalics <rudalics@HIDDEN>
MIME-Version: 1.0
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#24803: Redirection problem with separate minibuffer frame
References: <jwvpomn9e4j.fsf@HIDDEN> <58123AD6.4070703@HIDDEN>
 <jwv7f8q6agf.fsf-monnier+emacsbugs@HIDDEN>
In-Reply-To: <jwv7f8q6agf.fsf-monnier+emacsbugs@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K0:1OocH9jjVK2n8CFWfVzFByK3v9yh2ot8Mcv42tMBswSkY8aSegb
 EsZow91dw2S0UAtDUyuUPMnWryZ61+tlR7Hqs8ISHFUHK5X3OiSY4vCGpSF4cElELUHnBfV
 Svl9uFMI5EI333giUane1aczI3hw1z4gmqlawFG4W5SiXdDH0/Nr7aSALpAwVrTR4zjwCHa
 y2PedftYmTdVokZmH1hTw==
X-UI-Out-Filterresults: notjunk:1;V01:K0:51CfHBsxmGA=:JmwAfI7PjsT1NTO7A7rCD8
 ZeoyfgCuPgRo9fCW0z7SmII82wHtxiedjTPrHUKvJkjFVGwsZ1pSi+zkcaFR3HJVy9JZfFkWE
 8VDD3fsy/J3fx9UGyyMJYHImwMQreEioKsIFCPSbVZ4/njwcgG88GKVK7iGhtl3xNWTMalhVi
 vWMM1rkcRcpbrElo49niYt6gAg06O8NyytTPiBru6CzkciMBGLBwgO7hAGTEUQzM0DORYUj6J
 wUAlaBjZc+0FAtI2mDjlygfqKtBZSAJawNTjiYNigOjr2GffA30GVvwuLPFKAAgwKoni+W4kB
 9u1FQ+0BRJcXGCMp9GgdMzYKoLQKd/CNKGEZqUrNhxsjgiZjtzU3s2thOTwy1ji3U6EWYMHZ9
 gDQON9XfiZP9de9x0nwYAsNzlyNHKo3PEduiKQCeSCIJT3k7GMMN5K8VnWR0CCB3pCDhaGe/W
 iXLvwBIOTc60AgIR2jP7I1XKkznqMmMAcNHCUnn+IRXi2WOg/jsbh8OF8SiUnFFIzqXuy7M1z
 bui/QJKy3JXXCsSP+JGr4O0EVJ/8z99Bgy4mks+Zhs7PGvwvXLuGe0X9v7YyM4fah32OtsYMe
 /V5Niw3RzoP99djcZR2IoM5l4gWTCC7lEsxTV8umT+uSH3NAITHSDD8y4LXsB7bXwWZkfz/jq
 J+KHnSj01OasPbcAuwcET8IJR73G9pkSwVXid3WO7QnqET3VskGTto7FTze4+7KiyU94a0uKh
 L/ulwr4sihx9S1o2QrqMsW3bLbJOC7Hn2TkeFebrgcv+y1S73hKqKYb3M/MIReBc0FNmOiYoS
 GKQrNUUkeDAL5h+UNhJAb/x5elSEQ==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 24803
Cc: 24803 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

 > Reverting the frame.c change seems to fix the problem.

As expected.  Please keep it this way for the moment.  If we don't find
a better solution, I'll do the revert on master.  Currently, I'd be more
interested if someone else sees the same or a similar problem.

 > BTW I also just noticed that the bogus (the one I get at the end of my=

 > recipe) focus is "mutual":
 > - when the mouse points at the minibuffer window, the focus is in the
 >    *scratch* buffer.
 > - when the mouse points in the *scratch* window, the focus is in the
 >    minibuffer!

With emacs -Q and just =E2=80=98display-buffer-alist=E2=80=99 customized =
and no
minibuffer dialogue in process?  Queer.

 >> Hmm... This seems to indicate that I do not remove the redirection wh=
en
 >> exiting the minibuffer.  Could you try to augment in read_minibuf_unw=
ind
 >>
 >>    if (minibuf_level =3D=3D 0)
 >>      resize_mini_window (XWINDOW (window), 0);
 >>
 >> to something that for each frame redirects focus to itself?
 >
 > Still haven't found the time to try this, but I just want to mention
 > that until recently, the focus redirection was usually nil rather than=

 > "redirected to itself".

Indeed you would have to set it to nil.  And obviously my proposal is
not a solution anyway since someone might want to redirect focus without
any minibuffers being involved in the first place.

 > I'm not sure if there should be a difference between these two states,=

 > but I have the suspicion that not all the C code handles those two
 > states in the same way (then again, last time I looked at the
 > redirection code, I concluded that I just don't understand how it's
 > supposed to work, so maybe it's just my misunderstanding).

I'm currently struggling with focus redirection in various contexts -
for example, when redirecting focus from a parent to a child frame and
back again.  So far it's a lost battle :-(

martin





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24803; Package emacs. Full text available.

Message received at 24803 <at> debbugs.gnu.org:


Received: (at 24803) by debbugs.gnu.org; 29 Oct 2016 22:54:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 29 18:54:12 2016
Received: from localhost ([127.0.0.1]:36871 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1c0cVw-0006VT-Bf
	for submit <at> debbugs.gnu.org; Sat, 29 Oct 2016 18:54:12 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:42441)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1c0cVu-0006VL-Eo
 for 24803 <at> debbugs.gnu.org; Sat, 29 Oct 2016 18:54:11 -0400
Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id u9TMs8UN012269;
 Sat, 29 Oct 2016 18:54:08 -0400
Received: by ceviche.home (Postfix, from userid 20848)
 id A85C56622D; Sat, 29 Oct 2016 18:54:07 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>
Subject: Re: bug#24803: Redirection problem with separate minibuffer frame
Message-ID: <jwv7f8q6agf.fsf-monnier+emacsbugs@HIDDEN>
References: <jwvpomn9e4j.fsf@HIDDEN> <58123AD6.4070703@HIDDEN>
Date: Sat, 29 Oct 2016 18:54:07 -0400
In-Reply-To: <58123AD6.4070703@HIDDEN> (martin rudalics's message of "Thu, 27
 Oct 2016 19:35:18 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 2 Rules triggered
	EDT_SA_DN_PASS=0, RV5842=0
X-NAI-Spam-Version: 2.3.0.9418 : core <5842> : inlines <5388> : streams
 <1718205> : uri <2317336>
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 24803
Cc: 24803 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.7 (--)

> Please revert the frame.c change so we can be sure which of the two is
> the real culprit.

Reverting the frame.c change seems to fix the problem.

BTW I also just noticed that the bogus (the one I get at the end of my
recipe) focus is "mutual":
- when the mouse points at the minibuffer window, the focus is in the
  *scratch* buffer.
- when the mouse points in the *scratch* window, the focus is in the
  minibuffer!

> Works as intended on both Windows XP and a GTK+ build with XFCE on
> Debian.  I use focus-follows-mouse plus auto-raise-frame though the
> minibuffer does _not_ get autoraised when moving the mouse there.
> Actually, that's what I would call a misbehavior here ;-)

I don't use auto-raise of any kind.  But yes, it's probably dependent on
some aspect of the window manager event sequences.

> Hmm... This seems to indicate that I do not remove the redirection when
> exiting the minibuffer.  Could you try to augment in read_minibuf_unwind
>
>   if (minibuf_level == 0)
>     resize_mini_window (XWINDOW (window), 0);
>
> to something that for each frame redirects focus to itself?

Still haven't found the time to try this, but I just want to mention
that until recently, the focus redirection was usually nil rather than
"redirected to itself".

I'm not sure if there should be a difference between these two states,
but I have the suspicion that not all the C code handles those two
states in the same way (then again, last time I looked at the
redirection code, I concluded that I just don't understand how it's
supposed to work, so maybe it's just my misunderstanding).


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24803; Package emacs. Full text available.

Message received at 24803 <at> debbugs.gnu.org:


Received: (at 24803) by debbugs.gnu.org; 27 Oct 2016 17:35:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 27 13:35:32 2016
Received: from localhost ([127.0.0.1]:32777 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bzoaS-0001VP-2V
	for submit <at> debbugs.gnu.org; Thu, 27 Oct 2016 13:35:32 -0400
Received: from mout.gmx.net ([212.227.17.20]:57249)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1bzoaQ-0001VC-L9
 for 24803 <at> debbugs.gnu.org; Thu, 27 Oct 2016 13:35:31 -0400
Received: from [192.168.1.100] ([212.95.7.14]) by mail.gmx.com (mrgmx102) with
 ESMTPSA (Nemesis) id 0MFAaV-1c64up0hdT-00GEYS;
 Thu, 27 Oct 2016 19:35:20 +0200
Message-ID: <58123AD6.4070703@HIDDEN>
Date: Thu, 27 Oct 2016 19:35:18 +0200
From: martin rudalics <rudalics@HIDDEN>
MIME-Version: 1.0
To: Stefan Monnier <monnier@HIDDEN>, 24803 <at> debbugs.gnu.org
Subject: Re: bug#24803: Redirection problem with separate minibuffer frame
References: <jwvpomn9e4j.fsf@HIDDEN>
In-Reply-To: <jwvpomn9e4j.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K0:LDeqJxTxy73+T48pvwljHvG3UyFj+t0beIme4QpSClo0RNex52X
 Eq+1BIGpdFgeMW7iQLRtVVmcgd4Rs0JUAVz+scCTYd1HqiqpQU9HA+iSodHcNKtXN7iFQT+
 92mxw1MYYmYyCQk5UR73ggRtOgihgoV418wKntAyG3iglU/g2tDpKRfv99uvTppqeCJBIpw
 XJUk00abGvJxVWDaiRecw==
X-UI-Out-Filterresults: notjunk:1;V01:K0:qPF9kexRy0I=:y7/43bWxtsGzcXB45y8UHq
 JLZSwN97aTTnIi2yqDdveqfijJqPVtLiztEmYfF0uosMQ9BPt3CBAqSKtaQbEiIcFs3/tJHV1
 DZU04HlsVobMQXbDTk9Rdq1Ah+nPgPrxm4RCXjlMSLvBRIAcXh0o1SLeILUIED1/L878Zf6rZ
 fB1JN2jK+4ooM1syFE5G5yNmACWnveIJI2R4l4XFeIsJ/jsGWwtHaiDdBEEaOTlIjeGauHwsV
 bCX6ixV7H/SDvTLU0GhfqzXQwqMRS4a0HQaqi+YkUgNFm5y2v5ua2JV6ImJcu5DFSEAcf6wBB
 sfGnhW8HqH4Il6PMLH9Q0KKBJRbe8Oqunp9viUVEUbps362UPbUkVRhrIkUFCUcGoD4tvGNET
 4iofE+ETtC+VEvtfiQHdswuY/o0vhO4VyELrCRzMQcybjXRL7ww1peAgTetDRFfyCLWTEHHog
 DdPUKlDXWL6aKKHuK4hJzLS2L2eDJun7uO6aVREk4F3joSn9tGLH8tSO7r8FEQuSsAg2MpjaX
 Atqt9Z/iXgI4McB6T4MWjnFuEZjyKdr8kDAE58MBwpRpX194CRJLuRTpH3f/l5pEAjF+uNlBX
 RxQYcy71SxyzuJEUpqGrwHkp4/nckcMuyLTYd3tKDpnmv644Jwflmrs+nTCg4kfd40/KsJF6H
 Xnv5JpmF1ac/mFBdT3qJJNGRvlGnI5WZgnCt3yFb/2tPAJX8OX8t2qGh7voTYP1C2FA2g4CLP
 ZsFqN9fjo1jhLSxPnan2H0cv68dnPHFL9kT/8jCkZDgO46IZQtmIiRJdsE55FFn8QMZPwiKGR
 8iZW2CIVsEkaCoIO83HulvMs7vRbw==
X-Spam-Score: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  > I'm seeing redirection problems in my Emacs setup (with
 separate > minibuffer-only frame). I suspect it comes from > > commit
 421c0512f76683e0b85ea5e1362291c2da4149ba
 > Author: Martin Rudalics > Date: Mon Oct 17 10:52:01 2016 +0200 > > Fix
 frame focus redirection with shared minibuffer windows (Bug#24500) > > *
 src/frame.c
 (do_switch_frame): Redirect frame focus also when > the frame switched to
 has its minibuffer window on the selected > frame. > * src/window.c
 (candidate_window_p):
 To qualify as candidate > it's not sufficient for the window's frame to just
 share the > minibuffer window - it must be active as well. [...] 
 Content analysis details:   (2.6 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
 (rudalics[at]gmx.at)
 -0.0 SPF_PASS               SPF: sender matches SPF record
 3.3 RCVD_IN_SORBS_WEB      RBL: SORBS: sender is an abusable web server
 [212.95.7.14 listed in dnsbl.sorbs.net]
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
 trust [212.227.17.20 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [212.227.17.20 listed in wl.mailspike.net]
X-Debbugs-Envelope-To: 24803
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  > I'm seeing redirection problems in my Emacs setup (with
    separate > minibuffer-only frame). I suspect it comes from > > commit 421c0512f76683e0b85ea5e1362291c2da4149ba
    > Author: Martin Rudalics > Date: Mon Oct 17 10:52:01 2016 +0200 > > Fix
   frame focus redirection with shared minibuffer windows (Bug#24500) > > * src/frame.c
    (do_switch_frame): Redirect frame focus also when > the frame switched to
    has its minibuffer window on the selected > frame. > * src/window.c (candidate_window_p):
    To qualify as candidate > it's not sufficient for the window's frame to just
    share the > minibuffer window - it must be active as well. [...] 
 
 Content analysis details:   (2.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  3.3 RCVD_IN_SORBS_WEB      RBL: SORBS: sender is an abusable web server
                             [212.95.7.14 listed in dnsbl.sorbs.net]
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
                             trust
                             [212.227.17.20 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [212.227.17.20 listed in wl.mailspike.net]
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail provider
                             (rudalics[at]gmx.at)
 -0.0 SPF_PASS               SPF: sender matches SPF record

 > I'm seeing redirection problems in my Emacs setup (with separate
 > minibuffer-only frame).  I suspect it comes from
 >
 >      commit 421c0512f76683e0b85ea5e1362291c2da4149ba
 >      Author: Martin Rudalics <rudalics@HIDDEN>
 >      Date:   Mon Oct 17 10:52:01 2016 +0200
 >
 >        Fix frame focus redirection with shared minibuffer windows (Bug#24500)
 >
 >        * src/frame.c (do_switch_frame): Redirect frame focus also when
 >        the frame switched to has its minibuffer window on the selected
 >        frame.
 >        * src/window.c (candidate_window_p): To qualify as candidate
 >        it's not sufficient for the window's frame to just share the
 >        minibuffer window - it must be active as well.

Please revert the frame.c change so we can be sure which of the two is
the real culprit.

 > I just managed to reliably reproduce one of the symptoms of the problem:
 >
 >      % emacs -Q --eval "(setq default-frame-alist '((minibuffer)))"
 >      ... place the minibuffer frame so that half of it covers the main frame ...
 >      ... now from the minibuffer frame, do
 >      C-h f car RET
 >
 > at this point, the stacking order has been changed: the main frame is above
 > the minibuffer-only frame.  Then I move the mouse into the part of the
 > minibuffer frame still visible and I type
 >
 >      ffff
 >
 > The first `f` should call `find-file` (according to
 > minibuffer-inactive-mode-map), but instead the `ffff` text gets inserted
 > into the *scratch* buffer because of some inappropriate focus redirection.
 > [ This recipe depends on using a window-manager with
 >    focus-follows-mouse and it might also depend on other aspects of the
 >    window manager's behavior.  ]

Works as intended on both Windows XP and a GTK+ build with XFCE on
Debian.  I use focus-follows-mouse plus auto-raise-frame though the
minibuffer does _not_ get autoraised when moving the mouse there.
Actually, that's what I would call a misbehavior here ;-)

 > +      if (!NILP (FRAME_FOCUS_FRAME (XFRAME (frame)))
 > +          && !EQ (FRAME_FOCUS_FRAME (XFRAME (frame)), frame))
[...]
 > +  if (minibuf_level == 0)

Hmm... This seems to indicate that I do not remove the redirection when
exiting the minibuffer.  Could you try to augment in read_minibuf_unwind

   if (minibuf_level == 0)
     resize_mini_window (XWINDOW (window), 0);

to something that for each frame redirects focus to itself?  Obviously,
this might fail with recursive minibuffer invocations from two different
frames ...

martin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24803; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Oct 2016 18:09:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 26 14:09:18 2016
Received: from localhost ([127.0.0.1]:57844 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bzSda-0004Jx-Fo
	for submit <at> debbugs.gnu.org; Wed, 26 Oct 2016 14:09:18 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52095)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1bzSdY-0004Jj-68
 for submit <at> debbugs.gnu.org; Wed, 26 Oct 2016 14:09:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1bzSdR-0007o8-Rg
 for submit <at> debbugs.gnu.org; Wed, 26 Oct 2016 14:09:10 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:37462)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <monnier@HIDDEN>)
 id 1bzSdR-0007o4-OT
 for submit <at> debbugs.gnu.org; Wed, 26 Oct 2016 14:09:09 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43054)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1bzSdP-0002Pk-U9
 for bug-gnu-emacs@HIDDEN; Wed, 26 Oct 2016 14:09:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <monnier@HIDDEN>) id 1bzSdK-0007kW-TU
 for bug-gnu-emacs@HIDDEN; Wed, 26 Oct 2016 14:09:07 -0400
Received: from alt44.smtp-out.videotron.ca ([23.233.128.31]:7268)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <monnier@HIDDEN>)
 id 1bzSdK-0007k0-Oc
 for bug-gnu-emacs@HIDDEN; Wed, 26 Oct 2016 14:09:02 -0400
Received: from ceviche.home ([24.202.159.173]) by Videotron with SMTP
 id zSdIbxrbZcMN9zSdJbIhSq; Wed, 26 Oct 2016 14:09:01 -0400
X-Authority-Analysis: v=2.1 cv=YqOvP9sX c=1 sm=1 tr=0
 a=drQ1+/MlVPSpi4JwKQuNfg==:117 a=drQ1+/MlVPSpi4JwKQuNfg==:17
 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=CH0kA5CcgfcA:10
 a=hcp_KWb3LyN37U6EM3cA:9
Received: by ceviche.home (Postfix, from userid 20848)
 id 57ED066239; Wed, 26 Oct 2016 14:09:00 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Redirection problem with separate minibuffer frame
Date: Wed, 26 Oct 2016 14:09:00 -0400
Message-ID: <jwvpomn9e4j.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-CMAE-Envelope: MS4wfLFOLedcgw37bnFU14+HNiirkNppFGehI4HrTQ0ttcZQMImefX3ItZoHpGyLduDYVKu9Wprdr7MoqEAnYHkwAWUWEFnmJ2WmjPxEqdpz+GCk628b1JSG
 799XHib7d0cD5mZ+RTBrhZWyAhNQ0F2tWM17TzEJqnnwYzQ8wCDZMlAYELCzVLgCqIo+ECmRJr9H8A==
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

Package: Emacs
Version: 26.0.50


I'm seeing redirection problems in my Emacs setup (with separate
minibuffer-only frame).  I suspect it comes from

    commit 421c0512f76683e0b85ea5e1362291c2da4149ba
    Author: Martin Rudalics <rudalics@HIDDEN>
    Date:   Mon Oct 17 10:52:01 2016 +0200
    
      Fix frame focus redirection with shared minibuffer windows (Bug#24500)
      
      * src/frame.c (do_switch_frame): Redirect frame focus also when
      the frame switched to has its minibuffer window on the selected
      frame.
      * src/window.c (candidate_window_p): To qualify as candidate
      it's not sufficient for the window's frame to just share the
      minibuffer window - it must be active as well.

I just managed to reliably reproduce one of the symptoms of the problem:

    % emacs -Q --eval "(setq default-frame-alist '((minibuffer)))"
    ... place the minibuffer frame so that half of it covers the main frame ...
    ... now from the minibuffer frame, do
    C-h f car RET

at this point, the stacking order has been changed: the main frame is above
the minibuffer-only frame.  Then I move the mouse into the part of the
minibuffer frame still visible and I type

    ffff

The first `f` should call `find-file` (according to
minibuffer-inactive-mode-map), but instead the `ffff` text gets inserted
into the *scratch* buffer because of some inappropriate focus redirection.
[ This recipe depends on using a window-manager with
  focus-follows-mouse and it might also depend on other aspects of the
  window manager's behavior.  ]

A few years back, I had a problem with focus redirection which I tracked
with the patch below.  I never removed the patch after fixing the bug,
so the first symptom of the new problem was that I started to see "Left
over focus redirection!" messages all the time.  At first I thought it
was my patch at fault, so I disabled it, but since then I started to see
various odd behaviors, which I think all get down to the left over
redirection reproduced in the above recipe.

This said, I also noticed something else: ever since this redirection
problem appeared, I often see my cursor furiously blinking very rapidly
for a very short amount of time, every time I select another frame
(which happens all the time with my focus-follows-mouse WM).  I used to
see this also back when I was tracking that old redirection problem, so
I suspect that we have a redisplay bug/inefficiency that's only
triggered when some redirection is in place.


        Stefan


diff --git a/src/minibuf.c b/src/minibuf.c
index 57eea05..dcafc77 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -338,6 +338,18 @@ If the current buffer is not a minibuffer, return its entire contents.  */)
   return make_buffer_string (prompt_end, PT, 1);
 }
 
+static void
+check_no_redirected_focus (void)
+{
+  Lisp_Object tail, frame;
+  FOR_EACH_FRAME (tail, frame)
+    {
+      if (!NILP (FRAME_FOCUS_FRAME (XFRAME (frame)))
+          && !EQ (FRAME_FOCUS_FRAME (XFRAME (frame)), frame))
+	message ("Left over focus redirection!");
+    }
+}
+
 
 /* Read from the minibuffer using keymap MAP and initial contents INITIAL,
    putting point minus BACKUP_N bytes from the end of INITIAL,
@@ -380,6 +392,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   Lisp_Object empty_minibuf;
   Lisp_Object dummy, frame;
 
+
+  if (minibuf_level == 0)
+    record_unwind_protect_void (check_no_redirected_focus);
+
   specbind (Qminibuffer_default, defalt);
   specbind (Qinhibit_read_only, Qnil);
 






Acknowledgement sent to Stefan Monnier <monnier@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#24803; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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