GNU bug report logs

#78527 30.1; Mishaving new frame creation in MacOS on new desktop

version graph
PackageSource(s)Maintainer(s)
emacs PTS Buildd Popcon
Full log

Message #47 received at 78527@debbugs.gnu.org (full text, mbox, reply):

Received: (at 78527) by debbugs.gnu.org; 5 Jun 2025 09:06:01 +0000
From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 05 05:06:01 2025
Received: from localhost ([127.0.0.1]:58820 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1uN6Xw-0006bd-9P
	for submit@debbugs.gnu.org; Thu, 05 Jun 2025 05:06:01 -0400
Received: from mout.gmx.net ([212.227.17.20]:40185)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rudalics@gmx.at>) id 1uN6Xu-0006b2-7P
 for 78527@debbugs.gnu.org; Thu, 05 Jun 2025 05:05:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at;
 s=s31663417; t=1749114346; x=1749719146; i=rudalics@gmx.at;
 bh=40krXRoBb/M5Al8zznxDat/3lraZPwvzg/fuMKwXg1o=;
 h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc:
 References:From:In-Reply-To:Content-Type:
 Content-Transfer-Encoding:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=AZYisnGOrvIxk15gEYi6z/wYZdmXxcxT1N4H4b4SV5hjLTmdngf07uw2nYt79Of4
 cppJ8Vncqh5QJxhQpYwsZOVYXOkh0jTGzd88+wL97EKoLeVC6is/Q70zbC4e/eV/o
 McFHqk5mmBMHVs9QZJzNvar5zQheN6UUVAH+KuFPsO8jKp2bY4YUusYmRnbRA/CRW
 Y1KJHx3CMq6AsWBenrUvLNRqjIJfAeim4q+rq9xxy2fP5Tb4dI4Ja3mxvj5VFiGTR
 LeWQBnihX2XT7S8azYHAuju5nGqGM5yyzbmBN2RL4CnHGk4GWSWgiAykOzF0XEvGO
 wcM5DMU/YPFyAsmmGA==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from [192.168.31.113] ([212.95.8.152]) by mail.gmx.net (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mn2aN-1v6e1l032V-00qODP; Thu, 05
 Jun 2025 11:05:46 +0200
Message-ID: <db66688e-d099-467c-95be-e9d80a330544@gmx.at>
Date: Thu, 5 Jun 2025 11:05:45 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#78527: 30.1; Mishaving new frame creation in MacOS on new
 desktop
To: Boris Aronov <aronov.boris@gmail.com>
References: <CAGPpUSoPzgd4bSKoAagQniBZoS+fhMZp0ZskoW5nA24VNxmtYg@mail.gmail.com>
 <865xht6k1e.fsf@gnu.org> <db4f94fe-a395-4ece-a9bb-6d763d7d0235@gmx.at>
 <CAGPpUSr-uyVcoOBMyEjVLSCp8+=RnkCiWyjw5afSs4XnkT9N=A@mail.gmail.com>
 <97dfdc42-d676-4cf0-a1cd-b248d441a6f7@gmx.at>
 <CAGPpUSrQDJmx=PEjJRpozzHZrQAD0S-fRCxNNhPB7ViAN4yfDA@mail.gmail.com>
Content-Language: en-US
From: martin rudalics <rudalics@gmx.at>
In-Reply-To: <CAGPpUSrQDJmx=PEjJRpozzHZrQAD0S-fRCxNNhPB7ViAN4yfDA@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64
X-Provags-ID: V03:K1:DkOhWmRvjEBSPipafigB9J05U5Nztd2azYT3xbCRYM1TG02S1mG
 60K1+7YQP7pT3h8AsJumUL6xlgwVDIabXbLVPiO66DEJ1Cf/mmFCCwIW3eMKUkBAlB71yf4
 kwWqkUnGnrm4VpSXN/a4cTnuuNsVS868lbYbW3S0zATpRIhV5Rs7ckOjRHzBS33kLvopRYq
 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I4KstgyvQJZS1/CtPT2VqUmxTn+3Dksxnne1uKNXI
 kI9HoesvZPlVAAnxxMufqb+6WyrevcRG/V1c4QLfmS61im7KZ1sUhQTFLcn5wAdsfPKkTE0nA
 L1DL8JF0y/abN8D6DnatxKRSAnXG5nzjqqILg6pf/XK7jpfRAHyCMlsOlFGaT+dQyNOk8XisT
 C38DodBkvdxyGEQOJf7FuImiSwJUKVze/BieX/33YSdMyWE18NVRPkfk4fLQgtkgnZPoyfabE
 uyktcXYN+4eXpd9H
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78527
Cc: Gerd Möllmann <gerd.moellmann@gmail.com>,
 Eli Zaretskii <eliz@gnu.org>, 78527@debbugs.gnu.org
X-BeenThere: debbugs-submit@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@debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit@debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>> I'm still a bit dense in the following sense: You have a fullscreen
>> frame, do C-x 5 2 and now see the new frame on a new desktop but it
>> apparently didn't get focus because, as you say, the prompt doesn't
>> appear there.  However, in your initial posting you say that "Focus
>> shifts there".  What makes you think that focus shifted there?  The
>> appearance of the cursor, the mode line, some decoration in the new
>> frame?  Does C-x 2 split a window in the new or old frame?
>>
>
> C-x 2: New frame, surprisingly.

Not really.  C-x 2 splits the selected window and that's the one on the
new frame.  The C-x 5 2 need _not_ necessarily have made the new frame
the selected one but it apparently does so on your system.  On many
systems, the window manager gives users the choice whether a freshly
created window should automatically become "active", that is, has
keystrokes directed to it.  In your case we apparently have a split
behavior - the new frame becomes selected but focus remains on the old
frame.

> But subsequent commands are still messed
> up.  For example, after C-x 2 I now have 2 windows in the new frame, but if
> I try M-x, the prompt shows up the old frame!

You would have to trace choose_minibuf_frame in minibuf.c to find out
why Emacs shows the prompt in the old frame.  I'm afraid you won't be
able to do that.  Try the following instead: With a fullscreen Emacs
showing *scratch* insert the following text

(setq old-frame (selected-frame))
(setq new-frame (make-frame))

(defun foo ()
  (interactive)
  (insert
   (format "selected: % s old: %s new: %s old-mw: %s new-mw: %s"
	   (selected-frame) old-frame new-frame
	   (window-frame (minibuffer-window old-frame))
	   (window-frame (minibuffer-window new-frame)))))

(global-set-key [(control l)] 'foo)

do M-x RET eval-buffer RET and then type C-l.  The text this adds to
+scratch* might tell us which minibuffer window Emacs wants to use.

> That's without trying any of
> the hooks you suggested.
>
> Focus: Sorry.  I did not use the right terminology.  I only at the moment
> work on my laptop with a single physical screen.  So when a "new frame
> opens on new desktop",  what I see on my physical screen is the old desktop
> slides off to the left and a new desktop with a new frame appears.  I
> probably should not have used the word "focus."  I get a new frame with a
> highlighted cursor in the main window.

This again only indicates that Emacs considers the new frame as the
selected one.  Here on xfce WM windows have decorations showing which
window the WM considers as the one having focus - where it directs
keystrokes to.  Does your bad scenario happen with an initially
"maximized" (not "fullboth") frame too?  Then maybe such decorations
would reveal more information.

> Just noticed another weirdness, btw:
> – I see a blinking cursor with emacs -Q.
> – But after I have two frames in different desktops, immediately after I
> switch between desktops (in either direction), the cursor is highlighted,
> but does not blink.
> – In fact, this cursor thing has nothing to do with full screen or
> desktops: with two regular frames next to each other on a common desktop,
> when *I click on a frame to switch focus there*, the cursor gets
> highlighted, but does not blink until I do something...  *But if I do C-x 5
> 2 to switch frames, *it blinks as it should.  And when I switch from
> Firefox (where I am writing this) to Emacs (using Alt-TAB [=command-TAB]),
> the cursor initially does not blink.

This further indicates a problem with what Emacs thinks about which of
its frames has focus.

> Another experiment (similar to what I wrote in an earlier email): Do the
> C-x 5 2 from a full-screen frame.  Do a M-x.  I do *not* see the prompt.
> Now use MacOS shortcut keys to switch frames (ctrl-right/left).  Then the
> M-x prompt appears in BOTH frames.

But you can't tell since you can see only one frame at a time.  What is
your value of 'minibuffer-follows-selected-frame'?  Does changing it
change the behavior you see?

> In one it is selected (cursor is
> highlighted)

Is "it" the minibuffer window or just the frame?

> and in the other it is not (highlighted cursor is in the main
> *scratch* window).  This is w/o any of the hooks you wanted me to try.
> Just plain Macports Emacs -Q.

Again this hints at a focus problem.  We would have to understand how
focusing works on MacOS.  You could try with

(defun foo-it (&rest rest)
  (with-current-buffer (get-buffer-create "*foo*")
    (goto-char (point-max))
    (when rest
      (insert (format "%s" (car rest)))
      (setq rest (cdr rest))
      (while rest
	(insert (format " .. %s" (car rest)))
	(setq rest (cdr rest)))
      (insert "\n"))))

(defun my-foo-it ()
  (let ((frames (frame-list))
	frame foo)
    (while frames
      (setq frame (car frames))
      (setq foo (cons (cons frame (frame-focus-state frame)) foo))
      (setq frames (cdr frames)))
    (foo-it foo)))

(add-function :after after-focus-change-function #'my-foo-it)

and tell us what the buffer *foo* contains after C-x 5 2.  The focus
handling code has changed in Emacs a couple of years ago and I have no
idea whether 'frame-focus-state' is useful at all.

martin

Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Wed Sep 10 21:27:19 2025; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.