From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Reuben Thomas <rrt@sc3d.org>
Cc: Po Lu <luangruo@yahoo.com>, Eli Zaretskii <eliz@gnu.org>,
72986@debbugs.gnu.org
Subject: bug#72986: Disabling menu-bar-mode changes size of new frames
Date: Mon, 9 Sep 2024 10:58:05 +0200 [thread overview]
Message-ID: <300cb820-d6b7-44c6-8609-fa7804babf99@gmx.at> (raw)
In-Reply-To: <CAOnWdohFep93KVBb1cOzCSL1nxO_zcPeUgT2UcpgvnBQiSQUwA@mail.gmail.com>
[-- 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); **/
}
next prev parent reply other threads:[~2024-09-09 8:58 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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-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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=300cb820-d6b7-44c6-8609-fa7804babf99@gmx.at \
--to=bug-gnu-emacs@gnu.org \
--cc=72986@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=luangruo@yahoo.com \
--cc=rrt@sc3d.org \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.