* bug#72986: Disabling menu-bar-mode changes size of new frames
@ 2024-09-02 18:48 Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 12:07 ` Eli Zaretskii
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-02 18:48 UTC (permalink / raw)
To: 72986
[-- Attachment #1: Type: text/plain, Size: 761 bytes --]
Reproduction with Emacs 29.3 (also with git master HEAD, see below).
Run: emacs -Q
C-x 5 2 ; window opens the same size as the initial window
M-x menu-bar-mode RET ; disable menu-bar-mode
C-x 52 ; window opens much smaller than initial window
With master HEAD (commit 92ea393a16e), the situation is slightly different:
Run: emacs -Q
C-x 52 ; window opens much smaller than initial window
When the new windows are opening at a small size, changing
default-frame-alist has no effect. When the new windows are opening at the
same size as the initial window (with Emacs 29.3, as above), then changing
default-frame-alist works as expected.
I'm running on Ubuntu 24.04, under GNOME 46 with X11. I don't have any
Emacs X resources set.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 2321 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-02 18:48 bug#72986: Disabling menu-bar-mode changes size of new frames Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-03 12:07 ` Eli Zaretskii
2024-09-03 12:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 15:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 82+ messages in thread
From: Eli Zaretskii @ 2024-09-03 12:07 UTC (permalink / raw)
To: Reuben Thomas, martin rudalics, Po Lu; +Cc: 72986
> Date: Mon, 2 Sep 2024 19:48:57 +0100
> From: Reuben Thomas via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> Reproduction with Emacs 29.3 (also with git master HEAD, see below).
>
> Run: emacs -Q
> C-x 5 2 ; window opens the same size as the initial window
> M-x menu-bar-mode RET ; disable menu-bar-mode
> C-x 52 ; window opens much smaller than initial window
>
> With master HEAD (commit 92ea393a16e), the situation is slightly different:
>
> Run: emacs -Q
> C-x 52 ; window opens much smaller than initial window
I cannot reproduce this, but I'm not on X. Here on MS-Windows,
disabling menu-bar-mode makes the frames one line smaller, and
thereafter "C-x 5 2" creates frames whose dimensions are exactly
identical to the existing frames. As expected.
I see the above both in Emacs 29, on the current emacs-30 release
branch, and on master.
> I'm running on Ubuntu 24.04, under GNOME 46 with X11. I don't have any Emacs X resources set.
You didn't say which toolkit did you build with. It might be
important.
Adding Martin and Po Lu in the hope that they will have comments
and/or suggestions.
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 12:07 ` Eli Zaretskii
@ 2024-09-03 12:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 15:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-03 12:09 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Po Lu, martin rudalics, 72986
[-- Attachment #1: Type: text/plain, Size: 196 bytes --]
On Tue, 3 Sept 2024 at 13:07, Eli Zaretskii <eliz@gnu.org> wrote:
>
> You didn't say which toolkit did you build with. It might be
> important.
>
gtk-3 in both cases.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 976 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 12:07 ` Eli Zaretskii
2024-09-03 12:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-03 15:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 15:59 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-03 15:52 UTC (permalink / raw)
To: Eli Zaretskii, Reuben Thomas, Po Lu; +Cc: 72986
>> Reproduction with Emacs 29.3 (also with git master HEAD, see below).
>>
>> Run: emacs -Q
>> C-x 5 2 ; window opens the same size as the initial window
>> M-x menu-bar-mode RET ; disable menu-bar-mode
Here with a GTK-3 build on XFCE disabling menu-bar-mode makes both
frames smaller by the menu bar height. Does this happen on your system?
>> C-x 52 ; window opens much smaller than initial window
>>
>> With master HEAD (commit 92ea393a16e), the situation is slightly different:
>>
>> Run: emacs -Q
>> C-x 52 ; window opens much smaller than initial window
In all these cases after every single step please evaluate
(frame-geometry)
and post the results here. The window manager is mutter, I suppose?
Thanks, martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 15:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-03 15:59 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:03 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-03 15:59 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 2630 bytes --]
On Tue, 3 Sept 2024 at 16:52, martin rudalics <rudalics@gmx.at> wrote:
> >> Reproduction with Emacs 29.3 (also with git master HEAD, see below).
> >>
> >> Run: emacs -Q
> >> C-x 5 2 ; window opens the same size as the initial window
> >> M-x menu-bar-mode RET ; disable menu-bar-mode
>
> Here with a GTK-3 build on XFCE disabling menu-bar-mode makes both
> frames smaller by the menu bar height. Does this happen on your system?
>
Yes it does.
>> C-x 52 ; window opens much smaller than initial window
> >>
> >> With master HEAD (commit 92ea393a16e), the situation is slightly
> different:
> >>
> >> Run: emacs -Q
> >> C-x 52 ; window opens much smaller than initial window
>
> In all these cases after every single step please evaluate
>
> (frame-geometry)
>
> and post the results here.
Sure thing:
Emacs 29:
emacs -Q
(frame-geometry): ((outer-position 1127 . 81) (outer-size 1384 . 1504)
(external-border-size 28 . 34) (outer-border-width . 0) (title-bar-size 0 .
46) (menu-bar-external . t) (menu-bar-size 1328 . 50) (tab-bar-size 0 . 0)
(tool-bar-external . t) (tool-bar-position . top) (tool-bar-size 1328 . 82)
(internal-border-width . 0))
C-x 5 2
menu-bar-mode RET
(frame-geometry): ((outer-position 1127 . 81) (outer-size 1384 . 1454)
(external-border-size 28 . 34) (outer-border-width . 0) (title-bar-size 0 .
46) (menu-bar-external . t) (menu-bar-size 0 . 0) (tab-bar-size 0 . 0)
(tool-bar-external . t) (tool-bar-position . top) (tool-bar-size 1328 . 82)
(internal-border-width . 0))
C-x 5 2
(frame-geometry): ((outer-position 28 . 90) (outer-size 456 . 570)
(external-border-size 28 . 34) (outer-border-width . 0) (title-bar-size 0 .
46) (menu-bar-external . t) (menu-bar-size 0 . 0) (tab-bar-size 0 . 0)
(tool-bar-external . t) (tool-bar-position . top) (tool-bar-size 400 . 82)
(internal-border-width . 0))
Emacs git master (commit 92ea393a16e):
emacs -Q
(frame-geometry): ((outer-position 28 . 90) (outer-size 1384 . 1504)
(external-border-size 28 . 34) (outer-border-width . 0) (title-bar-size 0 .
46) (menu-bar-external . t) (menu-bar-size 1328 . 50) (tab-bar-size 0 . 0)
(tool-bar-external . t) (tool-bar-position . top) (tool-bar-size 1328 . 82)
(internal-border-width . 0))
C-x 5 2
(frame-geometry): ((outer-position 108 . 170) (outer-size 456 . 620)
(external-border-size 28 . 34) (outer-border-width . 0) (title-bar-size 0 .
46) (menu-bar-external . t) (menu-bar-size 400 . 50) (tab-bar-size 0 . 0)
(tool-bar-external . t) (tool-bar-position . top) (tool-bar-size 400 . 82)
(internal-border-width . 0))
The window manager is mutter, I suppose?
>
Indeed, yes.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 5657 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 15:59 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-03 17:03 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:29 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:44 ` Eli Zaretskii
0 siblings, 2 replies; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-03 17:03 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> Sure thing:
Thanks. The geometry values are consistent with what you described.
This seems to be Bug#67654 and Bug#68463 and possibly Bug#65559. When
you run Emacs from a console or under gdb can you observe whether it
triggers a
gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
which typically means that the menubar cannot be accommodated.
The one really notable difference to the above bugs is that the 29
version makes a shrunk frame only after you've removed the menubar while
master makes a shrunk frame immediately. Are the GTK versions of the
Emacs 29 build and the master build the same?
> The window manager is mutter, I suppose?
>>
>
> Indeed, yes.
mutter doesn't like us. Just to make sure one thing: Would setting
'frame-resize-pixelwise' to t change anything?
Otherwise I would try to build Emacs with gtk2, lucid or motif.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 17:03 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-03 17:29 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:42 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 8:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:44 ` Eli Zaretskii
1 sibling, 2 replies; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-03 17:29 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]
On Tue, 3 Sept 2024 at 18:03, martin rudalics <rudalics@gmx.at> wrote:
> > Sure thing:
>
> Thanks. The geometry values are consistent with what you described.
> This seems to be Bug#67654 and Bug#68463 and possibly Bug#65559. When
> you run Emacs from a console or under gdb can you observe whether it
> triggers a
>
> gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
>
Yes, both with Emacs 29 and git master produce this message when
menu-bar-mode is non-nil, and the menu bar is drawn, in both window sizes
(the normal sized window, and the strangely small one).
The one really notable difference to the above bugs is that the 29
> version makes a shrunk frame only after you've removed the menubar while
> master makes a shrunk frame immediately. Are the GTK versions of the
> Emacs 29 build and the master build the same?
>
Yes, they are identical: gtk 3.24.41, Ubuntu build.
Just to make sure one thing: Would setting
> 'frame-resize-pixelwise' to t change anything?
>
So, I did (setq frame-resize-pixelwise t), then disabled menu-bar-mode (in
Emacs 29), then C-x 5 2 (in both Emacs 29 & git master), and the new window
was small, just as before. It seems therefore to make no difference.
Otherwise I would try to build Emacs with gtk2, lucid or motif.
I tried building Emacs git master with gtk2, and it doesn't fix the
problem: the second window opened is slightly smaller than before (i.e.
very small indeed).
Building with lucid does fix the problem (both with menu-bar-mode enabled,
and disabled).
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 3239 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 17:29 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-03 17:42 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 8:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-03 17:42 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
On Tue, 3 Sept 2024 at 18:29, Reuben Thomas <rrt@sc3d.org> wrote:
>
> Otherwise I would try to build Emacs with gtk2, lucid or motif.
>
>
>
I can confirm that building with no toolkit (as recommended in the issues
you mentioned) also fixes the problem.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1059 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 17:03 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:29 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-03 17:44 ` Eli Zaretskii
2024-09-03 18:34 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 8:05 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 2 replies; 82+ messages in thread
From: Eli Zaretskii @ 2024-09-03 17:44 UTC (permalink / raw)
To: rrt, martin rudalics; +Cc: luangruo, 72986
> Date: Tue, 3 Sep 2024 19:03:05 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, Po Lu <luangruo@yahoo.com>,
> 72986@debbugs.gnu.org
> From: martin rudalics <rudalics@gmx.at>
>
> mutter doesn't like us. Just to make sure one thing: Would setting
> 'frame-resize-pixelwise' to t change anything?
>
> Otherwise I would try to build Emacs with gtk2, lucid or motif.
Isn't it true that disabling menu-bar-mode from the init file avoids
these problems?
Reuben, is running with menu-bar-mode disabled at all a goal of yours,
or you reported this issue simply because it looks like incorrect
behavior, and you don't really care about running without the menu
bar?
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 17:44 ` Eli Zaretskii
@ 2024-09-03 18:34 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 8:05 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-03 18:34 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: luangruo, martin rudalics, 72986
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]
On Tue, 3 Sept 2024 at 18:44, Eli Zaretskii <eliz@gnu.org> wrote:
> Isn't it true that disabling menu-bar-mode from the init file avoids
> these problems?
>
I don't think so: I had it customized off and had to bisect my
customizations in order to find what was causing the problem.
Reuben, is running with menu-bar-mode disabled at all a goal of yours,
>
Yes!
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1269 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 17:29 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:42 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-04 8:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 11:23 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-04 8:01 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
>> Thanks. The geometry values are consistent with what you described.
>> This seems to be Bug#67654 and Bug#68463 and possibly Bug#65559. When
>> you run Emacs from a console or under gdb can you observe whether it
>> triggers a
>>
>> gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
>>
>
> Yes, both with Emacs 29 and git master produce this message when
> menu-bar-mode is non-nil, and the menu bar is drawn, in both window sizes
> (the normal sized window, and the strangely small one).
But you can't see this message when building with gtk-2 I presume.
> The one really notable difference to the above bugs is that the 29
>> version makes a shrunk frame only after you've removed the menubar while
>> master makes a shrunk frame immediately. Are the GTK versions of the
>> Emacs 29 build and the master build the same?
>>
>
> Yes, they are identical: gtk 3.24.41, Ubuntu build.
This strongly hints that there was an Emacs change affecting gtk-2 _and_
gtk-3 builds in between 29 and master. I could imagine that commit
e087c89b1e243bbd941a4a50b4bf99613e13d016
is involved but if you could try to bisect, it would be of great help.
> Just to make sure one thing: Would setting
>> 'frame-resize-pixelwise' to t change anything?
>>
>
> So, I did (setq frame-resize-pixelwise t), then disabled menu-bar-mode (in
> Emacs 29), then C-x 5 2 (in both Emacs 29 & git master), and the new window
> was small, just as before. It seems therefore to make no difference.
Which should eliminate the possibility that our size hints are
responsible. IIRC mutter is very severe when size hints are not set up
correctly.
> Otherwise I would try to build Emacs with gtk2, lucid or motif.
>
>
> I tried building Emacs git master with gtk2, and it doesn't fix the
> problem: the second window opened is slightly smaller than before (i.e.
> very small indeed).
This would eliminate earlier conjectures that changes from one gtk-3
version to another would be responsible. And it would exclude
emacsgtkfixed.c as possible culprit.
> Building with lucid does fix the problem (both with menu-bar-mode enabled,
> and disabled).
I suppose that all these problems happen when requests travel from GTK
to mutter and back. Basically, mutter is not obliged to fulfill any
size or position request for any top-level (non-child frame). BTW,
could you try adding a (user-size . t) member to 'default-frame-alist'?
And could you try doing that from an 'early-init.el' file?
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-03 17:44 ` Eli Zaretskii
2024-09-03 18:34 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-04 8:05 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-04 8:05 UTC (permalink / raw)
To: Eli Zaretskii, rrt; +Cc: luangruo, 72986
> Isn't it true that disabling menu-bar-mode from the init file avoids
> these problems?
In Reuben's second scenario 'menu-bar-mode' is not disabled. The second
frame is smaller with the menu bar enabled.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-04 8:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-04 11:23 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 12:12 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 17:11 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-04 11:23 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]
On Wed, 4 Sept 2024 at 09:02, martin rudalics <rudalics@gmx.at> wrote:
> >>
> >> gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
> >>
> >
> > Yes, both with Emacs 29 and git master produce this message when
> > menu-bar-mode is non-nil, and the menu bar is drawn, in both window
> sizes
> > (the normal sized window, and the strangely small one).
>
> But you can't see this message when building with gtk-2 I presume.
>
That's correct, no message with gtk-2.
This strongly hints that there was an Emacs change affecting gtk-2 _and_
> gtk-3 builds in between 29 and master. I could imagine that commit
>
> e087c89b1e243bbd941a4a50b4bf99613e13d016
>
> is involved but if you could try to bisect, it would be of great help.
>
Just to check, you're suggesting that I bisect from emacs-29.3 (I use that
tag because it's what the version of 29 I'm using is built from) to master
HEAD, to find at which commit C-x 5 2 opens a small window immediately
(without disabling menu-bar-mode)?
BTW, could you try adding a (user-size . t) member to 'default-frame-alist'?
> And could you try doing that from an 'early-init.el' file?
>
This made no difference. I added just:
(add-to-list 'default-frame-alist '(user-size . t))
to ~/.config/emacs/early-init.el
Then I ran each Emacs with just "emacs", confirmed that default-frame-alist
was set, then disabled menu-bar-mode (Emacs 29 only), then C-x 5 2. In each
case a small window was opened as before.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 3466 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-04 11:23 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-04 12:12 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 13:05 ` Robert Pluim
2024-09-04 17:11 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 82+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-04 12:12 UTC (permalink / raw)
To: Reuben Thomas; +Cc: martin rudalics, Eli Zaretskii, 72986
Reuben Thomas <rrt@sc3d.org> writes:
> On Wed, 4 Sept 2024 at 09:02, martin rudalics <rudalics@gmx.at> wrote:
>
> >>
> >> gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
> >>
> >
> > Yes, both with Emacs 29 and git master produce this message when
> > menu-bar-mode is non-nil, and the menu bar is drawn, in both window sizes
> > (the normal sized window, and the strangely small one).
>
> But you can't see this message when building with gtk-2 I presume.
>
> That's correct, no message with gtk-2.
>
> This strongly hints that there was an Emacs change affecting gtk-2 _and_
> gtk-3 builds in between 29 and master. I could imagine that commit
>
> e087c89b1e243bbd941a4a50b4bf99613e13d016
>
> is involved but if you could try to bisect, it would be of great help.
>
> Just to check, you're suggesting that I bisect from emacs-29.3 (I use
> that tag because it's what the version of 29 I'm using is built from)
> to master HEAD, to find at which commit C-x 5 2 opens a small window
> immediately (without disabling menu-bar-mode)?
If it is this bug that you are trying to isolate, we have already heard
reports of its being reproducible all the way to Emacs 26.1, and
concluded that it is a product of a change in the Mutter window manager.
Too bad I'm only personally interested in the no toolkit and Motif
builds and cannot set aside the time to investigate these GTK issues at
this time.
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-04 12:12 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-04 13:05 ` Robert Pluim
0 siblings, 0 replies; 82+ messages in thread
From: Robert Pluim @ 2024-09-04 13:05 UTC (permalink / raw)
To: Po Lu; +Cc: martin rudalics, Eli Zaretskii, 72986, Reuben Thomas
>>>>> On Wed, 04 Sep 2024 20:12:28 +0800, Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> said:
Po Lu> If it is this bug that you are trying to isolate, we have already heard
Po Lu> reports of its being reproducible all the way to Emacs 26.1, and
Po Lu> concluded that it is a product of a change in the Mutter window manager.
As a reference point: I donʼt see this issue here with mutter 43.8
Robert
--
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-04 11:23 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 12:12 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-04 17:11 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 22:45 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-04 17:11 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> Just to check, you're suggesting that I bisect from emacs-29.3 (I use that
> tag because it's what the version of 29 I'm using is built from) to master
> HEAD, to find at which commit C-x 5 2 opens a small window immediately
> (without disabling menu-bar-mode)?
That's the idea, yes.
> This made no difference. I added just:
>
> (add-to-list 'default-frame-alist '(user-size . t))
>
> to ~/.config/emacs/early-init.el
>
> Then I ran each Emacs with just "emacs", confirmed that default-frame-alist
> was set, then disabled menu-bar-mode (Emacs 29 only), then C-x 5 2. In each
> case a small window was opened as before.
I had no hope that this would help.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-04 17:11 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-04 22:45 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 7:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-04 22:45 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
On Wed, 4 Sept 2024 at 18:11, martin rudalics <rudalics@gmx.at> wrote:
> > Just to check, you're suggesting that I bisect from emacs-29.3 (I use
> that
> > tag because it's what the version of 29 I'm using is built from) to
> master
> > HEAD, to find at which commit C-x 5 2 opens a small window immediately
> > (without disabling menu-bar-mode)?
>
> That's the idea, yes.
>
Thanks for confirming.
My bisection suggests the problematic commit is
241616831024c9c9fe2b2378b611db0a560b9675
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1353 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-04 22:45 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-05 7:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 19:31 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-05 7:49 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> My bisection suggests the problematic commit is
> 241616831024c9c9fe2b2378b611db0a560b9675
Thanks. Please try first setting 'frame-inhibit-implied-resize' to t
which should avoid that a frame gets resized when the menu bar is
enabled or disabled (this time I have slightly more hope that it fixes
your problem).
If this does not help, please proceed as follows: Try to undo that
commit (I cite it below) and please first run without the commit under
gdb with a breakpoint at the line
adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);
in xg_update_frame_menubar. Please note all values you see after doing
p req.height
whenever you hit that breakpoint (here the value is 27 all the time) -
that is when you create the initial frame and after C-x 5 2. Then
restore current master and repeat the same steps. When the values
differ, this should tell us something about what happens.
martin
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -4141,7 +4141,7 @@ xg_update_frame_menubar (struct frame *f)
g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f);
gtk_widget_show_all (x->menubar_widget);
gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req);
- req.height *= xg_get_scale (f);
+ req.height *= scale;
#if !defined HAVE_PGTK && defined HAVE_GTK3
if (FRAME_DISPLAY_INFO (f)->n_planes == 32)
@@ -4154,9 +4154,9 @@ xg_update_frame_menubar (struct frame *f)
}
#endif
- if (FRAME_MENUBAR_HEIGHT (f) != (req.height * scale))
+ if (FRAME_MENUBAR_HEIGHT (f) != req.height)
{
- FRAME_MENUBAR_HEIGHT (f) = req.height * scale;
+ FRAME_MENUBAR_HEIGHT (f) = req.height;
adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);
}
unblock_input ();
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-05 7:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-05 19:31 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 7:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-05 19:31 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]
On Thu, 5 Sept 2024 at 08:49, martin rudalics <rudalics@gmx.at> wrote:
> > My bisection suggests the problematic commit is
> > 241616831024c9c9fe2b2378b611db0a560b9675
>
> Thanks. Please try first setting 'frame-inhibit-implied-resize' to t
> which should avoid that a frame gets resized when the menu bar is
> enabled or disabled
Setting the variable to t does indeed prevent the frame being resized when
menu-bar-mode is toggled, but has no effect on the size of the subsequent
windows created.
If this does not help, please proceed as follows: Try to undo that
> commit (I cite it below)
I checked out git master HEAD (currently df57e44a08f) and reverted commit
241616831024c9c9fe2b2378b611db0a560b9675 on top of that.
and please first run without the commit under
> gdb with a breakpoint at the line
>
> adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);
>
> in xg_update_frame_menubar. Please note all values you see after doing
>
> p req.height
>
50 (before initial frame opens)
50 (after C-x 5 2, before second frame opens)
And the second frame opens at the expected size, the same size as the first.
Then restore current master and repeat the same steps. When the values
> differ, this should tell us something about what happens.
>
50 (before initial frame opens)
50 (after C-x 5 2, before second frame opens)
But the second frame opens small.
[-- Attachment #2: Type: text/html, Size: 3531 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-05 19:31 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-06 7:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 8:11 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-06 7:54 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> I checked out git master HEAD (currently df57e44a08f) and reverted commit
> 241616831024c9c9fe2b2378b611db0a560b9675 on top of that.
Good.
> and please first run without the commit under
>> gdb with a breakpoint at the line
>>
>> adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);
>>
>> in xg_update_frame_menubar. Please note all values you see after doing
>>
>> p req.height
>>
>
> 50 (before initial frame opens)
> 50 (after C-x 5 2, before second frame opens)
>
> And the second frame opens at the expected size, the same size as the first.
>
> Then restore current master and repeat the same steps. When the values
>> differ, this should tell us something about what happens.
>>
>
> 50 (before initial frame opens)
> 50 (after C-x 5 2, before second frame opens)
>
> But the second frame opens small.
Inexplicable to me. Please conduct both runs once more. But rather
than using the debugger simply evaluate
(setq frame-size-history '(100))
in the initial frame, do C-x 5 2, evaluate
(frame--size-history)
and post the contents of the the buffer *frame-size-history* for each
run here. Maybe we can see some difference then.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-06 7:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-06 8:11 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 9:50 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-06 8:11 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 4175 bytes --]
On Fri, 6 Sept 2024 at 08:54, martin rudalics <rudalics@gmx.at> wrote:
>
> Inexplicable to me. Please conduct both runs once more. But rather
> than using the debugger simply evaluate
>
> (setq frame-size-history '(100))
>
> in the initial frame, do C-x 5 2, evaluate
>
> (frame--size-history)
>
> and post the contents of the the buffer *frame-size-history* for each
> run here. Maybe we can see some difference then.
Buffer contents for master HEAD after C-x 5 2:
Frame size history of #<frame *Minibuf-1* 0x5a93cc9332e8>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x340, DS=1328x1260
tool-bar-lines (2), NS=1328x1260~>400x340, MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=400x340, DS=400x340
ConfigureNotify, PS=1328x1260, XS=400x340, DS=400x340
xg_frame_resized, changed, PS=1328x1260, XS=400x340, DS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x340, DS=400x340
change_frame_size (5), TS=1280x1260~>352x340, TC=80x36~>22x9,
NS=1328x1260~>400x340, IS=1328x1260~>400x340, MS=32x70 IH IV
ConfigureNotify, PS=400x340, XS=400x374
xg_frame_resized, changed, PS=400x340, XS=400x374
change_frame_size_1, delayed, PS=400x340, XS=400x374
change_frame_size (5), TS=352x340~>352x374, TC=22x9~>22x10,
NS=400x340~>400x374, IS=400x340~>400x374, MS=32x70 IH IV
ConfigureNotify, PS=400x374, XS=1280x1354
xg_frame_resized, changed, PS=400x374, XS=1280x1354
change_frame_size_1, delayed, PS=400x374, XS=1280x1354
change_frame_size (5), TS=352x374~>1232x1354, TC=22x10~>77x38,
NS=400x374~>1280x1354, IS=400x374~>1280x1354, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
And again, but with commit 24161683102 reverted:
Frame size history of #<frame *Minibuf-1* 0x5f6dbd4449c0>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x322, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x322
change_frame_size_1, delayed, PS=1328x1260, XS=400x322, DS=1328x1260
change_frame_size (5), TS=1280x1260~>352x322, TC=80x36~>22x9,
NS=1328x1260~>400x322, IS=1328x1260~>400x322, MS=32x70 IH IV
ConfigureNotify, PS=400x322, XS=1328x1258
xg_frame_resized, changed, PS=400x322, XS=1328x1258
change_frame_size_1, delayed, PS=400x322, XS=1328x1258
tool-bar-lines (2), NS=400x322~>1328x1258, MS=160x175
xg_frame_set_char_size, visible, PS=400x322, XS=1328x1258, DS=1328x1258
ConfigureNotify, PS=400x322, XS=1328x1258, DS=1328x1258
xg_frame_resized, changed, PS=400x322, XS=1328x1258, DS=1328x1258
change_frame_size_1, delayed, PS=400x322, XS=1328x1258, DS=1328x1258
change_frame_size (5), TS=352x322~>1280x1258, TC=22x9~>80x35,
NS=400x322~>1328x1258, IS=400x322~>1328x1258, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 5728 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-06 8:11 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-06 9:50 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 12:20 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-06 9:50 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> Buffer contents for master HEAD after C-x 5 2:
I can't figure out what's going on. We get a
ConfigureNotify, PS=400x374, XS=1280x1354
event that tells us to set the frame to some "reasonable" size at least.
And the penultimate lines
> change_frame_size (5), TS=352x374~>1232x1354, TC=22x10~>77x38,
> NS=400x374~>1280x1354, IS=400x374~>1280x1354, MS=32x70 IH IV
tell, for example, that the text size of the frame should increase from
22x10 columns/lines to 77x38 (38 being obviously too large). But
apparently nothing changes which is a complete mystery because
- if the WM does give us the indicated new size and we do not react, you
should at least see an excessive frame border around or a much too
long title bar above the contents of the new frame,
- if the WM only pretended to give us the indicated new size, you should
see the new frame clipped at the right and bottom.
Since neither of these apparently happen, I'm clueless. Could you do
the following: adjust_frame_size (in frame.c) contains the line
if (new_inner_width != old_inner_width)
Please put a breakpoint there and look what happens when new_inner_width
is 1280. That is, use
condition B new_inner_width == 1280
where B is the number of the breakpoint you've set. I'm mostly
interested in whether the breakpoint gets hit at all. If it does get
hit, we can try to dig further.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-06 9:50 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-06 12:20 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 14:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-06 12:20 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 3713 bytes --]
On Fri, 6 Sept 2024 at 10:50, martin rudalics <rudalics@gmx.at> wrote:
> > Buffer contents for master HEAD after C-x 5 2:
>
> I can't figure out what's going on.
I couldn't make sense of the results I sent either, so I re-ran the tests.
Buffer contents after C-x 5 2 with commit 24161683102 reverted:
Frame size history of #<frame *Minibuf-1* 0x5b1397209180>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x322, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x322
change_frame_size_1, delayed, PS=1328x1260, XS=400x322, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=400x322
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258, DS=400x322
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=400x322
tool-bar-lines (2), NS=1328x1260~>1328x1258, MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1258, DS=1328x1258
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1258
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258, DS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1258
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
With git master HEAD:
Frame size history of #<frame *Minibuf-1* 0x5e9870140918>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x340, DS=1328x1260
tool-bar-lines (2), NS=1328x1260~>400x340, MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=400x340, DS=400x340
ConfigureNotify, PS=1328x1260, XS=400x340, DS=400x340
xg_frame_resized, changed, PS=1328x1260, XS=400x340, DS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x340, DS=400x340
change_frame_size (5), TS=1280x1260~>352x340, TC=80x36~>22x9,
NS=1328x1260~>400x340, IS=1328x1260~>400x340, MS=32x70 IH IV
ConfigureNotify, PS=400x340, XS=400x374
xg_frame_resized, changed, PS=400x340, XS=400x374
change_frame_size_1, delayed, PS=400x340, XS=400x374
change_frame_size (5), TS=352x340~>352x374, TC=22x9~>22x10,
NS=400x340~>400x374, IS=400x340~>400x374, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
Now the change_frame_size(5) initial and final sizes look correct.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 5244 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-06 12:20 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-06 14:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 15:14 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-06 14:16 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> Now the change_frame_size(5) initial and final sizes look correct.
OK. In the next step I'd like to isolate the menubar code as the sole
culprit for what's going in. Please with master do
(setq default-frame-alist '((width . 200)))
or some other insanely large value so we can see whether we can make the
GTK error disappear this way. And please apply the trivial patch
diff --git a/src/xfns.c b/src/xfns.c
index 3f0d8f3fcd0..c90ac9c0d37 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5230,7 +5230,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
gui_default_parameter (f, parms, Qmenu_bar_lines,
NILP (Vmenu_bar_mode)
- ? make_fixnum (0) : make_fixnum (1),
+ ? make_fixnum (0) : make_fixnum (0),
NULL, NULL, RES_TYPE_NUMBER);
gui_default_parameter (f, parms, Qtab_bar_lines,
NILP (Vtab_bar_mode)
@@ -5342,7 +5342,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
/* Create the menu bar. */
- if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
+ if (0) // !minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
{
/* If this signals an error, we haven't set size hints for the
frame and we didn't make it visible. */
and do C-x 5 2.
martin
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-06 14:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-06 15:14 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 8:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-06 15:14 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 759 bytes --]
On Fri, 6 Sept 2024 at 15:16, martin rudalics <rudalics@gmx.at> wrote:
>
> OK. In the next step I'd like to isolate the menubar code as the sole
> culprit for what's going in. Please with master do
>
> (setq default-frame-alist '((width . 200)))
>
It takes effect on the initial frame, but doesn't affect the size of the
frame opened with C-x 5 2, or remove the gtk error message:
(emacs:2091071): Gtk-CRITICAL **: 15:57:43.714:
gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
(Just to confirm: I put this setting in early-init.el.)
I then applied the trivial patch you gave to git master HEAD, ran 'emacs
-Q' and did C-x 5 2, and got a small window as usual, but with no error
message in the terminal.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1930 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-06 15:14 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-07 8:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 12:07 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-07 8:37 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> I then applied the trivial patch you gave to git master HEAD, ran 'emacs
> -Q' and did C-x 5 2, and got a small window as usual, but with no error
> message in the terminal.
Let's try to continue from here. Instead of the "trivial" patch please
now use
diff --git a/src/xfns.c b/src/xfns.c
index 3f0d8f3fcd0..e47f5219a6f 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5340,7 +5340,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
gui_default_parameter (f, parms, Qno_accept_focus, Qnil,
NULL, NULL, RES_TYPE_BOOLEAN);
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
+#if defined (USE_X_TOOLKIT) && !defined (USE_GTK)
/* Create the menu bar. */
if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
{
Do you see any error message in the terminal? Now set
(setq default-frame-alist '((menu-bar-lines . 0)))
and do C-x 5 2. How does that behave?
martin
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-07 8:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-07 12:07 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 8:42 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-07 12:07 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
On Sat, 7 Sept 2024 at 09:37, martin rudalics <rudalics@gmx.at> wrote:
>
> -#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
> +#if defined (USE_X_TOOLKIT) && !defined (USE_GTK)
>
OK, so I applied this patch and ran `emacs -Q`, then did C-x 5 2 and got
the usual small window and error:
(emacs:3159980): Gtk-CRITICAL **: 13:05:49.056:
gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
> Now set
>
> (setq default-frame-alist '((menu-bar-lines . 0)))
>
> and do C-x 5 2. How does that behave?
>
That opens a small window with no error message.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1695 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-07 12:07 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-08 8:42 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 11:38 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-08 8:42 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
>> -#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
>> +#if defined (USE_X_TOOLKIT) && !defined (USE_GTK)
>>
>
> OK, so I applied this patch and ran `emacs -Q`, then did C-x 5 2 and got
> the usual small window and error:
>
> (emacs:3159980): Gtk-CRITICAL **: 13:05:49.056:
> gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
Do you get an assertion failure already before the C-x 5 2?
>> Now set
>>
>> (setq default-frame-alist '((menu-bar-lines . 0)))
>>
>> and do C-x 5 2. How does that behave?
>>
>
> That opens a small window with no error message.
From what you've tested till now I can conclude the following.
Your Emacs requests a frame size of 1328x1260 pixels and for some
inexplicable reason your Emacs _always_ gets a ConfigureNotify
notification that tells it that the frame has been shrunk to 400x340
pixels. Below, the values marked with XS are the requested values and
show up as:
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
...
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
The equivalent sequence on my system is
xg_frame_set_char_size, invisible, PS=752x792, XS=752x792, DS=752x792
...
ConfigureNotify, PS=752x792, XS=752x792, DS=752x792
Now two things may happen on your system. In one scenario you get a
second ConfigureNotify event, this time with the expected size:
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=400x322
Emacs complies and there are no further issues. This is the scenario
with commit 24161683102 reverted.
Note: The second ConfigureNotify event in this scenario seems to be a
result of Emacs issuing two apparently identical requests as
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
...
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
with maybe different menu bar sizes. We have yet to find out what
causes the second request.
In the other scenario Emacs complies with the sizes received in the
ConfigureNotify event, re-issues a new resize request with the small
sizes and the next ConfigureNotify event does not cause any change.
xg_frame_set_char_size, visible, PS=1328x1260, XS=400x340, DS=400x340
...
ConfigureNotify, PS=1328x1260, XS=400x340, DS=400x340
The small frame size stays. This is the scenario with current master.
There is no previous second request from the side of Emacs.
One thing that we'd have to verify yet is whether the
gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
can happen only when Emacs issues the
xg_frame_set_char_size, visible, PS=1328x1260, XS=400x340, DS=400x340
request (which I'd expect) or already when we get the ConfigureNotify
event (which I doubt). In either case, I think that the assertion
failure is only a consequence of getting an unreasonable size and not
the cause of it.
Where could we go from here?
(1) Try to find out why we always get a
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
after requesting the larger size. For this purpose we would have to
find out whether 400x340 is some built-in size used by the WM or GTK
or something Emacs itself has used before.
(2) Find out why Emacs in one scenario issues a second resize request
and doesn't do that with the reverted commit. Maybe Po Lu can tell. I
also suppose that the missing second resize request is also the reason
why the menubar-less frame always shrinks. Maybe we should _always_
fake such a request - idempotent resize requests should never harm.
(3) Do not flush events. Could
gdk_flush ();
#ifndef HAVE_PGTK
x_wait_for_event (f, ConfigureNotify);
#endif
flush a ConfigureNotify event to which we should have reacted?
(4) Look for other causes. Could scaling be involved? Do we calculate
size hints correctly - mutter is very selective about these. Should we
delay setting the frame's visibility?
(5) Finally, the most important: Can other users observe the same or
similar behavior as Reuben?
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-08 8:42 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-08 11:38 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 14:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-08 11:38 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]
On Sun, 8 Sept 2024 at 09:42, martin rudalics <rudalics@gmx.at> wrote:
> >> -#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
> >> +#if defined (USE_X_TOOLKIT) && !defined (USE_GTK)
> >>
> >
> > OK, so I applied this patch and ran `emacs -Q`, then did C-x 5 2 and got
> > the usual small window and error:
> >
> > (emacs:3159980): Gtk-CRITICAL **: 13:05:49.056:
> > gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
>
> Do you get an assertion failure already before the C-x 5 2?
>
No.
Where could we go from here?
>
(I comment below where I think I may have useful input.)
after requesting the larger size. For this purpose we would have to
> find out whether 400x340 is some built-in size used by the WM or GTK
> or something Emacs itself has used before.
>
Since this size crops up with emacs -Q, it doesn't seem to be related to
something Emacs has used before. I did also grep through my ~/.emacs.d
directory, but I couldn't find anything relevant there.
(4) Look for other causes. Could scaling be involved?
My GNOME desktop is scaled by 200%, so it could be.
> (5) Finally, the most important: Can other users observe the same or
> similar behavior as Reuben?
>
Several bugs were already reported of similar behaviour, no? Or maybe you
meant something more specific.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 3293 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-08 11:38 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-08 14:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:20 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-08 14:21 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
>> >> -#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
>> >> +#if defined (USE_X_TOOLKIT) && !defined (USE_GTK)
>> >>
>> >
>> > OK, so I applied this patch and ran `emacs -Q`, then did C-x 5 2 and got
>> > the usual small window and error:
>> >
>> > (emacs:3159980): Gtk-CRITICAL **: 13:05:49.056:
>> > gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed
>>
>> Do you get an assertion failure already before the C-x 5 2?
>>
>
> No.
Thanks. Did you ever get an assertion failure for the original frame?
If not, then we should try to understand why not. Please with pristine
master replace the initial assignment of 'frame-size-history' in frame.c
from
frame_size_history = Qnil;
to
frame_size_history = Fcons (make_fixnum (100), Qnil);
start Emacs -Q and tell me the contents of the *frame-size-history*
buffer. The idea is that if the initial frame gets it right, what can
we do to make subsequent C-x 5 2 calls get it right.
>> find out whether 400x340 is some built-in size used by the WM or GTK
>> or something Emacs itself has used before.
>>
>
> Since this size crops up with emacs -Q, it doesn't seem to be related to
> something Emacs has used before. I did also grep through my ~/.emacs.d
> directory, but I couldn't find anything relevant there.
Sorry. I meant something in the history of the frame creation
'frame-size-history' doesn't catch like the initial assignments in
make_frame combined with the values of FRAME_COLUMN_WIDTH and
FRAME_LINE_HEIGHT
FRAME_COLS (f) = FRAME_TOTAL_COLS (f) = rw->total_cols = 80;
FRAME_TEXT_WIDTH (f) = FRAME_PIXEL_WIDTH (f) = rw->pixel_width
= 80 * FRAME_COLUMN_WIDTH (f);
FRAME_LINES (f) = FRAME_TOTAL_LINES (f) = 25;
FRAME_TEXT_HEIGHT (f) = FRAME_PIXEL_HEIGHT (f) = 25 * FRAME_LINE_HEIGHT (f);
or what gui_figure_window_size concocts with the size hints.
> (4) Look for other causes. Could scaling be involved?
>
>
> My GNOME desktop is scaled by 200%, so it could be.
Can you try not using any scaling experimentally? Jan always complained
that GTK does not handle scaling orderly (that is, in our sense).
>> (5) Finally, the most important: Can other users observe the same or
>> similar behavior as Reuben?
>>
>
> Several bugs were already reported of similar behaviour, no? Or maybe you
> meant something more specific.
I meant in the light of what I've written here. IIUC nobody so far has
noticed the two idempotent xg_frame_set_char_size calls and how the
second one sometimes magically fixes things. It would be interesting to
find out whether such "fixes" happen all the time without being noticed.
Also most people have identified natural allocation distribution as a
possible culprit and not as a potential victim. And if the WM is the
culprit, why does the same WM handle Lucid frames or those without
toolkit correctly? Maybe the WM is a racist, maybe we are.
Thanks, martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-08 14:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-08 15:20 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 16:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-08 15:20 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 903 bytes --]
On Sun, 8 Sept 2024 at 15:21, martin rudalics <rudalics@gmx.at> wrote:
> >>
> >> Do you get an assertion failure already before the C-x 5 2?
> >
> > No.
>
> Thanks. Did you ever get an assertion failure for the original frame?
>
I don't think so, no.
If not, then we should try to understand why not. Please with pristine
> master replace the initial assignment of 'frame-size-history' in frame.c
> from
>
> frame_size_history = Qnil;
>
> to
>
> frame_size_history = Fcons (make_fixnum (100), Qnil);
>
> start Emacs -Q and tell me the contents of the *frame-size-history*
> buffer.
There isn't one.
> Can you try not using any scaling experimentally? Jan always complained
> that GTK does not handle scaling orderly (that is, in our sense).
>
I changed scaling to 100%, and it doesn't make any difference.
Thanks for the explanations of the other points.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 2353 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-08 15:20 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-08 16:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 17:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-08 16:54 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> If not, then we should try to understand why not. Please with pristine
>> master replace the initial assignment of 'frame-size-history' in frame.c
>> from
>>
>> frame_size_history = Qnil;
>>
>> to
>>
>> frame_size_history = Fcons (make_fixnum (100), Qnil);
>>
>> start Emacs -Q and tell me the contents of the *frame-size-history*
>> buffer.
>
>
> There isn't one.
Silly me. You have to evaluate
(frame--size-history)
first. Then it should be there.
> I changed scaling to 100%, and it doesn't make any difference.
Another pipe dream gone.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-08 16:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-08 17:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 8:58 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-08 17:32 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 2329 bytes --]
On Sun, 8 Sept 2024 at 17:54, martin rudalics <rudalics@gmx.at> wrote:
> > If not, then we should try to understand why not. Please with pristine
> >> master replace the initial assignment of 'frame-size-history' in
> frame.c
> >> from
> >>
> >> frame_size_history = Qnil;
> >>
> >> to
> >>
> >> frame_size_history = Fcons (make_fixnum (100), Qnil);
> >>
> >> start Emacs -Q and tell me the contents of the *frame-size-history*
> >> buffer.
> >
> >
> > There isn't one.
>
> Silly me. You have to evaluate
>
> (frame--size-history)
>
> first. Then it should be there.
>
Yes, sorry, I didn't think of it either. Here's the output:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at ecls
0x59a9a967e790>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1258, XS=1328x1258
ConfigureNotify, PS=1328x1258, XS=1328x1258
xg_frame_resized, unchanged, PS=1328x1258, XS=1328x1258
ConfigureNotify, PS=1328x1258, XS=1280x1354
xg_frame_resized, changed, PS=1328x1258, XS=1280x1354
change_frame_size_1, delayed, PS=1328x1258, XS=1280x1354
change_frame_size (5), TS=1280x1258~>1232x1354, TC=80x35~>77x38,
NS=1328x1258~>1280x1354, IS=1328x1258~>1280x1354, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 3437 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-08 17:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-09 8:58 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 9:49 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-09 8:58 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 3274 bytes --]
The important fact is that in the entire sequence of the initial frame's
setup you never experience one of those strange ConfigureNotify events
asking to shrink the frame. Why they happen only for subsequent frame
creations will probably remain a mystery.
A new mystery is that your creation of the initial frame has one
xg_frame_set_char_size call followed by two ConfigureNotify events where
the first event asks for 1328x1260 and the second one for 1328x1258
pixels. The same happens again after setting up the tool bar only that
there the first event has 1328x1258 (which matches the previous) and the
second one asks for 1280x1354 pixels. In the first event
xg_frame_resized concludes that nothing changed, in the second event it
notices a change.
When I do the same thing on my system I get
Frame size history of #<frame *scratch* - GNU Emacs at restno 0x1f668c0>
x_create_frame_1 (5), TS=80x25~>720x550, NS=80x25~>736x550, IS=80x25~>736x550, MS=18x44 IH IV
gui_figure_window_size (5), TS=720x550~>720x792, TC=80x25~>80x36, NS=736x550~>736x792, IS=736x550~>736x792, MS=18x44 IH IV
scroll-bar-width (3), NS=736x792~>752x792, IS=736x792~>752x792, MS=90x110
scroll-bar-height (3), MS=90x110
x_create_frame_2 (0), MS=90x110
xg_frame_set_char_size, invisible, PS=752x792, XS=752x792, DS=752x792
xg_frame_set_char_size (5), MS=18x44 IH IV
MapNotify, not hidden & not iconified, PS=752x792, DS=752x792
ConfigureNotify, PS=752x792, XS=752x792, DS=752x792
xg_frame_resized, unchanged, PS=752x792, XS=752x792
menu-bar-lines (2), MS=90x110
xg_frame_set_char_size, visible, PS=752x792, XS=752x792, DS=752x792
ConfigureNotify, PS=752x792, XS=752x792, DS=752x792
xg_frame_resized, unchanged, PS=752x792, XS=752x792
tool-bar-lines (2), MS=90x110
xg_frame_set_char_size, visible, PS=752x792, XS=752x792, DS=752x792
ConfigureNotify, PS=752x792, XS=752x792, DS=752x792
xg_frame_resized, unchanged, PS=752x792, XS=752x792
and the sizes requested by xg_frame_set_char_size and the ones received
by ConfigureNotify remain the same throughout - 752x792.
I have no hope that anyone will tell us what's going on here. Hence
this new mystery will remain unsolved too, I presume. But maybe I'm
missing an important detail here.
I forgot whether creating an initial frame without menubar works
reasonably on your system. So please do the same once more but this
time with --eval "(setq default-frame-alist '((menu-bar-lines . 0)))"
appended to your emacs call. This will conclude our experiments with
the history of the initial frame.
Next let's try the following: Upon receiving a ConfigureNotify event we
don't call change_frame_size when _we_ conclude that nothing has
changed. This conclusion might be wrong so let's _always_ process a
ConfigureNotify event via change_frame_size with the trivial patch I
attached as gtkutil-change.diff.
If this doesn't accomplish anything (as I'd expect), let's try to be
stubborn. For this purpose apply the less trivial patch attached as
gtkutil-reject.diff, do
(setq frame-size-history '(100))
C-x 5 2
(frame--size-history)
and tell me what *frame-size-history* says in the new frame (if we're
unlucky and I did something wrong, this might get your Emacs run into an
infinite loop and you have to kill it by external means).
martin
[-- Attachment #2: gtkutil-reject.diff --]
[-- Type: text/x-patch, Size: 2506 bytes --]
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..c5c99d6f1bd 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,49 @@ xg_set_geometry (struct frame *f)
}
}
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static int last_resize_count = 0;
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ if (f == last_resize_frame
+ && width != last_resize_width
+ && height != last_resize_height
+ && last_resize_count <= 3)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ if (FRAME_GTK_OUTER_WIDGET (f))
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+ else
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ last_resize_width, last_resize_height);
+
+ last_resize_count++;
+
+ return;
+ }
+ else
+ /* We either got what we asked for or lost the battle. */
+ {
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_count = 0;
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1300,16 +1338,17 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
+ last_resize_frame = f;
+ last_resize_height = outer_height;
+ last_resize_width = outer_width;
+ last_resize_count = 0;
+
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
[-- Attachment #3: gtkutil-change.diff --]
[-- Type: text/x-patch, Size: 1786 bytes --]
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..68ae38550e0 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1135,12 +1135,12 @@ xg_set_geometry (struct frame *f)
xg_frame_resized (struct frame *f, int width, int height)
{
/* Ignore case where size of native rectangle didn't change. */
- if (width != FRAME_PIXEL_WIDTH (f)
- || height != FRAME_PIXEL_HEIGHT (f)
- || (f->new_size_p
- && ((f->new_width >= 0 && width != f->new_width)
- || (f->new_height >= 0 && height != f->new_height))))
- {
+/** if (width != FRAME_PIXEL_WIDTH (f) **/
+/** || height != FRAME_PIXEL_HEIGHT (f) **/
+/** || (f->new_size_p **/
+/** && ((f->new_width >= 0 && width != f->new_width) **/
+/** || (f->new_height >= 0 && height != f->new_height)))) **/
+/** { **/
if (CONSP (frame_size_history))
frame_size_history_extra
(f, build_string ("xg_frame_resized, changed"),
@@ -1152,13 +1152,13 @@ xg_frame_resized (struct frame *f, int width, int height)
change_frame_size (f, width, height, false, true, false);
SET_FRAME_GARBAGED (f);
cancel_mouse_face (f);
- }
- else if (CONSP (frame_size_history))
- frame_size_history_extra
- (f, build_string ("xg_frame_resized, unchanged"),
- FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
- f->new_size_p ? f->new_width : -1,
- f->new_size_p ? f->new_height : -1);
+/** } **/
+/** else if (CONSP (frame_size_history)) **/
+/** frame_size_history_extra **/
+/** (f, build_string ("xg_frame_resized, unchanged"), **/
+/** FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height, **/
+/** f->new_size_p ? f->new_width : -1, **/
+/** f->new_size_p ? f->new_height : -1); **/
}
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-09 8:58 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-09 9:49 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 12:33 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-09 9:49 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 4550 bytes --]
Thanks for your persistence, Martin!
On Mon, 9 Sept 2024 at 09:58, martin rudalics <rudalics@gmx.at> wrote:
>
> I forgot whether creating an initial frame without menubar works
> reasonably on your system. So please do the same once more but this
> time with --eval "(setq default-frame-alist '((menu-bar-lines . 0)))"
> appended to your emacs call. This will conclude our experiments with
> the history of the initial frame.
>
So, I'm doing this with git master HEAD still with the patch that changes
frame.c to initialize frame_size_history thus:
frame_size_history = Fcons (make_fixnum (100), Qnil);
And here is the contents of *frame-size-history*:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at ecls
0x56eeaaf4faa0>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1258, XS=1328x1258
ConfigureNotify, PS=1328x1258, XS=1328x1258
xg_frame_resized, unchanged, PS=1328x1258, XS=1328x1258
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1258, XS=1328x1258
ConfigureNotify, PS=1328x1258, XS=1328x1258
xg_frame_resized, unchanged, PS=1328x1258, XS=1328x1258
set_window_configuration (4), MS=160x175 IH IV
(I observe that this seems to behave just like the "vanilla" version of the
test, only there's no menu bar in the initial frame.)
> Next let's try the following: Upon receiving a ConfigureNotify event we
> don't call change_frame_size when _we_ conclude that nothing has
> changed. This conclusion might be wrong so let's _always_ process a
> ConfigureNotify event via change_frame_size with the trivial patch I
> attached as gtkutil-change.diff.
>
OK, so with just gtkutil-change.diff applied to git master HEAD, I get the
same behaviour as ever when starting 'emacs -Q' and then typing C-x 5 2.
If this doesn't accomplish anything (as I'd expect), let's try to be
> stubborn. For this purpose apply the less trivial patch attached as
> gtkutil-reject.diff, do
>
> (setq frame-size-history '(100))
>
> C-x 5 2
>
> (frame--size-history)
>
> and tell me what *frame-size-history* says in the new frame
Frame size history of #<frame *Minibuf-1* 0x6324643cf650>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x340, DS=1328x1260
tool-bar-lines (2), NS=1328x1260~>400x340, MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=400x340, DS=400x340
ConfigureNotify, PS=1328x1260, XS=400x374, DS=400x340
xg_frame_resized, changed, PS=1328x1260, XS=400x374, DS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x374, DS=400x340
change_frame_size (5), TS=1280x1260~>352x374, TC=80x36~>22x10,
NS=1328x1260~>400x374, IS=1328x1260~>400x374, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
set_window_configuration (4), MS=160x175 IH IV
(No infinite loop!)
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 7095 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-09 9:49 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-09 12:33 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 13:59 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-09 12:33 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 173 bytes --]
> Thanks for your persistence, Martin!
Thanks for yours!
> (No infinite loop!)
Obviously. I modified the PGTK part. Please try again with what I
attached now.
martin
[-- Attachment #2: gtkutil-reject.diff --]
[-- Type: text/x-patch, Size: 2388 bytes --]
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..89061245500 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,45 @@ xg_set_geometry (struct frame *f)
}
}
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static int last_resize_count = 0;
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ if (f == last_resize_frame
+ && (width != last_resize_width
+ || height != last_resize_height)
+ && last_resize_count <= 3)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+
+ last_resize_count++;
+
+ return;
+ }
+ else
+ /* We either got what we asked for or lost the battle. */
+ {
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_count = 0;
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1297,19 +1331,20 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
else
{
#ifndef HAVE_PGTK
+ last_resize_frame = f;
+ last_resize_height = outer_height;
+ last_resize_width = outer_width;
+ last_resize_count = 0;
+
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-09 12:33 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-09 13:59 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 16:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-09 13:59 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]
On Mon, 9 Sept 2024 at 13:33, martin rudalics <rudalics@gmx.at> wrote:
> Obviously. I modified the PGTK part. Please try again with what I
> attached now.
>
This makes an obviously visible difference: C-x 5 2 opens a small frame
which immediately becomes large.
Here's the *frame-size-history* buffer:
Frame size history of #<frame *Minibuf-1* 0x5e56112ccf80>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x671
set_window_configuration (4), MS=160x175 IH IV
Note that once more I retained the simple patch to frame.c to set
frame-size-history to (100).
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 2732 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-09 13:59 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-09 16:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 17:52 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-09 16:52 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1736 bytes --]
> This makes an obviously visible difference: C-x 5 2 opens a small frame
> which immediately becomes large.
>
> Here's the *frame-size-history* buffer:
...
> ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
> xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
> tool-bar-lines (2), MS=160x175
> xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
> xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x671
> set_window_configuration (4), MS=160x175 IH IV
>
> Note that once more I retained the simple patch to frame.c to set
> frame-size-history to (100).
Setting 'frame-size-history' to '(100), doing C-x 5 2 and evaluating
'frame--size-history' should be enough. The frame.c change is needed
only for the initial frame because at that time no Lisp was evaluated.
The result is not yet what I hoped for. We reject two ConfigureNotify
events but the ensuing xg_frame_set_char_size calls do not get us a
ConfigureNotify we'd accept. IIUC the final height may be off by two
pixels. What does (frame-text-height) return for the first and the
second frame? Also I hope you didn't get the GTK assertion failure.
And how does removing the menubar behave?
Now something completely different. A couple of years ago I noticed
that our size hints calculations are fundamentally wrong. I tried to
fix them and I attach some parts of that fix together with the previous
changes I proposed. Attached as size_hints.diff. If the patch does not
apply, complain. I edited it by hand to exclude other changes I made
and I might have made mistakes. Again I'm interested in the history of
the second frame.
martin
[-- Attachment #2: size_hints.diff --]
[-- Type: text/x-patch, Size: 13370 bytes --]
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..7a5cf8e32e1 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,45 @@ xg_set_geometry (struct frame *f)
}
}
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static int last_resize_count = 0;
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ if (f == last_resize_frame
+ && (width != last_resize_width
+ || height != last_resize_height)
+ && last_resize_count <= 3)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+
+ last_resize_count++;
+
+ return;
+ }
+ else
+ /* We either got what we asked for or lost the battle. */
+ {
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_count = 0;
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1199,7 +1233,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
outer_height /= xg_get_scale (f);
outer_width /= xg_get_scale (f);
- xg_wm_set_size_hint (f, 0, 0);
+ xg_wm_set_size_hint (f, 0, 0, width, height);
/* Resize the top level widget so rows and columns remain constant.
@@ -1297,19 +1331,20 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
else
{
#ifndef HAVE_PGTK
+ last_resize_frame = f;
+ last_resize_height = outer_height;
+ last_resize_width = outer_width;
+ last_resize_count = 0;
+
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
@@ -1910,14 +1945,16 @@ xg_free_frame_widgets (struct frame *f)
}
}
-/* Set the normal size hints for the window manager, for frame F.
- FLAGS is the flags word to use--or 0 meaning preserve the flags
- that the window now has.
- If USER_POSITION, set the User Position
- flag (this is useful when FLAGS is 0). */
+/** Set the normal size hints for the window manager, for frame F.
+ FLAGS is the flags word to use--or 0 meaning preserve the flags
+ that the window now has.
+ If USER_POSITION, set the User Position
+ flag (this is useful when FLAGS is 0).
+ WIDTH and HEIGHT are the native pixel sizes for F. */
void
-xg_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
+xg_wm_set_size_hint (struct frame *f, long int flags, bool user_position,
+ int width, int height)
{
/* Must use GTK routines here, otherwise GTK resets the size hints
to its own defaults. */
@@ -1927,6 +1964,9 @@ xg_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
int win_gravity = f->win_gravity;
Lisp_Object fs_state, frame;
int scale = xg_get_scale (f);
+ int hor_fix = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
+ int ver_fix = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0);
+ int rest_width = 0, rest_height = 0;
/* Don't set size hints during initialization; that apparently leads
to a race condition. See the thread at
@@ -1936,6 +1976,16 @@ xg_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
|| FRAME_PARENT_FRAME (f))
return;
+ if (width < 0)
+ width = FRAME_PIXEL_WIDTH (f);
+
+ width /= scale;
+
+ if (height < 0)
+ height = FRAME_PIXEL_HEIGHT (f);
+
+ height /= scale;
+
XSETFRAME (frame, f);
fs_state = Fframe_parameter (frame, Qfullscreen);
if ((EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth))
@@ -1963,22 +2013,26 @@ xg_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
size_hints = f->output_data.xp->size_hints;
hint_flags = f->output_data.xp->hint_flags;
- hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE;
- size_hints.width_inc = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f);
- size_hints.height_inc = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f);
+ hint_flags |= GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE;
+ size_hints.width_inc
+ = frame_resize_pixelwise ? 1 : (FRAME_COLUMN_WIDTH (f) / scale);
+ size_hints.height_inc
+ = frame_resize_pixelwise ? 1 : (FRAME_LINE_HEIGHT (f) / scale);
+
+ base_width = (hor_fix + FRAME_TOOLBAR_WIDTH (f)) / scale;
+ base_height = ((ver_fix + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f))
+ / scale);
- hint_flags |= GDK_HINT_BASE_SIZE;
- /* Use one row/col here so base_height/width does not become zero.
- Gtk+ and/or Unity on Ubuntu 12.04 can't handle it.
- Obviously this makes the row/col value displayed off by 1. */
- base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 1) + FRAME_TOOLBAR_WIDTH (f);
- base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 1)
- + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
+ /* Now correct the base sizes by what the text equivalents of WIDTH
+ and HEIGHT are not multiples of the size increments. */
+ rest_width = (width - hor_fix / scale) % size_hints.width_inc;
+ rest_height = (height - ver_fix / scale) % size_hints.height_inc;
+ size_hints.base_width = base_width + rest_width;
+ size_hints.base_height = base_height + rest_height;
- size_hints.base_width = base_width;
- size_hints.base_height = base_height;
- size_hints.min_width = base_width;
- size_hints.min_height = base_height;
+ /* For GTK2 include the size of external decorations in the minimum
+ sizes, for GTK3 don't do that. I have no idea why these behave
+ differently (on xfwm4 at least). */
/* These currently have a one to one mapping with the X values, but I
don't think we should rely on that. */
@@ -2018,11 +2072,6 @@ xg_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
hint_flags |= GDK_HINT_USER_POS;
}
- size_hints.base_width /= scale;
- size_hints.base_height /= scale;
- size_hints.width_inc /= scale;
- size_hints.height_inc /= scale;
-
if (hint_flags != f->output_data.xp->hint_flags
|| memcmp (&size_hints,
&f->output_data.xp->size_hints,
diff --git a/src/gtkutil.h b/src/gtkutil.h
index b689053b4b8..cf1adf0d606 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -153,7 +153,7 @@ #define XG_ITEM_DATA "emacs_menuitem"
extern int xg_get_default_scrollbar_width (struct frame *f);
extern int xg_get_default_scrollbar_height (struct frame *f);
-extern void xg_wm_set_size_hint (struct frame *, long int, bool);
+extern void xg_wm_set_size_hint (struct frame *, long int, bool, int, int);
extern void update_frame_tool_bar (struct frame *f);
extern void free_frame_tool_bar (struct frame *f);
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index f0fd3000965..c6379280a1d 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -1645,7 +1645,7 @@ #define INSTALL_CURSOR(FIELD, NAME) \
badly we want them. This should be done after we have the menu
bar so that its size can be taken into account. */
block_input ();
- xg_wm_set_size_hint (f, window_prompting, false);
+ xg_wm_set_size_hint (f, window_prompting, false, -1, -1);
unblock_input ();
adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 079945126e0..d16b61b3e9d 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -639,7 +639,7 @@ pgtk_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
pgtk_calc_absolute_position (f);
block_input ();
- xg_wm_set_size_hint (f, 0, false);
+ xg_wm_set_size_hint (f, 0, false, -1, -1);
if (change_gravity != 0)
{
@@ -686,7 +686,7 @@ pgtk_set_window_size (struct frame *f, bool change_gravity,
f->output_data.pgtk->preferred_width = pixelwidth;
f->output_data.pgtk->preferred_height = pixelheight;
- xg_wm_set_size_hint (f, 0, 0);
+ xg_wm_set_size_hint (f, 0, 0, -1, -1);
xg_frame_set_char_size (f, pixelwidth, pixelheight);
gtk_widget_queue_resize (FRAME_WIDGET (f));
@@ -974,7 +974,7 @@ pgtk_set_parent_frame (struct frame *f, Lisp_Object new_value,
fixed, TRUE, TRUE, 0);
f->output_data.pgtk->preferred_width = alloc.width;
f->output_data.pgtk->preferred_height = alloc.height;
- xg_wm_set_size_hint (f, 0, 0);
+ xg_wm_set_size_hint (f, 0, 0, -1, -1);
xg_frame_set_char_size (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, alloc.width),
FRAME_PIXEL_TO_TEXT_HEIGHT (f, alloc.height));
gtk_widget_queue_resize (FRAME_WIDGET (f));
diff --git a/src/xfns.c b/src/xfns.c
index 3f0d8f3fcd0..92f1567b66a 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4845,7 +4845,7 @@ DEFUN ("x-wm-set-size-hint", Fx_wm_set_size_hint, Sx_wm_set_size_hint,
struct frame *f = decode_window_system_frame (frame);
block_input ();
- x_wm_set_size_hint (f, 0, false);
+ x_wm_set_size_hint (f, 0, false, -1, -1);
unblock_input ();
return Qnil;
}
@@ -5340,7 +5340,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
gui_default_parameter (f, parms, Qno_accept_focus, Qnil,
NULL, NULL, RES_TYPE_BOOLEAN);
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
+#if defined (USE_X_TOOLKIT) && !defined (USE_GTK)
/* Create the menu bar. */
if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
{
@@ -5365,7 +5365,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
badly we want them. This should be done after we have the menu
bar so that its size can be taken into account. */
block_input ();
- x_wm_set_size_hint (f, window_prompting, false);
+ x_wm_set_size_hint (f, window_prompting, false, -1, -1);
unblock_input ();
adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
diff --git a/src/xterm.c b/src/xterm.c
index 0c20d38b0f7..4dc50213622 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -27617,7 +27617,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_gravity)
x_calc_absolute_position (f);
block_input ();
- x_wm_set_size_hint (f, 0, false);
+ x_wm_set_size_hint (f, 0, false, -1, -1);
#ifdef USE_GTK
if (x_gtk_use_window_move)
@@ -28318,7 +28318,7 @@ x_check_fullscreen (struct frame *f)
emacs_abort ();
}
- x_wm_set_size_hint (f, 0, false);
+ x_wm_set_size_hint (f, 0, false,-1, -1);
XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
width, height);
@@ -28489,7 +28489,7 @@ x_set_window_size_1 (struct frame *f, bool change_gravity,
{
if (change_gravity)
f->win_gravity = NorthWestGravity;
- x_wm_set_size_hint (f, 0, false);
+ x_wm_set_size_hint (f, 0, false, width, height);
XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
width, height + FRAME_MENUBAR_HEIGHT (f));
@@ -29326,7 +29326,7 @@ x_make_frame_invisible (struct frame *f)
program-specified, so that when the window is mapped again, it will be
placed at the same location, without forcing the user to position it
by hand again (they have already done that once for this window.) */
- x_wm_set_size_hint (f, 0, true);
+ x_wm_set_size_hint (f, 0, true, -1, -1);
#ifdef USE_GTK
if (FRAME_GTK_OUTER_WIDGET (f))
@@ -30049,7 +30049,8 @@ x_embed_frame (struct x_display_info *dpyinfo, struct frame *f)
The GTK version is in gtkutils.c. */
void
-x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
+x_wm_set_size_hint (struct frame *f, long flags, bool user_position,
+ int width, int height)
{
#ifndef USE_GTK
XSizeHints size_hints;
@@ -30228,7 +30229,7 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
XSetWMNormalHints (FRAME_X_DISPLAY (f), window, &size_hints);
#else
- xg_wm_set_size_hint (f, flags, user_position);
+ xg_wm_set_size_hint (f, flags, user_position, width, height);
#endif /* USE_GTK */
}
diff --git a/src/xterm.h b/src/xterm.h
index 8d5c9917749..2b6145a2b14 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1774,7 +1774,7 @@ #define SELECTION_EVENT_TIME(eventp) \
extern void x_make_frame_invisible (struct frame *);
extern void x_iconify_frame (struct frame *);
extern void x_free_frame_resources (struct frame *);
-extern void x_wm_set_size_hint (struct frame *, long, bool);
+extern void x_wm_set_size_hint (struct frame *, long, bool, int, int);
#if defined HAVE_XSYNCTRIGGERFENCE && !defined USE_GTK \
&& defined HAVE_CLOCK_GETTIME
extern void x_sync_init_fences (struct frame *);
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-09 16:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-09 17:52 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 9:31 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-09 17:52 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 2880 bytes --]
I've removed the patch to frame.c, and I'm running with:
emacs -Q --eval "(setq default-frame-alist '((menu-bar-lines . 0)))"
On Mon, 9 Sept 2024 at 17:52, martin rudalics <rudalics@gmx.at> wrote:
>
> The result is not yet what I hoped for. We reject two ConfigureNotify
> events but the ensuing xg_frame_set_char_size calls do not get us a
> ConfigureNotify we'd accept. IIUC the final height may be off by two
> pixels. What does (frame-text-height) return for the first and the
> second frame?
1260 for both.
> Also I hope you didn't get the GTK assertion failure.
>
Indeed, I do not.
> And how does removing the menubar behave?
>
When I do M-x menu-bar-mode the first time it has no effect, as Emacs
considers the menu bar to be currently enabled, so it disables it.
After that, toggling the menu bar works as expected, and the window gets
taller each time it is enabled, and shorter (by the same amount) each time
it is disabled.
Now something completely different. A couple of years ago I noticed
> that our size hints calculations are fundamentally wrong. I tried to
> fix them and I attach some parts of that fix together with the previous
> changes I proposed. Attached as size_hints.diff. If the patch does not
> apply, complain. I edited it by hand to exclude other changes I made
> and I might have made mistakes. Again I'm interested in the history of
> the second frame.
>
OK, running with just this patch (which applies fine), and doing the
history test, the history of the second frame is:
Frame size history of #<frame *Minibuf-1* 0x6253825731d0>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x376, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x376, DS=664x630
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1260, DS=664x655
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1260, DS=664x696
set_window_configuration (4), MS=160x175 IH IV
The second window is the same size as the first.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 5492 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-09 17:52 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-10 9:31 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 17:00 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-10 9:31 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 2586 bytes --]
>> What does (frame-text-height) return for the first and the
>> second frame?
>
> 1260 for both.
Relieving.
>> Also I hope you didn't get the GTK assertion failure.
>>
>
> Indeed, I do not.
So the sequence definitely is: For some inexplicable reason we receive a
ConfigureNotify event that tells us that the frame has become very
small. We accept the new size, adjust our frame accordingly and use the
new size as base for the next resize request. When we issue that
request, GTK complains that it cannot fit the menubar and issues the
assertion failure.
> When I do M-x menu-bar-mode the first time it has no effect, as Emacs
> considers the menu bar to be currently enabled, so it disables it.
Since you run with
emacs -Q --eval "(setq default-frame-alist '((menu-bar-lines . 0)))"
Emacs considers menu bars to be currently enabled "globally" and
disabling them globally has no effect on that frame. Do you agree with
this explanation?
> OK, running with just this patch (which applies fine), and doing the
> history test, the history of the second frame is:
...
> ConfigureNotify, PS=1328x1260, XS=400x376, DS=1328x1260
> xg_frame_resized, rejected, PS=1328x1260, XS=400x376, DS=664x630
The 400x376 are as before so other size hints won't fix anything (but we
inherently checked that when running with 'frame-resize-pixelwise'
before).
> menu-bar-lines (2), MS=160x175
> xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
> xg_frame_resized, rejected, PS=1328x1260, XS=1328x1260, DS=664x655
But this one ...
> tool-bar-lines (2), MS=160x175
> xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
> xg_frame_resized, rejected, PS=1328x1260, XS=1328x1260, DS=664x696
... and this one are obviously fishy. The sizes apparently match, so
why reject them? The reason is that I recorded scaled sizes in what
appear after DS. Since you have a scaling factor of 2 and (* 2 664)
gives 1328 this explains the width value. The height value is likely as
(- (* 2 696) 132) giving 1260 where 132 is the height of your tool bar
(I extracted that from your previous call of 'frame-geometry'). If
there were a menu bar, we would have to subtract another 50 pixels.
So please try again with the attached patch which records the original
unscaled sizes. And please tell me what
(frame-char-width)
(frame-char-height)
evaluate to. I'm still trying to explain the 400x376 values.
martin
[-- Attachment #2: gtkutil-reject.diff --]
[-- Type: text/x-patch, Size: 2376 bytes --]
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..f5022411dab 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,45 @@ xg_set_geometry (struct frame *f)
}
}
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static int last_resize_count = 0;
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ if (f == last_resize_frame
+ && (width != last_resize_width
+ || height != last_resize_height)
+ && last_resize_count <= 3)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+
+ last_resize_count++;
+
+ return;
+ }
+ else
+ /* We either got what we asked for or lost the battle. */
+ {
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_count = 0;
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1297,19 +1331,20 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
else
{
#ifndef HAVE_PGTK
+ last_resize_frame = f;
+ last_resize_height = height;
+ last_resize_width = width;
+ last_resize_count = 0;
+
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-10 9:31 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-10 17:00 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 17:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-10 17:00 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 847 bytes --]
On Tue, 10 Sept 2024 at 10:32, martin rudalics <rudalics@gmx.at> wrote:
>
> Since you run with
>
> emacs -Q --eval "(setq default-frame-alist '((menu-bar-lines . 0)))"
>
> Emacs considers menu bars to be currently enabled "globally" and
> disabling them globally has no effect on that frame. Do you agree with
> this explanation?
>
I would be more cautious, since I do not know the code, and simply say that
disabling menu-bar-mode has no effect on the current frame, where there is
already no menu bar.
So please try again with the attached patch which records the original
> unscaled sizes. And please tell me what
>
> (frame-char-width)
> (frame-char-height)
>
> evaluate to.
>
Can I just check: do you want me to apply your latest gtkutil-reject.diff
on top of your previous size_hints.diff, or instead of it?
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 2157 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-10 17:00 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-10 17:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-12 16:24 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-10 17:16 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> Can I just check: do you want me to apply your latest gtkutil-reject.diff
> on top of your previous size_hints.diff, or instead of it?
Instead of it.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-10 17:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-12 16:24 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14 14:43 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-12 16:24 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1784 bytes --]
On Tue, 10 Sept 2024 at 18:16, martin rudalics <rudalics@gmx.at> wrote:
> > Can I just check: do you want me to apply your latest gtkutil-reject.diff
> > on top of your previous size_hints.diff, or instead of it?
>
> Instead of it.
>
Here is the frame size history:
Frame size history of #<frame *Minibuf-1* 0x56bbf9520158>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=1328x1260
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=2560x1346, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=2560x1346, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=2560x1326, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=2560x1326, DS=1328x1260
set_window_configuration (4), MS=160x175 IH IV
Note that something quite different happens when I open the second frame:
it ends up full screen, but the Emacs window only occupies the same space
as the initial window (roughly half the screen wide, and a little shorter
than the screen).
frame-char-width: 16
frame-char-height: 35
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 3015 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-12 16:24 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-14 14:43 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-15 12:40 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-14 14:43 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 2697 bytes --]
> Here is the frame size history:
Thanks.
> x_create_frame_2 (0), MS=160x175
> xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> xg_frame_set_char_size (5), MS=32x70 IH IV
> x_make_frame_visible
> MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
Here we go again with the small size, reject it and ask for the previous
size ...
> xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=1328x1260
> tool-bar-lines (2), MS=160x175
> xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=2560x1346, DS=1328x1260
... but now all of a sudden we should handle a frame size about twice as
large which we reject again ...
> xg_frame_resized, rejected, PS=1328x1260, XS=2560x1346, DS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=2560x1326, DS=1328x1260
> xg_frame_resized, rejected, PS=1328x1260, XS=2560x1326, DS=1328x1260
> set_window_configuration (4), MS=160x175 IH IV
>
> Note that something quite different happens when I open the second frame:
> it ends up full screen, but the Emacs window only occupies the same space
> as the initial window (roughly half the screen wide, and a little shorter
> than the screen).
... and never fill accordingly because we don't like it. This was a bad
idea. The second call of gtk_window_resize simply has to get the same
dimensions as the first one as in the first version of this patch.
Just that the "first version" of this patch had another problem: The
sizes we ask for in gtk_window_resize via outer_height and outer_width
include tool and menu bars. The sizes reported by ConfigureNotify are
those of the native rectangle only. I hopefully fixed that now. Please
try again and tell me the histories you get here for the initial frame
and the second frame both with and without the menu bar by evaluating
(frame--size-history).
> frame-char-width: 16
> frame-char-height: 35
Times twice gets us the MS=32x70 above.
Next I'd like to know what you see with
(let ((frame (make-frame '((visibility . nil)))))
(make-frame-visible frame))
and
(let ((frame (make-frame '((visibility . nil) (menu-bar-lines . 0)))))
(make-frame-visible frame))
both with an unpatched Emacs and a patched one. Here the second frame
appears exactly where the first one is, so we would have to care about
the placement ourselves.
I only want to know whether this "visibly" improves the behavior you
observe (no need to look at the history of these frames). The idea is
that we could make creation of the second frame smoother so that you
don't see its initial size.
martin
[-- Attachment #2: gtkutil-reject.diff --]
[-- Type: text/x-patch, Size: 3812 bytes --]
diff --git a/src/frame.c b/src/frame.c
index 7f4bf274ad9..6b6f6aa3c5c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -6769,7 +6769,7 @@ focus (where a frame immediately loses focus when it's left by the mouse
The function `frame--size-history' displays the value of this variable
in a more readable form. */);
- frame_size_history = Qnil;
+ frame_size_history = Fcons (make_fixnum (100), Qnil);
DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame,
doc: /* Non-nil means reuse hidden tooltip frames.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..649cc3c8030 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,47 @@ xg_set_geometry (struct frame *f)
}
}
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static int last_resize_count = 0;
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ if (f == last_resize_frame
+ && (width != last_resize_width - FRAME_TOOLBAR_WIDTH (f)
+ || height != (last_resize_height
+ - FRAME_MENUBAR_HEIGHT (f)
+ - FRAME_TOOLBAR_HEIGHT (f)))
+ && last_resize_count <= 3)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+
+ last_resize_count++;
+
+ return;
+ }
+ else
+ /* We either got what we asked for or lost the battle. */
+ {
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_count = 0;
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1297,19 +1333,20 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
else
{
#ifndef HAVE_PGTK
+ last_resize_frame = f;
+ last_resize_width = outer_width;
+ last_resize_height = outer_height;
+ last_resize_count = 0;
+
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
@@ -1327,10 +1364,16 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
if (FRAME_VISIBLE_P (f) && !was_visible)
{
if (CONSP (frame_size_history))
- frame_size_history_extra
- (f, build_string ("xg_frame_set_char_size, visible"),
- FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
- f->new_width, f->new_height);
+ {
+ frame_size_history_extra
+ (f, build_string ("xg_frame_set_char_size, visible"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ f->new_width, f->new_height);
+
+ if (gwidth > 0 || gheight > 0)
+ frame_size_history_extra
+ (f, build_string (" gvalues"), gwidth, gheight, -1, -1, -1, -1);
+ }
/* Must call this to flush out events */
(void)gtk_events_pending ();
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-14 14:43 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-15 12:40 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-16 8:46 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-15 12:40 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 3455 bytes --]
On Sat, 14 Sept 2024 at 15:43, martin rudalics <rudalics@gmx.at> wrote:
>
> Just that the "first version" of this patch had another problem: The
> sizes we ask for in gtk_window_resize via outer_height and outer_width
> include tool and menu bars. The sizes reported by ConfigureNotify are
> those of the native rectangle only. I hopefully fixed that now. Please
> try again and tell me the histories you get here for the initial frame
> and the second frame both with and without the menu bar by evaluating
> (frame--size-history).
>
History without menu bar:
Frame size history of #<frame *Minibuf-1* 0x6220fb2af828>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
gvalues, PS=200x187
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x671
set_window_configuration (4), MS=160x175 IH IV
History with menu bar:
Frame size history of #<frame *Minibuf-1* 0x56319385af48>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=664x655
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
gvalues, PS=200x195
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x696
set_window_configuration (4), MS=160x175 IH IV
Next I'd like to know what you see with
>
> (let ((frame (make-frame '((visibility . nil)))))
> (make-frame-visible frame))
>
> and
>
> (let ((frame (make-frame '((visibility . nil) (menu-bar-lines . 0)))))
> (make-frame-visible frame))
>
> both with an unpatched Emacs and a patched one. Here the second frame
> appears exactly where the first one is, so we would have to care about
> the placement ourselves.
>
Unpatched Emacs: both expressions create a small second frame in the top
left-hand corner of the screen.
Patched Emacs: both expressions create a small second frame in the top
left-hand corner of the screen that immediately jumps to being the correct
size.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 5588 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-15 12:40 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-16 8:46 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-25 19:12 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-16 8:46 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]
> xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
I'm afraid that some mishap has happened here. The DS=664x630 values
indicate that you've run an older version of the patch where I confused
scaled and unscaled values. I'm attaching the latest version renamed to
include today's date. Please retry.
> Next I'd like to know what you see with
>>
>> (let ((frame (make-frame '((visibility . nil)))))
>> (make-frame-visible frame))
>>
>> and
>>
>> (let ((frame (make-frame '((visibility . nil) (menu-bar-lines . 0)))))
>> (make-frame-visible frame))
>>
>> both with an unpatched Emacs and a patched one. Here the second frame
>> appears exactly where the first one is, so we would have to care about
>> the placement ourselves.
>>
>
> Unpatched Emacs: both expressions create a small second frame in the top
> left-hand corner of the screen.
>
> Patched Emacs: both expressions create a small second frame in the top
> left-hand corner of the screen that immediately jumps to being the correct
> size.
I would need a frame size history for one of these to understand why the
frame gets apparently mapped before the last resize.
martin
[-- Attachment #2: gtkutil-reject-2024-09-16.diff --]
[-- Type: text/x-patch, Size: 3812 bytes --]
diff --git a/src/frame.c b/src/frame.c
index 7f4bf274ad9..6b6f6aa3c5c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -6769,7 +6769,7 @@ focus (where a frame immediately loses focus when it's left by the mouse
The function `frame--size-history' displays the value of this variable
in a more readable form. */);
- frame_size_history = Qnil;
+ frame_size_history = Fcons (make_fixnum (100), Qnil);
DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame,
doc: /* Non-nil means reuse hidden tooltip frames.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..649cc3c8030 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,47 @@ xg_set_geometry (struct frame *f)
}
}
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static int last_resize_count = 0;
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ if (f == last_resize_frame
+ && (width != last_resize_width - FRAME_TOOLBAR_WIDTH (f)
+ || height != (last_resize_height
+ - FRAME_MENUBAR_HEIGHT (f)
+ - FRAME_TOOLBAR_HEIGHT (f)))
+ && last_resize_count <= 3)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+
+ last_resize_count++;
+
+ return;
+ }
+ else
+ /* We either got what we asked for or lost the battle. */
+ {
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_count = 0;
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1297,19 +1333,20 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
else
{
#ifndef HAVE_PGTK
+ last_resize_frame = f;
+ last_resize_width = outer_width;
+ last_resize_height = outer_height;
+ last_resize_count = 0;
+
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
@@ -1327,10 +1364,16 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
if (FRAME_VISIBLE_P (f) && !was_visible)
{
if (CONSP (frame_size_history))
- frame_size_history_extra
- (f, build_string ("xg_frame_set_char_size, visible"),
- FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
- f->new_width, f->new_height);
+ {
+ frame_size_history_extra
+ (f, build_string ("xg_frame_set_char_size, visible"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ f->new_width, f->new_height);
+
+ if (gwidth > 0 || gheight > 0)
+ frame_size_history_extra
+ (f, build_string (" gvalues"), gwidth, gheight, -1, -1, -1, -1);
+ }
/* Must call this to flush out events */
(void)gtk_events_pending ();
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-16 8:46 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-25 19:12 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-01 8:55 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-25 19:12 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 8277 bytes --]
On Mon, 16 Sept 2024 at 09:46, martin rudalics <rudalics@gmx.at> wrote:
> > xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
>
> I'm afraid that some mishap has happened here. The DS=664x630 values
> indicate that you've run an older version of the patch where I confused
> scaled and unscaled values. I'm attaching the latest version renamed to
> include today's date. Please retry.
>
I've rebuilt with the dated patch.
History for initial frame without menu bar:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x55a01c95a0d0>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1260, DS=664x655
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x655
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
gvalues, PS=664x654
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x630
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
gvalues, PS=664x629
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x671
set_window_configuration (4), MS=160x175 IH IV
History for second frame without menu bar:
Frame size history of #<frame *Minibuf-1* 0x55a01ca20940>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
gvalues, PS=200x187
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x671
set_window_configuration (4), MS=160x175 IH IV
History for initial frame with menu bar:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x5f4024e62b80>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1260, DS=664x655
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x655
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
gvalues, PS=664x654
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x696
set_window_configuration (4), MS=160x175 IH IV
History for second frame with menu bar:
Frame size history of #<frame *Minibuf-1* 0x5f4025026420>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=664x655
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x655
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
gvalues, PS=664x654
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x696
set_window_configuration (4), MS=160x175 IH IV
> Next I'd like to know what you see with
> >>
> >> (let ((frame (make-frame '((visibility . nil)))))
> >> (make-frame-visible frame))
>
Frame size history with patched Emacs:
Frame size history of #<frame *Minibuf-1* 0x5a14ea4df208>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_invisible
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=664x655
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
gvalues, PS=200x195
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x696
set_window_configuration (4), MS=160x175 IH IV
set_window_configuration (4), MS=160x175 IH IV
> >> and
> >>
> >> (let ((frame (make-frame '((visibility . nil) (menu-bar-lines . 0)))))
> >> (make-frame-visible frame))
>
Frame size history with patched Emacs:
Frame size history of #<frame *Minibuf-1* 0x5954e4cec248>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_invisible
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
gvalues, PS=200x187
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x671
set_window_configuration (4), MS=160x175 IH IV
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 12283 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-09-25 19:12 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-01 8:55 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-01 18:11 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-01 8:55 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 936 bytes --]
> I've rebuilt with the dated patch.
Thanks. In my previous patch I wrongly rejected a ConfigureNotify
because I didn't correctly calculate the expected size of the native
frame from the scaled size we requested earlier. Please try again with
the attached patch the basic four behaviors of the first frame with and
without menu bar and the second frame with and without menu bar. Don't
bother about visibility.
I meanwhile tried to run GNOME but I upgraded my Debian since the last
time I used it and now most of my previous customizations are gone,
display resembles that of a cell phone (or maybe Windows 10), many
programs I used earlier are not available any more and tracker hogs my
hard disk every time I log in. I have no idea how to disable programs
that autostart and don't even know how to log off. So I'm afraid that I
won't be able to test things there and will have to rely on your tests
even in the future.
martin
[-- Attachment #2: gtkutil-reject-2024-10-01.diff --]
[-- Type: text/x-patch, Size: 3891 bytes --]
diff --git a/src/frame.c b/src/frame.c
index 7f4bf274ad9..6b6f6aa3c5c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -6769,7 +6769,7 @@ focus (where a frame immediately loses focus when it's left by the mouse
The function `frame--size-history' displays the value of this variable
in a more readable form. */);
- frame_size_history = Qnil;
+ frame_size_history = Fcons (make_fixnum (100), Qnil);
DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame,
doc: /* Non-nil means reuse hidden tooltip frames.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..a02be51600e 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,48 @@ xg_set_geometry (struct frame *f)
}
}
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static int last_resize_count = 0;
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ if (f == last_resize_frame
+ && (width != ((last_resize_width * xg_get_scale (f))
+ - FRAME_TOOLBAR_WIDTH (f))
+ || height != ((last_resize_height * xg_get_scale (f))
+ - FRAME_MENUBAR_HEIGHT (f)
+ - FRAME_TOOLBAR_HEIGHT (f)))
+ && last_resize_count <= 3)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+
+ last_resize_count++;
+
+ return;
+ }
+ else
+ /* We either got what we asked for or lost the battle. */
+ {
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_count = 0;
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1297,19 +1334,20 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
else
{
#ifndef HAVE_PGTK
+ last_resize_frame = f;
+ last_resize_width = outer_width;
+ last_resize_height = outer_height;
+ last_resize_count = 0;
+
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
@@ -1327,10 +1365,17 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
if (FRAME_VISIBLE_P (f) && !was_visible)
{
if (CONSP (frame_size_history))
- frame_size_history_extra
- (f, build_string ("xg_frame_set_char_size, visible"),
- FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
- f->new_width, f->new_height);
+ {
+ frame_size_history_extra
+ (f, build_string ("xg_frame_set_char_size, visible"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ f->new_width, f->new_height);
+
+ if (gwidth > 0 || gheight > 0)
+ frame_size_history_extra
+ (f, build_string (" +values"), gwidth, gheight,
+ outer_width, outer_height, -1, -1);
+ }
/* Must call this to flush out events */
(void)gtk_events_pending ();
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-01 8:55 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-01 18:11 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-02 8:53 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-01 18:11 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 5957 bytes --]
On Tue, 1 Oct 2024 at 09:55, martin rudalics <rudalics@gmx.at> wrote:
>
> Thanks. In my previous patch I wrongly rejected a ConfigureNotify
> because I didn't correctly calculate the expected size of the native
> frame from the scaled size we requested earlier. Please try again with
> the attached patch the basic four behaviors of the first frame with and
> without menu bar and the second frame with and without menu bar. Don't
> bother about visibility.
>
First frame with menu bar:
Frame size history of #<frame *Minibuf-1* 0x56c5e0b0cf88>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=664x655
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=200x195, XS=664x696
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x696
set_window_configuration (4), MS=160x175 IH IV
First frame without menu bar:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x5f14cf87c2c0>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=664x655, XS=664x630
ConfigureNotify, PS=1328x1260, XS=1328x1308, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1308, DS=664x630
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=664x654, XS=664x671
ConfigureNotify, PS=1328x1260, XS=1328x1176, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1176, DS=664x671
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x671
set_window_configuration (4), MS=160x175 IH IV
Second frame with menu bar:
Frame size history of #<frame *Minibuf-1* 0x56c5e0b0cf88>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=664x655
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=200x195, XS=664x696
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x696
set_window_configuration (4), MS=160x175 IH IV
Second frame without menu bar:
Frame size history of #<frame *Minibuf-1* 0x5c4df2a6a5a8>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=200x187, XS=664x671
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x671
set_window_configuration (4), MS=160x175 IH IV
> I meanwhile tried to run GNOME but I upgraded my Debian since the last
> time I used it and now most of my previous customizations are gone,
> display resembles that of a cell phone (or maybe Windows 10), many
> programs I used earlier are not available any more and tracker hogs my
> hard disk every time I log in. I have no idea how to disable programs
> that autostart and don't even know how to log off. So I'm afraid that I
> won't be able to test things there and will have to rely on your tests
> even in the future.
>
OK, no problem.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 8334 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-01 18:11 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-02 8:53 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-02 12:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-02 8:53 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]
> First frame with menu bar:
Whatever it is, I can't figure out what's going on. It's basically the
same issue that's harassing me all the time. In a frame with menu bar
we request an initial frame of size 644x696 here:
> xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> +values, PS=200x195, XS=664x696
The 696 come from (/ (+ 1260 50 82) 2) where the 1260 is the native
pixel height of the frame calculated as (* 36 35) where 36 is our number
of lines and 35 is your frame character height. 50 is the height of the
menu bar, 92 the height of the tool bar and 2 is the scaling factor. I
cannot spot any rounding problem here.
> ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
> xg_frame_resized, rejected, PS=1328x1260, XS=1328x1258, DS=664x696
Now we get a ConfigureNotify event that instead of giving us a native
pixel height of 1260 gives us a height of 1258 and we reject it. Where
did those two pixels go to? I suppose I'll never find out.
The next two things I'd ask you to do are:
- Apply the patch gtkutil-reject-2024-10-02.diff which adds a tolerance
of two pixels in order to avoid rejecting the ConfigureNotify and post
the four histories as before.
- Apply the patch gtkutil-reject-2024-10-02(25).diff (from a pristine
Emacs). This is like the previous patch but makes the initial frame
only 25 lines high. Again please post the histories for all four
cases.
Thanks, martin
[-- Attachment #2: gtkutil-reject-2024-10-02.diff --]
[-- Type: text/x-patch, Size: 4007 bytes --]
diff --git a/src/frame.c b/src/frame.c
index 7f4bf274ad9..6b6f6aa3c5c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -6769,7 +6769,7 @@ focus (where a frame immediately loses focus when it's left by the mouse
The function `frame--size-history' displays the value of this variable
in a more readable form. */);
- frame_size_history = Qnil;
+ frame_size_history = Fcons (make_fixnum (100), Qnil);
DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame,
doc: /* Non-nil means reuse hidden tooltip frames.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..e5b505ab98b 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,54 @@ xg_set_geometry (struct frame *f)
}
}
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static int last_resize_count = 0;
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ if (f == last_resize_frame)
+ {
+ int expected_width = ((last_resize_width * xg_get_scale (f))
+ - FRAME_TOOLBAR_WIDTH (f));
+ int expected_height = ((last_resize_height * xg_get_scale (f))
+ - FRAME_MENUBAR_HEIGHT (f)
+ - FRAME_TOOLBAR_HEIGHT (f));
+
+ if ((width > expected_width + 2
+ || width < expected_width - 2
+ || height > expected_height + 2
+ || height < expected_height - 2)
+ && last_resize_count <= 3)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+
+ last_resize_count++;
+
+ return;
+ }
+ else
+ {
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_count = 0;
+ }
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1297,19 +1340,20 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
else
{
#ifndef HAVE_PGTK
+ last_resize_frame = f;
+ last_resize_width = outer_width;
+ last_resize_height = outer_height;
+ last_resize_count = 0;
+
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
@@ -1327,10 +1371,17 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
if (FRAME_VISIBLE_P (f) && !was_visible)
{
if (CONSP (frame_size_history))
- frame_size_history_extra
- (f, build_string ("xg_frame_set_char_size, visible"),
- FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
- f->new_width, f->new_height);
+ {
+ frame_size_history_extra
+ (f, build_string ("xg_frame_set_char_size, visible"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ f->new_width, f->new_height);
+
+ if (gwidth > 0 || gheight > 0)
+ frame_size_history_extra
+ (f, build_string (" +values"), gwidth, gheight,
+ outer_width, outer_height, -1, -1);
+ }
/* Must call this to flush out events */
(void)gtk_events_pending ();
[-- Attachment #3: gtkutil-reject-2024-10-02(25).diff --]
[-- Type: text/x-patch, Size: 4471 bytes --]
diff --git a/src/frame.c b/src/frame.c
index 7f4bf274ad9..7ae520188c0 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -5822,7 +5822,7 @@ gui_figure_window_size (struct frame *f, Lisp_Object parms, bool tabbar_p,
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
int parent_done = -1, outer_done = -1;
int text_width = 80 * FRAME_COLUMN_WIDTH (f);
- int text_height = 36 * FRAME_LINE_HEIGHT (f);
+ int text_height = 25 * FRAME_LINE_HEIGHT (f);
/* Window managers expect that if program-specified
positions are not (0,0), they're intentional, not defaults. */
@@ -6769,7 +6769,7 @@ focus (where a frame immediately loses focus when it's left by the mouse
The function `frame--size-history' displays the value of this variable
in a more readable form. */);
- frame_size_history = Qnil;
+ frame_size_history = Fcons (make_fixnum (100), Qnil);
DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame,
doc: /* Non-nil means reuse hidden tooltip frames.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..e5b505ab98b 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,54 @@ xg_set_geometry (struct frame *f)
}
}
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static int last_resize_count = 0;
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ if (f == last_resize_frame)
+ {
+ int expected_width = ((last_resize_width * xg_get_scale (f))
+ - FRAME_TOOLBAR_WIDTH (f));
+ int expected_height = ((last_resize_height * xg_get_scale (f))
+ - FRAME_MENUBAR_HEIGHT (f)
+ - FRAME_TOOLBAR_HEIGHT (f));
+
+ if ((width > expected_width + 2
+ || width < expected_width - 2
+ || height > expected_height + 2
+ || height < expected_height - 2)
+ && last_resize_count <= 3)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+
+ last_resize_count++;
+
+ return;
+ }
+ else
+ {
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_count = 0;
+ }
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1297,19 +1340,20 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
else
{
#ifndef HAVE_PGTK
+ last_resize_frame = f;
+ last_resize_width = outer_width;
+ last_resize_height = outer_height;
+ last_resize_count = 0;
+
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
@@ -1327,10 +1371,17 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
if (FRAME_VISIBLE_P (f) && !was_visible)
{
if (CONSP (frame_size_history))
- frame_size_history_extra
- (f, build_string ("xg_frame_set_char_size, visible"),
- FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
- f->new_width, f->new_height);
+ {
+ frame_size_history_extra
+ (f, build_string ("xg_frame_set_char_size, visible"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ f->new_width, f->new_height);
+
+ if (gwidth > 0 || gheight > 0)
+ frame_size_history_extra
+ (f, build_string (" +values"), gwidth, gheight,
+ outer_width, outer_height, -1, -1);
+ }
/* Must call this to flush out events */
(void)gtk_events_pending ();
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-02 8:53 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-02 12:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-03 13:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-02 12:06 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 12010 bytes --]
On Wed, 2 Oct 2024 at 09:53, martin rudalics <rudalics@gmx.at> wrote:
> Now we get a ConfigureNotify event that instead of giving us a native
> pixel height of 1260 gives us a height of 1258 and we reject it. Where
> did those two pixels go to? I suppose I'll never find out.
>
It's infuriating! But unless it's related to the eventual dramatic
difference in size, maybe it doesn't actually matter.
- Apply the patch gtkutil-reject-2024-10-02.diff which adds a tolerance
> of two pixels in order to avoid rejecting the ConfigureNotify and post
> the four histories as before.
>
First frame with menu bar:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x64f211b91440>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
tool-bar-lines (2), NS=1328x1260~>1328x1258, MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1258, DS=1328x1258
+values, PS=664x654, XS=664x695
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1258
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258, DS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1258
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
First frame without menu bar:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x5a4bf2898980>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=664x655, XS=664x630
ConfigureNotify, PS=1328x1260, XS=1328x1308, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1308, DS=664x630
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=664x654, XS=664x671
ConfigureNotify, PS=1328x1260, XS=1328x1176, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=1328x1176, DS=664x671
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
Second frame with menu bar:
Frame size history of #<frame *Minibuf-1* 0x6051a23e13e0>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=664x655
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=200x195, XS=664x696
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
Second frame without menu bar:
Frame size history of #<frame *Minibuf-1* 0x5be3fa6f4250>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=200x187, XS=664x671
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
- Apply the patch gtkutil-reject-2024-10-02(25).diff (from a pristine
> Emacs). This is like the previous patch but makes the initial frame
> only 25 lines high. Again please post the histories for all four
> cases.
>
First frame with menu bar:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x5e3d15f35b10>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), MS=32x70 IH IV
scroll-bar-width (3), NS=1296x875~>1328x875, IS=1296x875~>1328x875,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x875, XS=1328x875, DS=1328x875
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x875, DS=1328x875
ConfigureNotify, PS=1328x875, XS=1328x874, DS=1328x875
xg_frame_resized, changed, PS=1328x875, XS=1328x874
change_frame_size_1, delayed, PS=1328x875, XS=1328x874, DS=1328x875
change_frame_size (5), TS=1280x875~>1280x874, TC=80x25~>80x24,
NS=1328x875~>1328x874, IS=1328x875~>1328x874, MS=32x70 IH IV
ConfigureNotify, PS=1328x874, XS=1328x850
xg_frame_resized, changed, PS=1328x874, XS=1328x850
change_frame_size_1, delayed, PS=1328x874, XS=1328x850
tool-bar-lines (2), NS=1328x874~>1328x850, MS=160x175
xg_frame_set_char_size, visible, PS=1328x874, XS=1328x850, DS=1328x850
+values, PS=664x450, XS=664x491
ConfigureNotify, PS=1328x874, XS=1328x850, DS=1328x850
xg_frame_resized, changed, PS=1328x874, XS=1328x850, DS=1328x850
change_frame_size_1, delayed, PS=1328x874, XS=1328x850, DS=1328x850
change_frame_size (5), TS=1280x874~>1280x850, NS=1328x874~>1328x850,
IS=1328x874~>1328x850, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
First frame without menu bar:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x58db7d353700>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), MS=32x70 IH IV
scroll-bar-width (3), NS=1296x875~>1328x875, IS=1296x875~>1328x875,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x875, XS=1328x875, DS=1328x875
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x875, DS=1328x875
ConfigureNotify, PS=1328x875, XS=1328x874, DS=1328x875
xg_frame_resized, changed, PS=1328x875, XS=1328x874
change_frame_size_1, delayed, PS=1328x875, XS=1328x874, DS=1328x875
change_frame_size (5), TS=1280x875~>1280x874, TC=80x25~>80x24,
NS=1328x875~>1328x874, IS=1328x875~>1328x874, MS=32x70 IH IV
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x874, XS=1328x874
+values, PS=664x462, XS=664x437
ConfigureNotify, PS=1328x874, XS=1328x900
xg_frame_resized, rejected, PS=1328x874, XS=1328x900, DS=664x437
ConfigureNotify, PS=1328x874, XS=1328x850
xg_frame_resized, rejected, PS=1328x874, XS=1328x850, DS=664x437
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x874, XS=1328x874
+values, PS=664x425, XS=664x478
ConfigureNotify, PS=1328x874, XS=1328x850
xg_frame_resized, rejected, PS=1328x874, XS=1328x850, DS=664x478
set_window_configuration (4), MS=160x175 IH IV
Second frame with menu bar:
Frame size history of #<frame *Minibuf-1* 0x56df7cb4ae70>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), MS=32x70 IH IV
scroll-bar-width (3), NS=1296x875~>1328x875, IS=1296x875~>1328x875,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x875, XS=1328x875, DS=1328x875
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x875, DS=1328x875
ConfigureNotify, PS=1328x875, XS=400x340, DS=1328x875
xg_frame_resized, rejected, PS=1328x875, XS=400x340, DS=664x462
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x875, XS=1328x875, DS=1328x875
+values, PS=200x195, XS=664x503
ConfigureNotify, PS=1328x875, XS=1328x768, DS=1328x875
xg_frame_resized, rejected, PS=1328x875, XS=1328x768, DS=664x503
ConfigureNotify, PS=1328x875, XS=1328x850, DS=1328x875
xg_frame_resized, rejected, PS=1328x875, XS=1328x850, DS=664x503
set_window_configuration (4), MS=160x175 IH IV
Second frame without menu bar:
Frame size history of #<frame *Minibuf-1* 0x6319bd8c8720>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), MS=32x70 IH IV
scroll-bar-width (3), NS=1296x875~>1328x875, IS=1296x875~>1328x875,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x875, XS=1328x875, DS=1328x875
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x875, DS=1328x875
ConfigureNotify, PS=1328x875, XS=400x374, DS=1328x875
xg_frame_resized, rejected, PS=1328x875, XS=400x374, DS=664x437
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x875, XS=1328x875, DS=1328x875
+values, PS=200x187, XS=664x478
ConfigureNotify, PS=1328x875, XS=1328x850, DS=1328x875
xg_frame_resized, rejected, PS=1328x875, XS=1328x850, DS=664x478
set_window_configuration (4), MS=160x175 IH IV
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 16217 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-02 12:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-03 13:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-03 19:43 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-03 13:54 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 6529 bytes --]
> First frame with menu bar:
...
> ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
> xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
Now we get the 1328x1258 notification and do not reject it because it's
within the tolerance.
> change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
And here we end up with a frame of 35 lines, one less than we want
(rounding due to the 2 missing pixels). But that's what you already got
with commit 24161683102 reverted. Some users strongly object such
behavior so we probably will have to abolish the tolerance trick. You
should "see" the two missing pixels on the last line of the frame's
normal window just above the minibuffer window, if there's text on that
last line.
With the earlier "strong" rejection the last change of text columns was
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
which is the expected value.
One obvious cause are these lines in adjust_frame_size
&& (f->new_width >= 0 || f->new_height >= 0))
/* For implied resizes with inhibit 2 (external menu and tool
bar) pick up any new sizes the display engine has not
processed yet. Otherwise, we would request the old sizes
which will make this request appear as a request to set new
sizes and have the WM react accordingly which is not TRT.
We don't that for the external menu bar on Motif.
Otherwise, switching off the menu bar will shrink the frame
and switching it on will not enlarge it. */
{
if (f->new_width >= 0)
new_native_width = f->new_width;
if (f->new_height >= 0)
new_native_height = f->new_height;
}
Here we use the (unrejected) 1258 value (which was stored by a delayed
change_frame_size_1) in f->new_height and use it as something god-given
in future calls. But on GTK all this doesn't make sense. Whatever the
size of the menu or tool bar is, it won't affect the height of the
native frame.
> First frame without menu bar:
...
> ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
> xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
Same here. I never asked you but IIUC this means that creating the
first frame without menubar proceeds just as "smoothly" as with commit
24161683102 reverted. Right? Does it proceed just as smoothly with the
earlier gtkutil-reject-2024-10-01.diff used instead? Or can you observe
the correction by two pixels somehow?
> Second frame with menu bar:
...
> ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
> xg_frame_resized, rejected, PS=1328x1260, XS=400x340, DS=664x655
Here we reject the event and ask again for 1260 pixels ...
> tool-bar-lines (2), MS=160x175
> xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> +values, PS=200x195, XS=664x696
> ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
> xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
... in response we are offered 1258 pixels and accept them ...
> change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
> change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
> NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
... and are left with 1258 pixels. The frame has 35 lines, one less
than we wanted.
> Second frame without menu bar:
...
> ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
> xg_frame_resized, rejected, PS=1328x1260, XS=400x374, DS=664x630
Same here ...
> ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
> xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
... here ...
> change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
> change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
> NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
... and here. I suppose you still see here the small frame first and
the resized one immediately afterwards. Right?
Now about the 25 lines scenario which is quite interesting:
> First frame with menu bar:
>
> Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
> 0x5e3d15f35b10>
> x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
The 875 come from (* 25 35) where 25 is the initial frame height in
lines Emacs wants (for historical reasons I can't explain). In the
other scenarios we changed that to 36 later, now we don't.
> IS=80x25~>1296x875, MS=32x70 IH IV
> gui_figure_window_size (5), MS=32x70 IH IV
> scroll-bar-width (3), NS=1296x875~>1328x875, IS=1296x875~>1328x875,
> MS=160x175
> scroll-bar-height (3), MS=160x175
> menu-bar-lines (2), MS=160x175
> x_create_frame_2 (0), MS=160x175
> xg_frame_set_char_size, invisible, PS=1328x875, XS=1328x875, DS=1328x875
The 875 is what we ask for here ...
> xg_frame_set_char_size (5), MS=32x70 IH IV
> x_make_frame_visible
> MapNotify, not hidden & not iconified, PS=1328x875, DS=1328x875
> ConfigureNotify, PS=1328x875, XS=1328x874, DS=1328x875
> xg_frame_resized, changed, PS=1328x875, XS=1328x874
... and what we get are 874 pixels (one less so we stay within the
height tolerance and accept it) ...
> change_frame_size_1, delayed, PS=1328x875, XS=1328x874, DS=1328x875
> change_frame_size (5), TS=1280x875~>1280x874, TC=80x25~>80x24,
> NS=1328x875~>1328x874, IS=1328x875~>1328x874, MS=32x70 IH IV
... but here we get a second ConfigureNotify which allots us 850 pixels
only. We don't reject it because the last time xg_frame_set_char_size
was called the frame was still invisible and there are no last values
available. We reduce the number of lines from 25 to 24.
> ConfigureNotify, PS=1328x874, XS=1328x850
> xg_frame_resized, changed, PS=1328x874, XS=1328x850
> change_frame_size_1, delayed, PS=1328x874, XS=1328x850
> tool-bar-lines (2), NS=1328x874~>1328x850, MS=160x175
> xg_frame_set_char_size, visible, PS=1328x874, XS=1328x850, DS=1328x850
> +values, PS=664x450, XS=664x491
> ConfigureNotify, PS=1328x874, XS=1328x850, DS=1328x850
> xg_frame_resized, changed, PS=1328x874, XS=1328x850, DS=1328x850
> change_frame_size_1, delayed, PS=1328x874, XS=1328x850, DS=1328x850
> change_frame_size (5), TS=1280x874~>1280x850, NS=1328x874~>1328x850,
> IS=1328x874~>1328x850, MS=32x70 IH IV
> set_window_configuration (4), MS=160x175 IH IV
Eventually, the frame ends up with 24 lines, one less than we want.
If you still have enough patience, I'd ask you to try next with the
attached patch gtkutil-frame.diff. It does not reject anything but also
does not pick up any sizes from delayed size changes.
martin
[-- Attachment #2: gtkutil-frame.diff --]
[-- Type: text/x-patch, Size: 2090 bytes --]
diff --git a/src/frame.c b/src/frame.c
index 7f4bf274ad9..af95cb54701 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -734,6 +734,7 @@ adjust_frame_size (struct frame *f, int new_text_width, int new_text_height,
&& (new_native_height != old_native_height
|| inhibit == 0 || inhibit == 2))))
{
+#ifndef USE_GTK
if (inhibit == 2
#ifdef USE_MOTIF
&& !EQ (parameter, Qmenu_bar_lines)
@@ -754,7 +755,7 @@ adjust_frame_size (struct frame *f, int new_text_width, int new_text_height,
if (f->new_height >= 0)
new_native_height = f->new_height;
}
-
+#endif
if (CONSP (frame_size_history))
frame_size_history_adjust (f, inhibit, parameter,
old_text_width, old_text_height,
@@ -6769,7 +6770,7 @@ focus (where a frame immediately loses focus when it's left by the mouse
The function `frame--size-history' displays the value of this variable
in a more readable form. */);
- frame_size_history = Qnil;
+ frame_size_history = Fcons (make_fixnum (100), Qnil);
DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame,
doc: /* Non-nil means reuse hidden tooltip frames.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..2be84ae60b9 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1327,10 +1327,17 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
if (FRAME_VISIBLE_P (f) && !was_visible)
{
if (CONSP (frame_size_history))
- frame_size_history_extra
- (f, build_string ("xg_frame_set_char_size, visible"),
- FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
- f->new_width, f->new_height);
+ {
+ frame_size_history_extra
+ (f, build_string ("xg_frame_set_char_size, visible"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ f->new_width, f->new_height);
+
+ if (gwidth > 0 || gheight > 0)
+ frame_size_history_extra
+ (f, build_string (" +values"), gwidth, gheight,
+ outer_width, outer_height, -1, -1);
+ }
/* Must call this to flush out events */
(void)gtk_events_pending ();
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-03 13:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-03 19:43 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-04 15:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-03 19:43 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 7358 bytes --]
On Thu, 3 Oct 2024 at 14:55, martin rudalics <rudalics@gmx.at> wrote:
>
> Same here. I never asked you but IIUC this means that creating the
> first frame without menubar proceeds just as "smoothly" as with commit
> 24161683102 reverted. Right? Does it proceed just as smoothly with the
> earlier gtkutil-reject-2024-10-01.diff used instead? Or can you observe
> the correction by two pixels somehow?
>
The initial frame's size doesn't seem to change as it appears when I run:
./src/emacs -Q --eval "(setq default-frame-alist '((menu-bar-lines . 0)))"
The only visual glitch I can see is that the menu bar appears for an
instant before disappearing.
I suppose you still see here the small frame first and
> the resized one immediately afterwards. Right?
>
That's right!
> If you still have enough patience, I'd ask you to try next with the
> attached patch gtkutil-frame.diff. It does not reject anything but also
> does not pick up any sizes from delayed size changes.
>
Sure, no problem.
First frame with menu bar:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x59e577a85750>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1258
+values, PS=664x654, XS=664x696
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1258
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258, DS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1258
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
First frame without menu bar:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x63f23d459690>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
+values, PS=664x655, XS=664x630
ConfigureNotify, PS=1328x1260, XS=1328x1308, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1308
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1308, DS=1328x1260
change_frame_size (5), TS=1280x1260~>1280x1308, TC=80x36~>80x37,
NS=1328x1260~>1328x1308, IS=1328x1260~>1328x1308, MS=32x70 IH IV
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1308, XS=1328x1308
+values, PS=664x654, XS=664x695
ConfigureNotify, PS=1328x1308, XS=1328x1176
xg_frame_resized, changed, PS=1328x1308, XS=1328x1176
change_frame_size_1, delayed, PS=1328x1308, XS=1328x1176
change_frame_size (5), TS=1280x1308~>1280x1176, TC=80x37~>80x33,
NS=1328x1308~>1328x1176, IS=1328x1308~>1328x1176, MS=32x70 IH IV
ConfigureNotify, PS=1328x1176, XS=1328x1292
xg_frame_resized, changed, PS=1328x1176, XS=1328x1292
change_frame_size_1, delayed, PS=1328x1176, XS=1328x1292
change_frame_size (5), TS=1280x1176~>1280x1292, TC=80x33~>80x36,
NS=1328x1176~>1328x1292, IS=1328x1176~>1328x1292, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
Second frame with menu bar:
Frame size history of #<frame *Minibuf-1* 0x55cd2d33c8f0>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x340, DS=1328x1260
change_frame_size (5), TS=1280x1260~>352x340, TC=80x36~>22x9,
NS=1328x1260~>400x340, IS=1328x1260~>400x340, MS=32x70 IH IV
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=400x340, XS=400x340
+values, PS=200x195, XS=200x236
ConfigureNotify, PS=400x340, XS=400x340
xg_frame_resized, unchanged, PS=400x340, XS=400x340
ConfigureNotify, PS=400x340, XS=400x374
xg_frame_resized, changed, PS=400x340, XS=400x374
change_frame_size_1, delayed, PS=400x340, XS=400x374
change_frame_size (5), TS=352x340~>352x374, TC=22x9~>22x10,
NS=400x340~>400x374, IS=400x340~>400x374, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
Second frame without menu bar:
Frame size history of #<frame *Minibuf-1* 0x5f9a7c015ef8>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x374
change_frame_size_1, delayed, PS=1328x1260, XS=400x374, DS=1328x1260
change_frame_size (5), TS=1280x1260~>352x374, TC=80x36~>22x10,
NS=1328x1260~>400x374, IS=1328x1260~>400x374, MS=32x70 IH IV
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=400x374, XS=400x374
+values, PS=200x187, XS=200x228
ConfigureNotify, PS=400x374, XS=400x374
xg_frame_resized, unchanged, PS=400x374, XS=400x374
set_window_configuration (4), MS=160x175 IH IV
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 10850 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-03 19:43 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-04 15:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-04 15:23 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-04 15:01 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> First frame with menu bar:
>
> Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
> 0x59e577a85750>
> x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
> IS=80x25~>1296x875, MS=32x70 IH IV
> gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
> NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
> scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
> MS=160x175
> scroll-bar-height (3), MS=160x175
> menu-bar-lines (2), MS=160x175
> x_create_frame_2 (0), MS=160x175
> xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
This is our first explicit call to set the frame size albeit for an
invisible frame.
> xg_frame_set_char_size (5), MS=32x70 IH IV
> x_make_frame_visible
> MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
So far I failed to notice that first ConfigureNotify following the
MapNotify. It comes with the expected values XS=1328x1260. Where on
earth does it come from ...
> xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
... and where does this with XS=1328x1258 come from? On my system, I
get just one ConfigureNotify for each xg_frame_set_char_size.
> xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
> change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
Here we steadfastly reject the 1258 pixels conceded to us ...
> tool-bar-lines (2), MS=160x175
> xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1258
> +values, PS=664x654, XS=664x696
... ask again with 696 (/ (+ 1260 50 82) 2) ...
> ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1258
> xg_frame_resized, changed, PS=1328x1260, XS=1328x1258, DS=1328x1258
> change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1258
... and finally succumb because ConfigureNotify offers us those lousy
1258 pixels once more and we don't delay the change any more.
> change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
> NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
> set_window_configuration (4), MS=160x175 IH IV
We end up with 35 lines as before.
> First frame without menu bar:
>
> Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
> 0x63f23d459690>
> x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
> IS=80x25~>1296x875, MS=32x70 IH IV
> gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
> NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
> scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
> MS=160x175
> scroll-bar-height (3), MS=160x175
> menu-bar-lines (2), MS=160x175
> x_create_frame_2 (0), MS=160x175
> xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> xg_frame_set_char_size (5), MS=32x70 IH IV
> x_make_frame_visible
> MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
> xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
> menu-bar-lines (2), MS=160x175
> xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> +values, PS=664x655, XS=664x630
The 630 here are the next strange thing (they existed in all previous
runs you reported but I didn't notice them either). For some reason the
height of the tool bar is not added when we do not add the one of the
menu bar. This must be a bug on our side.
> ConfigureNotify, PS=1328x1260, XS=1328x1308, DS=1328x1260
This one is truly remarkable: 1308 is 1258 + 50 and 50 pixels are the
height of your menu bar. Why would anyone add the menu bar height here
when we just asked to not add neither the height of the menu nor that of
the tool bar?
> xg_frame_resized, changed, PS=1328x1260, XS=1328x1308
> change_frame_size_1, delayed, PS=1328x1260, XS=1328x1308, DS=1328x1260
> change_frame_size (5), TS=1280x1260~>1280x1308, TC=80x36~>80x37,
So this gets us 37 lines, one too many ...
> NS=1328x1260~>1328x1308, IS=1328x1260~>1328x1308, MS=32x70 IH IV
> tool-bar-lines (2), MS=160x175
> xg_frame_set_char_size, visible, PS=1328x1308, XS=1328x1308
> +values, PS=664x654, XS=664x695
> ConfigureNotify, PS=1328x1308, XS=1328x1176
> xg_frame_resized, changed, PS=1328x1308, XS=1328x1176
> change_frame_size_1, delayed, PS=1328x1308, XS=1328x1176
> change_frame_size (5), TS=1280x1308~>1280x1176, TC=80x37~>80x33,
... here we shrink back to 33 lines ...
> NS=1328x1308~>1328x1176, IS=1328x1308~>1328x1176, MS=32x70 IH IV
> ConfigureNotify, PS=1328x1176, XS=1328x1292
> xg_frame_resized, changed, PS=1328x1176, XS=1328x1292
> change_frame_size_1, delayed, PS=1328x1176, XS=1328x1292
> change_frame_size (5), TS=1280x1176~>1280x1292, TC=80x33~>80x36,
> NS=1328x1176~>1328x1292, IS=1328x1176~>1328x1292, MS=32x70 IH IV
... and here we get the correct number of lines albeit with a surplus of
12 pixels. How does that first frame without menu bar look to you?
> Second frame with menu bar:
>
> Frame size history of #<frame *Minibuf-1* 0x55cd2d33c8f0>
> x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
> IS=80x25~>1296x875, MS=32x70 IH IV
> gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
> NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
> scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
> MS=160x175
> scroll-bar-height (3), MS=160x175
> menu-bar-lines (2), MS=160x175
> x_create_frame_2 (0), MS=160x175
> xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
> xg_frame_set_char_size (5), MS=32x70 IH IV
> x_make_frame_visible
> MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
> ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
This is the usual minimization attempt ...
> xg_frame_resized, changed, PS=1328x1260, XS=400x340
> change_frame_size_1, delayed, PS=1328x1260, XS=400x340, DS=1328x1260
> change_frame_size (5), TS=1280x1260~>352x340, TC=80x36~>22x9,
... which succeeds here. There's no good first ConfigureNotify event
and no second ConfigureNotify as with the initial frame. The remainder
can be ignored.
This time I'll have to look into our code first - something is fishy.
If there are any volunteers on GNOME who can apply a patch and check
whether they get the same either buggy or correct behavior, preferably
with a scaled screen, I'd be very, very grateful.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-04 15:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-04 15:23 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-04 17:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-04 15:23 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 921 bytes --]
On Fri, 4 Oct 2024 at 16:01, martin rudalics <rudalics@gmx.at> wrote:
>
> ... and here we get the correct number of lines albeit with a surplus of
> 12 pixels. How does that first frame without menu bar look to you?
>
Looks correct. Unlike some previous situations, where there were oddities
(e.g. the frame was wider than the Emacs window, or the minibuf was cut off
at the bottom), the frame seems to fit the contents perfectly.
> This time I'll have to look into our code first - something is fishy.
>
> If there are any volunteers on GNOME who can apply a patch and check
> whether they get the same either buggy or correct behavior, preferably
> with a scaled screen, I'd be very, very grateful.
>
Good to see you're making progress! I can check on two different machines,
for what it's worth, although with the same version of GNOME and same scale
(but with different screen sizes).
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1823 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-04 15:23 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-04 17:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-05 20:02 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-04 17:21 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
>> ... and here we get the correct number of lines albeit with a surplus of
>> 12 pixels. How does that first frame without menu bar look to you?
>>
>
> Looks correct. Unlike some previous situations, where there were oddities
> (e.g. the frame was wider than the Emacs window, or the minibuf was cut off
> at the bottom), the frame seems to fit the contents perfectly.
Somewhere these 12 pixels must show up. What does
(window-pixel-height)
in the *scratch* window evaluate to?
From my earlier
> So far I failed to notice that first ConfigureNotify following the
> MapNotify. It comes with the expected values XS=1328x1260. Where on
> earth does it come from ...
>
> > xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
> > ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
>
> ... and where does this with XS=1328x1258 come from? On my system, I
> get just one ConfigureNotify for each xg_frame_set_char_size.
I can only suspect that this comes from a request to move the frame that
doesn't show up in the history. Now the only location where this might
happen is in xterm.c around like 29259 here:
if (original_left != x || original_top != y)
XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
original_left, original_top);
Please put a breakpoint on that line and tell me whether it gets hit.
The probability is less than 1% but who knows ...
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-04 17:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-05 20:02 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-06 15:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-05 20:02 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1347 bytes --]
On Fri, 4 Oct 2024 at 18:21, martin rudalics <rudalics@gmx.at> wrote:
> > Looks correct. Unlike some previous situations, where there were
> oddities
> > (e.g. the frame was wider than the Emacs window, or the minibuf was cut
> off
> > at the bottom), the frame seems to fit the contents perfectly.
>
> Somewhere these 12 pixels must show up. What does
>
> (window-pixel-height)
>
> in the *scratch* window evaluate to?
>
(This is for first frame without menu bar.)
(window-pixel-height) ⇒ 1257
I can only suspect that this comes from a request to move the frame that
> doesn't show up in the history. Now the only location where this might
> happen is in xterm.c around like 29259 here:
>
> if (original_left != x || original_top != y)
> XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
> original_left, original_top);
>
> Please put a breakpoint on that line and tell me whether it gets hit.
> The probability is less than 1% but who knows ...
>
Nope, sorry, I put a breakpoint and it was not hit. Indeed, the whole block
starting at 29233 was not hit (I put a breakpoint at the call to
block_input on line 29245).
All line numbers above with your most recent patch gtktutil-frame.diff
applied to commit 4c7a6dc1a0c
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 2733 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-05 20:02 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-06 15:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 12:39 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-06 15:01 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 2004 bytes --]
> (This is for first frame without menu bar.)
>
> (window-pixel-height) ⇒ 1257
+ 35 pixels for the minibuffer gets us 1292 as expected. Your main
window is 32 pixels too high, the lowest 3 pixels of the last line
(provided it contains text) should be cut off.
> I can only suspect that this comes from a request to move the frame that
>> doesn't show up in the history. Now the only location where this might
>> happen is in xterm.c around like 29259 here:
>>
>> if (original_left != x || original_top != y)
>> XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
>> original_left, original_top);
>>
>> Please put a breakpoint on that line and tell me whether it gets hit.
>> The probability is less than 1% but who knows ...
>>
>
> Nope, sorry, I put a breakpoint and it was not hit. Indeed, the whole block
> starting at 29233 was not hit (I put a breakpoint at the call to
> block_input on line 29245).
It was unlikely anyway. Let us next check whether our event handler
drops events because they come with the same sizes. With the attached
gtkutil-frame-2.diff and the first frame without minibuffer.
If you have any idea how to debug mutter on your system, we should be
able to get the cause right from there. In window-x11.c the function
send_configure_notify calls
meta_topic (META_DEBUG_GEOMETRY,
"Sending synthetic configure notify to %s with x: %d y: %d w: %d h: %d",
window->desc,
event.xconfigure.x, event.xconfigure.y,
event.xconfigure.width, event.xconfigure.height);
That height should tell us all. IIUC you would have to set the
environment variable
MUTTER_DEBUG="geometry"
and then look into stderr (or redirect it) whether anything shows up.
IIUC mutter must have been built with a "verbose" option, so I doubt
that it will work for you out of the box but you could try nevertheless.
martin
[-- Attachment #2: gtkutil-frame-2.diff --]
[-- Type: text/x-patch, Size: 4645 bytes --]
diff --git a/src/frame.c b/src/frame.c
index 7f4bf274ad9..af95cb54701 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -734,6 +734,7 @@ adjust_frame_size (struct frame *f, int new_text_width, int new_text_height,
&& (new_native_height != old_native_height
|| inhibit == 0 || inhibit == 2))))
{
+#ifndef USE_GTK
if (inhibit == 2
#ifdef USE_MOTIF
&& !EQ (parameter, Qmenu_bar_lines)
@@ -754,7 +755,7 @@ adjust_frame_size (struct frame *f, int new_text_width, int new_text_height,
if (f->new_height >= 0)
new_native_height = f->new_height;
}
-
+#endif
if (CONSP (frame_size_history))
frame_size_history_adjust (f, inhibit, parameter,
old_text_width, old_text_height,
@@ -6769,7 +6770,7 @@ focus (where a frame immediately loses focus when it's left by the mouse
The function `frame--size-history' displays the value of this variable
in a more readable form. */);
- frame_size_history = Qnil;
+ frame_size_history = Fcons (make_fixnum (100), Qnil);
DEFVAR_BOOL ("tooltip-reuse-hidden-frame", tooltip_reuse_hidden_frame,
doc: /* Non-nil means reuse hidden tooltip frames.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..2be84ae60b9 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1327,10 +1327,17 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
if (FRAME_VISIBLE_P (f) && !was_visible)
{
if (CONSP (frame_size_history))
- frame_size_history_extra
- (f, build_string ("xg_frame_set_char_size, visible"),
- FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
- f->new_width, f->new_height);
+ {
+ frame_size_history_extra
+ (f, build_string ("xg_frame_set_char_size, visible"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ f->new_width, f->new_height);
+
+ if (gwidth > 0 || gheight > 0)
+ frame_size_history_extra
+ (f, build_string (" +values"), gwidth, gheight,
+ outer_width, outer_height, -1, -1);
+ }
/* Must call this to flush out events */
(void)gtk_events_pending ();
diff --git a/src/xterm.c b/src/xterm.c
index 0c20d38b0f7..07b368601c2 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -18873,6 +18873,9 @@ x_find_selection_owner (struct x_display_info *dpyinfo, Atom selection)
We return the number of characters stored into the buffer. */
+static int
+configurenotifycount = 0;
+
static int
handle_one_xevent (struct x_display_info *dpyinfo,
#ifndef HAVE_XINPUT2
@@ -21372,18 +21375,26 @@ handle_one_xevent (struct x_display_info *dpyinfo,
{
XNextEvent (dpyinfo->display, &next_event);
if (next_event.type != ConfigureNotify
- || next_event.xconfigure.window != event->xconfigure.window
+ || next_event.xconfigure.window != event->xconfigure.window)
+ {
+ XPutBackEvent (dpyinfo->display, &next_event);
+ break;
+ }
/* Skipping events with different sizes can lead to a
mispositioned mode line at initial window creation.
Only drop window motion events for now. */
- || next_event.xconfigure.width != event->xconfigure.width
- || next_event.xconfigure.height != event->xconfigure.height)
+ else if (next_event.xconfigure.width != event->xconfigure.width
+ || next_event.xconfigure.height != event->xconfigure.height)
{
XPutBackEvent (dpyinfo->display, &next_event);
- break;
+ configurenotifycount++;
+ break;
}
else
- configureEvent = next_event;
+ {
+ configurenotifycount = 0;
+ configureEvent = next_event;
+ }
}
/* If we get a ConfigureNotify for the root window, this means
@@ -21575,12 +21586,19 @@ handle_one_xevent (struct x_display_info *dpyinfo,
{
if (CONSP (frame_size_history))
- frame_size_history_extra
- (f, build_string ("ConfigureNotify"),
- FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f),
- configureEvent.xconfigure.width,
- configureEvent.xconfigure.height,
- f->new_width, f->new_height);
+ {
+ frame_size_history_extra
+ (f, build_string ("ConfigureNotify"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f),
+ configureEvent.xconfigure.width,
+ configureEvent.xconfigure.height,
+ f->new_width, f->new_height);
+
+ if (configurenotifycount > 0)
+ frame_size_history_extra
+ (f, build_string (" +count"),
+ configurenotifycount, -1, -1, -1, -1, -1);
+ }
#ifdef HAVE_XDBE
if (FRAME_X_DOUBLE_BUFFERED_P (f))
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-06 15:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-26 12:39 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 17:40 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-26 12:39 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 10127 bytes --]
On Sun, 6 Oct 2024 at 16:02, martin rudalics <rudalics@gmx.at> wrote:
[Apologies for the delay since last time!]
Let us next check whether our event handler
> drops events because they come with the same sizes. With the attached
> gtkutil-frame-2.diff and the first frame without minibuffer.
>
Frame size history from opening first frame without minibuffer:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at ecls
0x5595b811ad50>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
menu-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1258, XS=1328x1258
+values, PS=664x654, XS=664x629
ConfigureNotify, PS=1328x1258, XS=1328x1258
xg_frame_resized, unchanged, PS=1328x1258, XS=1328x1258
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1258, XS=1328x1258
+values, PS=664x629, XS=664x670
ConfigureNotify, PS=1328x1258, XS=1328x1258
xg_frame_resized, unchanged, PS=1328x1258, XS=1328x1258
set_window_configuration (4), MS=160x175 IH IV
I wasn't sure exactly what you wanted, so here's the same for the second
frame:
Frame size history of #<frame *Minibuf-1* 0x5963494a84d0>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x374, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x374
change_frame_size_1, delayed, PS=1328x1260, XS=400x374, DS=1328x1260
change_frame_size (5), TS=1280x1260~>352x374, TC=80x36~>22x10,
NS=1328x1260~>400x374, IS=1328x1260~>400x374, MS=32x70 IH IV
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=400x374, XS=400x374
+values, PS=200x187, XS=200x228
ConfigureNotify, PS=400x374, XS=400x374
xg_frame_resized, unchanged, PS=400x374, XS=400x374
set_window_configuration (4), MS=160x175 IH IV
If you have any idea how to debug mutter on your system, we should be
> able to get the cause right from there.
It's possible to turn on debug topics in Mutter at run-time using the
built-in Looking Glass debugger (`lg` from "Run Command" prompt).
Having done this, I can see the output in journalctl.
Using xwininfo, I found that the first window is ID 0x5000148 and the
second window I opened is ID 0x500031c.
Then, the logs show, grepping for the first ID:
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x5000148 in
move from 50,108 1328x1430 to 50,108 1328x1430
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 has
height_inc (34) that does not evenly divide min_height - base_height (340 -
116); thus >
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
gravity 1
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
resize width inc: 16 height inc: 34
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets min
size 128 x 340
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
base size 64 x 116
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Updating WM_NORMAL_HINTS
for 0x5000148
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x5000148 in
move from 50,108 1328x1430 to 50,108 1328x1430
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x5000148 in
move from 50,108 1328x1314 to 50,108 1328x1430
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 has
height_inc (34) that does not evenly divide min_height - base_height (238 -
116); thus >
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
gravity 1
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
resize width inc: 16 height inc: 34
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets min
size 128 x 238
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
base size 64 x 116
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Updating WM_NORMAL_HINTS
for 0x5000148
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x5000148 in
move from 50,108 1328x1314 to 50,108 1328x1314
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x5000148 in
move from 50,108 1328x1314 to 50,108 1328x1314
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x5000148 in
move from 50,108 1328x1364 to 50,108 1328x1314
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
gravity 1
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
resize width inc: 16 height inc: 34
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets min
size 128 x 102
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
base size 64 x 34
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Updating WM_NORMAL_HINTS
for 0x5000148
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
gravity 1
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
resize width inc: 16 height inc: 34
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets min
size 128 x 102
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 sets
base size 64 x 34
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Updating WM_NORMAL_HINTS
for 0x5000148
Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x5000148 in
move from 50,108 1328x1366 to 50,108 1328x1364
and for the second ID:
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
move from 130,188 400x512 to 130,188 400x512
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c has
height_inc (34) that does not evenly divide min_height - base_height (340 -
116); thus >
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets
gravity 1
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets
resize width inc: 16 height inc: 34
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets min
size 128 x 340
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets
base size 64 x 116
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Updating WM_NORMAL_HINTS
for 0x500031c
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
move from 130,188 400x512 to 130,188 400x512
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
move from 130,188 400x430 to 130,188 400x512
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c has
height_inc (34) that does not evenly divide min_height - base_height (238 -
116); thus >
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets
gravity 1
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets
resize width inc: 16 height inc: 34
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets min
size 128 x 238
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets
base size 64 x 116
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Updating WM_NORMAL_HINTS
for 0x500031c
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
move from 130,188 400x430 to 130,188 400x456
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
move from 130,188 400x430 to 130,188 400x456
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Sending synthetic
configure notify to 0x500031c with x: 130 y: 244 w: 400 h: 374
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: require_titlebar_visible
for 0x500031c toggled to TRUE
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
move from 0,58 400x430 to 0,0 400x456
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Setting
_NET_FRAME_EXTENTS on managed window 0x500031c to left = 0, right = 0, top
= 56, bottom = 0
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: require_titlebar_visible
for 0x500031c toggled to FALSE
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
move from 0,0 1328x1258 to 0,0 400x456
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets
gravity 1
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets
resize width inc: 16 height inc: 34
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets min
size 128 x 102
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets
base size 64 x 34
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Updating WM_NORMAL_HINTS
for 0x500031c
Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets min
height to 0, which makes no sense
These traces include the "Sending synthetic configure" message you
mentioned, hopefully helpful!
(At least good to know that it's easy to turn on debugging in a production
build.)
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 13897 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-26 12:39 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-26 17:40 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 11:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-26 17:40 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> It's possible to turn on debug topics in Mutter at run-time using the
> built-in Looking Glass debugger (`lg` from "Run Command" prompt).
Thanks, you saved my day. I should have found out about 'lg' myself but
didn't see it wherever I went.
> Having done this, I can see the output in journalctl.
>
> Using xwininfo, I found that the first window is ID 0x5000148 and the
> second window I opened is ID 0x500031c.
Just to make sure: The first window is the initial window Emacs made
with normal size and the second window the one you make via C-x 5 2 with
the menu bar still enabled and the abnormal size. Correct?
> Then, the logs show, grepping for the first ID:
>
> Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x5000148 in
> move from 50,108 1328x1430 to 50,108 1328x1430
> Oct 26 13:33:47 ecls gnome-shell[3227]: GEOMETRY: Window 0x5000148 has
> height_inc (34) that does not evenly divide min_height - base_height (340 -
> 116); thus >
This and all the following complaints are probably correct. I'm aware
that our sizes hints are incorrect and with 'lg' we can hopefully fix
them now. But IIUC mutter only complains but does not react in any
malevolent way. What surprises me is that for the first frame there's
no "Sending synthetic configure notify" entry. We'll have to find out
why.
> and for the second ID:
>
> Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
> move from 130,188 400x512 to 130,188 400x512
What surprises me most is that here we start already with a size
constrained to 400x512. Where would that come from? Basically, it
means whatever causes the frame to shrink must have happened before
mutter writes out the first log entry.
> Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: require_titlebar_visible
> for 0x500031c toggled to TRUE
This one is strange too. Why on earth would we turn the title bar on
here ...
> Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Sending synthetic
> configure notify to 0x500031c with x: 130 y: 244 w: 400 h: 374
> Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
> move from 0,58 400x430 to 0,0 400x456
> Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Setting
> _NET_FRAME_EXTENTS on managed window 0x500031c to left = 0, right = 0, top
> = 56, bottom = 0
> Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: require_titlebar_visible
> for 0x500031c toggled to FALSE
... and off here?
> Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Constraining 0x500031c in
> move from 0,0 1328x1258 to 0,0 400x456
This one is the most interesting entry here: Somehow we must have got
through with our idea of a 1328x1258 frame (which should IMHO mean that
GTK could not possibly have intercepted it as with the earlier ones) but
mutter immediately constrains it back to 400x456. I'd guess from this
that mutter _is_ responsible for the shrinking albeit in consensus with
GTK.
> Oct 26 13:33:48 ecls gnome-shell[3227]: GEOMETRY: Window 0x500031c sets min
> height to 0, which makes no sense
Likely another silly size hint we generate.
> These traces include the "Sending synthetic configure" message you
> mentioned, hopefully helpful!
>
> (At least good to know that it's easy to turn on debugging in a production
> build.)
It's more. For the first time I see a way to guess how mutter proceeds.
Can you please do the same you did above for a Lucid, Motif or a
--with-x-toolkit=no build - the one you find most convenient to build.
Maybe by comparing the logs we can understand better.
Thanks, martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-26 17:40 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-31 11:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 14:14 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-31 11:09 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]
On Sat, 26 Oct 2024 at 18:40, martin rudalics <rudalics@gmx.at> wrote:
>
> > Having done this, I can see the output in journalctl.
> >
> > Using xwininfo, I found that the first window is ID 0x5000148 and the
> > second window I opened is ID 0x500031c.
>
> Just to make sure: The first window is the initial window Emacs made
> with normal size and the second window the one you make via C-x 5 2 with
> the menu bar still enabled and the abnormal size. Correct?
>
Correct, except that I was working with the menu bar disabled. Do let me
know if you'd like me to redo with the default menu bar setting, before I
reply to the rest of your questions, and apologies if this confused things.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1362 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-31 11:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-10-31 14:14 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-05 23:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-31 14:14 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> Do let me
> know if you'd like me to redo with the default menu bar setting,
Please do three things:
- Make the second frame with the default menu bar settings.
- Make the first frame where in an early-init.el file you disable the
menu bar with a (menu-bar-lines . 0) entry in 'initial-frame-alist'.
- Make the second frame with menu bar mode disabled and any toolkit
where the second frame has the normal size.
> before I
> reply to the rest of your questions, and apologies if this confused things.
There are no questions IIRC, just some speculations. Obviously, if you
have any idea about how to include debug information (geometry, size
requests) from GTK too, then we should be able to get the whole picture.
Thanks, martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-10-31 14:14 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-05 23:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-06 8:48 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-05 23:06 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 14436 bytes --]
On Thu, 31 Oct 2024 at 14:14, martin rudalics <rudalics@gmx.at> wrote:
> > Do let me
> > know if you'd like me to redo with the default menu bar setting,
>
> Please do three things:
>
> - Make the second frame with the default menu bar settings.
>
Frame size history in this case:
Frame size history of #<frame *Minibuf-1* 0x55ae52a5ce70>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
menu-bar-lines (2), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=400x340, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=400x340, DS=1328x1260
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1260, XS=1328x1260, DS=400x340
+values, PS=200x195, XS=664x696
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=400x340
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258, DS=400x340
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=400x340
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
set_window_configuration (4), MS=160x175 IH IV
journalctl output:
9420: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
doesn't set gravity, using NW
9421: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets min width to 0, which makes no sense
9422: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets min height to 0, which makes no sense
9423: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000318
9424: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets base size 64 x 84
9425: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets min size 128 x 238
9426: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets resize width inc: 16 height inc: 34
9427: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets gravity 1
9428: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
has height_inc (34) that does not evenly divide min_height - base_height
(238 - 84); thus effective min_height is really 254
9429: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 0,0 1328x1308 to 0,0 400x456
9459: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x5000318 toggled to FALSE
9460: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Setting
_NET_FRAME_EXTENTS on managed window 0x5000318 to left = 0, right = 0, top
= 56, bottom = 0
9462: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 0,58 400x446 to 0,0 400x456
9490: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x5000318 toggled to TRUE
9492: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Sending synthetic
configure notify to 0x5000318 with x: 160 y: 274 w: 400 h: 390
9493: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 400x446 to 160,218 400x456
9524: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 400x446 to 160,218 400x456
9555: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000318
9556: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets base size 64 x 166
9557: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets min size 128 x 476
9558: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets resize width inc: 16 height inc: 34
9559: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
sets gravity 1
9560: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000318
has height_inc (34) that does not evenly divide min_height - base_height
(476 - 166); thus effective min_height is really 506
9561: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 400x446 to 160,218 1328x1446
9592: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 1328x1446 to 160,218 1328x1446
9623: Nov 05 22:31:38 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 1328x1446 to 160,218 1328x1446
9654: Nov 05 22:31:44 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 160,218 1328x1446 to 160,218 1328x1446
- Make the first frame where in an early-init.el file you disable the
> menu bar with a (menu-bar-lines . 0) entry in 'initial-frame-alist'.
>
Frame size history:
Frame size history of #<frame *Minibuf-1* - GNU Emacs at dwks
0x62c518283b88>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1296x875,
IS=80x25~>1296x875, MS=32x70 IH IV
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1296x875~>1296x1260, IS=1296x875~>1296x1260, MS=32x70 IH IV
scroll-bar-width (3), NS=1296x1260~>1328x1260, IS=1296x1260~>1328x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
xg_frame_set_char_size, invisible, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_set_char_size (5), MS=32x70 IH IV
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1328x1260, DS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1260, DS=1328x1260
xg_frame_resized, unchanged, PS=1328x1260, XS=1328x1260
ConfigureNotify, PS=1328x1260, XS=1328x1258, DS=1328x1260
xg_frame_resized, changed, PS=1328x1260, XS=1328x1258
change_frame_size_1, delayed, PS=1328x1260, XS=1328x1258, DS=1328x1260
change_frame_size (5), TS=1280x1260~>1280x1258, TC=80x36~>80x35,
NS=1328x1260~>1328x1258, IS=1328x1260~>1328x1258, MS=32x70 IH IV
tool-bar-lines (2), MS=160x175
xg_frame_set_char_size, visible, PS=1328x1258, XS=1328x1258
+values, PS=664x629, XS=664x670
ConfigureNotify, PS=1328x1258, XS=1328x1258
xg_frame_resized, unchanged, PS=1328x1258, XS=1328x1258
set_window_configuration (4), MS=160x175 IH IV
journalctl output:
10776: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
doesn't set gravity, using NW
10777: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min width to 0, which makes no sense
10778: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min height to 0, which makes no sense
10779: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000148
10780: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets base size 0 x 0
10781: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min size 0 x 0
10782: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets resize width inc: 2 height inc: 2
10783: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets gravity 1
10784: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min width to 0, which makes no sense
10785: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min height to 0, which makes no sense
10786: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
has width_inc (2) that does not evenly divide min_width - base_width (1 -
0); thus effective min_width is really 2
10787: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
has height_inc (2) that does not evenly divide min_height - base_height (1
- 0); thus effective min_height is really 2
10788: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 0,0 1328x1260 to 0,0 1328x1316
10818: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x5000148 toggled to FALSE
10819: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Setting
_NET_FRAME_EXTENTS on managed window 0x5000148 to left = 0, right = 0, top
= 56, bottom = 0
10821: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 0,58 1328x1316 to 0,0 1328x1316
10849: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x5000148 toggled to TRUE
10851: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Sending synthetic
configure notify to 0x5000148 with x: 80 y: 194 w: 1328 h: 1260
10854: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1316 to 80,138 1328x1316
10885: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000148
10886: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets base size 64 x 34
10887: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min size 128 x 102
10888: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets resize width inc: 16 height inc: 34
10889: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets gravity 1
10890: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1316 to 80,138 1328x1314
10921: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1314 to 80,138 1328x1314
10952: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x5000148
10953: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets base size 64 x 116
10954: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets min size 128 x 340
10955: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets resize width inc: 16 height inc: 34
10956: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
sets gravity 1
10957: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Window 0x5000148
has height_inc (34) that does not evenly divide min_height - base_height
(340 - 116); thus effective min_height is really 354
10958: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1314 to 80,138 1328x1396
10989: Nov 05 22:45:08 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1396 to 80,138 1328x1396
11051: Nov 05 22:45:20 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000148 in move from 80,138 1328x1396 to 80,138 1328x1396
- Make the second frame with menu bar mode disabled and any toolkit
> where the second frame has the normal size.
>
So here I rebuilt Emacs reconfigured with --with-x-toolkit=lucid
Frame size history of #<frame *Minibuf-1* 0x5885e759c460>
x_create_frame_1 (5), TS=80x25~>1280x875, NS=80x25~>1298x877,
IS=80x25~>1296x875, MS=32x70 IH IV
tool-bar-lines (1), NS=1298x877~>1298x912, MS=160x175
tool-bar-position (3), MS=160x175
gui_figure_window_size (5), TS=1280x875~>1280x1260, TC=80x25~>80x36,
NS=1298x912~>1298x1313, IS=1296x875~>1296x1260, MS=32x70 IH IV
update_from_various_frame_slots, PS=1298x1313, XS=1298x1313
set_frame_size
EmacsFrameRealize
EmacsFrameResize, PS=1298x1313, XS=1298x1313
change_frame_size_1, delayed, PS=1298x1313, XS=1298x1313
scroll-bar-width (3), NS=1298x1313~>1314x1313, IS=1296x1260~>1312x1260,
MS=160x175
scroll-bar-height (3), MS=160x175
x_create_frame_2 (0), MS=160x175
x_set_window_size_1, invisible, PS=1314x1313, XS=1314x1313, DS=1314x1313
x_set_window_size_1 (5), MS=32x70 IH IV
EmacsFrameResize, PS=1314x1313, XS=1314x1313, DS=1314x1313
EmacsFrameResize, PS=1314x1313, XS=1314x1313, DS=1314x1313
x_make_frame_visible
MapNotify, not hidden & not iconified, PS=1314x1313, DS=1314x1313
change_frame_size (5), MS=32x70 IH IV
EmacsFrameResize, PS=1314x1313, XS=1314x1313
change_frame_size_1, delayed, PS=1314x1313, XS=1314x1313
journalctl output:
11456: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
doesn't set gravity, using NW
11457: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets min width to 0, which makes no sense
11458: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets min height to 0, which makes no sense
11459: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Updating
WM_NORMAL_HINTS for 0x50002fd
11460: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets base size 34 x 53
11461: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets min size 34 x 53
11462: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets resize width inc: 16 height inc: 35
11463: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Window 0x50002fd
sets gravity 1
11465: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x50002fd in move from 0,0 1314x1313 to 0,0 1314x1369
11495: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x50002fd toggled to FALSE
11496: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Setting
_NET_FRAME_EXTENTS on managed window 0x50002fd to left = 0, right = 0, top
= 56, bottom = 0
11498: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x50002fd in move from 0,58 1314x1369 to 0,0 1314x1369
11526: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY:
require_titlebar_visible for 0x50002fd toggled to TRUE
11528: Nov 05 22:53:55 dwks gnome-shell[3900]: GEOMETRY: Sending synthetic
configure notify to 0x50002fd with x: 160 y: 274 w: 1314 h: 1313
> before I
> > reply to the rest of your questions, and apologies if this confused
> things.
>
> There are no questions IIRC, just some speculations. Obviously, if you
> have any idea about how to include debug information (geometry, size
> requests) from GTK too, then we should be able to get the whole picture.
>
https://docs.gtk.org/gtk3/running.html suggests that setting
GTK_DEBUG=geometry ought to help, but it requires gtk to be built with
--enable-debug=yes. When I run emacs built with Ubuntu's supplied gtk, I
get:
GTK_DEBUG=geometry ./src/emacs
(emacs:922673): Gtk-WARNING **: 22:58:57.468: GTK_DEBUG set but ignored
because gtk isn't built with G_ENABLE_DEBUG
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 18576 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-05 23:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-06 8:48 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-06 22:03 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-06 8:48 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
In your first log for
- Make the second frame with the default menu bar settings.
there is this entry
9429: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
0x5000318 in move from 0,0 1328x1308 to 0,0 400x456
Can you please try to find that (or if it got removed a new
corresponding entry) in journalctl and look there for the next entry
whose first line should be
Setting up constraint info:
and tell me what it says. IIUC those entries have no associated window
information. The whole format string in mutter's constraints.c here is
meta_topic (META_DEBUG_GEOMETRY,
"Setting up constraint info:\n"
" orig: %d,%d %dx%d\n"
" new : %d,%d %dx%d\n"
" action_type : %s\n"
" is_user_action : %s\n"
" resize_gravity : %s\n"
" fixed_directions: %s\n"
" work_area_monitor: %d,%d %dx%d\n"
" entire_monitor : %d,%d %dx%d",
It's number should obviously be 9430 but I have no idea how journalctl
works.
Thanks, martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-06 8:48 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-06 22:03 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-07 9:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-06 22:03 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]
On Wed, 6 Nov 2024 at 08:48, martin rudalics <rudalics@gmx.at> wrote:
> In your first log for
>
> - Make the second frame with the default menu bar settings.
>
> there is this entry
>
> 9429: Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Constraining
> 0x5000318 in move from 0,0 1328x1308 to 0,0 400x456
>
> Can you please try to find that (or if it got removed a new
> corresponding entry) in journalctl and look there for the next entry
> whose first line should be
>
> Setting up constraint info:
>
Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Setting up constraint
info:
orig: 0,0 1328x1308
new : 0,0 400x456
action_type : Move&Resize
is_user_action : false
resize_gravity :
META_GRAVITY_NORTH_WEST
fixed_directions: None
work_area_monitor: 0,58 3840x2102
entire_monitor : 0,0 3840x2160
> It's number should obviously be 9430 but I have no idea how journalctl
> works.
>
Mostly, the newlines in the message confuse the grep!
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 2441 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-06 22:03 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-07 9:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-07 10:36 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 23:25 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-07 9:49 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> Nov 05 22:31:36 dwks gnome-shell[3900]: GEOMETRY: Setting up constraint
> info:
> orig: 0,0 1328x1308
> new : 0,0 400x456
> action_type : Move&Resize
> is_user_action : false
> resize_gravity :
> META_GRAVITY_NORTH_WEST
> fixed_directions: None
> work_area_monitor: 0,58 3840x2102
> entire_monitor : 0,0 3840x2160
Again this only seems to confirm that the new size 400x456 is requested
somewhere _before_ mutter comes into play.
> Mostly, the newlines in the message confuse the grep!
It might be easier to restrict journalctl output via the -S and -U
options, feed its output into Emacs and do the searching there.
Since, as you said earlier, you can't debug GTK (I have the same problem
here) and the only person who might have done that in the past has left
us long ago, I can only try a guess at where GTK (or maybe Emacs itself)
could mess up things.
One problem I see is that in emacsgtkfixed.c we set up the preferred
size of the frame widget and take the width and size from our
min_width/min_height size hints. From the mutter log we know that these
are broken so maybe GTK does something weird with them. Please put
breakpoints at the lines
if (minimum) *minimum = w;
and
if (minimum) *minimum = h;
within the #else parts of emacs_fixed_get_preferred_width and
emacs_fixed_get_preferred_height in emacsgtkfixed.c and tell me which
values are assigned here: Once for a good scenario and once for a bad
one. Here I get 0 initially and later on 110 for h and 90 for w.
Experimentally, you could also try to use some arbitrary integer value
here so the code there becomes
#else
int w = priv->f->output_data.x->size_hints.min_width;
w = max (w, 800);
if (minimum) *minimum = w;
if (natural) *natural = w;
#endif
and
#else
int h = priv->f->output_data.x->size_hints.min_height;
h = max (h, 800);
if (minimum) *minimum = h;
if (natural) *natural = h;
#endif
and see whether your frame still shrinks. Obviously, such a setting
will inhibit shrinking your frame later on but here we want to know
whether these functions are responsible for the weird behavior you see.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-07 9:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-07 10:36 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 23:25 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-07 10:36 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> Experimentally, you could also try to use some arbitrary integer value
> here so the code there becomes
>
> #else
> int w = priv->f->output_data.x->size_hints.min_width;
> w = max (w, 800);
> if (minimum) *minimum = w;
> if (natural) *natural = w;
> #endif
>
> and
>
> #else
> int h = priv->f->output_data.x->size_hints.min_height;
> h = max (h, 800);
> if (minimum) *minimum = h;
> if (natural) *natural = h;
> #endif
Better make this
#else
int w = priv->f->output_data.x->size_hints.min_width;
if (minimum) *minimum = w;
w = max (w, 800);
if (natural) *natural = w;
#endif
and
#else
int h = priv->f->output_data.x->size_hints.min_height;
if (minimum) *minimum = h;
h = max (h, 800);
if (natural) *natural = h;
#endif
A comment in gtkwindow.c says
/* (Note: Replace "size" with "width" or "height". Also, the request
* mode is honoured.)
* For selecting the default window size, the following conditions
* should hold (in order of importance):
* - the size is not below the minimum size
* Windows cannot be resized below their minimum size, so we must
* ensure we don’t do that either.
* - the size is not above the natural size
* It seems weird to allocate more than this in an initial guess.
* - the size does not exceed that of a maximized window
* We want to see the whole window after all.
* (Note that this may not be possible to achieve due to imperfect
* information from the windowing system.)
*/
so if we make the natural size small, it's only natural that gtk chooses
a default size that is smaller than that.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-07 9:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-07 10:36 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-14 23:25 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 17:20 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-14 23:25 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]
On Thu, 7 Nov 2024 at 09:49, martin rudalics <rudalics@gmx.at> wrote:
>
> One problem I see is that in emacsgtkfixed.c we set up the preferred
> size of the frame widget and take the width and size from our
> min_width/min_height size hints. From the mutter log we know that these
> are broken so maybe GTK does something weird with them. Please put
> breakpoints at the lines
>
> if (minimum) *minimum = w;
>
> and
>
> if (minimum) *minimum = h;
>
> within the #else parts of emacs_fixed_get_preferred_width and
> emacs_fixed_get_preferred_height in emacsgtkfixed.c and tell me which
> values are assigned here: Once for a good scenario and once for a bad
> one. Here I get 0 initially and later on 110 for h and 90 for w.
>
Just to check I've understood what you want here, I did a first run with
the latest gtkutil-frame-2.diff applied, and with breakpoints on those two
lines, of simply "emacs -Q", and I get, for just opening the initial
window, 4 hits on each breakpoint.
The first hit is w = 0, h = 0.
The other three are w = 64, h = 167.
I wasn't exactly sure what you meant by a "good" or "bad" scenario; but I
guess you meant "good" == "with patch applied", and "bad" == "without patch
applied"?
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 2597 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-14 23:25 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-15 17:20 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 20:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-15 17:20 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 910 bytes --]
> Just to check I've understood what you want here, I did a first run with
> the latest gtkutil-frame-2.diff applied, and with breakpoints on those two
> lines, of simply "emacs -Q", and I get, for just opening the initial
> window, 4 hits on each breakpoint.
>
> The first hit is w = 0, h = 0.
>
> The other three are w = 64, h = 167.
OK.
> I wasn't exactly sure what you meant by a "good" or "bad" scenario; but I
> guess you meant "good" == "with patch applied", and "bad" == "without patch
> applied"?
With "good" scenario I meant one where you don't see any shrinking. A
"bad" scenario is one where you see it. Sorry for being unclear.
Please apply the attached diff to an unpatched Emacs and tell me whether
the frame sizes for a bad scenario are in any way different from those
that you see for the same bad scenario in an unpatched Emacs. Here the
patch has no effect.
Thanks, martin
[-- Attachment #2: emacsgtkfixed.diff --]
[-- Type: text/x-patch, Size: 629 bytes --]
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index 3941960b3ba..a7eddb31150 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -105,7 +105,7 @@ emacs_fixed_get_preferred_width (GtkWidget *widget,
#else
int w = priv->f->output_data.x->size_hints.min_width;
if (minimum) *minimum = w;
- if (natural) *natural = w;
+ if (natural) *natural = 800;
#endif
}
@@ -123,7 +123,7 @@ emacs_fixed_get_preferred_height (GtkWidget *widget,
#else
int h = priv->f->output_data.x->size_hints.min_height;
if (minimum) *minimum = h;
- if (natural) *natural = h;
+ if (natural) *natural = 600;
#endif
}
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-15 17:20 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-15 20:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 8:59 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-15 20:06 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]
On Fri, 15 Nov 2024 at 17:20, martin rudalics <rudalics@gmx.at> wrote:
>
> With "good" scenario I meant one where you don't see any shrinking. A
> "bad" scenario is one where you see it. Sorry for being unclear.
>
I feel I'm being a bit slow here. As I understand it, I see shrinking with
every new window in an unpatched Emacs, and with your recent patch, I don't
see shrinking; as I previously said, for me currently, bad == unpatched and
good == patched. Does that sound right?
Please apply the attached diff to an unpatched Emacs and tell me whether
> the frame sizes for a bad scenario are in any way different from those
> that you see for the same bad scenario in an unpatched Emacs. Here the
> patch has no effect.
>
So as far as I can tell, this request supersedes any outstanding previous
requests; does that sound right? Once I've given you these data, you'll
have frame sizes as given at the breakpoint for three scenarios:
1. Patched (already done).
2. Plain unpatched (not yet done).
3. Unpatched but with natural size forced to 800x600.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 2389 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-15 20:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-16 8:59 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 14:45 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-16 8:59 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> As I understand it, I see shrinking with
> every new window in an unpatched Emacs, and with your recent patch, I don't
> see shrinking; as I previously said, for me currently, bad == unpatched and
> good == patched. Does that sound right?
That sounds too good to be true. Let's try to take a step back. With a
pristine, unpatched emacs -Q, when you do C-x 5 2, the new frame opens
much smaller than the initial frame. With a patched emacs -Q, when you
do C-x 5 2, the new frame window opens just as large as the initial
frame. Is that description correct?
And you do not see a behavior where the new frame is very small
initially and only then resizes to the final appearance? And if you
turn off the menu bars, the new frame opens as large as the initial
frame minus the height of the menu bar?
If the answer to all these is yes, then what was the patch? Just that
recent one where I set the natural sizes in emacsgtkfixed.c to 800x600?
Or do you have applied some patch I sent earlier?
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-16 8:59 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-16 14:45 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 16:40 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-16 14:45 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]
On Sat, 16 Nov 2024 at 08:59, martin rudalics <rudalics@gmx.at> wrote:
>
> That sounds too good to be true. Let's try to take a step back. With a
> pristine, unpatched emacs -Q, when you do C-x 5 2, the new frame opens
> much smaller than the initial frame. With a patched emacs -Q, when you
> do C-x 5 2, the new frame window opens just as large as the initial
> frame. Is that description correct?
>
Yes.
And you do not see a behavior where the new frame is very small
> initially and only then resizes to the final appearance? And if you
> turn off the menu bars, the new frame opens as large as the initial
> frame minus the height of the menu bar?
>
Sorry, I had forgotten about the instantaneous resizing. So yes, with the
patched Emacs, I get this resizing, if my eyes don't deceive me (it is very
fast).
And indeed, when I turn off menu bars, the second frame still opens small,
even with the patch.
If the answer to all these is yes, then what was the patch? Just that
> recent one where I set the natural sizes in emacsgtkfixed.c to 800x600?
> Or do you have applied some patch I sent earlier?
>
I am referring to your gtkutil-frame-2.diff of October 6th.
So anyway, what I'm really trying to understand is just in simple terms
what tests you'd like me to run next.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 3012 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-16 14:45 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-16 16:40 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 13:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-16 16:40 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> So anyway, what I'm really trying to understand is just in simple terms
> what tests you'd like me to run next.
Please remove all of my patches from the Emacs version you try. Then
apply only emacsgtkfixed.diff and tell me whether the second frame
shrinks as before.
Thanks, martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-16 16:40 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-17 13:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 16:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-17 13:09 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
On Sat, 16 Nov 2024 at 16:40, martin rudalics <rudalics@gmx.at> wrote:
> > So anyway, what I'm really trying to understand is just in simple terms
> > what tests you'd like me to run next.
>
> Please remove all of my patches from the Emacs version you try. Then
> apply only emacsgtkfixed.diff and tell me whether the second frame
> shrinks as before.
>
Thanks for spelling it out!
When I update to current git master, apply just your patch, and start up
`emacs -Q` with and without menu bars, the second frame shrinks as before,
in both cases.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1394 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-17 13:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-17 16:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 17:01 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-17 16:37 UTC (permalink / raw)
To: Reuben Thomas; +Cc: Po Lu, Eli Zaretskii, 72986
> When I update to current git master, apply just your patch, and start up
> `emacs -Q` with and without menu bars, the second frame shrinks as before,
> in both cases.
So my last hope for finding the cause of this behavior is gone.
Thanks for trying, martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-17 16:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-17 17:01 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 9:59 ` Eli Zaretskii
0 siblings, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-17 17:01 UTC (permalink / raw)
To: martin rudalics; +Cc: Po Lu, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 265 bytes --]
On Sun, 17 Nov 2024 at 16:37, martin rudalics <rudalics@gmx.at> wrote:
>
> So my last hope for finding the cause of this behavior is gone.
>
> Thanks for trying, martin
>
You're welcome; do let me know if there's anything else I can do.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 976 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-17 17:01 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-30 9:59 ` Eli Zaretskii
2024-11-30 10:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: Eli Zaretskii @ 2024-11-30 9:59 UTC (permalink / raw)
To: rudalics, Reuben Thomas; +Cc: luangruo, 72986
> From: Reuben Thomas <rrt@sc3d.org>
> Date: Sun, 17 Nov 2024 17:01:24 +0000
> Cc: Eli Zaretskii <eliz@gnu.org>, Po Lu <luangruo@yahoo.com>, 72986@debbugs.gnu.org
>
> On Sun, 17 Nov 2024 at 16:37, martin rudalics <rudalics@gmx.at> wrote:
>
> So my last hope for finding the cause of this behavior is gone.
>
> Thanks for trying, martin
>
> You're welcome; do let me know if there's anything else I can do.
Martin, what should we do with this bug? Leave it open, close it as
unreproducible, something else?
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-30 9:59 ` Eli Zaretskii
@ 2024-11-30 10:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 11:50 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 12:32 ` Eli Zaretskii
0 siblings, 2 replies; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-30 10:16 UTC (permalink / raw)
To: Eli Zaretskii, Reuben Thomas; +Cc: luangruo, 72986
> Martin, what should we do with this bug? Leave it open, close it as
> unreproducible, something else?
In a previous mail Reuben told me that with an earlier patch he got
Sorry, I had forgotten about the instantaneous resizing. So yes, with the
patched Emacs, I get this resizing, if my eyes don't deceive me (it is very
fast).
So the bug could be fixed with that patch albeit not entirely
satisfactorily. I think I will install it with the help of a
customizable variable users would then have to set in their early init
files.
In addition I will have to take care of the sizes hints but that won't
happen too soon.
martin
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-30 10:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-30 11:50 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 19:00 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 12:32 ` Eli Zaretskii
1 sibling, 1 reply; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-30 11:50 UTC (permalink / raw)
To: martin rudalics; +Cc: luangruo, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 900 bytes --]
On Sat, 30 Nov 2024 at 10:16, martin rudalics <rudalics@gmx.at> wrote:
> So the bug could be fixed with that patch albeit not entirely
> satisfactorily. I think I will install it with the help of a
> customizable variable users would then have to set in their early init
> files.
>
Assuming that this problem affects all or most users of recent GNOME, it
would be fantastic to have this patch installed. It's a very unsatisfactory
fix (because we don't understand what the problem really is, or even where,
I think?), but the current situation is quite annoying (every time I open a
new Emacs frame, I first have to resize it before I can use it).
Thanks again to Martin; having myself had to do quite a lot of proxy
debugging of weird effects on systems I don't use, I appreciate the
patience and hard thought that goes into trying to diagnose and fix this
sort of bug.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1903 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-30 10:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 11:50 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-30 12:32 ` Eli Zaretskii
1 sibling, 0 replies; 82+ messages in thread
From: Eli Zaretskii @ 2024-11-30 12:32 UTC (permalink / raw)
To: martin rudalics; +Cc: luangruo, 72986, rrt
> Date: Sat, 30 Nov 2024 11:16:42 +0100
> Cc: luangruo@yahoo.com, 72986@debbugs.gnu.org
> From: martin rudalics <rudalics@gmx.at>
>
> > Martin, what should we do with this bug? Leave it open, close it as
> > unreproducible, something else?
>
> In a previous mail Reuben told me that with an earlier patch he got
>
> Sorry, I had forgotten about the instantaneous resizing. So yes, with the
> patched Emacs, I get this resizing, if my eyes don't deceive me (it is very
> fast).
>
> So the bug could be fixed with that patch albeit not entirely
> satisfactorily. I think I will install it with the help of a
> customizable variable users would then have to set in their early init
> files.
>
> In addition I will have to take care of the sizes hints but that won't
> happen too soon.
TIA
^ permalink raw reply [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-30 11:50 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-30 19:00 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-13 14:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 82+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-30 19:00 UTC (permalink / raw)
To: Reuben Thomas; +Cc: luangruo, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 877 bytes --]
> Assuming that this problem affects all or most users of recent GNOME, it
> would be fantastic to have this patch installed. It's a very unsatisfactory
> fix (because we don't understand what the problem really is, or even where,
> I think?), but the current situation is quite annoying (every time I open a
> new Emacs frame, I first have to resize it before I can use it).
> Thanks again to Martin; having myself had to do quite a lot of proxy
> debugging of weird effects on systems I don't use, I appreciate the
> patience and hard thought that goes into trying to diagnose and fix this
> sort of bug.
I now added a variable called 'x-gtk-insist-on-requested-size'. If
non-nil, it should do what its doc-string says. The rest of the
attached patch is mostly what was in a diff I earlier posted as
gtkutil-reject-2024-10-02.diff. Please try it.
Thanks, martin
[-- Attachment #2: gtkutil-reject-11.diff --]
[-- Type: text/x-patch, Size: 4301 bytes --]
diff --git a/src/gtkutil.c b/src/gtkutil.c
index d57627f152f..1496b761550 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1129,11 +1129,59 @@ xg_set_geometry (struct frame *f)
}
}
+#ifndef HAVE_PGTK
+static struct frame *last_resize_frame = NULL;
+static int last_resize_height = -1;
+static int last_resize_width = -1;
+static bool last_resize_insist = false;
+#endif
+
/** Function to handle resize of native frame F to WIDTH and HEIGHT
pixels after we got a ConfigureNotify event. */
void
xg_frame_resized (struct frame *f, int width, int height)
{
+#ifndef HAVE_PGTK
+ bool reject = false;
+
+ if (last_resize_insist && f == last_resize_frame)
+ {
+ int expected_width = ((last_resize_width * xg_get_scale (f))
+ - FRAME_TOOLBAR_WIDTH (f));
+ int expected_height = ((last_resize_height * xg_get_scale (f))
+ - FRAME_MENUBAR_HEIGHT (f)
+ - FRAME_TOOLBAR_HEIGHT (f));
+
+ /* Fuzzyness: Reject the new size if the deviation is more than
+ two pixels in either direction. */
+ if (width > expected_width + 2
+ || width < expected_width - 2
+ || height > expected_height + 2
+ || height < expected_height - 2)
+ /* We did not get what we wanted, retry. */
+ {
+ if (CONSP (frame_size_history))
+ frame_size_history_extra
+ (f, build_string ("xg_frame_resized, rejected"),
+ FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), width, height,
+ last_resize_width, last_resize_height);
+
+ /* Resend the previous request. */
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ last_resize_width, last_resize_height);
+ reject = true;
+ }
+
+ /* Reset the insistence values. */
+ last_resize_frame = NULL;
+ last_resize_height = -1;
+ last_resize_width = -1;
+ last_resize_insist = false;
+
+ if (reject)
+ return;
+ }
+#endif
/* Ignore case where size of native rectangle didn't change. */
if (width != FRAME_PIXEL_WIDTH (f)
|| height != FRAME_PIXEL_HEIGHT (f)
@@ -1297,19 +1345,23 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
else
{
#ifndef HAVE_PGTK
+ if (x_gtk_insist_on_requested_size)
+ {
+ last_resize_frame = f;
+ last_resize_width = outer_width;
+ last_resize_height = outer_height;
+ last_resize_insist = true;
+ }
+
gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
outer_width, outer_height);
#else
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- outer_width, outer_height);
- }
+ gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ outer_width, outer_height);
else
- {
- gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
- outer_width, outer_height);
- }
+ gtk_widget_set_size_request (FRAME_GTK_WIDGET (f),
+ outer_width, outer_height);
#endif
fullscreen = Qnil;
}
diff --git a/src/xterm.c b/src/xterm.c
index 0c20d38b0f7..00dc976e2ff 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -32762,6 +32762,23 @@ syms_of_xterm (void)
always uses gtk_window_move and ignores the value of this variable. */);
x_gtk_use_window_move = true;
+#if defined USE_GTK && !defined HAVE_PGTK
+ DEFVAR_BOOL ("x-gtk-insist-on-requested-size", x_gtk_insist_on_requested_size,
+ doc: /* Non-nil means try harder to obtain requested size for new frames.
+If this variable is non-nil, a GTK build on X will reject once a frame
+size it is offered that does not match the one previously requested by
+Emacs. Rather, Emacs will reissue the previous request to size the
+frame. If this variable is nil, Emacs will accept any frame size it is
+offered.
+
+Setting this to a non-nil value can be necessary when running on a GNOME
+desktop with the mutter window manager under GTK3. These may offer
+Emacs a much smaller frame size for the initial as well as for any
+additional frames. For the initial frame it will be necessary to set
+this in the `early-init.el' file. */);
+ x_gtk_insist_on_requested_size = false;
+#endif
+
DEFVAR_LISP ("x-scroll-event-delta-factor", Vx_scroll_event_delta_factor,
doc: /* A scale to apply to pixel deltas reported in scroll events.
This option is only effective when Emacs is built with XInput 2
^ permalink raw reply related [flat|nested] 82+ messages in thread
* bug#72986: Disabling menu-bar-mode changes size of new frames
2024-11-30 19:00 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-13 14:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 82+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-13 14:32 UTC (permalink / raw)
To: martin rudalics; +Cc: luangruo, Eli Zaretskii, 72986
[-- Attachment #1: Type: text/plain, Size: 858 bytes --]
On Sat, 30 Nov 2024 at 19:01, martin rudalics <rudalics@gmx.at> wrote:
>
> I now added a variable called 'x-gtk-insist-on-requested-size'. If
> non-nil, it should do what its doc-string says. The rest of the
> attached patch is mostly what was in a diff I earlier posted as
> gtkutil-reject-2024-10-02.diff. Please try it.
>
Thanks very much for this. I have switched to KDE, because it seemed that
GNOME was making problems for other applications, not just Emacs; for
example, Firefox windows were also opening small (but then resizing larger).
I did do one final test before switching, which was to check that I still
experienced the problem in a default setup (so that it wasn't due to my
user settings).
I do have another machine that is still using GNOME, so I will try to test
your patch before I switch it to KDE too.
--
https://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 1899 bytes --]
^ permalink raw reply [flat|nested] 82+ messages in thread
end of thread, other threads:[~2024-12-13 14:32 UTC | newest]
Thread overview: 82+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 18:48 bug#72986: Disabling menu-bar-mode changes size of new frames Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 12:07 ` Eli Zaretskii
2024-09-03 12:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 15:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 15:59 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:03 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:29 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-03 17:42 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 8:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 11:23 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 12:12 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 13:05 ` Robert Pluim
2024-09-04 17:11 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 22:45 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 7:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 19:31 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 7:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 8:11 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 9:50 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 12:20 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 14:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 15:14 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 8:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 12:07 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 8:42 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 11:38 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 14:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:20 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 16:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 17:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 8:58 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 9:49 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 12:33 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 13:59 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 16:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 17:52 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 9:31 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 17:00 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 17:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-12 16:24 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14 14:43 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-15 12:40 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-16 8:46 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-25 19:12 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-01 8:55 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-01 18:11 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-02 8:53 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-02 12:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-03 13:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-03 19:43 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-04 15:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-04 15:23 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-04 17:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-05 20:02 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-06 15:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 12:39 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 17:40 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 11:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 14:14 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-05 23:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-06 8:48 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-06 22:03 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-07 9:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-07 10:36 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 23:25 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 17:20 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 20:06 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 8:59 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 14:45 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 16:40 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 13:09 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 16:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 17:01 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 9:59 ` Eli Zaretskii
2024-11-30 10:16 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 11:50 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 19:00 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-13 14:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 12:32 ` Eli Zaretskii
2024-09-03 17:44 ` Eli Zaretskii
2024-09-03 18:34 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-04 8:05 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).