summaryrefslogtreecommitdiff
path: root/src/xterm.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-10-12 15:07:49 +0800
committerPo Lu <luangruo@yahoo.com>2022-10-12 15:08:01 +0800
commit2953d89d74ebfe6a6bcbe0d25a60a845acad0e13 (patch)
treeaf5220d41ea686ac0df84743acfc1db31668a875 /src/xterm.c
parentc22e85715e47e371fda1af420f54e3840978b81f (diff)
downloademacs-2953d89d74ebfe6a6bcbe0d25a60a845acad0e13.tar.gz
Stop relying on Xt hack to set window manager hints
* src/widget.c (get_wm_shell): Return WMShellWidget. (update_wm_hints, widget_update_wm_size_hints): Return whether or not size hints changed. * src/widget.h: Delete `size_switch'. * src/widgetprv.h (EmacsFramePart): Likewise. * src/xterm.c (x_wm_set_size_hint): Set size hints the usual way if Xt did not set them. (bug#58412)
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 9c34fce7c5b..9059ad7136e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -28006,6 +28006,7 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
Window window = FRAME_OUTER_WINDOW (f);
#ifdef USE_X_TOOLKIT
WMShellWidget shell;
+ bool hints_changed;
#endif
if (!window)
@@ -28032,8 +28033,9 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
shell->wm.size_hints.flags |= USPosition;
}
- widget_update_wm_size_hints (f->output_data.x->widget,
- f->output_data.x->edit_widget);
+ hints_changed
+ = widget_update_wm_size_hints (f->output_data.x->widget,
+ f->output_data.x->edit_widget);
#ifdef USE_MOTIF
/* Do this all over again for the benefit of Motif, which always
@@ -28046,6 +28048,7 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
shell->wm.size_hints.flags &= ~PPosition;
shell->wm.size_hints.flags |= USPosition;
}
+#endif
/* Drill hints into Motif, since it keeps setting its own. */
size_hints.flags = shell->wm.size_hints.flags;
@@ -28063,15 +28066,23 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
size_hints.min_aspect.y = shell->wm.size_hints.min_aspect.y;
size_hints.max_aspect.x = shell->wm.size_hints.max_aspect.x;
size_hints.max_aspect.y = shell->wm.size_hints.max_aspect.y;
-#ifdef HAVE_X11XTR6
size_hints.base_width = shell->wm.base_width;
size_hints.base_height = shell->wm.base_height;
size_hints.win_gravity = shell->wm.win_gravity;
-#endif
+#ifdef USE_MOTIF
XSetWMNormalHints (XtDisplay (f->output_data.x->widget),
XtWindow (f->output_data.x->widget),
&size_hints);
+#else
+ /* In many cases, widget_update_wm_size_hints will not have
+ updated the size hints if only flags changed. When that
+ happens, set the WM hints manually. */
+
+ if (!hints_changed)
+ XSetWMNormalHints (XtDisplay (f->output_data.x->widget),
+ XtWindow (f->output_data.x->widget),
+ &size_hints);
#endif
return;