CTWM
Loading...
Searching...
No Matches
/usr/src/RPM/BUILD/ctwm-4.1.0/gc.c
Go to the documentation of this file.
1/*
2 * Copyright 1988 by Evans & Sutherland Computer Corporation,
3 * Salt Lake City, Utah
4 * Portions Copyright 1989 by the Massachusetts Institute of Technology
5 * Cambridge, Massachusetts
6 *
7 * Copyright 1992 Claude Lecommandeur.
8 */
9
10/**********************************************************************
11 *
12 * $XConsortium: gc.c,v 1.22 91/01/09 17:13:12 rws Exp $
13 *
14 * Open the fonts and create the GCs
15 *
16 * 31-Mar-88 Tom LaStrange Initial Version.
17 *
18 * Do the necessary modification to be integrated in ctwm.
19 * Can no longer be used for the standard twm.
20 *
21 * 22-April-92 Claude Lecommandeur.
22 *
23 *
24 **********************************************************************/
25
26#include "ctwm.h"
27
28#include <stdio.h>
29
30#include "gram.tab.h"
31#include "screen.h"
32#include "gc.h"
33
34/***********************************************************************
35 *
36 * Procedure:
37 * CreateGCs - open fonts and create all the needed GC's. I only
38 * want to do this once, hence the first_time flag.
39 *
40 ***********************************************************************
41 */
42
43void CreateGCs(void)
44{
45 static ScreenInfo *prevScr = NULL;
47 unsigned long gcm;
48 static unsigned char greypattern [] = {0x0f, 0x05, 0x0f, 0x0a};
50 static char dashlist [2] = {1, 1};
51
52 if(!Scr->FirstTime || prevScr == Scr) {
53 return;
54 }
55
56 prevScr = Scr;
57
58 /* create GC's */
59
60 gcm = 0;
61 gcm |= GCFunction;
62 gcv.function = GXxor;
64 gcv.line_width = 0;
66 gcv.foreground = Scr->XORvalue;
68 gcv.subwindow_mode = IncludeInferiors;
69
70 Scr->DrawGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
71
72 gcm = 0;
74 gcv.foreground = Scr->MenuC.fore;
76 gcv.background = Scr->MenuC.back;
77
78 Scr->MenuGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
79
80 gcm = 0;
82 gcv.plane_mask = AllPlanes;
83 /*
84 * Prevent GraphicsExpose and NoExpose events. We'd only get NoExpose
85 * events anyway; they cause BadWindow errors from XGetWindowAttributes
86 * call in FindScreenInfo (events.c) (since drawable is a pixmap).
87 */
89 gcv.graphics_exposures = False;
91 gcv.line_width = 0;
92
93 Scr->NormalGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
94
96 (char *) greypattern, 4, 4, 1, 0, 1);
97
98 if(Scr->Monochrome != COLOR) {
99 gcm = 0;
100 gcm |= GCStipple;
101 gcv.stipple = greypixmap;
102 gcm |= GCFillStyle;
103 gcv.fill_style = FillOpaqueStippled;
104 gcm |= GCForeground;
105 gcv.foreground = Scr->Black;
106 gcm |= GCBackground;
107 gcv.background = Scr->White;
108 Scr->BorderGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
109 XSetDashes(dpy, Scr->BorderGC, 1, dashlist, 2);
110 }
111 else if(Scr->BeNiceToColormap) {
112 gcm = 0;
113 gcm |= GCLineStyle;
114 gcv.line_style = LineDoubleDash;
115 Scr->BorderGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
116 XSetDashes(dpy, Scr->BorderGC, 0, dashlist, 2);
117 }
118 else {
119 Scr->BorderGC = XCreateGC(dpy, Scr->Root, 0, NULL);
120 }
121}
static int PlaceX
Definition add_window.c:82
Display * dpy
Definition ctwm_main.c:84
#define Scr
void CreateGCs(void)
Definition gc.c:43
Info and control for each X Screen we control.
Definition screen.h:96
unsigned long XORvalue
XorValue config var, or default.
Definition screen.h:713