sdo@soliado.East.Sun.COM (Scott Oaks - Sun Consulting NYC) (04/29/91)
Submitted-by: sdo@soliado.East.Sun.COM (Scott Oaks - Sun Consulting NYC) Posting-number: Volume 12, Issue 63 Archive-name: olvwm/part07 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 7 (of 16)." # Contents: InitGraphics.c Makefile wincolor.c # Wrapped by sdo@piccolo on Fri Apr 26 17:31:06 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'InitGraphics.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'InitGraphics.c'\" else echo shar: Extracting \"'InitGraphics.c'\" \(15901 characters\) sed "s/^X//" >'InitGraphics.c' <<'END_OF_FILE' X/* X * (c) Copyright 1989, 1990 Sun Microsystems, Inc. Sun design patents X * pending in the U.S. and foreign countries. See LEGAL_NOTICE X * file for terms of the license. X * X * Written for Sun Microsystems by Crucible, Santa Cruz, CA. X */ X static char sccsid[] = "@(#) InitGraphics.c 25.8 90/05/22 Crucible"; X#include <errno.h> X#include <stdio.h> X#include <X11/Xos.h> X#include <X11/Xlib.h> X#include <X11/Xutil.h> X#include <X11/cursorfont.h> X X#include <olgx/olgx.h> X X#include "olwm.h" X#include "globals.h" X#include "resources.h" X X X/* Externs. */ extern Display *DefDpy; extern int DefScreen; extern Bool WorkspaceColorUsed; extern unsigned long WorkspaceColorPixel; X X/* Globals. */ GC RootGC; GC DrawBackgroundGC, DrawSelectedGC; GC DrawNormalGC, DrawReverseGC; X#ifdef STILL_NEEDED? GC DrawLinesGC, DrawRevLinesGC; X#endif /* STILL_NEEDED? */ GC IconNormalGC, IconBorderGC, IconSelectedGC, IconUnselectedGC; GC DrawBusyGC; GC DrawWhiteGC, DrawBlackGC; X Bool ColorDisplay; Pixmap Gray50; int Gray50width; int Gray50height; X X/* bitmaps */ X X#define gray50_width 8 X#define gray50_height 8 static char gray50_bits[] = { X 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa X}; X X#define busy_gray_width 8 X#define busy_gray_height 8 static char busy_gray_bits[] = { X 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 X}; X X/* OLGX context */ Graphics_info *olgx_gisbutton; /* buttons have special font */ Graphics_info *olgx_gistext; /* notice box text has special font */ Graphics_info *olgx_gisnormal; Graphics_info *olgx_gisreverse; Graphics_info *olgx_gisrevpin; /* drawing reverse pushpins */ X int Resize_height, Resize_width; X X/* X * initGCs - initialize all the GCs used by olwm X * X * Creating all of these in one place will hopefully prevent the X * creation of redundant GCs. (There is some motivation for creating X * GCs as they are needed, so they can also be free'd when not used, X * but so far it's resulted in more GCs than really needed. If we change X * back to that scheme, some Upd* routines for dynamically changing X * resources will need to be reorganized.) X */ static void initGCs(dpy) Display *dpy; X{ X XGCValues values; static char dashList[2] = { 1, 1 }; X X /* Create a GC for drawing move window outlines in the root window. */ X values.function = GXxor; X values.foreground = ~((~0L) << DisplayPlanes(dpy,DefaultScreen(dpy))); X values.subwindow_mode = IncludeInferiors; X RootGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X ( GCFunction | GCForeground | X GCBackground | GCSubwindowMode ), X &values ); X X /* Create a GC for drawing strictly using the background color X * (frame-color), for example, in the frame. X * Used for drawing filled frame-colored rectangles for frame X * edges around titlebar/header and footer. X * Should only be used for XFillRectangle, since both foreground and X * background are background colored (Bg1) and no font is specified. X */ X values.function = GXcopy; X values.foreground = values.background = GRV.Bg1Color; X values.line_width = 1; X values.graphics_exposures = False; X DrawBackgroundGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X ( GCFunction | GCForeground X | GCBackground | GCGraphicsExposures X | GCLineWidth ), X &values ); X X /* Create a GC for text and line graphics (forecolor on backcolor). */ X values.function = GXcopy; X values.foreground = GRV.Fg1Color; X values.background = GRV.Bg1Color; X values.font = GRV.TitleFontInfo->fid; X values.graphics_exposures = False; X DrawNormalGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X (GCFont | GCFunction | GCForeground | GCBackground | X GCGraphicsExposures), X &values ); X X /* Create a GC the opposite of the previous one. */ X values.function = GXcopy; X values.foreground = GRV.Bg1Color; X values.background = GRV.Fg1Color; X values.font = GRV.TitleFontInfo->fid; X values.graphics_exposures = False; X DrawReverseGC = XCreateGC(dpy, RootWindow(dpy, DefaultScreen(dpy)), X (GCFont | GCFunction | GCForeground | GCBackground | X GCGraphicsExposures), X &values); X X#ifdef STILL_NEEDED? X /* This GC is used for the frame borders and titlebar X * lines in focus follows mouse mode, so it's black on background. X */ X values.function = GXcopy; X values.foreground = BlackPixel(dpy, DefaultScreen(dpy)); X values.background = GRV.Bg1Color; X values.font = GRV.TitleFontInfo->fid; X values.graphics_exposures = False; X DrawLinesGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X (GCFont | GCFunction | GCForeground | GCBackground | X GCGraphicsExposures), X &values ); X /* Create a GC the opposite of the previous one. */ X values.function = GXcopy; X values.foreground = GRV.Bg1Color; X values.background = BlackPixel(dpy, DefaultScreen(dpy)); X values.font = GRV.TitleFontInfo->fid; X values.graphics_exposures = False; X DrawRevLinesGC = XCreateGC(dpy, RootWindow(dpy, DefaultScreen(dpy)), X (GCFont | GCFunction | GCForeground | GCBackground | X GCGraphicsExposures), X &values); X#endif /* STILL_NEEDED? */ X X /* Create a GC for drawing the icon name (just like DrawNormal, but X * using IconFont). Is also used for the icon pixmap. X */ X values.function = GXcopy; X values.foreground = GRV.Fg1Color; X if (WorkspaceColorUsed) X values.background = WorkspaceColorPixel; X else X values.background = GRV.Bg1Color; X values.font = GRV.IconFontInfo->fid; X values.line_width = 1; X values.graphics_exposures = False; X IconNormalGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X (GCFont | GCFunction | GCForeground | GCBackground | X GCGraphicsExposures | GCLineWidth), X &values ); X X /* Create a GC for drawing the icon name and pixmap when selected. X * (used only in 3D) X */ X values.function = GXcopy; X values.foreground = GRV.Fg1Color; X if (WorkspaceColorUsed) X values.background = WorkspaceColorPixel; X else X values.background = GRV.Bg1Color; X values.font = GRV.IconFontInfo->fid; X values.line_width = 1; X values.graphics_exposures = False; X IconSelectedGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X (GCFont | GCFunction | GCForeground | GCBackground | X GCGraphicsExposures | GCLineWidth), X &values ); X X /* GC for unselected icons */ X values.function = GXcopy; X if (WorkspaceColorUsed) X values.foreground = WorkspaceColorPixel; X else X values.foreground = GRV.Bg1Color; X values.line_width = 0; X IconUnselectedGC = XCreateGC(dpy, DefaultRootWindow(dpy), X GCFunction | GCForeground | GCLineWidth, X &values); X X /* Create a GC for icon border. */ X values.function = GXcopy; X#ifndef COLOR2D X values.foreground = GRV.Fg1Color; X#else X values.foreground = GRV.BorderColor; X#endif /* COLOR2D */ X values.background = GRV.Bg1Color; X values.line_width = 0; X values.line_style = LineOnOffDash; X values.graphics_exposures = False; X IconBorderGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X ( GCFunction | GCForeground | GCBackground | X GCGraphicsExposures | GCLineWidth | GCLineStyle ), X &values ); X XSetDashes( dpy, IconBorderGC, 1, dashList, 2 ); X X /* Create a GC for drawing strictly using the selected color X * (slightly dark background for 3d and border color for 2d). X * Used for drawing icon selection borders. X * Should only be used for XFillRectangle, since both foreground and X * background are same color and no font is specified. X */ X values.function = GXcopy; X#ifndef COLOR2D X values.foreground = values.background = GRV.Bg2Color; X#else X if ( GRV.F3dUsed ) X values.foreground = values.background = GRV.Bg2Color; X else X values.foreground = values.background = GRV.BorderColor; X#endif /* COLOR2D */ X values.line_width = 1; X values.graphics_exposures = False; X DrawSelectedGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X (GCFunction | GCForeground | GCBackground | X GCGraphicsExposures | GCLineWidth), X &values ); X X { X Pixmap busyStipple; X X busyStipple = XCreatePixmapFromBitmapData(dpy, DefaultRootWindow(dpy), X busy_gray_bits, busy_gray_width, busy_gray_height, 1, 0, 1); X X /* Create a GC for text and line graphics (forecolor on backcolor). */ X values.function = GXcopy; X values.foreground = GRV.Fg1Color; X values.graphics_exposures = False; X values.fill_style = FillStippled; X values.stipple = busyStipple; X DrawBusyGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X (GCStipple | GCFunction | GCForeground | X GCGraphicsExposures | GCFillStyle), X &values ); X X X } X X /* Create a GC for drawing black lines/rectangles (black on black). */ X values.function = GXcopy; X values.foreground = values.background = BlackPixel(dpy, X DefaultScreen(dpy)); X values.line_width = 1; X values.graphics_exposures = False; X DrawBlackGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X ( GCFunction | GCForeground | GCBackground | X GCGraphicsExposures | GCLineWidth ), X &values ); X X /* Create a GC for drawing white lines/rectangles (white on white). */ X values.function = GXcopy; X values.foreground = values.background = WhitePixel(dpy, X DefaultScreen(dpy)); X values.line_width = 1; X values.graphics_exposures = False; X DrawWhiteGC = XCreateGC( dpy, RootWindow(dpy, DefaultScreen(dpy)), X ( GCFunction | GCForeground | GCBackground | X GCGraphicsExposures | GCLineWidth ), X &values ); X} X X X/* X * initOLGX - initialize all the olgx Graphics_info structures used by olwm X * X * Creating all of these in one place will hopefully prevent the X * creation of redundant gis variables. (There is some motivation for X * creating olgx_gis* as they are needed, so they can also be better X * managed, but so far it's resulted in more gis variables than really X * needed. If we change back to that scheme, some Upd* routines for X * dynamically changing resources will need to be reorganized.) X * X * Notice that only the colors are set up here, since setting fonts X * is all done in the Upd*Font() routines. X */ static void initOLGX(dpy) Display *dpy; X{ X unsigned long pixvals[5]; X int dflag = GRV.F3dUsed ? OLGX_3D_COLOR : OLGX_2D; X X /* X * REMIND X * We will probably want to add support for OLGX_3D_MONO at X * some point. This will require replacing all of the NULL's X * in the olgx_initialize() calls with an array of pixmaps. X */ X X /* gis for drawing buttons */ X X pixvals[OLGX_WHITE] = GRV.Bg0Color; X pixvals[OLGX_BG1] = GRV.Bg1Color; X pixvals[OLGX_BG2] = GRV.Bg2Color; X pixvals[OLGX_BG3] = GRV.Bg3Color; X pixvals[OLGX_BLACK] = GRV.Fg1Color; X X olgx_gisbutton = olgx_initialize(dpy, DefaultScreen(dpy), dflag, X GRV.GlyphFontInfo, X GRV.ButtonFontInfo, X pixvals, NULL); X X /* gis for drawing descriptive text */ X X pixvals[OLGX_WHITE] = GRV.Bg0Color; X pixvals[OLGX_BG1] = GRV.Bg1Color; X pixvals[OLGX_BG2] = GRV.Bg2Color; X pixvals[OLGX_BG3] = GRV.Bg3Color; X pixvals[OLGX_BLACK] = GRV.Fg1Color; X X olgx_gistext = olgx_initialize(dpy, DefaultScreen(dpy), dflag, X GRV.GlyphFontInfo, X GRV.TextFontInfo, X pixvals, NULL); X X /* gis for drawing everything else */ X X pixvals[OLGX_WHITE] = GRV.Bg0Color; X pixvals[OLGX_BG1] = GRV.Bg1Color; X pixvals[OLGX_BG2] = GRV.Bg2Color; X pixvals[OLGX_BG3] = GRV.Bg3Color; X pixvals[OLGX_BLACK] = GRV.Fg1Color; X X olgx_gisnormal = olgx_initialize(dpy, DefaultScreen(dpy), dflag, X GRV.GlyphFontInfo, X GRV.TitleFontInfo, X pixvals, NULL); X X /* gis for drawing in reverse */ X X pixvals[OLGX_WHITE] = GRV.Bg2Color; X pixvals[OLGX_BG1] = GRV.Fg1Color; X pixvals[OLGX_BG2] = GRV.Bg0Color; X pixvals[OLGX_BG3] = GRV.Fg1Color; X pixvals[OLGX_BLACK] = GRV.Bg1Color; X X olgx_gisreverse = olgx_initialize(dpy, DefaultScreen(dpy), dflag, X GRV.GlyphFontInfo, X GRV.TitleFontInfo, X pixvals, NULL); X X X /* gis for drawing pushpin in reverse - useful only in 2D */ X X pixvals[OLGX_WHITE] = GRV.Fg1Color; X pixvals[OLGX_BG1] = GRV.Bg1Color; X pixvals[OLGX_BG2] = GRV.Bg2Color; X pixvals[OLGX_BG3] = GRV.Bg3Color; X pixvals[OLGX_BLACK] = GRV.Bg0Color; X X olgx_gisrevpin = olgx_initialize(dpy, DefaultScreen(dpy), dflag, X GRV.GlyphFontInfo, X GRV.TitleFontInfo, X pixvals, NULL); X} X X X/* X * isColorDisplay -- check to see if the display supports color. X * This should only need to be called once (which olwm first invoked) X */ static Bool isColorDisplay( dpy ) Display *dpy; X{ X XVisualInfo *vis; X XVisualInfo visTemplate; X int nvis; X int ii; X Bool colorDisplay = False; X X /* determine whether on a color display */ X vis = XGetVisualInfo( dpy, VisualNoMask, &visTemplate, &nvis ); X for ( ii = 0; ii < nvis; ++ii ) X { X if (vis[ii].screen == DefaultScreen(dpy)) X { X if ( vis[ii].class == StaticColor X || vis[ii].class == PseudoColor X || vis[ii].class == DirectColor ) X { X colorDisplay = True; X break; X } X } X } X XFree( vis ); X X return( colorDisplay ); X} X X X/* X * PreInitGraphics X * This is a little strange. PreInitGraphics initializes graphical data that X * might need to be used while the resource database is being read in. X * InitGraphics is set up based on values read from the resource database. X */ void PreInitGraphics(dpy) X Display *dpy; X{ X ColorDisplay = isColorDisplay(dpy); X X Gray50 = XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), X gray50_bits, gray50_width, gray50_height ); X Gray50width = gray50_width; X Gray50height = gray50_height; X} X X InitGraphics(dpy) Display *dpy; X{ X initGCs(dpy); X initOLGX(dpy); X X /* Global cursor variables are set in resources.c:SetCursors() X * [created from cursorFont resource]. They need to be assigned X * to windows as appropriate. X */ X XDefineCursor( dpy, RootWindow(dpy, DefaultScreen(dpy)), X GRV.BasicPointer ); X X /* Apply the TitleFontInfo settings everywhere applicable */ X UpdTitleFont( dpy, RM_TITLE_FONT ); X X /* Apply TextFontInfo information as appropriate. */ X UpdTextFont( dpy, RM_TEXT_FONT ); X X /* Apply the ButtonFontInfo settings everywhere applicable */ X UpdButtonFont( dpy, RM_BUTTON_FONT ); X X /* Apply the GlyphFontInfo settings everywhere applicable */ X UpdGlyphFont( dpy, RM_GLYPHFONT ); X} X X/* UninitGraphics - free up any server resources that have been consumed, X * and restore root cursor. X * X * REMIND Currently unused. X */ UninitGraphics() X{ X XUndefineCursor(DefDpy, RootWindow(DefDpy, DefScreen)); X olgx_destroy(olgx_gisbutton); X olgx_destroy(olgx_gistext); X olgx_destroy(olgx_gisnormal); X olgx_destroy(olgx_gisreverse); X olgx_destroy(olgx_gisrevpin); X} X X/* HACK - get size of resize corners. Should be X * replaced by a function/macro in olgx. Assumes X * all resize corners are the same size. X * X * REMIND - this is called from UpdGlyphFont(), since this X * routine uses the size of that font. X */ setResizeSizes() X{ X char s[2]; X XCharStruct xcs; X int i1, i2, i3; X X s[0]=UL_RESIZE_OUTLINE; X s[1]='\0'; X XTextExtents(GRV.GlyphFontInfo,s,1,&i1,&i2,&i2,&xcs); X Resize_height = xcs.ascent + xcs.descent; X Resize_width = xcs.width; X} END_OF_FILE if test 15901 -ne `wc -c <'InitGraphics.c'`; then echo shar: \"'InitGraphics.c'\" unpacked with wrong size! fi # end of 'InitGraphics.c' fi if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(14964 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# Makefile generated by imake - do not edit! X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ X# X# The cpp used on this machine replaces all newlines and multiple tabs and X# spaces in a macro expansion with a single space. Imake tries to compensate X# for this, but is not always successful. X# X X########################################################################### X# Makefile generated from "Imake.tmpl" and <Imakefile> X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ X# X# Platform-specific parameters may be set in the appropriate .cf X# configuration files. Site-wide parameters may be set in the file X# site.def. Full rebuilds are recommended if any parameters are changed. X# X# If your C preprocessor doesn't define any unique symbols, you'll need X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing X# "make Makefile", "make Makefiles", or "make World"). X# X# If you absolutely can't get imake to work, you'll need to set the X# variables at the top of each Makefile as well as the dependencies at the X# bottom (makedepend will do this automatically). X# X X########################################################################### X# platform-specific configuration parameters - edit sun.cf to change X X# platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ X# operating system: SunOS 4.0.3 X X########################################################################### X# site-specific configuration parameters - edit site.def to change X X# site: $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $ X X SHELL = /bin/sh X X TOP = . X CURRENT_DIR = . X X AR = ar clq X BOOTSTRAPCFLAGS = X CC = cc X X COMPRESS = compress X CPP = /lib/cpp $(STD_CPP_DEFINES) X PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) X INSTALL = install X LD = ld X LINT = lint X LINTLIBFLAG = -C X LINTOPTS = -axz X LN = ln -s X MAKE = make X MV = mv X CP = cp X RANLIB = ranlib X RANLIBINSTFLAGS = X RM = rm -f X STD_INCLUDES = X STD_CPP_DEFINES = X STD_DEFINES = X EXTRA_LOAD_FLAGS = -L${OPENWINHOME}/lib -L${X11HOME}/lib X EXTRA_LIBRARIES = X TAGS = ctags X X SHAREDCODEDEF = -DSHAREDCODE X SHLIBDEF = -DSUNSHLIB X X PROTO_DEFINES = X X INSTPGMFLAGS = X X INSTBINFLAGS = -m 0755 X INSTUIDFLAGS = -m 4755 X INSTLIBFLAGS = -m 0664 X INSTINCFLAGS = -m 0444 X INSTMANFLAGS = -m 0444 X INSTDATFLAGS = -m 0444 X INSTKMEMFLAGS = -m 4755 X X DESTDIR = /home/X11 X X TOP_INCLUDES = -I$(TOP) X X CDEBUGFLAGS = -O X CCOPTIONS = X COMPATFLAGS = X X ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) X LDCOMBINEFLAGS = -X -r X X MACROFILE = sun.cf X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut X X IMAKE_DEFINES = X X IRULESRC = $(CONFIGSRC) X IMAKE_CMD = $(NEWTOP)$(IMAKE) -I$(NEWTOP)$(IRULESRC) $(IMAKE_DEFINES) X X ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ X $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ X $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) X X########################################################################### X# X Window System Build Parameters X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ X X########################################################################### X# X Window System make variables; this need to be coordinated with rules X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ X X PATHSEP = / X USRLIBDIR = $(DESTDIR)/lib X BINDIR = $(DESTDIR)/bin X INCROOT = $(DESTDIR)/include/X11 X BUILDINCROOT = $(TOP) X BUILDINCDIR = $(BUILDINCROOT)/X11 X BUILDINCTOP = .. X INCDIR = $(INCROOT)/X11 X ADMDIR = $(DESTDIR)/usr/adm X LIBDIR = $(USRLIBDIR)/X11 X CONFIGDIR = $(LIBDIR)/config X LINTLIBDIR = $(USRLIBDIR)/lint X X FONTDIR = $(LIBDIR)/fonts X XINITDIR = $(LIBDIR)/xinit X XDMDIR = $(LIBDIR)/xdm X AWMDIR = $(LIBDIR)/awm X TWMDIR = $(LIBDIR)/twm X GWMDIR = $(LIBDIR)/gwm X MANPATH = $(DESTDIR)/man X MANSOURCEPATH = $(MANPATH)/man X MANDIR = $(MANSOURCEPATH)n X LIBMANDIR = $(MANSOURCEPATH)3 X XAPPLOADDIR = $(LIBDIR)/app-defaults X X SOXLIBREV = 4.2 X SOXTREV = 4.0 X SOXAWREV = 4.0 X SOOLDXREV = 4.0 X SOXMUREV = 4.0 X SOXEXTREV = 4.0 X X FONTCFLAGS = -t X X INSTAPPFLAGS = $(INSTDATFLAGS) X X IMAKE = $(IMAKESRC)/imake X DEPEND = $(DEPENDSRC)/makedepend X RGB = $(RGBSRC)/rgb X FONTC = $(BDFTOSNFSRC)/bdftosnf X MKFONTDIR = $(MKFONTDIRSRC)/mkfontdir X MKDIRHIER = /bin/sh $(SCRIPTSRC)/mkdirhier.sh X X CONFIGSRC = $(TOP)/config X CLIENTSRC = $(TOP)/clients X DEMOSRC = $(TOP)/demos X LIBSRC = $(TOP)/lib X FONTSRC = $(TOP)/fonts X INCLUDESRC = $(TOP)/X11 X SERVERSRC = $(TOP)/server X UTILSRC = $(TOP)/util X SCRIPTSRC = $(UTILSRC)/scripts X EXAMPLESRC = $(TOP)/examples X CONTRIBSRC = $(TOP)/../contrib X DOCSRC = $(TOP)/doc X RGBSRC = $(TOP)/rgb X DEPENDSRC = $(UTILSRC)/makedepend X IMAKESRC = $(CONFIGSRC) X XAUTHSRC = $(LIBSRC)/Xau X XLIBSRC = $(LIBSRC)/X X XMUSRC = $(LIBSRC)/Xmu X TOOLKITSRC = $(LIBSRC)/Xt X AWIDGETSRC = $(LIBSRC)/Xaw X OLDXLIBSRC = $(LIBSRC)/oldX X XDMCPLIBSRC = $(LIBSRC)/Xdmcp X BDFTOSNFSRC = $(FONTSRC)/bdftosnf X MKFONTDIRSRC = $(FONTSRC)/mkfontdir X EXTENSIONSRC = $(TOP)/extensions X X DEPEXTENSIONLIB = $(EXTENSIONSRC)/lib/libXext.a X EXTENSIONLIB = $(DEPEXTENSIONLIB) X X DEPXLIB = $(DEPEXTENSIONLIB) X XLIB = $(EXTENSIONLIB) -L$(XLIBSRC) -lX11 X X DEPXAUTHLIB = $(XAUTHSRC)/libXau.a X XAUTHLIB = $(DEPXAUTHLIB) X X DEPXMULIB = X XMULIB = -L$(XMUSRC) -lXmu X X DEPOLDXLIB = X OLDXLIB = -L$(OLDXLIBSRC) -loldX X X DEPXTOOLLIB = X XTOOLLIB = -L$(TOOLKITSRC) -lXt X X DEPXAWLIB = X XAWLIB = -L$(AWIDGETSRC) -lXaw X X LINTEXTENSIONLIB = $(EXTENSIONSRC)/lib/llib-lXext.ln X LINTXLIB = $(XLIBSRC)/llib-lX11.ln X LINTXMU = $(XMUSRC)/llib-lXmu.ln X LINTXTOOL = $(TOOLKITSRC)/llib-lXt.ln X LINTXAW = $(AWIDGETSRC)/llib-lXaw.ln X X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) X X DEPLIBS1 = $(DEPLIBS) X DEPLIBS2 = $(DEPLIBS) X DEPLIBS3 = $(DEPLIBS) X X########################################################################### X# Imake rules for building libraries, programs, scripts, and data files X# rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ X X########################################################################### X# start of Imakefile X X########################################################################### X# @(#)XView.cf 1.1 90/07/09 SMI X# XView.cf for XView release 2.0. Specify site preferences here. X X########################################################################### X# @(#)XView.tmpl 1.2 90/07/16 SMI X# XView.tmpl for XView release 2.0. Template to add additional config X# rules to those supplied with X Version 11 release 4. X X DESTDIR = /home/X11 X XVDESTDIR = /usr/local/X11R4/XView X LIBRARY_DEST = $(XVDESTDIR)/usr/lib X LINT_LIBRARY_DEST = $(XVDESTDIR)/usr/lib/lint X XVLIBSRC = $(TOP)/lib X X BINDIR = $(XVDESTDIR)/usr/bin/xview X MANPATH = $(DESTDIR)/man X HEADER_DEST = $(XVDESTDIR)/usr/include X SRC_DEST = $(XVDESTDIR)/usr/share/src/xview X DOC_DEST = $(XVDESTDIR)/usr/share/doc/xview X HELP_DEST = $(LIBRARY_DEST)/help X LIBRARY_DEST_EXTRAS = $(LIBRARY_DEST) X TEXT_EXTRAS_MENU = $(LIBRARY_DEST)/.text_extras_menu X AR = ar rulv X CHMOD = chmod X X DEPEXTENSIONLIB = X EXTENSIONLIB = X X DEPXLIB = X X BUILDINCDIR = $(TOP)/build X BUILDINCTOP = ../../../.. X X INCDIR = /usr/include X X XVPUBINC = xview X XVPRIINC = xview_private X OLPUBINC = olgx X OLPRIINC = olgx_private X PSPUBINC = xvps X PSPRIINC = xvps_private X IMAGEINC = images X PIXRECT_INCDIR = $(INCDIR)/pixrect X XVPUB_INCDIR = $(INCDIR)/$(XVPUBINC) X XVPRI_INCDIR = $(INCDIR)/$(XVPRIINC) X OLPUB_INCDIR = $(INCDIR)/$(OLPUBINC) X OLPRI_INCDIR = $(INCDIR)/$(OLPRIINC) X PSPUB_INCDIR = $(INCDIR)/$(PSPUBINC) X PSPRI_INCDIR = $(INCDIR)/$(PSPRIINC) X IMAGE_INCDIR = $(INCDIR)/$(IMAGEINC) X PIXRECT_HEADER_DEST = $(HEADER_DEST)/pixrect X XVPUB_HEADER_DEST = $(HEADER_DEST)/$(XVPUBINC) X XVPRI_HEADER_DEST = $(HEADER_DEST)/$(XVPRIINC) X OLPUB_HEADER_DEST = $(HEADER_DEST)/$(OLPUBINC) X OLPRI_HEADER_DEST = $(HEADER_DEST)/$(OLPRIINC) X PSPUB_HEADER_DEST = $(HEADER_DEST)/$(PSPUBINC) X PSPRI_HEADER_DEST = $(HEADER_DEST)/$(PSPRIINC) X IMAGES_DEST = $(HEADER_DEST)/$(IMAGEINC) X X LINTDIR = $(XVDESTDIR)/usr/lib/lint X X PIC = -pic X XSTR = xstr X XSTR_ARRAY = _libxview_xstr X OBJSORT = ./objsort.sh X OBJLIST = ./lorder-sparc X INSTSHAREDLIBFLAGS = -m 0755 X X DEPXVIEWLIB = X XVIEWLIB = -L$(LIBRARY_DEST) -lxview X X DEPOLGXLIB = X OLGXLIB = -L$(LIBRARY_DEST) -lolgx X X DEPXVPSLIB = X XVPSLIB = -L$(LIBRARY_DEST) -lxvps X X XLIB = $(EXTENSIONLIB) -lX11 X X SOXVIEWREV = 3.0 X SOOLGXREV = 3.0 X X SODIR = shared X SADIR = unshared X X SHARED_DIR = $(TARGETDIR)xshared X UNSHARED_DIR = $(TARGETDIR)xunshared X XSTR_STRINGS_FILE = $(TARGETDIR)xstrings X X########################################################################### X# @(#)XView.rules 1.3 90/08/02 SMI X# XView.rules for XView release 2.0. Imake rules needed by distribution. X X######################################################################### X# @(#)Imakefile 25.3 90/07/17 SMI X# Imakefile for olwm release 2.0. X DEFINES = INCLUDES = -I$(HEADER_DEST) -I$(TOP) SYS_LIBRARIES = -lm DEPLIBS = LOCAL_LIBRARIES = $(OLGXLIB) $(XLIB) X HEADERS = \ X defaults.h events.h globals.h group.h list.h mem.h menu.h notice.h \ X olcursor.h olwm.h resources.h slots.h st.h win.h X INFOFILES = MANPAGES = olvwm.man BITMAPS = iconbitmap.h vdm.icon SCRIPTS = MISC = openwin-menu X SRCS = \ X Debug.c Notice.c Error.c \ X InitGraphics.c RubberWin.c Select.c WinInfo.c \ X atom.c client.c defaults.c events.c group.c list.c \ X mem.c menu.c olwm.c resources.c services.c slots.c st.c states.c \ X usermenu.c usleep.c win.c winbusy.c winbutton.c wincolor.c \ X winframe.c wingframe.c winicon.c winipane.c winmenu.c \ X winnofoc.c winpane.c winpush.c winresize.c winroot.c \ X virtual.c X OBJS = \ X Debug.o Notice.o Error.o \ X InitGraphics.o RubberWin.o Select.o WinInfo.o \ X atom.o client.o defaults.o events.o group.o list.o \ X mem.o menu.o olwm.o resources.o services.o slots.o st.o states.o \ X usermenu.o usleep.o win.o winbusy.o winbutton.o wincolor.o \ X winframe.o wingframe.o winicon.o winipane.o winmenu.o \ X winnofoc.o winpane.o winpush.o winresize.o winroot.o \ X virtual.o X ALLFILES = \ X ${HEADERS} ${BITMAPS} ${SRCS} \ X ${MISC} ${INFOFILES} ${MANPAGES} ${SCRIPTS} X X PROGRAM = olvwm X all:: olvwm X olvwm: $(OBJS) $(DEPLIBS) X $(RM) $@ X $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) X install:: olvwm X $(INSTALL) -c $(INSTPGMFLAGS) olvwm $(BINDIR) X install.man:: olvwm.man X $(INSTALL) -c $(INSTMANFLAGS) olvwm.man $(MANDIR)/olvwm.n X depend:: $(DEPEND) X X$(DEPEND): X @echo "checking $@ over in $(DEPENDSRC) first..."; \ X cd $(DEPENDSRC); $(MAKE); \ X echo "okay, continuing in $(CURRENT_DIR)" X depend:: X $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) X lint: X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) X clean:: X $(RM) $(PROGRAM) X install:: X @case '${MFLAGS}' in *[i]*) set +e;; esac; X for i in $(MISC) ;\ X do \ X echo "installing $$i"; \ X $(RM) $(LIBRARY_DEST)/$$i ; \ X $(INSTALL) -c $(INSTDATFLAGS) $$i $(LIBRARY_DEST) ; \ X done X install.man:: $(MANPAGES).man X $(INSTALL) -c $(INSTMANFLAGS) $(MANPAGES).man $(MANDIR)/$(MANPAGES).n X populate:: X @case '${MFLAGS}' in *[i]*) set +e;; esac; X -@if [ -h SCCS ]; then \ X for i in $(ALLFILES) ; do sccs get $$i ; done ; \ X elif [ -h SCCS- ]; then \ X $(MV) SCCS- SCCS ; \ X for i in $(ALLFILES) ; do sccs get $$i ; done ; \ X $(MV) SCCS SCCS- ; \ X else \ X echo "SCCS or SCCS- do not exist" ; \ X fi X install.srcs:: X includes:: X install.man:: X depend:: $(DEPEND) X X$(DEPEND): X @echo "checking $@ over in $(DEPENDSRC) first..."; \ X cd $(DEPENDSRC); $(MAKE); \ X echo "okay, continuing in $(CURRENT_DIR)" X depend:: X $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) X lint: X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) X X########################################################################### X# common rules for all Makefiles - do not edit X emptyrule:: X clean:: X $(RM_CMD) \#* X Makefile:: $(IMAKE) X X$(IMAKE): X @(cd $(IMAKESRC); if [ -f Makefile ]; then \ X echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \ X echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \ X $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS); fi; \ X echo "okay, continuing in $(CURRENT_DIR)") X Makefile:: X -@if [ -f Makefile ]; then \ X echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ X else exit 0; fi X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) X tags:: X $(TAGS) -w *.[ch] X $(TAGS) -xw *.[ch] > TAGS X X########################################################################### X# empty rules for directories that do not have SUBDIRS - do not edit X install:: X @echo "install in $(CURRENT_DIR) done" X install.man:: X @echo "install.man in $(CURRENT_DIR) done" X Makefiles:: X includes:: X X########################################################################### X# dependencies generated by makedepend X END_OF_FILE if test 14964 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'wincolor.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'wincolor.c'\" else echo shar: Extracting \"'wincolor.c'\" \(17497 characters\) sed "s/^X//" >'wincolor.c' <<'END_OF_FILE' X/* X * (c) Copyright 1989, 1990 Sun Microsystems, Inc. Sun design patents X * pending in the U.S. and foreign countries. See LEGAL_NOTICE X * file for terms of the license. X * X * Written for Sun Microsystems by Crucible, Santa Cruz, CA. X */ X static char sccsid[] = "@(#)wincolor.c 1.2 olvwm version 3/30/91"; X X/* X * Based on static char sccsid[] = "@(#) wincolor.c 25.8 90/05/23 Crucible"; X * X */ X X#include <errno.h> X#include <stdio.h> X#include <X11/Xos.h> X#include <X11/Xlib.h> X#include <X11/Xutil.h> X#include <X11/Xatom.h> X#include <olgx/olgx.h> X#include "mem.h" X#include "olwm.h" X#include "win.h" X#include "menu.h" X#include "globals.h" X X/*************************************************************************** X* global data X***************************************************************************/ X extern Atom AtomColorMapWindows; X X/* X * ColorFocusLocked indicates the color focus mode. If it is false, we are in X * "color-follows-mouse" mode. In this mode, colormaps are installed based on X * the location of the mouse. The WM_COLORMAP_WINDOWS property determines the X * list of windows that are eligible to have their colormaps installed, but X * changes to this property do not necessarily cause colormap installation. X * If ColorFocusLocked is true, we are in "color-locked" mode. In this mode, X * a particular colormap is locked into the hardware, and colormaps do not X * track the pointer location. If a particular client has the focus, this X * client will be named by ColorFocusClient, and changes to its X * WM_COLORMAP_WINDOWS property will cause colormap changes. If no client has X * the focus (e.g. the colormap window is the root) then only user action can X * cause the colormap to change. In this case the ColorFocusClient will be X * NULL. X */ Bool ColorFocusLocked; Client *ColorFocusClient = NULL; X X/* X * ColorFocusWindow indicates the window that currently has the color focus. X * This is updated regardless of the color focus mode. X */ WinGeneric *ColorFocusWindow; X extern void WinAddColorClient(); extern void WinRemoveColorClient(); X X/*************************************************************************** X* private data X***************************************************************************/ X static Colormap currColormap = None; static Window currColormapWindow = NULL; static ClassColormap classColormap; X X/*************************************************************************** X* private functions X***************************************************************************/ X X/* X * eventDestroy - handle destroy events on the colormap window X */ static int eventDestroy(dpy, event, winInfo) Display *dpy; XXEvent *event; WinColormap *winInfo; X{ X Client *cli; X List *cli_list = winInfo->core.colormapClients; X List **win_list; X WinGeneric *newfocuswin; X X /* X * For every client in this window's client list, search that client's X * window list and remove this window from it. X */ X for (cli = ListEnum(&cli_list); cli != NULL; cli = ListEnum(&cli_list)) { X win_list = &(cli->colormapWins); X while (*win_list != NULL) { X if ((*win_list)->value == winInfo) { X ListDestroyCell(win_list); X break; X } X win_list = &((*win_list)->next); X } X if (ColorFocusLocked && ColorFocusWindow == winInfo && X ColorFocusClient == cli) { X if (cli->colormapWins) X newfocuswin = cli->colormapWins->value; X else X newfocuswin = (WinGeneric *) PANEOFCLIENT(cli); X InstallColormap(dpy, newfocuswin); X } X } X X ListDestroy(winInfo->core.colormapClients); X winInfo->core.colormapClients = NULL_LIST; X (WinFunc(winInfo,core.destroyfunc))(dpy, winInfo); X} X X X/* X * eventEnterLeaveNotify - handle enter/leave notify events on the colormap window X */ static int eventEnterLeaveNotify(dpy, event, winInfo) Display *dpy; XXEvent *event; WinColormap *winInfo; X{ X if (event->xany.type == EnterNotify) X ColorWindowCrossing(dpy, event, winInfo); X} X X X/* X * eventUnmapNotify - handle the unmapping of a colormap window X */ static int eventUnmapNotify(dpy, event, winInfo) Display *dpy; XXEvent *event; WinColormap *winInfo; X{ X if (ColorFocusWindow == (WinGeneric *)winInfo && !ColorFocusLocked) { X InstallPointerColormap(dpy, None, 0, 0, False); X } X} X X X/* X * eventColormapNotify X * X * Handle changes to this window's colormap attribute. If this window had the X * colormap focus, install the new colormap. X */ static int eventColormapNotify(dpy, event, winInfo) X Display *dpy; X XEvent *event; X WinColormap *winInfo; X{ X void ColormapChange(); X X ColormapChange(dpy, event, (WinGeneric *)winInfo); X} X X X/* X * DestroyColormap -- destroy the colormap window resources and free any allocated X * data. X */ static int destroyColormap(dpy, winInfo) Display *dpy; WinGeneric *winInfo; X{ X#ifdef DEBUG X if (winInfo->core.colormapClients != NULL_LIST) X puts("warning: destroying cmap window with non-null client list"); X#endif /* DEBUG */ X X /* free our data and throw away window */ X /* REMIND this test is here to avoid problems with changing X * a colourmap window into a pane X */ X if (WIGetInfo(winInfo->core.self) == winInfo) X WIUninstallInfo(winInfo->core.self); X MemFree(winInfo); X} X X/*************************************************************************** X* global functions X***************************************************************************/ X X/* X * InstallColormap X * X * Install the colormap for the given window. If the window's colormap X * attribute is None, install the default colormap instead. This can occur if X * a client creates a window, sets its colormap attribute to a particular X * colormap, and then destroys that colormap. X */ void InstallColormap(dpy, winInfo) X Display *dpy; X WinGeneric *winInfo; X{ X Colormap cmap = winInfo->core.colormap; X X if (cmap == None) { X Client *cli = winInfo->core.client; X if (cli == NULL) X cmap = DefaultColormap(dpy, DefaultScreen(dpy)); X else { X WinRoot *root = WIGetInfo(RootWindow(cli->dpy, cli->screen)); X cmap = root->core.colormap; X } X } X X XInstallColormap(dpy, cmap); X ColorFocusWindow = winInfo; X} X X X/* X * InstallPointerColormap X * X * Install the colormap for the leafmost window that we know about that X * encloses the pointer. The boolean setfocusclient indicates whether to set X * the colormap focus client to this window's client. If root is None, we do X * a QueryPointer to find out where the pointer is instead of using the rootx X * and rooty values. X */ void InstallPointerColormap(dpy, root, rootx, rooty, setfocusclient) X Display *dpy; X Window root; X int rootx, rooty; X Bool setfocusclient; X{ X Window src; X Window dest; X Window child; X int srcx; X int srcy; X int destx, desty; X WinGeneric *wi = NULL; X WinGeneric *t; X X if (root == None) { X Window child; X unsigned int state; X int junkx, junky; X X /* We want only the root, rootx, and rooty; we throw the rest away */ X XQueryPointer(dpy, DefaultRootWindow(dpy), &root, &child, X &rootx, &rooty, &junkx, &junky, &state); X } X X src = root; X dest = root; X srcx = rootx; X srcy = rooty; X X while (1) { X (void) XTranslateCoordinates(dpy, src, dest, srcx, srcy, X &destx, &desty, &child); X t = WIGetInfo(dest); X if (t != NULL) X wi = t; X if (child == None) X break; X src = dest; X dest = child; X srcx = destx; X srcy = desty; X } X /* X * At this point, dest contains the leafmost window that encloses the X * pointer, and wi points to the window structure of the leafmost known X * window that encloses the pointer. X */ X X /* if we didn't find a window we know about, use the root instead */ X X if (wi == NULL) { X wi = WIGetInfo(root); X if (wi == NULL) X return; X } X X /* X * If we are over a frame, its window button, or its resize corners, X * use the head of the pane's colormap window list, or the pane itself if X * it has no list. X */ X switch (wi->core.kind) { X case WIN_FRAME: X case WIN_RESIZE: X case WIN_PUSHPIN: X case WIN_WINBUTTON: X if (wi->core.client->colormapWins) X wi = wi->core.client->colormapWins->value; X else X wi = (WinGeneric *) PANEOFCLIENT(wi->core.client); X break; X default: X break; X } X InstallColormap(dpy, wi); X X if (setfocusclient) { X if (wi->core.colormapClients) { X /* REMIND if multiple clients, use just the first one */ X ColorFocusClient = (Client *) wi->core.colormapClients->value; X } else if (wi->core.client) { X ColorFocusClient = wi->core.client; X } else { X ColorFocusClient = NULL; X } X ColorFocusLocked = True; X } X} X X X/* X * UnlockColormap X * X * Turn off colormap-locked mode. X */ void UnlockColormap(dpy) X Display *dpy; X{ X ColorFocusClient = NULL; X ColorFocusLocked = False; X InstallPointerColormap(dpy, None, 0, 0, False); X} X X X/* X * ColormapChange X * X * Handle a change to a window's colormap attribute. X */ void ColormapChange(dpy, event, winInfo) X Display *dpy; X XEvent *event; X WinGeneric *winInfo; X{ X if (event->xcolormap.new) { X winInfo->core.colormap = event->xcolormap.colormap; X if (winInfo == ColorFocusWindow) X InstallColormap(dpy, winInfo); X } X} X X X/* X * ColorWindowCrossing X * X * Handle colormap installation on crossing events. If we are not in X * colormap-locked mode, install the window's colormap. X */ void ColorWindowCrossing(dpy, event, winInfo) X Display *dpy; X XEvent *event; X WinGeneric *winInfo; X{ X if (!ColorFocusLocked) X InstallColormap(dpy, winInfo); X} X X X/* X * TrackSubwindows -- check for the WM_COLORMAP_WINDOWS prop X * on a pane, if it exists, track the subwindows. X */ void TrackSubwindows(cli) X Client *cli; X{ X Display *dpy = cli->dpy; X Window pane = PANEWINOFCLIENT(cli); X unsigned long nItems, remain; X Window *cmapwindata; X List **last; X List *oldlist; X List *l; X WinGeneric *cmwi; X int i; X Bool paneseen = False; X X oldlist = cli->colormapWins; X cli->colormapWins = NULL_LIST; X X cmapwindata = GetWindowProperty(dpy, pane, AtomColorMapWindows, 0L, X 1000000L, XA_WINDOW, 32, &nItems, &remain); X if (cmapwindata == NULL) X { X return; X } X X /* X * Register all the windows on the new list, taking care to not touch any X * window that was on the old list, while getting rid of windows not on X * the new list. This is a three-step process: X * X * 1. Mark all old windows using the "tag" field. X * X * 2. Run through the new list. If we encounter a marked window, X * we know it was on the old list; unmark it. For other windows, X * we add the client to window's client list. If we didn't see the X * pane window on the new list, add it to the front, and deal with it X * as for any other window. X * X * 3. Any marked window on the old list is not on the new list. Run X * through the old list and, for each unmarked window, remove this X * client from that window's client list. Further, if this leaves no X * clients on the window's client list, and this window is a colormap X * window, destroy it. X */ X X l = oldlist; X for (cmwi = ListEnum(&l); cmwi != NULL; cmwi = ListEnum(&l)) X cmwi->core.tag = True; X X last = &cli->colormapWins; X for (i=0; i<nItems; ++i) { X paneseen = (paneseen || (cmapwindata[i] == pane)); X cmwi = WIGetInfo(cmapwindata[i]); X if (cmwi == NULL) { X cmwi = MakeColormap(cli, cmapwindata[i]); X } else { X if (cmwi->core.tag) { X cmwi->core.tag = False; X } else X WinAddColorClient(cmwi, cli); X } X (*last) = ListCons(cmwi, NULL_LIST); X last = &((*last)->next); X } X XFree(cmapwindata); X X if (!paneseen) { X WinGenericPane *paneinfo = PANEOFCLIENT(cli); X X cli->colormapWins = ListCons(paneinfo, cli->colormapWins); X if (paneinfo->core.tag) { X /* pane was on the old list, but not on the new */ X paneinfo->core.tag = False; X } else { X WinAddColorClient(paneinfo, cli); X } X } X X l = oldlist; X for (cmwi = ListEnum(&l); cmwi != NULL; cmwi = ListEnum(&l)) { X if (cmwi->core.tag) X WinRemoveColorClient(dpy, cmwi, cli); X } X ListDestroy(oldlist); X X /* install colormaps as necessary */ X X if (!ColorFocusLocked) { X InstallPointerColormap(dpy, None, 0, 0, False); X } else if (ColorFocusClient == cli) { X if (cli->colormapWins) X InstallColormap(dpy, (WinGeneric *)cli->colormapWins->value); X else X InstallColormap(dpy, PANEOFCLIENT(cli)); X } X} X X X/* X * UnTrackSubwindows -- stop tracking all subwindows. The Bool destroyed X * indicates that this client is being destroyed. If so, this client loses X * the colormap focus. If not, the color focus window is transferred to this X * client's pane. X */ void UnTrackSubwindows(cli, destroyed) X Client *cli; X Bool destroyed; X{ X WinGeneric *wi; X List *l; X X l = cli->colormapWins; X for (wi = ListEnum(&l); wi != NULL; wi = ListEnum(&l)) X WinRemoveColorClient(cli->dpy, wi, cli); X ListDestroy(cli->colormapWins); X cli->colormapWins = NULL_LIST; X X if (ColorFocusClient == cli) { X if (destroyed) { X ColorFocusClient = NULL; X if (GRV.ColorFocusLocked) { X /* lock in the root's colormap */ X InstallColormap(cli->dpy, X WIGetInfo(DefaultRootWindow(cli->dpy))); X } else { X /* revert to follow-mouse */ X ColorFocusLocked = False; X InstallPointerColormap(cli->dpy, None, 0, 0, False); X } X } else { X InstallColormap(cli->dpy, PANEOFCLIENT(cli)); X } X } X} X X X/* X * MakeColormap -- create the colormap window. Return a WinGeneric structure. X */ WinColormap * MakeColormap(cli,win) Client *cli; Window win; X{ X WinColormap *w; X XWindowAttributes winAttr; X X if (XGetWindowAttributes(cli->dpy, win, &winAttr) == 0) X return NULL; X X /* create the associated structure */ X w = MemNew(WinColormap); X w->class = &classColormap; X w->core.self = win; X w->core.kind = WIN_COLORMAP; X w->core.client = cli; X w->core.colormap = winAttr.colormap; X w->core.colormapClients = ListCons(cli, NULL_LIST); X X /* start paying attention to enter/exits on the win */ X XSelectInput(cli->dpy, win, X EnterWindowMask | ColormapChangeMask | X StructureNotifyMask); X X /* register the window */ X WIInstallInfo(w); X X return w; X} X X void ColormapInit(dpy) Display *dpy; X{ X classColormap.core.kind = WIN_COLORMAP; X classColormap.core.xevents[DestroyNotify] = eventDestroy; X classColormap.core.xevents[EnterNotify] = eventEnterLeaveNotify; X classColormap.core.xevents[LeaveNotify] = eventEnterLeaveNotify; X classColormap.core.xevents[UnmapNotify] = eventUnmapNotify; X classColormap.core.xevents[ColormapNotify] = eventColormapNotify; X classColormap.core.focusfunc = NULL; X classColormap.core.drawfunc = NULL; X classColormap.core.destroyfunc = destroyColormap; X classColormap.core.selectfunc = NULL; X classColormap.core.newconfigfunc = NULL; X classColormap.core.newposfunc = NULL; X classColormap.core.setconfigfunc = NULL; X classColormap.core.createcallback = NULL; X classColormap.core.heightfunc = NULL; X classColormap.core.widthfunc = NULL; X} X X void ColorFocusInit(dpy, root) X Display *dpy; X WinGeneric *root; X{ X InstallColormap(dpy, root); X ColorFocusClient = NULL; X ColorFocusLocked = GRV.ColorFocusLocked; X} X X/* The following two functions are used when a pane is being mapped, to X * handle the possibility that a pane has already been named as a X * colourmap window before it was mapped. X */ X X/* ColormapUnhook -- Given a window, if exists as a colourmap X * window, remove it from the event dispatching lookup table X * and return a pointer to the window structure. X */ WinColormap * ColormapUnhook(w) Window w; X{ X WinColormap *win; X X win = WIGetInfo(w); X if (win != NULL) X { X if (win->core.kind == WIN_COLORMAP) X { X WIUninstallInfo(w); X } X else X { X win = NULL; X } X } X return win; X} X X/* ColormapTransmogrify -- Take a previously-saved colourmap window X * structure, which has been superceded by a pane window structure, X * and patch up client-to-window references to point to the X * pane window structure. When done, destroy the colourmap X * window structure. X */ void ColormapTransmogrify(winc, winp) WinColormap *winc; WinPane *winp; X{ X Client *cli; X List *cli_list; X List *win_list; X X if (winc == NULL) X return; X X /* X * For every client in the colourmap window's client list, search that X * client's window list and change the reference. X */ X cli_list = winc->core.colormapClients; X for (cli = ListEnum(&cli_list); cli != NULL; cli = ListEnum(&cli_list)) { X win_list = cli->colormapWins; X while (win_list != NULL) { X if (win_list->value == winc) { X win_list->value = winp; X break; X } X win_list = win_list->next; X } X } X X /* patch up other pointers */ X if (ColorFocusWindow == winc) X ColorFocusWindow = (WinGeneric *)winp; X#ifdef NOTDEF X /* REMIND check that this next statement is correct */ X if (ColorFocusClient == winc->core.client) X ColorFocusClient = winp->core.client; X#endif X X winp->core.colormapClients = winc->core.colormapClients; X winc->core.colormapClients = NULL_LIST; X X /* the colourmap window can now be destroyed since all references X * to it have been removed. X */ X (WinFunc(winc,core.destroyfunc))(winc->core.client->dpy, winc); X} END_OF_FILE if test 17497 -ne `wc -c <'wincolor.c'`; then echo shar: \"'wincolor.c'\" unpacked with wrong size! fi # end of 'wincolor.c' fi echo shar: End of archive 7 \(of 16\). cp /dev/null ark7isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 16 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Dan Heller O'Reilly && Associates Z-Code Software Comp-sources-x: Senior Writer President comp-sources.x@uunet.uu.net argv@ora.com argv@zipcode.com