emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 74c0773369: * src/emacsgtkfixed.c (XSetWMSizeHints): Improve fix


From: Po Lu
Subject: master 74c0773369: * src/emacsgtkfixed.c (XSetWMSizeHints): Improve fix for bug#8919.
Date: Wed, 16 Feb 2022 21:28:40 -0500 (EST)

branch: master
commit 74c07733698b95eb455edcafab8634a700a3194f
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    * src/emacsgtkfixed.c (XSetWMSizeHints): Improve fix for bug#8919.
---
 src/emacsgtkfixed.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index a38ba35ad8..cd5d1d1435 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -164,11 +164,30 @@ XSetWMSizeHints (Display *d,
 
   if ((hints->flags & PMinSize) && f)
     {
-      int w = f->output_data.x->size_hints.min_width;
-      int h = f->output_data.x->size_hints.min_height;
-
-      data[5] = w;
-      data[6] = h;
+      /* Overriding the size hints with our own values of min_width
+        and min_height used to work, but these days just results in
+        frames resizing unpredictably and emitting GTK warnings while
+        Emacs fights with GTK over the size of the frame.  So instead
+        of doing that, just respect the hints set by GTK, but make
+        sure they are an integer multiple of the resize increments so
+        that bug#8919 stays fixed.  */
+
+      /* int w = f->output_data.x->size_hints.min_width;
+         int h = f->output_data.x->size_hints.min_height;
+
+        data[5] = w;
+        data[6] = h; */
+
+      /* Make sure min_width and min_height are multiples of width_inc
+        and height_inc.  */
+
+      if (hints->flags & PResizeInc)
+       {
+         if (data[5] % hints->width_inc)
+           data[5] += (hints->width_inc - (data[5] % hints->width_inc));
+         if (data[6] % hints->height_inc)
+           data[6] += (hints->height_inc - (data[6] % hints->height_inc));
+       }
     }
 
   XChangeProperty (d, w, prop, XA_WM_SIZE_HINTS, 32, PropModeReplace,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]