Mercurial > emacs
changeset 4630:70247ce8b381
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 14 Aug 1993 11:00:54 +0000 |
parents | f7128c7ea732 |
children | fc781d29fd48 |
files | src/xterm.c |
diffstat | 1 files changed, 56 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xterm.c Sat Aug 14 10:59:10 1993 +0000 +++ b/src/xterm.c Sat Aug 14 11:00:54 1993 +0000 @@ -2936,7 +2936,7 @@ if (f != 0) { KeySym keysym, orig_keysym; - char copy_buffer[80]; + unsigned char copy_buffer[80]; int modifiers; event.xkey.state @@ -4166,17 +4166,42 @@ struct frame *f; { #ifdef HAVE_X11 + Window win, child; + int win_x = 0, win_y = 0; + + /* Find the position of the outside upper-left corner of + the inner window, with respect to the outer window. */ + if (f->display.x->parent_desc != ROOT_WINDOW) + { + BLOCK_INPUT; + XTranslateCoordinates (x_current_display, + + /* From-window, to-window. */ + f->display.x->window_desc, + f->display.x->parent_desc, + + /* From-position, to-position. */ + 0, 0, &win_x, &win_y, + + /* Child of win. */ + &child); + UNBLOCK_INPUT; + } + + /* Treat negative positions as relative to the leftmost bottommost + position that fits on the screen. */ if (f->display.x->left_pos < 0) f->display.x->left_pos = (x_screen_width - - 2 * f->display.x->border_width + - f->display.x->border_width - win_x - PIXEL_WIDTH (f) + f->display.x->left_pos); if (f->display.x->top_pos < 0) f->display.x->top_pos = (x_screen_height - - 2 * f->display.x->border_width + - f->display.x->border_width - win_y - PIXEL_HEIGHT (f) + f->display.x->top_pos); + #else /* ! defined (HAVE_X11) */ WINDOWINFO_TYPE parentinfo; @@ -4204,7 +4229,7 @@ XMoveWindow (XDISPLAY FRAME_X_WINDOW (f), f->display.x->left_pos, f->display.x->top_pos); #ifdef HAVE_X11 - x_wm_set_size_hint (f, 0); + x_wm_set_size_hint (f, 0, xoff, yoff); #endif /* ! defined (HAVE_X11) */ UNBLOCK_INPUT; } @@ -4221,15 +4246,15 @@ BLOCK_INPUT; check_frame_size (f, &rows, &cols); - f->display.x->vertical_scroll_bar_extra = - (FRAME_HAS_VERTICAL_SCROLL_BARS (f) - ? VERTICAL_SCROLL_BAR_PIXEL_WIDTH (f) - : 0); + f->display.x->vertical_scroll_bar_extra + = (FRAME_HAS_VERTICAL_SCROLL_BARS (f) + ? VERTICAL_SCROLL_BAR_PIXEL_WIDTH (f) + : 0); pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); #ifdef HAVE_X11 - x_wm_set_size_hint (f, 0); + x_wm_set_size_hint (f, 0, 0, 0); #endif /* ! defined (HAVE_X11) */ XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight); @@ -4634,9 +4659,13 @@ #ifdef HAVE_X11 -x_wm_set_size_hint (f, prompting) +/* SPEC_X and SPEC_Y are the specified positions. + We look only at their sign, to decide the gravity. */ + +x_wm_set_size_hint (f, prompting, spec_x, spec_y) struct frame *f; long prompting; + int spec_x, spec_y; { XSizeHints size_hints; Window window = FRAME_X_WINDOW (f); @@ -4707,6 +4736,23 @@ size_hints.flags |= USSize; } + switch (((spec_x < 0) << 1) + (spec_y < 0)) + { + case 0: + size_hints.win_gravity = NorthWestGravity; + break; + case 1: + size_hints.win_gravity = SouthWestGravity; + break; + case 2: + size_hints.win_gravity = NorthEastGravity; + break; + case 3: + size_hints.win_gravity = SouthEastGravity; + break; + } + size_hints.flags |= PWinGravity; + #ifdef HAVE_X11R4 XSetWMNormalHints (x_current_display, window, &size_hints); #else