Add support for setting the resource class and name of X windows.
authorArthur Gleckler <edu/mit/csail/zurich/arthur>
Wed, 24 Jul 1991 19:43:22 +0000 (19:43 +0000)
committerArthur Gleckler <edu/mit/csail/zurich/arthur>
Wed, 24 Jul 1991 19:43:22 +0000 (19:43 +0000)
v7/src/microcode/version.h
v7/src/microcode/x11graph.c
v8/src/microcode/version.h

index 2c42a268c7abd3ec7b17d296d5b337a686bbe162..a9bd7b8b0f69b9c155cf150c0bcba4bf6dbeddd1 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.89 1991/07/23 08:18:07 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.90 1991/07/24 19:43:22 arthur Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
 
@@ -46,5 +46,5 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     89
+#define SUBVERSION     90
 #endif
index 783f5aecf7afd48abf69f294a2b5b9a388c5a84d..4af0af73f0b101bad4f6c95dcbf341c53a97e392 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11graph.c,v 1.15 1991/07/23 08:16:38 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11graph.c,v 1.16 1991/07/24 19:42:14 arthur Exp $
 
 Copyright (c) 1989-91 Massachusetts Institute of Technology
 
@@ -39,6 +39,8 @@ MIT in each case. */
 #include "x11.h"
 \f
 #define RESOURCE_NAME "scheme-graphics"
+#define DEFAULT_RESOURCE_CLASS "SchemeGraphics"
+#define DEFAULT_RESOURCE_NAME "schemeGraphics"
 #define DEFAULT_GEOMETRY "512x384+0+0"
 
 struct gw_extra
@@ -348,6 +350,14 @@ If third argument SUPPRESS-MAP? is true, do not map the window immediately.")
        XSelectInput (display, window, StructureNotifyMask);
        if ((ARG_REF (3)) == SHARP_F)
          {
+           XClassHint *class_hint = XAllocClassHint ();
+
+           if (class_hint == NULL)
+             error_external_return ();
+           class_hint->res_class = DEFAULT_RESOURCE_CLASS;
+           class_hint->res_name = DEFAULT_RESOURCE_NAME;
+           XSetClassHint (display, window, class_hint);
+           XFree ((caddr_t) class_hint);
            XMapWindow (display, window);
            XFlush (display);
          }
@@ -356,6 +366,33 @@ If third argument SUPPRESS-MAP? is true, do not map the window immediately.")
     }
   }
 }
+
+DEFINE_PRIMITIVE ("X-GRAPHICS-SET-CLASS-HINT",
+                 Prim_x_graphics_set_class_hint, 4, 4,
+  "(X-GRAPHICS-SET-CLASS-HINT DISPLAY WINDOW RESOURCE_CLASS RESOURCE_NAME)\n\
+Set the XA_WM_CLASS property of WINDOW on DISPLAY to RESOURCE_CLASS\n\
+and RESOURCE_NAME.")
+{
+  PRIMITIVE_HEADER (4);
+  {
+    struct xdisplay * xd = (x_display_arg (1));
+    Display * display = (XD_DISPLAY (xd));
+    struct xwindow * xw = (x_window_arg (2));
+    Window window = (XW_WINDOW (xw));
+    XClassHint *class_hint;
+
+    CHECK_ARG (3, STRING_P);
+    CHECK_ARG (4, STRING_P);
+    class_hint = XAllocClassHint ();
+    if (class_hint == NULL)
+      error_external_return ();
+    class_hint->res_class = STRING_ARG (3);
+    class_hint->res_name = STRING_ARG (4);
+    XSetClassHint (display, window, class_hint);
+    XFree ((caddr_t) class_hint);
+  }
+  PRIMITIVE_RETURN (UNSPECIFIC);
+}
 \f
 DEFINE_PRIMITIVE ("X-GRAPHICS-DRAW-LINE", Prim_x_graphics_draw_line, 5, 5,
   "(X-GRAPHICS-DRAW-LINE WINDOW X-START Y-START X-END Y-END)\n\
index ba6b0d38ed05f8d84d569fb32aa70947a7198e8a..5bb7a0732b9ed9eed602f13323cbfbc8c8113466 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.89 1991/07/23 08:18:07 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.90 1991/07/24 19:43:22 arthur Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
 
@@ -46,5 +46,5 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     89
+#define SUBVERSION     90
 #endif