diff options
| author | Po Lu | 2022-03-14 21:37:42 +0800 |
|---|---|---|
| committer | Po Lu | 2022-03-14 21:40:38 +0800 |
| commit | b72dd3d0c59d4174a779b97e310b8d2029d0736a (patch) | |
| tree | b2a481333c931553fee0aca2a77c14d0056294ae /src | |
| parent | 5d33f815422e8203297779c6ebedfff922e4ffc7 (diff) | |
| download | emacs-b72dd3d0c59d4174a779b97e310b8d2029d0736a.tar.gz emacs-b72dd3d0c59d4174a779b97e310b8d2029d0736a.zip | |
Handle position specification hints on X toolkit builds
* src/xterm.c (x_wm_set_size_hint): Set PPosition and USPosition
independently of Xt.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c index 06cb9332095..71c0bd3dcd5 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -578,6 +578,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 578 | 578 | ||
| 579 | #ifdef USE_X_TOOLKIT | 579 | #ifdef USE_X_TOOLKIT |
| 580 | #include <X11/Shell.h> | 580 | #include <X11/Shell.h> |
| 581 | #include <X11/ShellP.h> | ||
| 581 | #endif | 582 | #endif |
| 582 | 583 | ||
| 583 | #include <unistd.h> | 584 | #include <unistd.h> |
| @@ -16762,6 +16763,9 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position) | |||
| 16762 | { | 16763 | { |
| 16763 | XSizeHints size_hints; | 16764 | XSizeHints size_hints; |
| 16764 | Window window = FRAME_OUTER_WINDOW (f); | 16765 | Window window = FRAME_OUTER_WINDOW (f); |
| 16766 | #ifdef USE_X_TOOLKIT | ||
| 16767 | WMShellWidget shell; | ||
| 16768 | #endif | ||
| 16765 | 16769 | ||
| 16766 | if (!window) | 16770 | if (!window) |
| 16767 | return; | 16771 | return; |
| @@ -16769,8 +16773,63 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position) | |||
| 16769 | #ifdef USE_X_TOOLKIT | 16773 | #ifdef USE_X_TOOLKIT |
| 16770 | if (f->output_data.x->widget) | 16774 | if (f->output_data.x->widget) |
| 16771 | { | 16775 | { |
| 16776 | /* Do this dance in xterm.c because some stuff is not as easily | ||
| 16777 | available in widget.c. */ | ||
| 16778 | |||
| 16779 | eassert (XtIsWMShell (f->output_data.x->widget)); | ||
| 16780 | shell = (WMShellWidget) f->output_data.x->widget; | ||
| 16781 | |||
| 16782 | shell->wm.size_hints.flags &= ~(PPosition | USPosition); | ||
| 16783 | shell->wm.size_hints.flags |= flags & (PPosition | USPosition); | ||
| 16784 | |||
| 16785 | if (user_position) | ||
| 16786 | { | ||
| 16787 | shell->wm.size_hints.flags &= ~PPosition; | ||
| 16788 | shell->wm.size_hints.flags |= USPosition; | ||
| 16789 | } | ||
| 16790 | |||
| 16772 | widget_update_wm_size_hints (f->output_data.x->widget, | 16791 | widget_update_wm_size_hints (f->output_data.x->widget, |
| 16773 | f->output_data.x->edit_widget); | 16792 | f->output_data.x->edit_widget); |
| 16793 | |||
| 16794 | #ifdef USE_MOTIF | ||
| 16795 | /* Do this all over again for the benefit of Motif, which always | ||
| 16796 | knows better than the programmer. */ | ||
| 16797 | shell->wm.size_hints.flags &= ~(PPosition | USPosition); | ||
| 16798 | shell->wm.size_hints.flags |= flags & (PPosition | USPosition); | ||
| 16799 | |||
| 16800 | if (user_position) | ||
| 16801 | { | ||
| 16802 | shell->wm.size_hints.flags &= ~PPosition; | ||
| 16803 | shell->wm.size_hints.flags |= USPosition; | ||
| 16804 | } | ||
| 16805 | |||
| 16806 | /* Drill hints into Motif, since it keeps setting its own. */ | ||
| 16807 | size_hints.flags = shell->wm.size_hints.flags; | ||
| 16808 | size_hints.x = shell->wm.size_hints.x; | ||
| 16809 | size_hints.y = shell->wm.size_hints.y; | ||
| 16810 | size_hints.width = shell->wm.size_hints.width; | ||
| 16811 | size_hints.height = shell->wm.size_hints.height; | ||
| 16812 | size_hints.min_width = shell->wm.size_hints.min_width; | ||
| 16813 | size_hints.min_height = shell->wm.size_hints.min_height; | ||
| 16814 | size_hints.max_width = shell->wm.size_hints.max_width; | ||
| 16815 | size_hints.max_height = shell->wm.size_hints.max_height; | ||
| 16816 | size_hints.width_inc = shell->wm.size_hints.width_inc; | ||
| 16817 | size_hints.height_inc = shell->wm.size_hints.height_inc; | ||
| 16818 | size_hints.min_aspect.x = shell->wm.size_hints.min_aspect.x; | ||
| 16819 | size_hints.min_aspect.y = shell->wm.size_hints.min_aspect.y; | ||
| 16820 | size_hints.max_aspect.x = shell->wm.size_hints.max_aspect.x; | ||
| 16821 | size_hints.max_aspect.y = shell->wm.size_hints.max_aspect.y; | ||
| 16822 | #ifdef HAVE_X11XTR6 | ||
| 16823 | size_hints.base_width = shell->wm.base_width; | ||
| 16824 | size_hints.base_height = shell->wm.base_height; | ||
| 16825 | size_hints.win_gravity = shell->wm.win_gravity; | ||
| 16826 | #endif | ||
| 16827 | |||
| 16828 | XSetWMNormalHints (XtDisplay (f->output_data.x->widget), | ||
| 16829 | XtWindow (f->output_data.x->widget), | ||
| 16830 | &size_hints); | ||
| 16831 | #endif | ||
| 16832 | |||
| 16774 | return; | 16833 | return; |
| 16775 | } | 16834 | } |
| 16776 | #endif | 16835 | #endif |