Primitives to set internal border width and font now update the window
authorChris Hanson <org/chris-hanson/cph>
Tue, 11 Feb 1992 18:58:03 +0000 (18:58 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 11 Feb 1992 18:58:03 +0000 (18:58 +0000)
manager's "normal" hints, so that subsequent resizing works properly.

v7/src/microcode/x11.h
v7/src/microcode/x11base.c
v7/src/microcode/x11graph.c
v7/src/microcode/x11term.c

index c3ec8aee1280419128f790f4cf0ed246e0b93f5c..5e3f719fac85fed3df059b18f0c1579b0957f8ab 100644 (file)
@@ -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;
 };
 \f
 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)))
index 544f943b61809756201f7933006c0fda059c4240..1c19b6f4189fb4e3ed81d71ee7ec3a240ce0ec47 100644 (file)
@@ -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)));
index 2699c1ad2c796b366949aa89c444c10b1f63e9ec..199565f9fc66f1aaa0689716c197b543342c5843 100644 (file)
@@ -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);
index 9cbfe8d4f5e04c886e09b27d394bc1e816cd05c1..41b6ea4843c0feb76dc65bba9137f3b382bf2aa5 100644 (file)
@@ -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)),