unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>, Po Lu <luangruo@yahoo.com>
Cc: ajh@ajhurst.org, 73244@debbugs.gnu.org
Subject: bug#73244: Emacs29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41
Date: Mon, 14 Oct 2024 17:58:43 +0200	[thread overview]
Message-ID: <6af6243c-e2e4-4593-84c5-921ee1677910@gmx.at> (raw)
In-Reply-To: <86zfn6stau.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]

 >>>>>>>>>> The bug I have, since upgrading to Ubuntu 24.04 and install emacs29 is that the initial frame has width x height of 20 x 9, even though I have a .Xresources file containing
 >>>>>>>>>>     Emacs*geometry: 100x40+1900+0
 >>>>>>>>>> end a default-frame-alist of
 >>>>>>>>>>    Value:
 >>>>>>>>>>    ((font . "Monospace-10")
 >>>>>>>>>>     (height . 42)
 >>>>>>>>>>     (width . 90)
 >>>>>>>>>>     (tool-bar-lines . 0)
 >>>>>>>>>>     (menu-bar-lines . 1)
 >>>>>>>>>>     (top . 0)
 >>>>>>>>>>     (left . 1200))
 >>>>>>>>>>    Original value was nil
 >>>>>>>>>> set up by my .emacs file.
 >>>>>>>>>>
 >>>>>>>>>> Using either the pull-down File->New Frame, or C-x 5 2, both generate new frames of the 20 x 9 size.
...
 > Martin, any suggestions or ideas?

Welcome to the club, John.  Some standard questions:

- You're using GNOME desktop and the mutter window manager.  Right?  If
   so, what does mutter --version tell?  Can you try setting the
   environment variable MUTTER_DEBUG="geometry" and then look into stderr
   whether anything shows up there at all?  If so, we could try to
   investigate further.

- Is your screen scaled?

- What does evaluating (frame-geometry) tell for the first frame?  What
   do (frame-char-height) and (frame-char-width) evaluate too?

- Can you build with other toolkits?  GTK2, Lucid, Motif or with the
   --with-x-toolkit=no option?

- Can you build with the attached patch?  If so, please evaluate the
   form (frame--size-history) and post the contents of the the buffer
   *frame-size-history* here.

Thanks, 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 ();

      reply	other threads:[~2024-10-14 15:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-14  2:42 bug#73244: Emacs29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41 John Hurst
2024-09-14  2:45 ` bug#73245: " John Hurst
2024-09-14  7:23   ` Eli Zaretskii
2024-09-14  7:25 ` bug#73244: " Eli Zaretskii
2024-09-21  9:50 ` Eli Zaretskii
2024-09-21  9:58   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-21 11:19     ` Eli Zaretskii
2024-10-05  9:55       ` Eli Zaretskii
2024-10-05 11:05         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-12 11:48           ` Eli Zaretskii
2024-10-13 21:29             ` John Hurst
2024-10-13 23:33               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-14 13:33                 ` Eli Zaretskii
2024-10-14 15:58                   ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6af6243c-e2e4-4593-84c5-921ee1677910@gmx.at \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73244@debbugs.gnu.org \
    --cc=ajh@ajhurst.org \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    --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 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).