1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
/*
* Spider
*
* (c) Copyright 1989, Donald R. Woods and Sun Microsystems, Inc.
* (c) Copyright 1990, David Lemke and Network Computing Devices Inc.
*
* See copyright.h for the terms of the copyright.
*
* @(#)windows.c 2.1 90/04/25
*
*/
/*
* spider window manipulation
*/
#include "defs.h"
#include "globals.h"
#ifdef KITLESS
#include "spider.bm"
window_init(ac, av, geom)
int ac;
char **av;
char *geom;
{
XSetWindowAttributes winattr;
long winmask;
XSizeHints xsh;
XWMHints xwmh;
int mwin_h;
int x, y;
Pixmap icon_map;
x = TABLE_X;
y = TABLE_Y;
table_width = TABLE_WIDTH;
table_height = TABLE_HEIGHT;
xsh.min_width = TABLE_WIDTH;
xsh.min_height = TABLE_HEIGHT;
xsh.flags = PPosition | PSize | PMinSize;
if (geom) {
int flags;
flags = XParseGeometry(geom, &x, &y, &table_width,
&table_height);
/* don't let it start too short */
if (flags & HeightValue && table_height < TABLE_HEIGHT)
table_height = TABLE_HEIGHT;
/* don't let it start too narrow */
if (flags & WidthValue && table_width < TABLE_WIDTH)
table_width = TABLE_WIDTH;
if (flags & (WidthValue | HeightValue))
xsh.flags |= USSize;
if (flags & (XValue | YValue))
xsh.flags |= USPosition;
if (flags & XValue && flags & XNegative) {
x = DisplayWidth(dpy, screen) - (table_width + x);
}
if (flags & YValue && flags & YNegative) {
y = DisplayHeight(dpy, screen) - (table_height + y);
}
}
winattr.backing_store = WhenMapped;
winattr.border_pixel = blackpixel;
winattr.event_mask = KeyPressMask | ExposureMask | ButtonPressMask |
ButtonReleaseMask | StructureNotifyMask;
winmask = CWBorderPixel | CWEventMask | CWBackingStore;
if (is_color) {
winattr.background_pixel = greenpixel;
winmask |= CWBackPixel;
} else {
winattr.background_pixmap = greenmap;
winmask |= CWBackPixmap;
}
table = XCreateWindow(dpy, RootWindow(dpy, screen),
x, y, table_width, table_height,
TABLE_BW, CopyFromParent, CopyFromParent,
CopyFromParent, winmask, &winattr);
xsh.x = x;
xsh.y = y;
xsh.width = table_width;
xsh.height = table_height;
icon_map = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
spider_bits, spider_width, spider_height);
XSetStandardProperties(dpy, table, "Spider", "Spider", icon_map,
av, ac, &xsh);
xwmh.flags = InputHint | IconPixmapHint;
xwmh.input = True;
xwmh.icon_pixmap = icon_map;
XSetWMHints(dpy, table, &xwmh);
mwin_h = message_font->ascent + message_font->descent;
message_win = XCreateSimpleWindow(dpy, table,
0, table_height - 2 * TABLE_BW - mwin_h,
table_width - 2 * TABLE_BW, mwin_h,
TABLE_BW, borderpixel, whitepixel);
XMapWindow(dpy, message_win);
XMapWindow(dpy, table);
}
#endif KITLESS
#ifndef KITLESS
table_init(win)
Window win;
{
XSetWindowAttributes winattr;
long winmask;
/* save this for later */
table = win;
winattr.backing_store = WhenMapped;
winattr.bit_gravity = ForgetGravity;
winmask = CWBackingStore | CWBitGravity;
if (is_color) {
winattr.background_pixel = greenpixel;
winmask |= CWBackPixel;
} else {
winattr.background_pixmap = greenmap;
winmask |= CWBackPixmap;
}
XChangeWindowAttributes(dpy, table, winmask, &winattr);
}
#endif KITLESS
|