From: Po Lu Date: Thu, 17 Feb 2022 02:28:02 +0000 (+0800) Subject: * src/emacsgtkfixed.c (XSetWMSizeHints): Improve fix for bug#8919. X-Git-Tag: emacs-29.0.90~2281 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=74c07733698b95eb455edcafab8634a700a3194f;p=emacs.git * src/emacsgtkfixed.c (XSetWMSizeHints): Improve fix for bug#8919. --- diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c index a38ba35ad80..cd5d1d14353 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,