/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.2 1989/06/23 04:34:49 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.3 1989/06/27 10:09:48 cph Exp $
Copyright (c) 1989 Massachusetts Institute of Technology
return (cdef . pixel);
return (default_color);
}
+\f
+char *
+x_get_default (display, resource_name, property_name, class_name, sdefault)
+ Display * display;
+ char * resource_name;
+ char * property_name;
+ char * class_name;
+ char * sdefault;
+{
+ char * result;
+
+ result = (XGetDefault (display, resource_name, property_name));
+ if (result != ((char *) 0))
+ return (result);
+ result = (XGetDefault (display, resource_name, class_name));
+ if (result != ((char *) 0))
+ return (result);
+ return (sdefault);
+}
unsigned long
-x_default_color (display, resource_name, property_name, default_color)
+x_default_color (display, resource_name, property_name, class_name,
+ default_color)
Display * display;
char * resource_name;
char * property_name;
+ char * class_name;
unsigned long default_color;
{
- char * color_name;
-
- color_name = (XGetDefault (display, resource_name, property_name));
+ char * color_name =
+ (x_get_default
+ (display, resource_name, property_name, class_name, ((char *) 0)));
if (color_name == ((char *) 0))
return (default_color);
return
color_name,
default_color));
}
+
+void
+x_set_mouse_colors (display, mouse_cursor, mouse_pixel, background_pixel)
+ Display * display;
+ Cursor mouse_cursor;
+ unsigned long mouse_pixel;
+ unsigned long background_pixel;
+{
+ Colormap color_map = (DefaultColormap (display, (DefaultScreen (display))));
+ XColor mouse_color;
+ XColor background_color;
+
+ (mouse_color . pixel) = mouse_pixel;
+ XQueryColor (display, color_map, (& mouse_color));
+ (background_color . pixel) = background_pixel;
+ XQueryColor (display, color_map, (& background_color));
+ XRecolorCursor
+ (display, mouse_cursor, (& mouse_color), (& background_color));
+ return;
+}
\f
void
x_default_attributes (display, resource_name, attributes)
{
int screen_number = (DefaultScreen (display));
+ (attributes -> font) =
+ (XLoadQueryFont
+ (display,
+ (x_get_default
+ (display, resource_name, "font", "Font", "9x15"))));
+ if ((attributes -> font) == ((XFontStruct *) 0))
+ error_external_return ();
{
- char * font_name;
-
- font_name = (XGetDefault (display, resource_name, "Font"));
- if (font_name == ((char *) 0))
- font_name = "9x15";
- (attributes -> font) = (XLoadQueryFont (display, font_name));
- if ((attributes -> font) == ((XFontStruct *) 0))
- error_external_return ();
+ char * s =
+ (x_get_default
+ (display, resource_name, "borderWidth", "BorderWidth", ((char *) 0)));
+ (attributes -> border_width) = ((s == ((char *) 0)) ? 2 : (atoi (s)));
}
{
- char * s;
-
- s = (XGetDefault (display, resource_name, "BorderWidth"));
- (attributes -> border_width) = ((s == ((char *) 0)) ? 2 : (atoi (s)));
- s = (XGetDefault (display, resource_name, "InternalBorder"));
+ char * s =
+ (x_get_default
+ (display, resource_name,
+ "internalBorder", "BorderWidth", ((char *) 0)));
(attributes -> internal_border_width) =
- ((s == ((char *) 0)) ? 4 : (atoi (s)));
+ ((s == ((char *) 0)) ? (attributes -> border_width) : (atoi (s)));
}
{
unsigned long white_pixel = (WhitePixel (display, screen_number));
unsigned long black_pixel = (BlackPixel (display, screen_number));
+ unsigned long foreground_pixel;
(attributes -> background_pixel) =
- (x_default_color (display, resource_name, "Background", white_pixel));
- (attributes -> foreground_pixel) =
- (x_default_color (display, resource_name, "Foreground", black_pixel));
+ (x_default_color
+ (display, resource_name, "background", "Background", white_pixel));
+ foreground_pixel =
+ (x_default_color
+ (display, resource_name, "foreground", "Foreground", black_pixel));
+ (attributes -> foreground_pixel) = foreground_pixel;
(attributes -> border_pixel) =
- (x_default_color (display, resource_name, "BorderColor", black_pixel));
+ (x_default_color
+ (display, resource_name,
+ "borderColor", "BorderColor", foreground_pixel));
(attributes -> cursor_pixel) =
- (x_default_color (display, resource_name, "CursorColor", black_pixel));
+ (x_default_color
+ (display, resource_name,
+ "cursorColor", "Foreground", foreground_pixel));
(attributes -> mouse_pixel) =
- (x_default_color (display, resource_name, "pointerColor", black_pixel));
+ (x_default_color
+ (display, resource_name,
+ "pointerColor", "Foreground", foreground_pixel));
}
return;
}
-
-void
-x_set_mouse_colors (display, mouse_cursor, mouse_pixel, background_pixel)
- Display * display;
- Cursor mouse_cursor;
- unsigned long mouse_pixel;
- unsigned long background_pixel;
-{
- Colormap color_map = (DefaultColormap (display, (DefaultScreen (display))));
- XColor mouse_color;
- XColor background_color;
-
- (mouse_color . pixel) = mouse_pixel;
- XQueryColor (display, color_map, (& mouse_color));
- (background_color . pixel) = background_pixel;
- XQueryColor (display, color_map, (& background_color));
- XRecolorCursor
- (display, mouse_cursor, (& mouse_color), (& background_color));
- return;
-}
\f
#define MAKE_GC(gc, fore, back) \
{ \
PRIMITIVE_RETURN (UNSPECIFIC);
}
-DEFINE_PRIMITIVE ("X-WINDOW-GET-DEFAULT", Prim_x_get_default, 3, 3, 0)
+DEFINE_PRIMITIVE ("X-WINDOW-GET-DEFAULT", Prim_x_window_get_default, 3, 3, 0)
{
char * result;
PRIMITIVE_HEADER (3);