aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-08-14 11:00:54 +0000
committerRichard M. Stallman1993-08-14 11:00:54 +0000
commit6dba18584c174f450cb16e6c9ff3843d99fbc8d9 (patch)
treef470ca3fb8999eadef562f202f84f39a6021e8e8 /src
parent8014cc0367ddc57c8491d3888014f4acaee3d24b (diff)
downloademacs-6dba18584c174f450cb16e6c9ff3843d99fbc8d9.tar.gz
emacs-6dba18584c174f450cb16e6c9ff3843d99fbc8d9.zip
(x_wm_set_size_hint): New args spec_x and spec_y.
Set the window gravity. All callers changed. (XTread_socket): Make copy_buffer unsigned. (x_calc_absolute_position): For negative coords, take account of added width from window manager's outer window.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c66
1 files changed, 56 insertions, 10 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 30f34032d9b..c6fd73c13b0 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2936,7 +2936,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
2936 if (f != 0) 2936 if (f != 0)
2937 { 2937 {
2938 KeySym keysym, orig_keysym; 2938 KeySym keysym, orig_keysym;
2939 char copy_buffer[80]; 2939 unsigned char copy_buffer[80];
2940 int modifiers; 2940 int modifiers;
2941 2941
2942 event.xkey.state 2942 event.xkey.state
@@ -4166,17 +4166,42 @@ x_calc_absolute_position (f)
4166 struct frame *f; 4166 struct frame *f;
4167{ 4167{
4168#ifdef HAVE_X11 4168#ifdef HAVE_X11
4169 Window win, child;
4170 int win_x = 0, win_y = 0;
4171
4172 /* Find the position of the outside upper-left corner of
4173 the inner window, with respect to the outer window. */
4174 if (f->display.x->parent_desc != ROOT_WINDOW)
4175 {
4176 BLOCK_INPUT;
4177 XTranslateCoordinates (x_current_display,
4178
4179 /* From-window, to-window. */
4180 f->display.x->window_desc,
4181 f->display.x->parent_desc,
4182
4183 /* From-position, to-position. */
4184 0, 0, &win_x, &win_y,
4185
4186 /* Child of win. */
4187 &child);
4188 UNBLOCK_INPUT;
4189 }
4190
4191 /* Treat negative positions as relative to the leftmost bottommost
4192 position that fits on the screen. */
4169 if (f->display.x->left_pos < 0) 4193 if (f->display.x->left_pos < 0)
4170 f->display.x->left_pos = (x_screen_width 4194 f->display.x->left_pos = (x_screen_width
4171 - 2 * f->display.x->border_width 4195 - f->display.x->border_width - win_x
4172 - PIXEL_WIDTH (f) 4196 - PIXEL_WIDTH (f)
4173 + f->display.x->left_pos); 4197 + f->display.x->left_pos);
4174 4198
4175 if (f->display.x->top_pos < 0) 4199 if (f->display.x->top_pos < 0)
4176 f->display.x->top_pos = (x_screen_height 4200 f->display.x->top_pos = (x_screen_height
4177 - 2 * f->display.x->border_width 4201 - f->display.x->border_width - win_y
4178 - PIXEL_HEIGHT (f) 4202 - PIXEL_HEIGHT (f)
4179 + f->display.x->top_pos); 4203 + f->display.x->top_pos);
4204
4180#else /* ! defined (HAVE_X11) */ 4205#else /* ! defined (HAVE_X11) */
4181 WINDOWINFO_TYPE parentinfo; 4206 WINDOWINFO_TYPE parentinfo;
4182 4207
@@ -4204,7 +4229,7 @@ x_set_offset (f, xoff, yoff)
4204 XMoveWindow (XDISPLAY FRAME_X_WINDOW (f), 4229 XMoveWindow (XDISPLAY FRAME_X_WINDOW (f),
4205 f->display.x->left_pos, f->display.x->top_pos); 4230 f->display.x->left_pos, f->display.x->top_pos);
4206#ifdef HAVE_X11 4231#ifdef HAVE_X11
4207 x_wm_set_size_hint (f, 0); 4232 x_wm_set_size_hint (f, 0, xoff, yoff);
4208#endif /* ! defined (HAVE_X11) */ 4233#endif /* ! defined (HAVE_X11) */
4209 UNBLOCK_INPUT; 4234 UNBLOCK_INPUT;
4210} 4235}
@@ -4221,15 +4246,15 @@ x_set_window_size (f, cols, rows)
4221 BLOCK_INPUT; 4246 BLOCK_INPUT;
4222 4247
4223 check_frame_size (f, &rows, &cols); 4248 check_frame_size (f, &rows, &cols);
4224 f->display.x->vertical_scroll_bar_extra = 4249 f->display.x->vertical_scroll_bar_extra
4225 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) 4250 = (FRAME_HAS_VERTICAL_SCROLL_BARS (f)
4226 ? VERTICAL_SCROLL_BAR_PIXEL_WIDTH (f) 4251 ? VERTICAL_SCROLL_BAR_PIXEL_WIDTH (f)
4227 : 0); 4252 : 0);
4228 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); 4253 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);
4229 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); 4254 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows);
4230 4255
4231#ifdef HAVE_X11 4256#ifdef HAVE_X11
4232 x_wm_set_size_hint (f, 0); 4257 x_wm_set_size_hint (f, 0, 0, 0);
4233#endif /* ! defined (HAVE_X11) */ 4258#endif /* ! defined (HAVE_X11) */
4234 XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight); 4259 XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight);
4235 4260
@@ -4634,9 +4659,13 @@ mouse_event_pending_p ()
4634 4659
4635#ifdef HAVE_X11 4660#ifdef HAVE_X11
4636 4661
4637x_wm_set_size_hint (f, prompting) 4662/* SPEC_X and SPEC_Y are the specified positions.
4663 We look only at their sign, to decide the gravity. */
4664
4665x_wm_set_size_hint (f, prompting, spec_x, spec_y)
4638 struct frame *f; 4666 struct frame *f;
4639 long prompting; 4667 long prompting;
4668 int spec_x, spec_y;
4640{ 4669{
4641 XSizeHints size_hints; 4670 XSizeHints size_hints;
4642 Window window = FRAME_X_WINDOW (f); 4671 Window window = FRAME_X_WINDOW (f);
@@ -4707,6 +4736,23 @@ x_wm_set_size_hint (f, prompting)
4707 size_hints.flags |= USSize; 4736 size_hints.flags |= USSize;
4708 } 4737 }
4709 4738
4739 switch (((spec_x < 0) << 1) + (spec_y < 0))
4740 {
4741 case 0:
4742 size_hints.win_gravity = NorthWestGravity;
4743 break;
4744 case 1:
4745 size_hints.win_gravity = SouthWestGravity;
4746 break;
4747 case 2:
4748 size_hints.win_gravity = NorthEastGravity;
4749 break;
4750 case 3:
4751 size_hints.win_gravity = SouthEastGravity;
4752 break;
4753 }
4754 size_hints.flags |= PWinGravity;
4755
4710#ifdef HAVE_X11R4 4756#ifdef HAVE_X11R4
4711 XSetWMNormalHints (x_current_display, window, &size_hints); 4757 XSetWMNormalHints (x_current_display, window, &size_hints);
4712#else 4758#else