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.
This commit is contained in:
Po Lu 2022-08-31 10:17:20 +08:00
parent 5bedef8f87
commit 136495f178
3 changed files with 17 additions and 8 deletions

View file

@ -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);
}

View file

@ -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 */

View file

@ -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)
{