aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-08-31 10:17:20 +0800
committerPo Lu2022-08-31 10:17:43 +0800
commit136495f178ccd36b23ffc347fe2b6680fd689e34 (patch)
tree4b8836244aae562e984d522fe064ae2b37ade1f5 /src
parent5bedef8f87d2103e21342a06c4c1c9d7efe06621 (diff)
downloademacs-136495f178ccd36b23ffc347fe2b6680fd689e34.tar.gz
emacs-136495f178ccd36b23ffc347fe2b6680fd689e34.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/widget.c16
-rw-r--r--src/widgetprv.h2
-rw-r--r--src/xterm.c7
3 files changed, 17 insertions, 8 deletions
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)
292 base_height = (wmshell->core.height - ew->core.height 292 base_height = (wmshell->core.height - ew->core.height
293 + (rounded_height - (char_height * ch))); 293 + (rounded_height - (char_height * ch)));
294 294
295 /* This is kind of sleazy, but I can't see how else to tell it to 295 /* Ensure that Xt actually sets window manager hint flags specified
296 make it mark the WM_SIZE_HINTS size as user specified. 296 by the caller by making sure XtNminWidth (a relatively harmless
297 */ 297 resource) always changes each time this function is invoked. */
298/* ((WMShellWidget) wmshell)->wm.size_hints.flags |= USSize;*/ 298 ew->emacs_frame.size_switch = !ew->emacs_frame.size_switch;
299 299
300 XtVaSetValues (wmshell, 300 XtVaSetValues (wmshell,
301 XtNbaseWidth, (XtArgVal) base_width, 301 XtNbaseWidth, (XtArgVal) base_width,
302 XtNbaseHeight, (XtArgVal) base_height, 302 XtNbaseHeight, (XtArgVal) base_height,
303 XtNwidthInc, (XtArgVal) (frame_resize_pixelwise ? 1 : cw), 303 XtNwidthInc, (XtArgVal) (frame_resize_pixelwise ? 1 : cw),
304 XtNheightInc, (XtArgVal) (frame_resize_pixelwise ? 1 : ch), 304 XtNheightInc, (XtArgVal) (frame_resize_pixelwise ? 1 : ch),
305 XtNminWidth, (XtArgVal) base_width, 305 XtNminWidth, (XtArgVal) (base_width
306 XtNminHeight, (XtArgVal) base_height, 306 + ew->emacs_frame.size_switch),
307 XtNminHeight, (XtArgVal) (base_height
308 + ew->emacs_frame.size_switch),
307 NULL); 309 NULL);
308} 310}
309 311
@@ -355,6 +357,8 @@ EmacsFrameInitialize (Widget request, Widget new,
355 exit (1); 357 exit (1);
356 } 358 }
357 359
360 ew->emacs_frame.size_switch = 1;
361
358 update_from_various_frame_slots (ew); 362 update_from_various_frame_slots (ew);
359 set_frame_size (ew); 363 set_frame_size (ew);
360} 364}
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 {
49 49
50 Boolean visual_bell; /* flash instead of beep */ 50 Boolean visual_bell; /* flash instead of beep */
51 int bell_volume; /* how loud is beep */ 51 int bell_volume; /* how loud is beep */
52 int size_switch; /* hack to make setting size
53 hints work correctly */
52 54
53 /* private state */ 55 /* private state */
54 56
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)
27484 eassert (XtIsWMShell (f->output_data.x->widget)); 27484 eassert (XtIsWMShell (f->output_data.x->widget));
27485 shell = (WMShellWidget) f->output_data.x->widget; 27485 shell = (WMShellWidget) f->output_data.x->widget;
27486 27486
27487 shell->wm.size_hints.flags &= ~(PPosition | USPosition); 27487 if (flags)
27488 shell->wm.size_hints.flags |= flags & (PPosition | USPosition); 27488 {
27489 shell->wm.size_hints.flags &= ~(PPosition | USPosition);
27490 shell->wm.size_hints.flags |= flags & (PPosition | USPosition);
27491 }
27489 27492
27490 if (user_position) 27493 if (user_position)
27491 { 27494 {