From 1b4cf9d515e2845deabbfdb351655a6062a560ea Mon Sep 17 00:00:00 2001 From: Arthur Gleckler Date: Wed, 24 Jul 1991 19:43:22 +0000 Subject: [PATCH] Add support for setting the resource class and name of X windows. --- v7/src/microcode/version.h | 4 ++-- v7/src/microcode/x11graph.c | 39 ++++++++++++++++++++++++++++++++++++- v8/src/microcode/version.h | 4 ++-- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index 2c42a268c..a9bd7b8b0 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -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 diff --git a/v7/src/microcode/x11graph.c b/v7/src/microcode/x11graph.c index 783f5aecf..4af0af73f 100644 --- a/v7/src/microcode/x11graph.c +++ b/v7/src/microcode/x11graph.c @@ -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" #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); +} 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\ diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index ba6b0d38e..5bb7a0732 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -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 -- 2.25.1