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 **/
7 /** All Rights Reserved **/
9 /** Permission to use, copy, modify, and distribute this software and **/
10 /** its documentation for any purpose and without fee is hereby **/
11 /** granted, provided that the above copyright notice appear in all **/
12 /** copies and that both that copyright notice and this permis- **/
13 /** sion notice appear in supporting documentation, and that the **/
14 /** names of Evans & Sutherland and M.I.T. not be used in advertising **/
15 /** in publicity pertaining to distribution of the software without **/
16 /** specific, written prior permission. **/
18 /** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/
19 /** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/
20 /** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/
21 /** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/
22 /** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/
23 /** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/
24 /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/
25 /** OR PERFORMANCE OF THIS SOFTWARE. **/
26 /*****************************************************************************/
29 /**********************************************************************
31 * $XConsortium: gc.c,v 1.22 91/01/09 17:13:12 rws Exp $
33 * Open the fonts and create the GCs
35 * 31-Mar-88 Tom LaStrange Initial Version.
37 * Do the necessary modification to be integrated in ctwm.
38 * Can no longer be used for the standard twm.
40 * 22-April-92 Claude Lecommandeur.
43 **********************************************************************/
50 /***********************************************************************
53 * CreateGCs - open fonts and create all the needed GC's. I only
54 * want to do this once, hence the first_time flag.
56 ***********************************************************************
62 static ScreenInfo *prevScr = NULL;
65 static unsigned char greypattern [] = {0x0f, 0x05, 0x0f, 0x0a};
67 static char dashlist [2] = {1, 1};
69 if (!Scr->FirstTime || prevScr == Scr)
77 gcm |= GCFunction; gcv.function = GXxor;
78 gcm |= GCLineWidth; gcv.line_width = 0;
79 gcm |= GCForeground; gcv.foreground = Scr->XORvalue;
80 gcm |= GCSubwindowMode; gcv.subwindow_mode = IncludeInferiors;
82 Scr->DrawGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
85 gcm |= GCForeground; gcv.foreground = Scr->MenuC.fore;
86 gcm |= GCBackground; gcv.background = Scr->MenuC.back;
88 #ifndef NO_I18N_SUPPORT
91 gcm |= GCFont; gcv.font = Scr->MenuFont.font->fid;
94 gcm |= GCFont; gcv.font = Scr->MenuFont.font->fid;
97 Scr->MenuGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
100 gcm |= GCPlaneMask; gcv.plane_mask = AllPlanes;
102 * Prevent GraphicsExpose and NoExpose events. We'd only get NoExpose
103 * events anyway; they cause BadWindow errors from XGetWindowAttributes
104 * call in FindScreenInfo (events.c) (since drawable is a pixmap).
106 gcm |= GCGraphicsExposures; gcv.graphics_exposures = False;
107 gcm |= GCLineWidth; gcv.line_width = 0;
109 Scr->NormalGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
111 greypixmap = XCreatePixmapFromBitmapData(dpy, Scr->Root,
112 (char *) greypattern, 4, 4, 1, 0, 1);
115 gcm |= GCStipple; gcv.stipple = greypixmap;
116 gcm |= GCFillStyle; gcv.fill_style = FillOpaqueStippled;
117 gcm |= GCForeground; gcv.foreground = Scr->Black;
118 gcm |= GCBackground; gcv.background = Scr->White;
119 Scr->GreyGC = XCreateGC (dpy, Scr->Root, gcm, &gcv);
120 XSetDashes (dpy, Scr->GreyGC, 1, dashlist, 2);
122 if (Scr->BeNiceToColormap) {
125 gcv.line_style = LineDoubleDash;
126 Scr->ShadGC = XCreateGC (dpy, Scr->Root, gcm, &gcv);
127 XSetDashes (dpy, Scr->ShadGC, 0, dashlist, 2);