From bd8314d62bab55ef2cff3c24b35f3987be2dc6ad Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 11 Feb 1992 18:58:03 +0000 Subject: [PATCH] Primitives to set internal border width and font now update the window manager's "normal" hints, so that subsequent resizing works properly. --- v7/src/microcode/x11.h | 8 +++++++- v7/src/microcode/x11base.c | 9 ++++++--- v7/src/microcode/x11graph.c | 3 ++- v7/src/microcode/x11term.c | 14 +++++++++----- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/v7/src/microcode/x11.h b/v7/src/microcode/x11.h index c3ec8aee1..5e3f719fa 100644 --- a/v7/src/microcode/x11.h +++ b/v7/src/microcode/x11.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11.h,v 1.12 1992/02/10 21:09:03 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11.h,v 1.13 1992/02/11 18:57:46 cph Exp $ Copyright (c) 1989-92 Massachusetts Institute of Technology @@ -88,6 +88,7 @@ typedef void EXFUN ((*x_deallocator_t), (struct xwindow *)); typedef void EXFUN ((*x_event_processor_t), (struct xwindow *, XEvent *)); typedef SCHEME_OBJECT EXFUN ((*x_coordinate_map_t), (struct xwindow *, unsigned int)); +typedef void EXFUN ((*x_update_normal_hints_t), (struct xwindow *)); struct xwindow_methods { @@ -100,6 +101,10 @@ struct xwindow_methods /* Procedures to map coordinates to Scheme objects. */ x_coordinate_map_t x_coordinate_map; x_coordinate_map_t y_coordinate_map; + + /* Procedure that is called to inform the window manager of + adjustments to the window's internal border or font. */ + x_update_normal_hints_t update_normal_hints; }; struct xwindow @@ -165,6 +170,7 @@ struct xwindow #define XW_EVENT_PROCESSOR(xw) (((xw) -> methods) . event_processor) #define XW_X_COORDINATE_MAP(xw) (((xw) -> methods) . x_coordinate_map) #define XW_Y_COORDINATE_MAP(xw) (((xw) -> methods) . y_coordinate_map) +#define XW_UPDATE_NORMAL_HINTS(xw) (((xw) -> methods) . update_normal_hints) #define XW_EVENT_MASK(xw) ((xw) -> event_mask) #define XW_TO_OBJECT(xw) (LONG_TO_UNSIGNED_FIXNUM (XW_ALLOCATION_INDEX (xw))) diff --git a/v7/src/microcode/x11base.c b/v7/src/microcode/x11base.c index 544f943b6..1c19b6f41 100644 --- a/v7/src/microcode/x11base.c +++ b/v7/src/microcode/x11base.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.35 1992/02/10 21:29:27 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.36 1992/02/11 18:57:51 cph Exp $ Copyright (c) 1989-92 Massachusetts Institute of Technology @@ -1360,6 +1360,8 @@ DEFINE_PRIMITIVE ("X-WINDOW-SET-FONT", Prim_x_window_set_font, 2, 2, 0) XSetFont (display, (XW_REVERSE_GC (xw)), fid); XSetFont (display, (XW_CURSOR_GC (xw)), fid); } + if ((XW_UPDATE_NORMAL_HINTS (xw)) != 0) + (* (XW_UPDATE_NORMAL_HINTS (xw))) (xw); } PRIMITIVE_RETURN (SHARP_T); } @@ -1468,11 +1470,12 @@ DEFINE_PRIMITIVE ("X-WINDOW-SET-INTERNAL-BORDER-WIDTH", Prim_x_window_set_intern PRIMITIVE_HEADER (2); { struct xwindow * xw = (x_window_arg (1)); - Display * display = (XW_DISPLAY (xw)); unsigned int internal_border_width = (arg_nonnegative_integer (2)); (XW_INTERNAL_BORDER_WIDTH (xw)) = internal_border_width; + if ((XW_UPDATE_NORMAL_HINTS (xw)) != 0) + (* (XW_UPDATE_NORMAL_HINTS (xw))) (xw); XResizeWindow - (display, + ((XW_DISPLAY (xw)), (XW_WINDOW (xw)), ((XW_X_SIZE (xw)) + (2 * internal_border_width)), ((XW_Y_SIZE (xw)) + (2 * internal_border_width))); diff --git a/v7/src/microcode/x11graph.c b/v7/src/microcode/x11graph.c index 2699c1ad2..199565f9f 100644 --- a/v7/src/microcode/x11graph.c +++ b/v7/src/microcode/x11graph.c @@ -1,7 +1,7 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11graph.c,v 1.20 1992/02/10 21:10:14 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11graph.c,v 1.21 1992/02/11 18:57:58 cph Exp $ Copyright (c) 1989-92 Massachusetts Institute of Technology @@ -313,6 +313,7 @@ If third argument SUPPRESS-MAP? is true, do not map the window immediately.") (methods . event_processor) = process_event; (methods . x_coordinate_map) = x_coordinate_map; (methods . y_coordinate_map) = y_coordinate_map; + (methods . update_normal_hints) = 0; { unsigned int extra = (2 * (attributes . internal_border_width)); int x_pos = (-1); diff --git a/v7/src/microcode/x11term.c b/v7/src/microcode/x11term.c index 9cbfe8d4f..41b6ea484 100644 --- a/v7/src/microcode/x11term.c +++ b/v7/src/microcode/x11term.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11term.c,v 1.17 1992/02/10 21:09:52 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11term.c,v 1.18 1992/02/11 18:58:03 cph Exp $ Copyright (c) 1989-92 Massachusetts Institute of Technology @@ -186,6 +186,12 @@ DEFUN (xterm_set_wm_normal_hints, (xw, geometry_mask, x, y), XFree ((caddr_t) size_hints); } +static void +DEFUN (xterm_update_normal_hints, (xw), struct xwindow * xw) +{ + xterm_set_wm_normal_hints (xw, 0, 0, 0); +} + static void DEFUN (xterm_deallocate, (xw), struct xwindow * xw) { @@ -388,7 +394,7 @@ DEFUN (xterm_reconfigure, (xw, width, height), (XW_CHARACTER_MAP (xw))= new_char_map; (XW_HIGHLIGHT_MAP (xw))= new_hl_map; xterm_dump_contents (xw, 0, 0, x_csize, y_csize); - xterm_set_wm_normal_hints (xw, 0, 0, 0); + xterm_update_normal_hints (xw); XFlush (XW_DISPLAY (xw)); } } @@ -491,6 +497,7 @@ DEFINE_PRIMITIVE ("XTERM-OPEN-WINDOW", Prim_xterm_open_window, 3, 3, 0) (methods . event_processor) = xterm_process_event; (methods . x_coordinate_map) = xterm_x_coordinate_map; (methods . y_coordinate_map) = xterm_y_coordinate_map; + (methods . update_normal_hints) = xterm_update_normal_hints; { unsigned int extra = (2 * (attributes . internal_border_width)); int x_pos = (-1); @@ -577,9 +584,6 @@ DEFINE_PRIMITIVE ("XTERM-SET-SIZE", Prim_xterm_set_size, 3, 3, 0) xw = (x_window_arg (1)); extra = (2 * (XW_INTERNAL_BORDER_WIDTH (xw))); font = (XW_FONT (xw)); - /* Update the WM normal hints so they have the latest values for - font dimensions and internal border width. */ - xterm_set_wm_normal_hints (xw, 0, 0, 0); XResizeWindow ((XW_DISPLAY (xw)), (XW_WINDOW (xw)), -- 2.25.1