Use resource arguments to window creation primitives for looking up
authorChris Hanson <org/chris-hanson/cph>
Mon, 10 Feb 1992 21:10:14 +0000 (21:10 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 10 Feb 1992 21:10:14 +0000 (21:10 +0000)
defaults as well as for setting the class hint.

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

index 85b3ba86cc57d986a7f609e87552baf559bbe773..c3ec8aee1280419128f790f4cf0ed246e0b93f5c 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11.h,v 1.11 1992/02/08 14:54:21 cph Exp $
+$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 $
 
 Copyright (c) 1989-92 Massachusetts Institute of Technology
 
@@ -233,17 +233,17 @@ extern PTR EXFUN (x_realloc, (PTR ptr, unsigned int size));
 extern char * EXFUN
   (x_get_default,
    (Display * display,
-    char * resource_name,
-    char * resource_class,
-    char * property_name,
-    char * property_class,
+    CONST char * resource_name,
+    CONST char * resource_class,
+    CONST char * property_name,
+    CONST char * property_class,
     char * sdefault));
 
 extern void EXFUN
   (x_default_attributes,
    (Display * display,
-    char * resource_name,
-    char * resource_class,
+    CONST char * resource_name,
+    CONST char * resource_class,
     struct drawing_attributes * attributes));
 
 extern struct xwindow * EXFUN
@@ -265,9 +265,16 @@ extern void EXFUN
 extern void EXFUN
   (xw_set_wm_icon_name, (struct xwindow * xw, CONST char * name));
 
+extern void EXFUN
+  (x_decode_window_map_arg,
+   (SCHEME_OBJECT map_arg,
+    CONST char ** resource_class,
+    CONST char ** resource_name,
+    int * map_p));
+
 extern void EXFUN
   (xw_make_window_map,
    (struct xwindow * xw,
     CONST char * resource_name,
     CONST char * resource_class,
-    SCHEME_OBJECT map_arg));
+    int map_p));
index e183d0dd1c292bc6af309be09b998876faffa22c..c4446de334bc5690f1674424231d626c68f69f5d 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.33 1992/02/09 03:48:11 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.34 1992/02/10 21:09:31 cph Exp $
 
 Copyright (c) 1989-92 Massachusetts Institute of Technology
 
@@ -251,10 +251,10 @@ DEFUN (x_get_default,
        (display, resource_name, resource_class,
        property_name, property_class, sdefault),
        Display * display AND
-       char * resource_name AND
-       char * resource_class AND
-       char * property_name AND
-       char * property_class AND
+       CONST char * resource_name AND
+       CONST char * resource_class AND
+       CONST char * property_name AND
+       CONST char * property_class AND
        char * sdefault)
 {
   char * result = (XGetDefault (display, resource_name, property_name));
@@ -277,10 +277,10 @@ DEFUN (x_default_color,
        (display, resource_class, resource_name,
        property_name, property_class, default_color),
        Display * display AND
-       char * resource_name AND
-       char * resource_class AND
-       char * property_name AND
-       char * property_class AND
+       CONST char * resource_name AND
+       CONST char * resource_class AND
+       CONST char * property_name AND
+       CONST char * property_class AND
        unsigned long default_color)
 {
   char * color_name =
@@ -303,8 +303,8 @@ void
 DEFUN (x_default_attributes, 
        (display, resource_name, resource_class, attributes),
        Display * display AND
-       char * resource_name AND
-       char * resource_class AND
+       CONST char * resource_name AND
+       CONST char * resource_class AND
        struct drawing_attributes * attributes)
 {
   int screen_number = (DefaultScreen (display));
@@ -532,23 +532,32 @@ DEFUN (xw_set_wm_icon_name, (xw, name),
 }
 
 void
-DEFUN (xw_make_window_map, (xw, resource_name, resource_class, map_arg),
-       struct xwindow * xw AND
-       CONST char * resource_name AND
-       CONST char * resource_class AND
-       SCHEME_OBJECT map_arg)
+DEFUN (x_decode_window_map_arg, (map_arg, resource_name, resource_class),
+       SCHEME_OBJECT map_arg AND
+       CONST char ** resource_name AND
+       CONST char ** resource_class AND
+       int * map_p)
 {
-  int map_p = 0;
+  (*map_p) = 0;
   if (map_arg == SHARP_F)
-    map_p = 1;
+    (*map_p) = 1;
   else if ((PAIR_P (map_arg))
           && (STRING_P (PAIR_CAR (map_arg)))
           && (STRING_P (PAIR_CDR (map_arg))))
     {
-      resource_class = ((CONST char *) (STRING_LOC ((PAIR_CDR (map_arg)), 0)));
-      resource_name = ((CONST char *) (STRING_LOC ((PAIR_CAR (map_arg)), 0)));
-      map_p = 1;
+      (*resource_name) = ((CONST char *) (STRING_LOC ((PAIR_CAR (map_arg)), 0)));
+      (*resource_class) = ((CONST char *) (STRING_LOC ((PAIR_CDR (map_arg)), 0)));
+      (*map_p) = 1;
     }
+}
+
+void
+DEFUN (xw_make_window_map, (xw, resource_name, resource_class, map_p),
+       struct xwindow * xw AND
+       CONST char * resource_name AND
+       CONST char * resource_class AND
+       int map_p)
+{
   xw_set_class_hint (xw, resource_name, resource_class);
   if (map_p)
     {
index af771516c03f45ca99236c9ad3ab73350642d12c..2699c1ad2c796b366949aa89c444c10b1f63e9ec 100644 (file)
@@ -1,7 +1,7 @@
 
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11graph.c,v 1.19 1992/02/08 14:54:24 cph Exp $
+$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 $
 
 Copyright (c) 1989-92 Massachusetts Institute of Technology
 
@@ -298,8 +298,14 @@ If third argument SUPPRESS-MAP? is true, do not map the window immediately.")
     struct drawing_attributes attributes;
     struct xwindow_methods methods;
     XSetWindowAttributes wattributes;
+    CONST char * resource_name;
+    CONST char * resource_class;
+    int map_p;
+
+    x_decode_window_map_arg
+      ((ARG_REF (3)), (&resource_name), (&resource_class), (&map_p));
     x_default_attributes
-      (display, RESOURCE_NAME, RESOURCE_CLASS, (&attributes));
+      (display, resource_name, resource_class, (&attributes));
     (wattributes . background_pixel) = (attributes . background_pixel);
     (wattributes . border_pixel) = (attributes . border_pixel);
     (wattributes . backing_store) = Always;
@@ -317,7 +323,7 @@ If third argument SUPPRESS-MAP? is true, do not map the window immediately.")
        (XGeometry (display, (DefaultScreen (display)),
                    (((ARG_REF (2)) == SHARP_F)
                     ? (x_get_default
-                       (display, RESOURCE_NAME, RESOURCE_CLASS,
+                       (display, resource_name, resource_class,
                         "geometry", "Geometry", 0))
                     : (STRING_ARG (2))),
                    DEFAULT_GEOMETRY, (attributes . border_width),
@@ -350,7 +356,7 @@ If third argument SUPPRESS-MAP? is true, do not map the window immediately.")
        xw_set_wm_name (xw, "scheme-graphics");
        xw_set_wm_icon_name (xw, "scheme-graphics");
        XSelectInput (display, window, StructureNotifyMask);
-       xw_make_window_map (xw, RESOURCE_NAME, RESOURCE_CLASS, (ARG_REF (3)));
+       xw_make_window_map (xw, resource_name, resource_class, map_p);
        PRIMITIVE_RETURN (XW_TO_OBJECT (xw));
       }
     }
index 7fa00af9a9545f207b7ef601d9956d00b9f38f20..9cbfe8d4f5e04c886e09b27d394bc1e816cd05c1 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11term.c,v 1.16 1992/02/08 14:54:26 cph Exp $
+$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 $
 
 Copyright (c) 1989-92 Massachusetts Institute of Technology
 
@@ -479,8 +479,14 @@ DEFINE_PRIMITIVE ("XTERM-OPEN-WINDOW", Prim_xterm_open_window, 3, 3, 0)
     Display * display = (XD_DISPLAY (xd));
     struct drawing_attributes attributes;
     struct xwindow_methods methods;
+    CONST char * resource_name;
+    CONST char * resource_class;
+    int map_p;
+    
+    x_decode_window_map_arg
+      ((ARG_REF (3)), (&resource_name), (&resource_class), (&map_p));
     x_default_attributes
-      (display, RESOURCE_NAME, RESOURCE_CLASS, (&attributes));
+      (display, resource_name, resource_class, (&attributes));
     (methods . deallocator) = xterm_deallocate;
     (methods . event_processor) = xterm_process_event;
     (methods . x_coordinate_map) = xterm_x_coordinate_map;
@@ -496,7 +502,7 @@ DEFINE_PRIMITIVE ("XTERM-OPEN-WINDOW", Prim_xterm_open_window, 3, 3, 0)
         (display, (DefaultScreen (display)),
          (((ARG_REF (2)) == SHARP_F)
           ? (x_get_default
-             (display, RESOURCE_NAME, RESOURCE_CLASS,
+             (display, resource_name, resource_class,
               "geometry", "Geometry", 0))
           : (STRING_ARG (2))),
          DEFAULT_GEOMETRY, (attributes . border_width),
@@ -543,7 +549,7 @@ DEFINE_PRIMITIVE ("XTERM-OPEN-WINDOW", Prim_xterm_open_window, 3, 3, 0)
        xw_set_wm_input_hint (xw, 1);
        xw_set_wm_name (xw, "scheme-terminal");
        xw_set_wm_icon_name (xw, "scheme-terminal");
-       xw_make_window_map (xw, RESOURCE_NAME, RESOURCE_CLASS, (ARG_REF (3)));
+       xw_make_window_map (xw, resource_name, resource_class, map_p);
        PRIMITIVE_RETURN (XW_TO_OBJECT (xw));
       }
     }