From: Po Lu Date: Wed, 31 Aug 2022 02:17:20 +0000 (+0800) Subject: Gently nudge Xt into always setting size hints X-Git-Tag: emacs-29.0.90~1856^2~820 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=136495f178ccd36b23ffc347fe2b6680fd689e34;p=emacs.git Gently nudge Xt into always setting size hints * src/widget.c (update_wm_hints): Force a resource to change every time this function is called. (bug#57475) (EmacsFrameInitialize): Initialize new field. * src/widgetprv.h (EmacsFramePart): New field `size_switch'. * src/xterm.c (x_wm_set_size_hint): Don't change flags if flags is 0. --- diff --git a/src/widget.c b/src/widget.c index b125b4caeed..5a75cdaca8e 100644 --- a/src/widget.c +++ b/src/widget.c @@ -292,18 +292,20 @@ update_wm_hints (Widget wmshell, EmacsFrame ew) base_height = (wmshell->core.height - ew->core.height + (rounded_height - (char_height * ch))); - /* This is kind of sleazy, but I can't see how else to tell it to - make it mark the WM_SIZE_HINTS size as user specified. - */ -/* ((WMShellWidget) wmshell)->wm.size_hints.flags |= USSize;*/ + /* Ensure that Xt actually sets window manager hint flags specified + by the caller by making sure XtNminWidth (a relatively harmless + resource) always changes each time this function is invoked. */ + ew->emacs_frame.size_switch = !ew->emacs_frame.size_switch; XtVaSetValues (wmshell, XtNbaseWidth, (XtArgVal) base_width, XtNbaseHeight, (XtArgVal) base_height, XtNwidthInc, (XtArgVal) (frame_resize_pixelwise ? 1 : cw), XtNheightInc, (XtArgVal) (frame_resize_pixelwise ? 1 : ch), - XtNminWidth, (XtArgVal) base_width, - XtNminHeight, (XtArgVal) base_height, + XtNminWidth, (XtArgVal) (base_width + + ew->emacs_frame.size_switch), + XtNminHeight, (XtArgVal) (base_height + + ew->emacs_frame.size_switch), NULL); } @@ -355,6 +357,8 @@ EmacsFrameInitialize (Widget request, Widget new, exit (1); } + ew->emacs_frame.size_switch = 1; + update_from_various_frame_slots (ew); set_frame_size (ew); } diff --git a/src/widgetprv.h b/src/widgetprv.h index 960f814e16f..fe960326b03 100644 --- a/src/widgetprv.h +++ b/src/widgetprv.h @@ -49,6 +49,8 @@ typedef struct { Boolean visual_bell; /* flash instead of beep */ int bell_volume; /* how loud is beep */ + int size_switch; /* hack to make setting size + hints work correctly */ /* private state */ diff --git a/src/xterm.c b/src/xterm.c index 3c05bc7807d..e8c56d68ea8 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -27484,8 +27484,11 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position) eassert (XtIsWMShell (f->output_data.x->widget)); shell = (WMShellWidget) f->output_data.x->widget; - shell->wm.size_hints.flags &= ~(PPosition | USPosition); - shell->wm.size_hints.flags |= flags & (PPosition | USPosition); + if (flags) + { + shell->wm.size_hints.flags &= ~(PPosition | USPosition); + shell->wm.size_hints.flags |= flags & (PPosition | USPosition); + } if (user_position) {