diff options
| author | Richard M. Stallman | 1994-04-30 00:15:20 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-30 00:15:20 +0000 |
| commit | af31d76fa0c8749ec23e553b2ad8842f81a3a4f4 (patch) | |
| tree | 76c8d9c8a7399222f0b966c04a1174a556b0ccf6 /src | |
| parent | 7989f0846613bf3dd8f2107e93e60875d6b2e8e3 (diff) | |
| download | emacs-af31d76fa0c8749ec23e553b2ad8842f81a3a4f4.tar.gz emacs-af31d76fa0c8749ec23e553b2ad8842f81a3a4f4.zip | |
(x_wm_set_size_hint): Always set PWinGravity.
Rename the args. Compute x and y fields from negative positions.
Use XGetWMNormalHints if X11R4 or newer.
(x_make_frame_visible): Call x_set_offset only if not USE_X_TOOLKIT.
(x_make_frame_invisible): Call x_wm_set_size_hint.
(x_set_offset): Pass 0 as 3rd arg to x_wm_set_size_hint.
(x_set_window_size): Likewise. Set win_gravity field here if nec.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/src/xterm.c b/src/xterm.c index 0faf469c128..ab040069763 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -261,7 +261,7 @@ static XRectangle last_mouse_glyph; | |||
| 261 | to Qnil, to tell XTmouse_position to return an ordinary motion event. */ | 261 | to Qnil, to tell XTmouse_position to return an ordinary motion event. */ |
| 262 | static Lisp_Object last_mouse_scroll_bar; | 262 | static Lisp_Object last_mouse_scroll_bar; |
| 263 | 263 | ||
| 264 | /* Record which buttons are currently pressed. */ | 264 | /* Record which buttons are currently pressed. */ |
| 265 | unsigned int x_mouse_grabbed; | 265 | unsigned int x_mouse_grabbed; |
| 266 | 266 | ||
| 267 | /* This is a hack. We would really prefer that XTmouse_position would | 267 | /* This is a hack. We would really prefer that XTmouse_position would |
| @@ -5182,7 +5182,7 @@ x_set_offset (f, xoff, yoff, change_gravity) | |||
| 5182 | if (change_gravity) | 5182 | if (change_gravity) |
| 5183 | f->display.x->win_gravity = NorthWestGravity; | 5183 | f->display.x->win_gravity = NorthWestGravity; |
| 5184 | 5184 | ||
| 5185 | x_wm_set_size_hint (f, 0, 1); | 5185 | x_wm_set_size_hint (f, 0, 0); |
| 5186 | #endif /* ! defined (HAVE_X11) */ | 5186 | #endif /* ! defined (HAVE_X11) */ |
| 5187 | UNBLOCK_INPUT; | 5187 | UNBLOCK_INPUT; |
| 5188 | } | 5188 | } |
| @@ -5218,7 +5218,8 @@ x_set_window_size (f, change_gravity, cols, rows) | |||
| 5218 | pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); | 5218 | pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); |
| 5219 | 5219 | ||
| 5220 | #ifdef HAVE_X11 | 5220 | #ifdef HAVE_X11 |
| 5221 | x_wm_set_size_hint (f, 0, change_gravity); | 5221 | f->display.x->win_gravity = NorthWestGravity; |
| 5222 | x_wm_set_size_hint (f, 0, 0); | ||
| 5222 | #endif /* ! defined (HAVE_X11) */ | 5223 | #endif /* ! defined (HAVE_X11) */ |
| 5223 | XSync (x_current_display, False); | 5224 | XSync (x_current_display, False); |
| 5224 | XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight); | 5225 | XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight); |
| @@ -5386,7 +5387,9 @@ x_make_frame_visible (f) | |||
| 5386 | if (! FRAME_VISIBLE_P (f)) | 5387 | if (! FRAME_VISIBLE_P (f)) |
| 5387 | { | 5388 | { |
| 5388 | #ifdef HAVE_X11 | 5389 | #ifdef HAVE_X11 |
| 5390 | #ifndef USE_X_TOOLKIT | ||
| 5389 | x_set_offset (f, f->display.x->left_pos, f->display.x->top_pos, 0); | 5391 | x_set_offset (f, f->display.x->left_pos, f->display.x->top_pos, 0); |
| 5392 | #endif | ||
| 5390 | 5393 | ||
| 5391 | if (! EQ (Vx_no_window_manager, Qt)) | 5394 | if (! EQ (Vx_no_window_manager, Qt)) |
| 5392 | x_wm_set_window_state (f, NormalState); | 5395 | x_wm_set_window_state (f, NormalState); |
| @@ -5439,6 +5442,13 @@ x_make_frame_invisible (f) | |||
| 5439 | 5442 | ||
| 5440 | BLOCK_INPUT; | 5443 | BLOCK_INPUT; |
| 5441 | 5444 | ||
| 5445 | /* Before unmapping the window, update the WM_SIZE_HINTS property to claim | ||
| 5446 | that the current position of the window is user-specified, rather than | ||
| 5447 | program-specified, so that when the window is mapped again, it will be | ||
| 5448 | placed at the same location, without forcing the user to position it | ||
| 5449 | by hand again (they have already done that once for this window.) */ | ||
| 5450 | x_wm_set_size_hint (f, 0, 1); | ||
| 5451 | |||
| 5442 | #ifdef HAVE_X11R4 | 5452 | #ifdef HAVE_X11R4 |
| 5443 | 5453 | ||
| 5444 | #ifdef USE_X_TOOLKIT | 5454 | #ifdef USE_X_TOOLKIT |
| @@ -5713,14 +5723,16 @@ mouse_event_pending_p () | |||
| 5713 | 5723 | ||
| 5714 | #ifdef HAVE_X11 | 5724 | #ifdef HAVE_X11 |
| 5715 | 5725 | ||
| 5716 | /* SPEC_X and SPEC_Y are the specified positions. | 5726 | /* Set the normal size hints for the window manager, for frame F. |
| 5717 | We look only at their sign, to decide the gravity. | 5727 | FLAGS is the flags word to use--or 0 meaning preserve the flags |
| 5718 | If CHANGE_GRAVITY is 0, we may set PWinGravity. */ | 5728 | that the window now has. |
| 5729 | If USER_POSITION is nonzero, we set the USPosition | ||
| 5730 | flag (this is useful when FLAGS is 0). */ | ||
| 5719 | 5731 | ||
| 5720 | x_wm_set_size_hint (f, prompting, change_gravity) | 5732 | x_wm_set_size_hint (f, flags, user_position) |
| 5721 | struct frame *f; | 5733 | struct frame *f; |
| 5722 | long prompting; | 5734 | long flags; |
| 5723 | int change_gravity; | 5735 | int user_position; |
| 5724 | { | 5736 | { |
| 5725 | XSizeHints size_hints; | 5737 | XSizeHints size_hints; |
| 5726 | 5738 | ||
| @@ -5741,6 +5753,19 @@ x_wm_set_size_hint (f, prompting, change_gravity) | |||
| 5741 | size_hints.x = f->display.x->left_pos; | 5753 | size_hints.x = f->display.x->left_pos; |
| 5742 | size_hints.y = f->display.x->top_pos; | 5754 | size_hints.y = f->display.x->top_pos; |
| 5743 | 5755 | ||
| 5756 | /* Treat negative positions as relative to the leftmost bottommost | ||
| 5757 | position that fits on the screen. */ | ||
| 5758 | if (flags & XNegative) | ||
| 5759 | size_hints.x = (x_screen_width | ||
| 5760 | - 2 * f->display.x->border_width | ||
| 5761 | - PIXEL_WIDTH (f) | ||
| 5762 | + f->display.x->left_pos); | ||
| 5763 | if (flags & YNegative) | ||
| 5764 | size_hints.y = (x_screen_height | ||
| 5765 | - 2 * f->display.x->border_width | ||
| 5766 | - PIXEL_HEIGHT (f) | ||
| 5767 | + f->display.x->top_pos); | ||
| 5768 | |||
| 5744 | #ifdef USE_X_TOOLKIT | 5769 | #ifdef USE_X_TOOLKIT |
| 5745 | XtSetArg (al[ac], XtNwidth, &widget_width); ac++; | 5770 | XtSetArg (al[ac], XtNwidth, &widget_width); ac++; |
| 5746 | XtSetArg (al[ac], XtNheight, &widget_height); ac++; | 5771 | XtSetArg (al[ac], XtNheight, &widget_height); ac++; |
| @@ -5788,13 +5813,22 @@ x_wm_set_size_hint (f, prompting, change_gravity) | |||
| 5788 | #endif | 5813 | #endif |
| 5789 | } | 5814 | } |
| 5790 | 5815 | ||
| 5791 | if (prompting) | 5816 | if (flags) |
| 5792 | size_hints.flags |= prompting; | 5817 | size_hints.flags |= flags; |
| 5793 | else | 5818 | else |
| 5794 | { | 5819 | { |
| 5795 | XSizeHints hints; /* Sometimes I hate X Windows... */ | 5820 | XSizeHints hints; /* Sometimes I hate X Windows... */ |
| 5821 | long supplied_return; | ||
| 5822 | int value; | ||
| 5823 | |||
| 5824 | #ifdef HAVE_X11R4 | ||
| 5825 | value = XGetWMNormalHints (x_current_display, window, &hints, | ||
| 5826 | &supplied_return); | ||
| 5827 | #else | ||
| 5828 | value = XGetNormalHints (x_current_display, window, &hints); | ||
| 5829 | #endif | ||
| 5796 | 5830 | ||
| 5797 | if (XGetNormalHints (x_current_display, window, &hints) == 0) | 5831 | if (value == 0) |
| 5798 | hints.flags = 0; | 5832 | hints.flags = 0; |
| 5799 | if (hints.flags & PSize) | 5833 | if (hints.flags & PSize) |
| 5800 | size_hints.flags |= PSize; | 5834 | size_hints.flags |= PSize; |
| @@ -5806,13 +5840,14 @@ x_wm_set_size_hint (f, prompting, change_gravity) | |||
| 5806 | size_hints.flags |= USSize; | 5840 | size_hints.flags |= USSize; |
| 5807 | } | 5841 | } |
| 5808 | 5842 | ||
| 5809 | #if defined (PWinGravity) | 5843 | #ifdef PWinGravity |
| 5810 | size_hints.win_gravity = f->display.x->win_gravity; | 5844 | size_hints.win_gravity = f->display.x->win_gravity; |
| 5845 | size_hints.flags |= PWinGravity; | ||
| 5811 | 5846 | ||
| 5812 | if (change_gravity) | 5847 | if (user_position) |
| 5813 | { | 5848 | { |
| 5814 | if (! (size_hints.flags & USPosition)) | 5849 | size_hints.flags &= ~ PPosition; |
| 5815 | size_hints.flags |= PWinGravity; | 5850 | size_hints.flags |= USPosition; |
| 5816 | } | 5851 | } |
| 5817 | #endif /* PWinGravity */ | 5852 | #endif /* PWinGravity */ |
| 5818 | 5853 | ||