From: Branden Robinson Date: Sun, 6 Nov 2005 00:35:41 +0000 (+0000) Subject: Import vtwm_5.4.7.orig.tar.gz X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f72ceed5dbbe14bb38e6b07adf7759e2f4c7dbe8;p=vtwm.git Import vtwm_5.4.7.orig.tar.gz [dgit import orig vtwm_5.4.7.orig.tar.gz] --- f72ceed5dbbe14bb38e6b07adf7759e2f4c7dbe8 diff --git a/INSTALL b/INSTALL new file mode 120000 index 0000000..1f38889 --- /dev/null +++ b/INSTALL @@ -0,0 +1 @@ +doc/INSTALL \ No newline at end of file diff --git a/Imakefile b/Imakefile new file mode 100644 index 0000000..72db51e --- /dev/null +++ b/Imakefile @@ -0,0 +1,197 @@ +#ifndef XCOMM +#define XCOMM # +#endif + +XCOMM $XConsortium: Imakefile,v 1.33 91/07/17 00:48:06 gildea Exp $ +XCOMM +XCOMM Here is an Imakefile for VTWM. +XCOMM I like to use Imakefiles for everything, and I am sure other +XCOMM people do also, so perhaps you could do us all a favor and +XCOMM distribute this one. + +XCOMM =============== Start of common editables ===================== + +XCOMM To omit XPM image support, uncomment this +XCOMM NO_XPM_SUPPORT = -DNO_XPM_SUPPORT +XCOMM and comment these + XPMLIB = -lXpm + XPMINC = +XCOMM (version 3.4h of the XPM library is the earliest supported I know of) + +XCOMM To omit regular expressions ("RE"s) support, uncomment this +XCOMM NO_REGEX_SUPPORT = -DNO_REGEX_SUPPORT +XCOMM and comment these + REGEXLIB = + REGEXINC = +XCOMM (the library must conform to the POSIX 1003.2 specification) + +XCOMM To omit sound support, uncomment this +XCOMM NO_SOUND_SUPPORT = -DNO_SOUND_SUPPORT +XCOMM and comment these +SOUNDLIB = -L/usr/local/lib -lrplay +SOUNDINC = -I/usr/local/include +XCOMM (sound is supported only by way of the rplay library) + +XCOMM To omit Internationalization support, uncomment this +XCOMM NO_I18N_SUPPORT = -DNO_I18N_SUPPORT + +XCOMM To omit m4 pre-processing of resource files, uncomment this +XCOMM NO_M4_SUPPORT = -DNO_M4_SUPPORT + +XCOMM To omit platform and build info in the version window, uncomment this +XCOMM NO_BUILD_INFO = -DNO_BUILD_INFO + +XCOMM For lexers that don't track line numbers, uncomment this +XCOMM NEED_YYLINENO_V = -DNEED_YYLINENO_V + +XCOMM For those systems that don't have putenv(), uncomment this +XCOMM NEED_PUTENV_F = -DNEED_PUTENV_F + +XCOMM For those systems that require sys/select.h, uncomment this +XCOMM NEED_SELECT_H = -DNEED_SELECT_H + +XCOMM For those systems that require process.h, uncomment this +XCOMM NEED_PROCESS_H = -DNEED_PROCESS_H + +XCOMM Installation path for the binary + VTWMBINDIR = $(BINDIR) + +XCOMM Installation path for the system resource file + VTWMLIBDIR = $(LIBDIR)/twm + +XCOMM Installation path for the man page + VTWMMANDIR = $(MANDIR) + +XCOMM For the traditional look of TWM as the system fallback, +XCOMM change this to "2D" + SYS_VTWMRC_LOOK = 3D + +XCOMM ================ End of common editables ====================== + +XCOMM ============= Start of less common editables ================== + +XCOMM Handy for developers to check man page editions +XCOMM (see the end of this file) + DEROFF = deroff + DW = dw + SPELL = spell + +XCOMM Required to generate HTML or Postscript versions of the man page +XCOMM (see the end of this file) + MAN2HTML = man2html + MAN2PS = man2ps + +XCOMM ============== End of less common editables =================== + +XCOMM ========= Editing below here should not be necessary ========== + + YFLAGS = -d + DEPLIBS = $(DEPXMULIB) $(DEPEXTENSIONLIB) $(DEPXLIB) + LOCAL_LIBRARIES = $(LEXLIB) $(XPMLIB) $(REGEXLIB) $(SOUNDLIB) \ + $(XMULIB) $(EXTENSIONLIB) $(XLIB) + LINTLIBS = $(LINTXMU) $(LINTEXTENSIONLIB) $(LINTXLIB) + EXTRA_INCLUDES = $(XPMINC) $(REGEXINC) $(SOUNDINC) + DEFINES = $(SIGNAL_DEFINES) $(NO_XPM_SUPPORT) $(NO_REGEX_SUPPORT) \ + $(NO_SOUND_SUPPORT) $(NO_I18N_SUPPORT) $(NO_M4_SUPPORT) + + SRCS = gram.c lex.c deftwmrc.c add_window.c gc.c list.c \ + twm.c sound.c parse.c menus.c events.c resize.c util.c \ + version.c iconmgr.c cursor.c regions.c applets.c \ + icons.c desktop.c doors.c lastmake.c + + OBJS = gram.o lex.o deftwmrc.o add_window.o gc.o list.o \ + twm.o sound.o parse.o menus.o events.o resize.o util.o \ + version.o iconmgr.o cursor.o regions.o applets.o \ + icons.o desktop.o doors.o lastmake.o + +AllTarget(vtwm) + +SpecialObjectRule(menus.o,gram.h,$(NO_BUILD_INFO) $(NEED_PROCESS_H)) + +SpecialObjectRule(util.o,gram.h,$(NEED_PUTENV_F)) + +SpecialObjectRule(events.o,gram.h,$(NEED_SELECT_H)) + +SpecialObjectRule(parse.o,gram.h,$(NEED_YYLINENO_V) \ +'-DSYSTEM_VTWMRC="'$(VTWMLIBDIR)'/system.vtwmrc"' \ +'-DSYSTEM_TWMRC="'$(VTWMLIBDIR)'/system.twmrc"') + +SpecialObjectRule(add_window.o applets.o icons.o \ +list.o regions.o sound.o twm.o,gram.h,NullParameter) + +NormalProgramTarget(vtwm,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES),NullParameter) + +InstallProgram(vtwm,$(VTWMBINDIR)) +InstallManPage(vtwm,$(VTWMMANDIR)) +InstallNonExecFile(system.vtwmrc,$(VTWMLIBDIR)) + +depend:: lex.c gram.c deftwmrc.c lastmake.c vtwm.man + +all:: + $(RM) deftwmrc.* lastmake.* + +install:: + $(RM) deftwmrc.* lastmake.* + $(MAKE) install.man + +clean:: + $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c \ + lastmake.c system.vtwmrc vtwm.dw vtwm.ser vtwm.html vtwm.ps vtwm.man + +gram.h gram.c: gram.y + $(YACC) $(YFLAGS) gram.y + $(MV) y.tab.c gram.c + $(MV) y.tab.h gram.h + +deftwmrc.c: system.vtwmrc + $(RM) $@ + echo '/* ' >>$@ + echo ' * This file is generated automatically from the default' >>$@ + echo ' * VTWM bindings file system.vtwmrc.'$(SYS_VTWMRC_LOOK)' by the VTWM Makefile.' >>$@ + echo ' */' >>$@ + echo '' >>$@ + echo 'char *defTwmrc[] = {' >>deftwmrc.c + sed -e '/^$$/d' -e '/^#/d' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/",/' -e 's/[ ]\{1,\}/ /g' -e 's/^" /"/' system.vtwmrc >>$@ + echo '(char *)0 };' >>$@ + +lastmake.c: + $(RM) $@ + echo '/* ' >>$@ + echo ' * This file is generated automatically by the VTWM Makefile.' >>$@ + echo ' */' >>$@ + echo '' >>$@ + echo 'char *lastmake[] = {' >>lastmake.c + echo ' "Platform: '`uname -r -s`'",' >>$@ + echo ' "Build: '`date`'",' >>$@ + echo ' "" };' >>$@ + +system.vtwmrc: + $(RM) $@ + $(CP) $@.$(SYS_VTWMRC_LOOK) $@ + +vtwm.man: + $(RM) $@ + $(LN) doc/$@ $@ + +XCOMM Handy for developers to check the man page +dw vtwm.dw: vtwm.man + $(DEROFF) vtwm.man | $(DW) >vtwm.dw + @if test -s vtwm.dw ; \ + then \ + echo Doubled words in vtwm.man ... ; \ + cat vtwm.dw ; \ + fi +spell vtwm.ser: vtwm.man vtwm.sok + $(DEROFF) vtwm.man | $(SPELL) +vtwm.sok >vtwm.ser + @if test -s vtwm.ser ; \ + then \ + echo Spelling exceptions in vtwm.man ... ; \ + cat vtwm.ser ; \ + fi + +XCOMM If you wish to generate HTML or Postscript versions of the man page, +XCOMM enter 'make vtwm.html' or 'make vtwm.ps' +vtwm.html: vtwm.man + $(MAN2HTML) vtwm.man +vtwm.ps: vtwm.man + $(MAN2PS) < $< >$@ diff --git a/Makefile.QNX b/Makefile.QNX new file mode 100644 index 0000000..f0ff874 --- /dev/null +++ b/Makefile.QNX @@ -0,0 +1,223 @@ + +# Here is a makefile for VTWM. +# +# It's a hand-tweaked version of the makefile made with xmkmf, +# it may prove useful as a template for those who don't have xmkmf. +# +# This makefile guarantees that the build info is absolutely current. +# +# djhjr + +# =============== Start of common editables ===================== + +# To omit XPM image support, uncomment this +#XPM_DEFINE = -DNO_XPM_SUPPORT +# and comment these +XPMLIB = -lXpm +XPMINC = +# (version 3.4h of the XPM library is the earliest supported I know of) + +# To omit regular expressions ("RE"s) support, uncomment this +#REGEX_DEFINE = -DNO_REGEX_SUPPORT +# and comment these +REGEXLIB = +REGEXINC = +# (the library must conform to the POSIX 1003.2 specification) + +# To omit sound support. uncomment this +SOUND_DEFINE = -DNO_SOUND_SUPPORT +# and comment these +#SOUNDLIB = -L/usr/local/lib -lrplay +#SOUNDINC = -I/usr/local/include +# (sound is supported only by way of the rplay library) + +# To omit Internationalization support, uncomment this +I18N_DEFINE = -DNO_I18N_SUPPORT + +# To omit m4 pre-processing of resource files, uncomment this +#M4_DEFINE = -DNO_M4_SUPPORT + +# To omit platform and build info in the version window, uncomment this +#INFO_DEFINE = -DNO_BUILD_INFO + +# For lexers that don't track line numbers, uncomment this +YYLINENO_DEFINE = -DNEED_YYLINENO_V + +# For those systems that don't have putenv(), uncomment this +PUTENV_DEFINE = -DNEED_PUTENV_F + +# For those systems that require sys/select.h, uncomment this +SELECT_DEFINE = -DNEED_SELECT_H + +# For those systems that require process.h, uncomment this +PROCESS_DEFINE = -DNEED_PROCESS_H + +# Installation path for the binary +VTWMBINDIR = /usr/bin/X11 + +# Installation path for the system resource file +VTWMLIBDIR = /usr/lib/X11/twm + +# Installation path for the man page +VTWMMANDIR = /usr/man/mann + +# For the traditional look of TWM as the system fallback, +# change this to "2D" +SYS_VTWMRC_LOOK = 3D + +CDEBUGFLAGS = -w4 -M +CCOPTIONS = -Otx -zp1 -mf -b -j -Wc,-s -N32k + +# ================ End of common editables ====================== + +# ============= Start of less common editables ================== + +CP = cp -f +MV = mv -f +RM = rm -f +LN = ln -fs +CC = cc +LEX = lex +YACC = yacc + +YFLAGS = -d + +USRLIBDIR = /usr/lib/X11 + +# Handy for developers to check man page editions +# (see the end of this file) +DEROFF = deroff +DW = dw +SPELL = spell + +# Required to generate HTML or Postscript versions of the man page +# (see the end of this file) +MAN2HTML = man2html +MAN2PS = man2ps + +# ============== End of less common editables =================== + +# ========= Editing below here should not be necessary ========== + +XMULIB = -lXmu +XTOOLLIB = +EXTENSIONLIB = -lXext +XLIB = $(EXTENSIONLIB) -lX11_s + +LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) $(XLIB) \ + $(XPMLIB) $(REGEXLIB) $(SOUNDLIB) +EXTRA_LIBRARIES = -lXqnx -lsocket +LDLIBS = $(LOCAL_LIBRARIES) $(EXTRA_LIBRARIES) + +INCLUDES = +EXTRA_INCLUDES = $(XPMINC) $(REGEXINC) $(SOUNDINC) +STD_INCLUDES = + +ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(STD_INCLUDES) + +STD_DEFINES = -D__QNX__ -DMetroLink -DSTRINGS_ALIGNED -DNO_REGEX \ + -DBOGUS_MB_MAX +EXTRA_DEFINES = $(XPM_DEFINE) $(SOUND_DEFINE) $(REGEX_DEFINE) \ + $(I18N_DEFINE) $(M4_DEFINE) $(INFO_DEFINE) \ + $(YYLINENO_DEFINE) $(PUTENV_DEFINE) $(SELECT_DEFINE) \ + $(PROCESS_DEFINE) +PROTO_DEFINES = + +ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) + +CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) -L$(USRLIBDIR) + +SRCS = gram.c lex.c deftwmrc.c add_window.c gc.c list.c twm.c sound.c \ + parse.c menus.c events.c resize.c util.c version.c iconmgr.c \ + cursor.c regions.c applets.c icons.c desktop.c doors.c lastmake.c + +OBJS = gram.o lex.o deftwmrc.o add_window.o gc.o list.o twm.o sound.o \ + parse.o menus.o events.o resize.o util.o version.o iconmgr.o \ + cursor.o regions.o applets.o icons.o desktop.o doors.o lastmake.o + +PROGRAM = vtwm + +all: vtwm + +depend: lex.c gram.c deftwmrc.c lastmake.c + +install: + $(CP) $(PROGRAM) $(VTWMBINDIR) + $(CP) system.vtwmrc $(VTWMLIBDIR) + $(CP) doc/vtwm.man $(VTWMMANDIR) + +clean: + $(RM) $(PROGRAM) *.o *.b *.err *.map y.tab.h y.tab.c lex.yy.c \ + gram.h gram.c lex.c deftwmrc.c lastmake.c system.vtwmrc \ + vtwm.dw vtwm.ser vtwm.html vtwm.ps + +vtwm: $(OBJS) + $(RM) $@ + $(CC) -o $@ $(OBJS) $(CFLAGS) $(LDLIBS) + $(RM) deftwmrc.* lastmake.* + +parse.o: gram.h + $(RM) $@ + $(CC) -c $(CFLAGS) '-DSYSTEM_VTWMRC="'$(VTWMLIBDIR)'/system.vtwmrc"' \ + '-DSYSTEM_TWMRC="'$(VTWMLIBDIR)'/system.twmrc"' parse.c + +add_window.o applets.o events.o icons.o list.o menus.o \ +regions.o sound.o twm.o util.o: gram.h + $(RM) $@ + $(CC) -c $(CFLAGS) $*.c + +lex.o: gram.h + +gram.h gram.c: gram.y + $(YACC) $(YFLAGS) gram.y + $(MV) y.tab.c gram.c + $(MV) y.tab.h gram.h + +deftwmrc.c: system.vtwmrc + $(RM) $@ + echo '/* ' >>$@ + echo ' * This file is generated automatically from the default' >>$@ + echo ' * VTWM bindings file system.vtwmrc.'$(SYS_VTWMRC_LOOK)' by the VTWM Makefile.' >>$@ + echo ' */' >>$@ + echo '' >>$@ + echo 'char *defTwmrc[] = {' >>deftwmrc.c + sed -e '/^$$/d' -e '/^#/d' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/",/' -e 's/[ ]\{1,\}/ /g' -e 's/^" /"/' system.vtwmrc >>$@ + echo '(char *)0 };' >>$@ + +lastmake.c: + $(RM) $@ + echo '/* ' >>$@ + echo ' * This file is generated automatically by the VTWM Makefile.' >>$@ + echo ' */' >>$@ + echo '' >>$@ + echo 'char *lastmake[] = {' >>lastmake.c + echo ' "Platform: '`uname -r -s`'",' >>$@ + echo ' "Build: '`date`'",' >>$@ + echo ' "" };' >>$@ + +system.vtwmrc: + $(RM) $@ + $(CP) $@.$(SYS_VTWMRC_LOOK) $@ + +# Handy for developers to check the man page +dw vtwm.dw: doc/vtwm.man + $(DEROFF) doc/vtwm.man | $(DW) >vtwm.dw + @if test -s vtwm.dw ; \ + then \ + echo Doubled words in vtwm.man ... ; \ + cat vtwm.dw ; \ + fi +spell vtwm.ser: doc/vtwm.man vtwm.sok + $(DEROFF) doc/vtwm.man | $(SPELL) +vtwm.sok >vtwm.ser + @if test -s vtwm.ser ; \ + then \ + echo Spelling exceptions in vtwm.man ... ; \ + cat vtwm.ser ; \ + fi + +# If you wish to generate HTML or Postscript versions of the man page, +# enter 'make vtwm.html' or 'make vtwm.ps' +vtwm.html: doc/vtwm.man + $(MAN2HTML) doc/vtwm.man +vtwm.ps: doc/vtwm.man + $(MAN2PS) < $< >$@ diff --git a/add_window.c b/add_window.c new file mode 100644 index 0000000..1141cfe --- /dev/null +++ b/add_window.c @@ -0,0 +1,2558 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/********************************************************************** + * + * $XConsortium: add_window.c,v 1.153 91/07/10 13:17:26 dave Exp $ + * + * Add a new window, put the titlbar and other stuff around + * the window + * + * 31-Mar-88 Tom LaStrange Initial Version. + * + **********************************************************************/ + +#include +#include +#include "twm.h" +#include +#ifndef NO_XPM_SUPPORT +#include +#endif + +#include "add_window.h" +#include "util.h" +#include "resize.h" +#include "parse.h" + +/* djhjr - 4/19/96 */ +#include "gram.h" + +#include "list.h" +#include "events.h" +#include "menus.h" +#include "screen.h" +#include "iconmgr.h" +#include "desktop.h" + +/* random placement coordinates */ +#define PLACEMENT_START 50 +#define PLACEMENT_INCR 30 + +/* 4/26/99 - djhjr */ +extern int PlaceApplet(); + +#define gray_width 2 +#define gray_height 2 +static char gray_bits[] = { + 0x02, 0x01}; + +/* djhjr - 4/19/96 */ +static unsigned char black_bits[] = { + 0xFF, 0xFF}; + +int AddingX; +int AddingY; +int AddingW; +int AddingH; + +static void CreateWindowTitlebarButtons(); +void SetHighlightPixmap(); + +/* djhjr - 4/14/98 */ +static void AddMoveAndResize(); + +char NoName[] = "Untitled"; /* name if no name is specified */ + + +/************************************************************************ + * + * Procedure: + * GetGravityOffsets - map gravity to (x,y) offset signs for adding + * to x and y when window is mapped to get proper placement. + * + ************************************************************************ + */ + +void GetGravityOffsets (tmp, xp, yp) + TwmWindow *tmp; /* window from which to get gravity */ + int *xp, *yp; /* return values */ +{ + static struct _gravity_offset { + int x, y; + } gravity_offsets[11] = { + { 0, 0 }, /* ForgetGravity */ + { -1, -1 }, /* NorthWestGravity */ + { 0, -1 }, /* NorthGravity */ + { 1, -1 }, /* NorthEastGravity */ + { -1, 0 }, /* WestGravity */ + { 0, 0 }, /* CenterGravity */ + { 1, 0 }, /* EastGravity */ + { -1, 1 }, /* SouthWestGravity */ + { 0, 1 }, /* SouthGravity */ + { 1, 1 }, /* SouthEastGravity */ + { 0, 0 }, /* StaticGravity */ + }; + register int g = ((tmp->hints.flags & PWinGravity) + ? tmp->hints.win_gravity : NorthWestGravity); + + if (g < ForgetGravity || g > StaticGravity) { + *xp = *yp = 0; + } else { + *xp = gravity_offsets[g].x; + *yp = gravity_offsets[g].y; + } +} + + +/*********************************************************************** + * + * Procedure: + * AddWindow - add a new window to the twm list + * + * Returned Value: + * (TwmWindow *) - pointer to the TwmWindow structure + * + * Inputs: + * w - the window id of the window to add + * iconm - flag to tell if this is an icon manager window + * iconp - pointer to icon manager struct + * + *********************************************************************** + */ + +TwmWindow * +AddWindow(w, iconm, iconp) +Window w; +int iconm; +IconMgr *iconp; +{ + TwmWindow *tmp_win; /* new twm window structure */ + unsigned long valuemask; /* mask for create windows */ + XSetWindowAttributes attributes; /* attributes for create windows */ +#ifdef NO_I18N_SUPPORT + XTextProperty text_property; +#endif + Atom actual_type; + int actual_format; + unsigned long nitems, bytesafter; + int ask_user; /* don't know where to put the window */ + int *ppos_ptr, ppos_on; /* djhjr - 9/24/02 */ + int gravx, gravy; /* gravity signs for positioning */ + int namelen; + int bw2; + char *icon_name; /* djhjr - 2/20/99 */ +#ifndef NO_I18N_SUPPORT + char *name; +#endif + /* next two submitted by Jonathan Paisley - 11/8/02 */ + Atom motifhints = XInternAtom( dpy, "_MOTIF_WM_HINTS", 0); + MotifWmHints *mwmhints; + +#ifdef DEBUG + fprintf(stderr, "AddWindow: w = 0x%x\n", w); +#endif + + /* allocate space for the twm window */ + tmp_win = (TwmWindow *)calloc(1, sizeof(TwmWindow)); + if (tmp_win == 0) + { + fprintf (stderr, "%s: Unable to allocate memory to manage window ID %lx.\n", + ProgramName, w); + return NULL; + } + tmp_win->w = w; + tmp_win->zoomed = ZOOM_NONE; + tmp_win->iconmgr = iconm; + tmp_win->iconmgrp = iconp; + tmp_win->cmaps.number_cwins = 0; + + XSelectInput(dpy, tmp_win->w, PropertyChangeMask); + XGetWindowAttributes(dpy, tmp_win->w, &tmp_win->attr); + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (I18N_FetchName(dpy, tmp_win->w, &name)) + { + tmp_win->name = strdup(name); + free(name); + } +#else + /* + * Ask the window manager for a name with "newer" R4 function - + * it was 'XFetchName()', which apparently failed more often. + * Submitted by Nicholas Jacobs + */ + if (XGetWMName(dpy, tmp_win->w, &text_property) != 0) + { + tmp_win->name = (char *)strdup(text_property.value); + XFree(text_property.value); + } +#endif + else + tmp_win->name = NoName; + + tmp_win->class = NoClass; + XGetClassHint(dpy, tmp_win->w, &tmp_win->class); + FetchWmProtocols (tmp_win); + FetchWmColormapWindows (tmp_win); + + /* + * do initial clip; should look at window gravity + */ + if (tmp_win->attr.width > Scr->MaxWindowWidth) + tmp_win->attr.width = Scr->MaxWindowWidth; + if (tmp_win->attr.height > Scr->MaxWindowHeight) + tmp_win->attr.height = Scr->MaxWindowHeight; + + tmp_win->wmhints = XGetWMHints(dpy, tmp_win->w); + if (tmp_win->wmhints && (tmp_win->wmhints->flags & WindowGroupHint)) + tmp_win->group = tmp_win->wmhints->window_group; + else + tmp_win->group = tmp_win->w/* NULL */; + + /* submitted by Jonathan Paisley - 11/8/02 */ + tmp_win->mwmhints.flags = 0; + if (motifhints != None) + { + if (XGetWindowProperty(dpy, tmp_win->w, motifhints, + 0L, sizeof(MotifWmHints), False, + motifhints, &actual_type, &actual_format, + &nitems, &bytesafter, + (unsigned char**)&mwmhints) == Success && actual_type != None) + { + if (mwmhints) + { + tmp_win->mwmhints = *mwmhints; + XFree(mwmhints); + } + } + } + + /* + * The July 27, 1988 draft of the ICCCM ignores the size and position + * fields in the WM_NORMAL_HINTS property. + */ + + tmp_win->transient = Transient(tmp_win->w, &tmp_win->transientfor); + + if (tmp_win->class.res_name == NULL) + tmp_win->class.res_name = NoName; + if (tmp_win->class.res_class == NULL) + tmp_win->class.res_class = NoName; + + tmp_win->full_name = tmp_win->name; + namelen = strlen (tmp_win->name); + + tmp_win->highlight = Scr->Highlight && +/* djhjr - 4/22/98 + (!(short)(int) LookInList(Scr->NoHighlight, tmp_win->full_name, + &tmp_win->class)); +*/ + (LookInList(Scr->NoHighlight, tmp_win->full_name, + &tmp_win->class) == (char *)NULL); + + tmp_win->stackmode = Scr->StackMode && +/* djhjr - 4/22/98 + (!(short)(int) LookInList(Scr->NoStackModeL, tmp_win->full_name, + &tmp_win->class)); +*/ + (LookInList(Scr->NoStackModeL, tmp_win->full_name, + &tmp_win->class) == (char *)NULL); + + tmp_win->titlehighlight = Scr->TitleHighlight && +/* djhjr - 4/22/98 + (!(short)(int) LookInList(Scr->NoTitleHighlight, tmp_win->full_name, + &tmp_win->class)); +*/ + (LookInList(Scr->NoTitleHighlight, tmp_win->full_name, + &tmp_win->class) == (char *)NULL); + + tmp_win->auto_raise = Scr->AutoRaiseDefault || /* RAISEDELAY */ +/* djhjr - 4/22/98 + (short)(int) LookInList(Scr->AutoRaise, tmp_win->full_name, + &tmp_win->class); +*/ + (LookInList(Scr->AutoRaise, tmp_win->full_name, + &tmp_win->class) != (char *)NULL); + if (tmp_win->auto_raise) Scr->NumAutoRaises++; + + tmp_win->iconify_by_unmapping = Scr->IconifyByUnmapping; + if (Scr->IconifyByUnmapping) + { +/* djhjr - 9/21/99 + tmp_win->iconify_by_unmapping = iconm ? FALSE : +*/ + tmp_win->iconify_by_unmapping = +/* djhjr - 4/22/98 + !(short)(int) LookInList(Scr->DontIconify, tmp_win->full_name, + &tmp_win->class); +*/ + (LookInList(Scr->DontIconify, tmp_win->full_name, + &tmp_win->class) == (char *)NULL); + } + tmp_win->iconify_by_unmapping |= +/* djhjr - 4/22/98 + (short)(int) LookInList(Scr->IconifyByUn, tmp_win->full_name, + &tmp_win->class); +*/ + (LookInList(Scr->IconifyByUn, tmp_win->full_name, + &tmp_win->class) != (char *)NULL); + + /* Scr->NoWindowRingL submitted by Jonathan Paisley - 10/27/02 */ + if ((Scr->UseWindowRing || + LookInList(Scr->WindowRingL, tmp_win->full_name, + &tmp_win->class)) && + LookInList(Scr->NoWindowRingL, tmp_win->full_name, + &tmp_win->class) == (char *)NULL) + { + /* in menus.c now - djhjr - 10/27/02 */ + AddWindowToRing(tmp_win); + } + else + tmp_win->ring.next = tmp_win->ring.prev = NULL; +#ifdef ORIGINAL_WARPRINGCOORDINATES /* djhjr - 5/11/98 */ + tmp_win->ring.cursor_valid = False; +#endif + + if (LookInList(Scr->NailedDown, tmp_win->full_name, &tmp_win->class)) + tmp_win->nailed = TRUE; + else + tmp_win->nailed = FALSE; + + if (LookInList(Scr->DontShowInDisplay, tmp_win->full_name, &tmp_win->class)) + tmp_win->showindesktopdisplay = FALSE; + else + tmp_win->showindesktopdisplay = TRUE; + + tmp_win->squeeze_info = NULL; + /* + * get the squeeze information; note that this does not have to be freed + * since it is coming from the screen list + */ + if (HasShape) { + if (!LookInList (Scr->DontSqueezeTitleL, tmp_win->full_name, + &tmp_win->class)) { + tmp_win->squeeze_info = (SqueezeInfo *) + LookInList (Scr->SqueezeTitleL, tmp_win->full_name, + &tmp_win->class); + if (!tmp_win->squeeze_info) { + static SqueezeInfo default_squeeze = { J_LEFT, 0, 0 }; + if (Scr->SqueezeTitle) + tmp_win->squeeze_info = &default_squeeze; + } + } + } + + tmp_win->old_bw = tmp_win->attr.border_width; + +#ifdef NEVER /* see the next '#ifdef NEVER's '#else' - C. F. Jalali */ + /* djhjr - 4/19/96 */ + /* was 'Scr->ThreeDBorderWidth' - djhjr - 8/11/98 */ + tmp_win->frame_bw3D = Scr->BorderWidth; +#endif + /* added 'Scr->NoBorders' test - djhjr - 8/23/02 */ + if (Scr->NoBorders || LookInList(Scr->NoBorder, tmp_win->full_name, &tmp_win->class)) + { + tmp_win->frame_bw = 0; + tmp_win->frame_bw3D = 0; + } + else +#ifdef NEVER + if (tmp_win->frame_bw3D != 0) + { + tmp_win->frame_bw = 0; + Scr->ClientBorderWidth = FALSE; + } + else + if (Scr->ClientBorderWidth) + tmp_win->frame_bw = tmp_win->old_bw; + else + tmp_win->frame_bw = Scr->BorderWidth; +#else + /* + * Submitted by Caveh Frank Jalali - 8/25/98 + */ + { + if (Scr->BorderBevelWidth > 0) + { + tmp_win->frame_bw3D = Scr->BorderWidth; + tmp_win->frame_bw = 0; + Scr->ClientBorderWidth = FALSE; + } + else + { + tmp_win->frame_bw3D = 0; + if (Scr->ClientBorderWidth) + tmp_win->frame_bw = tmp_win->old_bw; + else + tmp_win->frame_bw = Scr->BorderWidth; + } + } +#endif + + /* submitted by Jonathan Paisley - 11/8/02 */ + if (tmp_win->mwmhints.flags & MWM_HINTS_DECORATIONS) + { + if (tmp_win->mwmhints.decorations & MWM_DECOR_ALL) + tmp_win->mwmhints.decorations |= (MWM_DECOR_BORDER | + MWM_DECOR_RESIZEH | MWM_DECOR_TITLE | + MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | + MWM_DECOR_MAXIMIZE); + + if (!(tmp_win->mwmhints.decorations & MWM_DECOR_BORDER)) + tmp_win->frame_bw = tmp_win->frame_bw3D = 0; + } + if (tmp_win->mwmhints.flags & MWM_HINTS_FUNCTIONS) + if (tmp_win->mwmhints.functions & MWM_FUNC_ALL) + tmp_win->mwmhints.functions |= (MWM_FUNC_RESIZE | + MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE | + MWM_FUNC_MAXIMIZE | MWM_FUNC_CLOSE); + + bw2 = tmp_win->frame_bw * 2; + + /* moved MakeTitle under NoTitle - djhjr - 10/20/01 */ + tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw; + + /* submitted by Jonathan Paisley 11/8/02 */ + if (tmp_win->mwmhints.flags & MWM_HINTS_DECORATIONS && + !(tmp_win->mwmhints.decorations & MWM_DECOR_TITLE)) + tmp_win->title_height = 0; + + if (Scr->NoTitlebar) + tmp_win->title_height = 0; + if (LookInList(Scr->NoTitle, tmp_win->full_name, &tmp_win->class)) + tmp_win->title_height = 0; + if (LookInList(Scr->MakeTitle, tmp_win->full_name, &tmp_win->class)) + tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw; + + /* djhjr - 4/7/98 */ + if (LookInList(Scr->OpaqueMoveL, tmp_win->full_name, &tmp_win->class)) + tmp_win->opaque_move = TRUE; + else + tmp_win->opaque_move = Scr->OpaqueMove && +/* djhjr - 4/22/98 + !(short)(int)LookInList(Scr->NoOpaqueMoveL, tmp_win->full_name, &tmp_win->class); +*/ + (LookInList(Scr->NoOpaqueMoveL, tmp_win->full_name, + &tmp_win->class) == (char *)NULL); + + /* djhjr - 9/21/99 */ + if (tmp_win->opaque_move) tmp_win->attr.save_under = True; + + /* djhjr - 4/7/98 */ + if (LookInList(Scr->OpaqueResizeL, tmp_win->full_name, &tmp_win->class)) + tmp_win->opaque_resize = TRUE; + else + tmp_win->opaque_resize = Scr->OpaqueResize && +/* djhjr - 4/22/98 + !(short)(int)LookInList(Scr->NoOpaqueResizeL, tmp_win->full_name, &tmp_win->class); +*/ + (LookInList(Scr->NoOpaqueResizeL, tmp_win->full_name, + &tmp_win->class) == (char *)NULL); + + /* djhjr - 9/21/99 */ + if (tmp_win->opaque_resize) tmp_win->attr.save_under = True; + + /* if it is a transient window, don't put a title on it */ + if (tmp_win->transient && !Scr->DecorateTransients) + tmp_win->title_height = 0; + + if (LookInList(Scr->StartIconified, tmp_win->full_name, &tmp_win->class)) + { + if (!tmp_win->wmhints) + { + tmp_win->wmhints = (XWMHints *)malloc(sizeof(XWMHints)); + tmp_win->wmhints->flags = 0; + } + tmp_win->wmhints->initial_state = IconicState; + tmp_win->wmhints->flags |= StateHint; + } + + GetWindowSizeHints (tmp_win); + GetGravityOffsets (tmp_win, &gravx, &gravy); + + /* + * Don't bother user if: + * + * o the window is a transient, or + * + * o a USPosition was requested, or + * + * o a PPosition was requested and UsePPosition is ON or + * NON_ZERO if the window is at other than (0,0) + */ + + /* djhjr - 9/24/02 */ + if ((ppos_ptr = (int *)LookInList(Scr->UsePPositionL, + tmp_win->full_name, &tmp_win->class))) + ppos_on = *ppos_ptr; + else + ppos_on = Scr->UsePPosition; + if (ppos_on == PPOS_NON_ZERO && + (tmp_win->attr.x != 0 || tmp_win->attr.y != 0)) + ppos_on = PPOS_ON; + + ask_user = TRUE; + if (tmp_win->transient || + (tmp_win->hints.flags & USPosition) || + ((tmp_win->hints.flags & PPosition) && ppos_on == PPOS_ON)) + ask_user = FALSE; + + /* check for applet regions - djhjr - 4/26/99 */ + if (PlaceApplet(tmp_win, tmp_win->attr.x, tmp_win->attr.y, + &tmp_win->attr.x, &tmp_win->attr.y)) + ask_user = FALSE; + + if (LookInList(Scr->NailedDown, tmp_win->full_name, &tmp_win->class)) + tmp_win->nailed = TRUE; + else + tmp_win->nailed = FALSE; + + /* + * 25/09/90 - Nailed windows should always be on the real screen, + * regardless of PPosition or UPosition. If we are dealing with + * PPosition, then offset by the current real screen offset on the vd. + */ + if (tmp_win->nailed || + ((tmp_win->hints.flags & PPosition) && (ask_user == FALSE))) { + tmp_win->attr.x = R_TO_V_X(tmp_win->attr.x); + tmp_win->attr.y = R_TO_V_Y(tmp_win->attr.y); + } + +/* moved to after window prep and creation - djhjr - 4/14/98 + AddMoveAndResize(tmp_win, ask_user); +*/ + + if (!Scr->ClientBorderWidth) { /* need to adjust for twm borders */ + +/* djhjr - 4/19/96 + int delta = tmp_win->attr.border_width - tmp_win->frame_bw; +*/ +/* submitted by Jonathan Paisley - 11/8/02 + int delta = tmp_win->attr.border_width - tmp_win->frame_bw - tmp_win->frame_bw3D; +*/ + int delta = -(tmp_win->frame_bw + tmp_win->frame_bw3D); + + tmp_win->attr.x += gravx * delta; + tmp_win->attr.y += gravy * delta; + } + + /* + * For windows with specified non-northwest gravities. + * Submitted by Jonathan Paisley - 11/8/02 + */ + if (tmp_win->old_bw) { + if (!Scr->ClientBorderWidth) { + JunkX = gravx + 1; + JunkY = gravy + 1; + } else + JunkX = JunkY = 1; + + tmp_win->attr.x += JunkX * tmp_win->old_bw; + tmp_win->attr.y += JunkY * tmp_win->old_bw; + } + + tmp_win->title_width = tmp_win->attr.width; + + if (tmp_win->old_bw) XSetWindowBorderWidth (dpy, tmp_win->w, 0); + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + tmp_win->name_width = MyFont_TextWidth(&Scr->TitleBarFont, +#else + tmp_win->name_width = XTextWidth(Scr->TitleBarFont.font, +#endif + tmp_win->name, namelen); + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (!I18N_GetIconName(dpy, tmp_win->w, &icon_name)) +#else + /* used to be a simple boolean test for success - djhjr - 1/10/98 */ + if (XGetWindowProperty (dpy, tmp_win->w, XA_WM_ICON_NAME, 0L, 200L, False, + XA_STRING, &actual_type, &actual_format, &nitems, &bytesafter, + +/* see that the icon name is it's own memory - djhjr - 2/20/99 + (unsigned char **)&tmp_win->icon_name) != Success || actual_type == None) + tmp_win->icon_name = tmp_win->name; +*/ + (unsigned char **)&icon_name) != Success || actual_type == None) +#endif + tmp_win->icon_name = strdup(tmp_win->name); + else + { + tmp_win->icon_name = strdup(icon_name); +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + free(icon_name); +#else + XFree(icon_name); +#endif + } + +/* redundant? - djhjr - 1/10/98 + if (tmp_win->icon_name == NULL) + tmp_win->icon_name = tmp_win->name; +*/ + + tmp_win->iconified = FALSE; + tmp_win->icon = FALSE; + tmp_win->icon_on = FALSE; + + XGrabServer(dpy); + + /* + * Make sure the client window still exists. We don't want to leave an + * orphan frame window if it doesn't. Since we now have the server + * grabbed, the window can't disappear later without having been + * reparented, so we'll get a DestroyNotify for it. We won't have + * gotten one for anything up to here, however. + */ + if (XGetGeometry(dpy, tmp_win->w, &JunkRoot, &JunkX, &JunkY, + &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0) + { + free((char *)tmp_win); + XUngrabServer(dpy); + return(NULL); + } + + /* add the window into the twm list */ + tmp_win->next = Scr->TwmRoot.next; + if (Scr->TwmRoot.next != NULL) + Scr->TwmRoot.next->prev = tmp_win; + tmp_win->prev = &Scr->TwmRoot; + Scr->TwmRoot.next = tmp_win; + + /* get all the colors for the window */ + +/* djhjr - 4/25/96 + tmp_win->border = Scr->BorderColor; +*/ + tmp_win->border.back = Scr->BorderColor; + + tmp_win->icon_border = Scr->IconBorderColor; + tmp_win->border_tile.fore = Scr->BorderTileC.fore; + tmp_win->border_tile.back = Scr->BorderTileC.back; + tmp_win->title.fore = Scr->TitleC.fore; + tmp_win->title.back = Scr->TitleC.back; + tmp_win->iconc.fore = Scr->IconC.fore; + tmp_win->iconc.back = Scr->IconC.back; + tmp_win->virtual.fore = Scr->VirtualDesktopDisplayC.fore; + tmp_win->virtual.back = Scr->VirtualDesktopDisplayC.back; + +/* djhjr - 4/25/96 + GetColorFromList(Scr->BorderColorL, tmp_win->full_name, &tmp_win->class, + &tmp_win->border); +*/ + GetColorFromList(Scr->BorderColorL, tmp_win->full_name, &tmp_win->class, + &tmp_win->border.back); + + GetColorFromList(Scr->IconBorderColorL, tmp_win->full_name, &tmp_win->class, + &tmp_win->icon_border); + GetColorFromList(Scr->BorderTileForegroundL, tmp_win->full_name, + &tmp_win->class, &tmp_win->border_tile.fore); + GetColorFromList(Scr->BorderTileBackgroundL, tmp_win->full_name, + &tmp_win->class, &tmp_win->border_tile.back); + GetColorFromList(Scr->TitleForegroundL, tmp_win->full_name, &tmp_win->class, + &tmp_win->title.fore); + GetColorFromList(Scr->TitleBackgroundL, tmp_win->full_name, &tmp_win->class, + &tmp_win->title.back); + GetColorFromList(Scr->IconForegroundL, tmp_win->full_name, &tmp_win->class, + &tmp_win->iconc.fore); + GetColorFromList(Scr->IconBackgroundL, tmp_win->full_name, &tmp_win->class, + &tmp_win->iconc.back); + +/* fixed transposed fallback fore and back color lists - djhjr - 9/25/01 */ + if (!GetColorFromList(Scr->VirtualDesktopColorFL, tmp_win->full_name, + &tmp_win->class, &tmp_win->virtual.fore)) + GetColorFromList(Scr->TitleForegroundL, tmp_win->full_name, + &tmp_win->class, &tmp_win->virtual.fore); + if (!GetColorFromList(Scr->VirtualDesktopColorBL, tmp_win->full_name, + &tmp_win->class, &tmp_win->virtual.back)) + GetColorFromList(Scr->TitleBackgroundL, tmp_win->full_name, + &tmp_win->class, &tmp_win->virtual.back); + + /* djhjr - 4/19/96 */ + /* loosened up for titlebar-colored 3D buttons - djhjr - 4/1/98 + if (Scr->use3Dtitles && !Scr->BeNiceToColormap) + */ + if (!Scr->BeNiceToColormap) + GetShadeColors (&tmp_win->title); + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + /* rearranged the parenthesis - djhjr - 10/30/02 */ + if ((Scr->ButtonColorIsFrame || Scr->BorderBevelWidth > 0) && !Scr->BeNiceToColormap) + { + GetShadeColors (&tmp_win->border); + GetShadeColors (&tmp_win->border_tile); + } + + /* create windows */ + +/* djhjr - 4/19/96 + tmp_win->frame_x = tmp_win->attr.x + tmp_win->old_bw - tmp_win->frame_bw; + tmp_win->frame_y = tmp_win->attr.y - tmp_win->title_height + + tmp_win->old_bw - tmp_win->frame_bw; + tmp_win->frame_width = tmp_win->attr.width; + tmp_win->frame_height = tmp_win->attr.height + tmp_win->title_height; +*/ +/* done in AddMoveAndResize() - djhjr - 4/14/98 + tmp_win->frame_x = tmp_win->attr.x + tmp_win->old_bw - tmp_win->frame_bw + - tmp_win->frame_bw3D; + tmp_win->frame_y = tmp_win->attr.y - tmp_win->title_height + + tmp_win->old_bw - tmp_win->frame_bw - tmp_win->frame_bw3D; +*/ + tmp_win->frame_width = tmp_win->attr.width + 2 * tmp_win->frame_bw3D; + tmp_win->frame_height = tmp_win->attr.height + tmp_win->title_height + + 2 * tmp_win->frame_bw3D; +/* done in AddMoveAndResize() - djhjr - 4/14/98 + ConstrainSize (tmp_win, &tmp_win->frame_width, &tmp_win->frame_height); + + tmp_win->virtual_frame_x = R_TO_V_X(tmp_win->frame_x); + tmp_win->virtual_frame_y = R_TO_V_Y(tmp_win->frame_y); +*/ + +/* djhjr - 4/19/96 + valuemask = CWBackPixmap | CWBorderPixel | CWCursor | CWEventMask; + attributes.background_pixmap = None; + attributes.border_pixel = tmp_win->border; + attributes.cursor = Scr->FrameCursor; + attributes.event_mask = (SubstructureRedirectMask | + ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask); + if (tmp_win->attr.save_under) { + attributes.save_under = True; + valuemask |= CWSaveUnder; + } +*/ +/* djhjr - 9/14/96 + valuemask = CWBackPixmap | CWBorderPixel | CWCursor | CWEventMask | CWBackPixel; + attributes.background_pixmap = None; +*/ + valuemask = CWBorderPixel | CWCursor | CWEventMask | CWBackPixel; + + attributes.background_pixel = tmp_win->border.back; + attributes.border_pixel = tmp_win->border.back; + attributes.cursor = Scr->FrameCursor; + attributes.event_mask = (SubstructureRedirectMask | + ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask | ExposureMask); + if (tmp_win->attr.save_under) { + attributes.save_under = True; + valuemask |= CWSaveUnder; + } + + /* djhjr - 9/17/96 - slows down iconify/delete/destroy too much... + if (Scr->BackingStore) + { + attributes.backing_store = WhenMapped; + valuemask |= CWBackingStore; + } + */ + + if (tmp_win->hints.flags & PWinGravity) { + attributes.win_gravity = tmp_win->hints.win_gravity; + valuemask |= CWWinGravity; + } + + tmp_win->frame = XCreateWindow (dpy, Scr->Root, tmp_win->frame_x, + tmp_win->frame_y, + (unsigned int) tmp_win->frame_width, + (unsigned int) tmp_win->frame_height, + (unsigned int) tmp_win->frame_bw, + Scr->d_depth, + (unsigned int) CopyFromParent, + Scr->d_visual, valuemask, &attributes); + + if (tmp_win->title_height) + { + valuemask = (CWEventMask | CWBorderPixel | CWBackPixel); + attributes.event_mask = (KeyPressMask | ButtonPressMask | + ButtonReleaseMask | ExposureMask); +/* djhjr - 4/19/96 + attributes.border_pixel = tmp_win->border; +*/ + attributes.border_pixel = tmp_win->title.back; + attributes.background_pixel = tmp_win->title.back; + + /* djhjr - 9/17/96 */ + if (Scr->BackingStore) + { + attributes.backing_store = WhenMapped; + valuemask |= CWBackingStore; + } + + tmp_win->title_w = XCreateWindow (dpy, tmp_win->frame, +/* djhjr - 4/19/96 + -tmp_win->frame_bw, + -tmp_win->frame_bw, +*/ + tmp_win->frame_bw3D - tmp_win->frame_bw, + tmp_win->frame_bw3D - tmp_win->frame_bw, + + (unsigned int) tmp_win->attr.width, + (unsigned int) Scr->TitleHeight, + (unsigned int) tmp_win->frame_bw, + Scr->d_depth, + (unsigned int) CopyFromParent, + Scr->d_visual, valuemask, + &attributes); + } + else { + tmp_win->title_w = 0; + tmp_win->squeeze_info = NULL; + } + + if (tmp_win->highlight) + { + + /* djhjr - 4/19/96 */ + /* was 'Scr->use3Dtitles' - djhjr - 8/11/98 */ + if (Scr->TitleBevelWidth > 0 && (Scr->Monochrome != COLOR)) + tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, + (char *)black_bits, gray_width, gray_height, + tmp_win->border_tile.fore, tmp_win->border_tile.back, + Scr->d_depth); + else + + tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, + gray_bits, gray_width, gray_height, + tmp_win->border_tile.fore, tmp_win->border_tile.back, + Scr->d_depth); + + SetBorder (tmp_win, False); + } + else + tmp_win->gray = None; + + if (tmp_win->title_w) { + CreateWindowTitlebarButtons (tmp_win); + ComputeTitleLocation (tmp_win); + XMoveWindow (dpy, tmp_win->title_w, + tmp_win->title_x, tmp_win->title_y); + XDefineCursor(dpy, tmp_win->title_w, Scr->TitleCursor); + } + + /* djhjr - 4/19/96 */ + else { + tmp_win->title_x = tmp_win->frame_bw3D - tmp_win->frame_bw; + tmp_win->title_y = tmp_win->frame_bw3D - tmp_win->frame_bw; + } + + valuemask = (CWEventMask | CWDontPropagate); + attributes.event_mask = (StructureNotifyMask | PropertyChangeMask | + ColormapChangeMask | VisibilityChangeMask | + EnterWindowMask | LeaveWindowMask); + attributes.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask; + XChangeWindowAttributes (dpy, tmp_win->w, valuemask, &attributes); + + if (HasShape) + XShapeSelectInput (dpy, tmp_win->w, ShapeNotifyMask); + + if (tmp_win->title_w) { + XMapWindow (dpy, tmp_win->title_w); + } + + if (HasShape) { + int xws, yws, xbs, ybs; + unsigned wws, hws, wbs, hbs; + int boundingShaped, clipShaped; + + XShapeSelectInput (dpy, tmp_win->w, ShapeNotifyMask); + XShapeQueryExtents (dpy, tmp_win->w, + &boundingShaped, &xws, &yws, &wws, &hws, + &clipShaped, &xbs, &ybs, &wbs, &hbs); + tmp_win->wShaped = boundingShaped; + } + + if (!tmp_win->iconmgr) + XAddToSaveSet(dpy, tmp_win->w); + +/* djhjr - 4/19/96 + XReparentWindow(dpy, tmp_win->w, tmp_win->frame, 0, tmp_win->title_height); +*/ + XReparentWindow(dpy, tmp_win->w, tmp_win->frame, tmp_win->frame_bw3D, + tmp_win->title_height + tmp_win->frame_bw3D); + + /* + * Reparenting generates an UnmapNotify event, followed by a MapNotify. + * Set the map state to FALSE to prevent a transition back to + * WithdrawnState in HandleUnmapNotify. Map state gets set correctly + * again in HandleMapNotify. + */ + tmp_win->mapped = FALSE; + + /* + * NOW do the move and resize - windows needed to be created + * first to accomodate the opaque resources - djhjr - 4/14/98 + */ + AddMoveAndResize(tmp_win, ask_user); + + SetupFrame (tmp_win, tmp_win->frame_x, tmp_win->frame_y, + tmp_win->frame_width, tmp_win->frame_height, -1, True); + + /* wait until the window is iconified and the icon window is mapped + * before creating the icon window + */ + tmp_win->icon_w = None; + + if (!tmp_win->iconmgr) + { + GrabButtons(tmp_win); + GrabKeys(tmp_win); + } + + (void) AddIconManager(tmp_win); + UpdateDesktop(tmp_win); + + XSaveContext(dpy, tmp_win->w, TwmContext, (caddr_t) tmp_win); + XSaveContext(dpy, tmp_win->w, ScreenContext, (caddr_t) Scr); + XSaveContext(dpy, tmp_win->frame, TwmContext, (caddr_t) tmp_win); + XSaveContext(dpy, tmp_win->frame, ScreenContext, (caddr_t) Scr); + if (tmp_win->title_height) + { + int i; + int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + + XSaveContext(dpy, tmp_win->title_w, TwmContext, (caddr_t) tmp_win); + XSaveContext(dpy, tmp_win->title_w, ScreenContext, (caddr_t) Scr); + for (i = 0; i < nb; i++) { + XSaveContext(dpy, tmp_win->titlebuttons[i].window, TwmContext, + (caddr_t) tmp_win); + XSaveContext(dpy, tmp_win->titlebuttons[i].window, ScreenContext, + (caddr_t) Scr); + } + if (tmp_win->hilite_w) + { + XSaveContext(dpy, tmp_win->hilite_w, TwmContext, (caddr_t)tmp_win); + XSaveContext(dpy, tmp_win->hilite_w, ScreenContext, (caddr_t)Scr); + } + } + + XUngrabServer(dpy); + + /* if we were in the middle of a menu activated function, regrab + * the pointer + */ + if (RootFunction != F_NOFUNCTION) + ReGrab(); + + Scr->Newest = tmp_win; /* PF */ + if (tmp_win->transient && Scr->WarpToTransients) /* PF */ + WarpToWindow(tmp_win); /* PF,DSE */ + + return (tmp_win); +} + + +/* + * AddPaintRealWindows() + * + * a little helper for AddMoveAndResize() - djhjr - 4/15/98 + */ +static void +AddPaintRealWindows(tmp_win, x, y) +TwmWindow *tmp_win; +int x, y; +{ +/* handled in add_window() now - djhjr - 9/21/99 + XSetWindowAttributes attr; + + attr.save_under = True; + XChangeWindowAttributes(dpy, tmp_win->frame, CWSaveUnder, &attr); +*/ + + /* don't need to send a configure notify event */ + SetupWindow(tmp_win, tmp_win->frame_x, tmp_win->frame_y, + tmp_win->frame_width, tmp_win->frame_height, -1); + + XMoveWindow(dpy, tmp_win->frame, x, y); + + XMapWindow(dpy, tmp_win->frame); + XMapSubwindows(dpy, tmp_win->frame); + XMapSubwindows(dpy, tmp_win->title_w); + + PaintBorderAndTitlebar(tmp_win); + + /* djhjr - 4/15/98 */ + if (!Scr->NoGrabServer) + { + /* these allow the application window to be drawn */ + XUngrabServer(dpy); XSync(dpy, 0); XGrabServer(dpy); + } +} + + +/* + * AddMoveAndResize() + * + * was inline in AddWindow() at first call to this function, + * now handles the opaque move and resize resources - djhjr - 4/14/98 + */ +static void +AddMoveAndResize(tmp_win, ask_user) +TwmWindow *tmp_win; +int ask_user; +{ + static int PlaceX = PLACEMENT_START; + static int PlaceY = PLACEMENT_START; + XEvent event; + int stat, gravx, gravy; + int bw2 = tmp_win->frame_bw * 2; + int wd = tmp_win->attr.width + bw2; + int ht = tmp_win->attr.height + tmp_win->title_height + bw2; + + /* + * do any prompting for position + */ + if (HandlingEvents && ask_user) { + if (Scr->RandomPlacement) { /* just stick it somewhere */ + if (PlaceX + wd > Scr->MyDisplayWidth) { + /* submitted by Seth Robertson - 8/25/02 */ + if (PLACEMENT_START + wd < Scr->MyDisplayWidth) + PlaceX = PLACEMENT_START; + else { + PlaceX = tmp_win->frame_bw; + if (wd < Scr->MyDisplayWidth) + PlaceX += (Scr->MyDisplayWidth - wd) / 2; + } + } + if (PlaceY + ht > Scr->MyDisplayHeight) { + /* submitted by Seth Robertson - 8/25/02 */ + if (PLACEMENT_START + ht < Scr->MyDisplayHeight) + PlaceY = PLACEMENT_START; + else { + PlaceY = tmp_win->title_height + tmp_win->frame_bw; + if (ht < Scr->MyDisplayHeight) + PlaceY += (Scr->MyDisplayHeight - ht) / 2; + } + } + + tmp_win->attr.x = PlaceX; + tmp_win->attr.y = PlaceY; + PlaceX += PLACEMENT_INCR; + PlaceY += PLACEMENT_INCR; + } else if (Scr->PointerPlacement) { + /* find pointer */ + if (!XQueryPointer (dpy, Scr->Root, &JunkRoot, + &JunkChild, &JunkX, &JunkY, + &AddingX, &AddingY, &JunkMask)) + JunkMask = 0; + /* fit window onto screen */ + if (Scr->WarpSnug) { + if (JunkX + wd > Scr->MyDisplayWidth) + JunkX -= (JunkX + wd - Scr->MyDisplayWidth); + if (JunkY + tmp_win->attr.height > Scr->MyDisplayHeight) + JunkY -= (JunkY + tmp_win->attr.height - Scr->MyDisplayHeight); + } + tmp_win->attr.x = JunkX; + tmp_win->attr.y = JunkY; + } else { /* else prompt */ + if (!(tmp_win->wmhints && tmp_win->wmhints->flags & StateHint && + tmp_win->wmhints->initial_state == IconicState)) + { + Bool firsttime = True; + + /* djhjr - 11/15/01 */ + Bool doorismapped = False; + TwmDoor *door = NULL; + XFindContext(dpy, tmp_win->w, DoorContext, (caddr_t *)&door); + + /* better wait until all the mouse buttons have been + * released. + */ + while (TRUE) + { + XUngrabServer(dpy); + XSync(dpy, 0); + XGrabServer(dpy); + + JunkMask = 0; + if (!XQueryPointer (dpy, Scr->Root, &JunkRoot, + &JunkChild, &JunkX, &JunkY, + &AddingX, &AddingY, &JunkMask)) + JunkMask = 0; + + JunkMask &= (Button1Mask | Button2Mask | Button3Mask | + Button4Mask | Button5Mask); + + /* + * watch out for changing screens + */ + if (firsttime) { + if (JunkRoot != Scr->Root) { + register int scrnum; + + for (scrnum = 0; scrnum < NumScreens; scrnum++) { + if (JunkRoot == RootWindow (dpy, scrnum)) break; + } + + if (scrnum != NumScreens) PreviousScreen = scrnum; + } + firsttime = False; + } + + /* + * wait for buttons to come up; yuck + */ + if (JunkMask != 0) continue; + + /* + * this will cause a warp to the indicated root + */ + stat = XGrabPointer(dpy, Scr->Root, False, + ButtonPressMask | ButtonReleaseMask | + PointerMotionMask | PointerMotionHintMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, UpperLeftCursor, CurrentTime); + + if (stat == GrabSuccess) + break; + } + + /* djhjr - 4/15/98 */ + if (Scr->NoGrabServer) XUngrabServer(dpy); + +/* use initialized size... djhjr - 5/9/96 +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + width = (SIZE_HINDENT + MyFont_TextWidth (&Scr->SizeFont, +#else + width = (SIZE_HINDENT + XTextWidth (Scr->SizeFont.font, +#endif + tmp_win->name, namelen)); + height = Scr->SizeFont.height + SIZE_VINDENT * 2; + +* djhjr - 4/27/96 + XResizeWindow (dpy, Scr->SizeWindow, width + SIZE_HINDENT, height); +* + XResizeWindow (dpy, Scr->SizeWindow, Scr->SizeStringOffset + + Scr->SizeStringWidth, height); +*/ + + XMapRaised(dpy, Scr->SizeWindow); + InstallRootColormap(); + +/* DisplayPosition overwrites it anyway... djhjr - 5/9/96 + * font was font.font->fid - djhjr - 9/14/03 * + FBF(Scr->DefaultC.fore, Scr->DefaultC.back, Scr->SizeFont); +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, +#else + XDrawImageString (dpy, Scr->SizeWindow, +#endif + Scr->NormalGC, SIZE_HINDENT, +* djhjr - 9/14/03 + SIZE_VINDENT + Scr->SizeFont.font->ascent, +* + SIZE_VINDENT + Scr->SizeFont.ascent, + tmp_win->name, namelen); +*/ + +/* djhjr - 4/19/96 + AddingW = tmp_win->attr.width + bw2; + AddingH = tmp_win->attr.height + tmp_win->title_height + bw2; + + MoveOutline(Scr->Root, AddingX, AddingY, AddingW, AddingH, + tmp_win->frame_bw, tmp_win->title_height); +*/ + AddingW = tmp_win->attr.width + bw2 + 2 * tmp_win->frame_bw3D; + AddingH = tmp_win->attr.height + tmp_win->title_height + + bw2 + 2 * tmp_win->frame_bw3D; + + /* added this 'if ... else' - djhjr - 4/14/98 */ + if (tmp_win->opaque_move) + { + AddPaintRealWindows(tmp_win, AddingX, AddingY); + + /* djhjr - 11/15/01 */ + if (door && !doorismapped) + { + XMapWindow(dpy, door->w); + RedoDoorName(tmp_win, door); + doorismapped = True; + } + } + else + MoveOutline(Scr->Root, AddingX, AddingY, AddingW, AddingH, + tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); + + /* djhjr - 4/17/98 */ + if (Scr->VirtualReceivesMotionEvents) + { + tmp_win->virtual_frame_x = R_TO_V_X(AddingX); + tmp_win->virtual_frame_y = R_TO_V_Y(AddingY); + UpdateDesktop(tmp_win); + } + +/* DisplayPosition() overwrites it anyway... djhjr - 5/9/96 +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, +#else + * djhjr - 4/27/96 * + XDrawImageString (dpy, Scr->SizeWindow, +#endif + Scr->NormalGC, width, +* djhjr - 9/14/03 + SIZE_VINDENT + Scr->SizeFont.font->ascent, ": ", 2); +* + SIZE_VINDENT + Scr->SizeFont.ascent, ": ", 2); +*/ + + /* djhjr - 4/27/96 */ + DisplayPosition (AddingX, AddingY); + + while (TRUE) + { + XMaskEvent(dpy, ButtonPressMask | PointerMotionMask, &event); + + if (Event.type == MotionNotify) { + /* discard any extra motion events before a release */ + while(XCheckMaskEvent(dpy, + ButtonMotionMask | ButtonPressMask, &Event)) + if (Event.type == ButtonPress) + break; + } + + if (event.type == ButtonPress) { + AddingX = event.xbutton.x_root; + AddingY = event.xbutton.y_root; + + /* DontMoveOff prohibits user form off-screen placement */ + if (Scr->DontMoveOff) + { + int AddingR, AddingB; + + AddingR = AddingX + AddingW; + AddingB = AddingY + AddingH; + + if (AddingX < 0) + AddingX = 0; + if (AddingR > Scr->MyDisplayWidth) + AddingX = Scr->MyDisplayWidth - AddingW; + + if (AddingY < 0) + AddingY = 0; + if (AddingB > Scr->MyDisplayHeight) + AddingY = Scr->MyDisplayHeight - AddingH; + + } + break; + } + + if (event.type != MotionNotify) { + continue; + } + + XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, + &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); + + if (Scr->DontMoveOff) + { + int AddingR, AddingB; + + AddingR = AddingX + AddingW; + AddingB = AddingY + AddingH; + + if (AddingX < 0) + AddingX = 0; + if (AddingR > Scr->MyDisplayWidth) + AddingX = Scr->MyDisplayWidth - AddingW; + + if (AddingY < 0) + AddingY = 0; + if (AddingB > Scr->MyDisplayHeight) + AddingY = Scr->MyDisplayHeight - AddingH; + } + +/* djhjr - 4/19/96 + MoveOutline(Scr->Root, AddingX, AddingY, AddingW, AddingH, + tmp_win->frame_bw, tmp_win->title_height); +*/ + /* added this 'if ... else' - djhjr - 4/14/98 */ + if (tmp_win->opaque_move) + { + XMoveWindow(dpy, tmp_win->frame, AddingX, AddingY); + PaintBorderAndTitlebar(tmp_win); + + /* djhjr - 4/15/98 */ + if (!Scr->NoGrabServer) + { + /* these allow the application window to be drawn */ + XUngrabServer(dpy); XSync(dpy, 0); XGrabServer(dpy); + } + } + else + MoveOutline(Scr->Root, AddingX, AddingY, AddingW, AddingH, + tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); + + /* djhjr - 4/17/98 */ + if (Scr->VirtualReceivesMotionEvents) + { + tmp_win->virtual_frame_x = R_TO_V_X(AddingX); + tmp_win->virtual_frame_y = R_TO_V_Y(AddingY); + MoveResizeDesktop(tmp_win, Scr->NoRaiseResize); + } + + /* djhjr - 4/27/96 */ + DisplayPosition (AddingX, AddingY); + + } + + if (event.xbutton.button == Button2) { + int lastx, lasty; + +/* AddStartResize() overwrites it anyway... djhjr - 5/9/96 + Scr->SizeStringOffset = width + +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + MyFont_TextWidth(&Scr->SizeFont, ": ", 2); +#else + XTextWidth(Scr->SizeFont.font, ": ", 2); +#endif + XResizeWindow (dpy, Scr->SizeWindow, Scr->SizeStringOffset + + Scr->SizeStringWidth, height); +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, +#else + XDrawImageString (dpy, Scr->SizeWindow, +#endif + Scr->NormalGC, width, +* djhjr - 9/14/03 + SIZE_VINDENT + Scr->SizeFont.font->ascent, +* + SIZE_VINDENT + Scr->SizeFont.ascent, + ": ", 2); +*/ + + /* djhjr - 4/15/98 */ + if (!tmp_win->opaque_move && tmp_win->opaque_resize) + { + /* erase the move outline */ + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + + AddPaintRealWindows(tmp_win, AddingX, AddingY); + + /* djhjr - 11/15/01 */ + if (door && !doorismapped) + { + XMapWindow(dpy, door->w); + RedoDoorName(tmp_win, door); + doorismapped = True; + } + } + +#if 0 + if (0/*Scr->AutoRelativeResize*/) +My R5 vtvwm came with this commented out, always 0. +Why? +#endif + if (Scr->AutoRelativeResize) + { + int dx = (tmp_win->attr.width / 4); + int dy = (tmp_win->attr.height / 4); + +#define HALF_AVE_CURSOR_SIZE 8 /* so that it is visible */ + if (dx < HALF_AVE_CURSOR_SIZE) dx = HALF_AVE_CURSOR_SIZE; + if (dy < HALF_AVE_CURSOR_SIZE) dy = HALF_AVE_CURSOR_SIZE; +#undef HALF_AVE_CURSOR_SIZE + dx += (tmp_win->frame_bw + 1); + dy += (bw2 + tmp_win->title_height + 1); + if (AddingX + dx >= Scr->MyDisplayWidth) + dx = Scr->MyDisplayWidth - AddingX - 1; + if (AddingY + dy >= Scr->MyDisplayHeight) + dy = Scr->MyDisplayHeight - AddingY - 1; + if (dx > 0 && dy > 0) + XWarpPointer (dpy, None, None, 0, 0, 0, 0, dx, dy); + } else { + XWarpPointer (dpy, None, Scr->Root, 0, 0, 0, 0, + AddingX + AddingW/2, AddingY + AddingH/2); + } + AddStartResize(tmp_win, AddingX, AddingY, AddingW, AddingH); + + lastx = -10000; + lasty = -10000; + while (TRUE) + { + XMaskEvent(dpy, + ButtonReleaseMask | ButtonMotionMask, &event); + + if (Event.type == MotionNotify) { + /* discard any extra motion events before a release */ + while(XCheckMaskEvent(dpy, + ButtonMotionMask | ButtonReleaseMask, &Event)) + if (Event.type == ButtonRelease) + break; + } + + if (event.type == ButtonRelease) + { + AddEndResize(tmp_win); + + /* don't need to send a configure notify event - djhjr - 4/15/98 */ + if (tmp_win->opaque_move && !tmp_win->opaque_resize) + SetupWindow(tmp_win, AddingX, AddingY, AddingW, AddingH, -1); + + /* djhjr - 11/15/01 */ + if (!tmp_win->opaque_resize && door && doorismapped) + RedoDoorName(tmp_win, door); + + break; + } + + if (event.type != MotionNotify) { + continue; + } + + /* + * XXX - if we are going to do a loop, we ought to consider + * using multiple GXxor lines so that we don't need to + * grab the server. + */ + XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, + &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask); + + if (lastx != AddingX || lasty != AddingY) + { + DoResize(AddingX, AddingY, tmp_win); + + lastx = AddingX; + lasty = AddingY; + } + + } + } /* if (event.xbutton.button == Button2) */ + else if (event.xbutton.button == Button3) + { + int maxw = Scr->MyDisplayWidth - AddingX - bw2; + int maxh = Scr->MyDisplayHeight - AddingY - bw2; + + /* + * Make window go to bottom of screen, and clip to right edge. + * This is useful when popping up large windows and fixed + * column text windows. + */ + if (AddingW > maxw) AddingW = maxw; + AddingH = maxh; + + ConstrainSize (tmp_win, &AddingW, &AddingH); /* w/o borders */ + AddingW += bw2; + AddingH += bw2; + + /* don't need to send a configure notify event - djhjr - 4/15/98 */ + SetupWindow(tmp_win, AddingX, AddingY, AddingW, AddingH, -1); + + /* djhjr - 11/15/01 */ + if (!tmp_win->opaque_resize && door && doorismapped) + RedoDoorName(tmp_win, door); + + } + else + { + XMaskEvent(dpy, ButtonReleaseMask, &event); + } + + /* erase the move outline */ + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + + XUnmapWindow(dpy, Scr->SizeWindow); + UninstallRootColormap(); + XUngrabPointer(dpy, CurrentTime); + +/* djhjr - 4/15/98 + tmp_win->attr.x = AddingX; + tmp_win->attr.y = AddingY + tmp_win->title_height; +*/ + tmp_win->attr.x = AddingX + tmp_win->frame_bw + tmp_win->frame_bw3D; + tmp_win->attr.y = AddingY + tmp_win->title_height + + tmp_win->frame_bw + tmp_win->frame_bw3D; + +/* djhjr - 4/19/96 + tmp_win->attr.width = AddingW - bw2; + tmp_win->attr.height = AddingH - tmp_win->title_height - bw2; +*/ + tmp_win->attr.width = AddingW - bw2 - 2 * tmp_win->frame_bw3D; + tmp_win->attr.height = AddingH - tmp_win->title_height - + bw2 - 2 * tmp_win->frame_bw3D; + +/* un-grabbed in the caller AddWindow() on return - djhjr - 4/15/98 + XUngrabServer(dpy); +*/ + } + } + + /* djhjr - 6/4/98 */ + if (Scr->VirtualReceivesMotionEvents && !tmp_win->opaque_move) + { + XUnmapWindow(dpy, Scr->VirtualDesktopDisplay); + XMapWindow(dpy, Scr->VirtualDesktopDisplay); + } + } else { /* put it where asked, mod title bar */ + /* interpret the position specified as a virtual one if asked */ + +/* added 'FixManagedVirtualGeometries' - djhjr - 1/6/98 */ +/* added test for 'PPosition' - submitted by Michael Dales */ + if (Scr->GeometriesAreVirtual || + (!Scr->GeometriesAreVirtual && + (tmp_win->nailed || + ( ( (Scr->FixManagedVirtualGeometries && + !tmp_win->transient) || + (Scr->FixTransientVirtualGeometries && + tmp_win->transient) + ) && (tmp_win->hints.flags & PPosition) + ) + ) + ) + ) + /* + * If virtual geometries is set, or virtual geometries + * isn't set and (nailed or (fix virtual geometries and + * preferred position)). This is a bug workaround -- DSE + */ + { + tmp_win->attr.x = V_TO_R_X(tmp_win->attr.x); + tmp_win->attr.y = V_TO_R_Y(tmp_win->attr.y); + } + + GetGravityOffsets (tmp_win, &gravx, &gravy); + + /* if the gravity is towards the top, move it by the title height */ + if (gravy < 0) tmp_win->attr.y -= gravy * tmp_win->title_height; + } + +/* should never have been - djhjr - 9/21/99 + if (tmp_win->opaque_move) + { + XSetWindowAttributes attr; + + attr.save_under = False; + XChangeWindowAttributes(dpy, tmp_win->frame, CWSaveUnder, &attr); + } +*/ + +/* + * consider client borderwidths based on the ClientBorderWidth and + * RandomPlacement resources, PPosition with the UsePPosition resource, + * and the USPosition spec - djhjr - 6/3/98 + * + tmp_win->frame_x = tmp_win->attr.x + tmp_win->old_bw - tmp_win->frame_bw + - tmp_win->frame_bw3D; + tmp_win->frame_y = tmp_win->attr.y - tmp_win->title_height + + tmp_win->old_bw - tmp_win->frame_bw - tmp_win->frame_bw3D; +*/ + tmp_win->frame_x = tmp_win->attr.x - + tmp_win->frame_bw - tmp_win->frame_bw3D; + tmp_win->frame_y = tmp_win->attr.y - tmp_win->title_height - + tmp_win->frame_bw - tmp_win->frame_bw3D; +/* Not needed? - submitted by Jonathan Paisley - 11/8/02 + if (Scr->ClientBorderWidth || !ask_user) + { + tmp_win->frame_x += tmp_win->old_bw; + tmp_win->frame_y += tmp_win->old_bw; + } +*/ + + tmp_win->frame_width = tmp_win->attr.width + 2 * tmp_win->frame_bw3D; + tmp_win->frame_height = tmp_win->attr.height + tmp_win->title_height + + 2 * tmp_win->frame_bw3D; + ConstrainSize (tmp_win, &tmp_win->frame_width, &tmp_win->frame_height); + + tmp_win->virtual_frame_x = R_TO_V_X(tmp_win->frame_x); + tmp_win->virtual_frame_y = R_TO_V_Y(tmp_win->frame_y); + +#ifdef DEBUG + fprintf(stderr, " position window %d, %d %dx%d\n", + tmp_win->attr.x, + tmp_win->attr.y, + tmp_win->attr.width, + tmp_win->attr.height); +#endif +} + + +/*********************************************************************** + * + * Procedure: + * MappedNotOverride - checks to see if we should really + * put a twm frame on the window + * + * Returned Value: + * TRUE - go ahead and frame the window + * FALSE - don't frame the window + * + * Inputs: + * w - the window to check + * + *********************************************************************** + */ + +int +MappedNotOverride(w) + Window w; +{ + XWindowAttributes wa; + + XGetWindowAttributes(dpy, w, &wa); + return ((wa.map_state != IsUnmapped) && (wa.override_redirect != True)); +} + + +/*********************************************************************** + * + * Procedure: + * AddDefaultBindings - attach default bindings so that naive users + * don't get messed up if they provide a minimal twmrc. + */ +static void do_add_binding (button, context, modifier, func) + int button, context, modifier; + int func; +{ + MouseButton *mb = &Scr->Mouse[button][context][modifier]; + + if (mb->func) return; /* already defined */ + + mb->func = func; + mb->item = NULL; +} + +void AddDefaultBindings () +{ + /* + * The bindings are stored in Scr->Mouse, indexed by + * Mouse[button_number][C_context][modifier]. + */ + +#define NoModifierMask 0 + + do_add_binding (Button1, C_TITLE, NoModifierMask, F_MOVE); + do_add_binding (Button1, C_ICON, NoModifierMask, F_ICONIFY); + do_add_binding (Button1, C_ICONMGR, NoModifierMask, F_ICONIFY); + do_add_binding (Button1, C_VIRTUAL, NoModifierMask, F_MOVESCREEN); + do_add_binding (Button1, C_VIRTUAL_WIN, NoModifierMask, F_MOVESCREEN); + + do_add_binding (Button2, C_TITLE, NoModifierMask, F_RAISELOWER); + do_add_binding (Button2, C_ICON, NoModifierMask, F_ICONIFY); + do_add_binding (Button2, C_ICONMGR, NoModifierMask, F_ICONIFY); + do_add_binding (Button2, C_VIRTUAL, NoModifierMask, F_MOVESCREEN); + do_add_binding (Button2, C_VIRTUAL_WIN, NoModifierMask, F_MOVESCREEN); + +#undef NoModifierMask +} + + + + +/*********************************************************************** + * + * Procedure: + * GrabButtons - grab needed buttons for the window + * + * Inputs: + * tmp_win - the twm window structure to use + * + *********************************************************************** + */ + +void +GrabButtons(tmp_win) +TwmWindow *tmp_win; +{ + int i, j; + + for (i = 0; i < MAX_BUTTONS+1; i++) + { + for (j = 0; j < MOD_SIZE; j++) + { + if (Scr->Mouse[i][C_WINDOW][j].func != F_NOFUNCTION) + { + /* twm used to do this grab on the application main window, + * tmp_win->w . This was not ICCCM complient and was changed. + */ + XGrabButton(dpy, i, j, tmp_win->frame, + True, ButtonPressMask | ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, None, + Scr->FrameCursor); + } + } + } +} + +/*********************************************************************** + * + * Procedure: + * GrabKeys - grab needed keys for the window + * + * Inputs: + * tmp_win - the twm window structure to use + * + *********************************************************************** + */ + +/* djhjr - 9/10/03 */ +void +GrabModKeys(w, k) +Window w; +FuncKey *k; +{ + int i; + + XGrabKey(dpy, k->keycode, k->mods, w, True, GrabModeAsync, GrabModeAsync); + + for (i = 1; i <= Scr->IgnoreModifiers; i++) + if ((Scr->IgnoreModifiers & i) == i) + XGrabKey(dpy, k->keycode, k->mods | i, w, True, + GrabModeAsync, GrabModeAsync); +} + +/* djhjr - 9/10/03 */ +void +UngrabModKeys(w, k) +Window w; +FuncKey *k; +{ + int i; + + XUngrabKey(dpy, k->keycode, k->mods, w); + + for (i = 1; i <= Scr->IgnoreModifiers; i++) + if ((Scr->IgnoreModifiers & i) == i) + XUngrabKey(dpy, k->keycode, k->mods | i, w); +} + +void +GrabKeys(tmp_win) +TwmWindow *tmp_win; +{ + FuncKey *tmp; + IconMgr *p; + + for (tmp = Scr->FuncKeyRoot.next; tmp != NULL; tmp = tmp->next) + { + switch (tmp->cont) + { + case C_WINDOW: +/* djhjr - 9/10/03 + XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->w, True, + GrabModeAsync, GrabModeAsync); +*/ + GrabModKeys(tmp_win->w, tmp); + break; + + case C_ICON: + if (tmp_win->icon_w) +/* djhjr - 9/10/03 + XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->icon_w, True, + GrabModeAsync, GrabModeAsync); +*/ + GrabModKeys(tmp_win->icon_w, tmp); + + case C_TITLE: + if (tmp_win->title_w) +/* djhjr - 9/10/03 + XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->title_w, True, + GrabModeAsync, GrabModeAsync); +*/ + GrabModKeys(tmp_win->title_w, tmp); + break; + + case C_NAME: +/* djhjr - 9/10/03 + XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->w, True, + GrabModeAsync, GrabModeAsync); +*/ + GrabModKeys(tmp_win->w, tmp); + if (tmp_win->icon_w) +/* djhjr - 9/10/03 + XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->icon_w, True, + GrabModeAsync, GrabModeAsync); +*/ + GrabModKeys(tmp_win->icon_w, tmp); + if (tmp_win->title_w) +/* djhjr - 9/10/03 + XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->title_w, True, + GrabModeAsync, GrabModeAsync); +*/ + GrabModKeys(tmp_win->title_w, tmp); + break; + + /* + case C_ROOT: +* djhjr - 9/10/03 + XGrabKey(dpy, tmp->keycode, tmp->mods, Scr->Root, True, + GrabModeAsync, GrabModeAsync); +* + GrabModKeys(Scr->Root, tmp); + break; + */ + } + } + for (tmp = Scr->FuncKeyRoot.next; tmp != NULL; tmp = tmp->next) + { + if (tmp->cont == C_ICONMGR && !Scr->NoIconManagers) + { + for (p = &Scr->iconmgr; p != NULL; p = p->next) + { +/* djhjr - 9/10/03 + XUngrabKey(dpy, tmp->keycode, tmp->mods, p->twm_win->w); +*/ + UngrabModKeys(p->twm_win->w, tmp); + } + } + } +} + +static Window CreateHighlightWindow (tmp_win) + TwmWindow *tmp_win; +{ + XSetWindowAttributes attributes; /* attributes for create windows */ + Pixmap pm = None; + GC gc; + XGCValues gcv; + unsigned long valuemask; + unsigned int pm_numcolors; + /* added '- 2' - djhjr - 10/18/02 */ + int h = (Scr->TitleHeight - 2 * Scr->FramePadding) - 2; + Window w; + +/* djhjr - 9/14/03 +#ifndef NO_I18N_SUPPORT + int en = MyFont_TextWidth(&Scr->TitleBarFont, "n", 1); +#else + * djhjr - 4/1/98 * + int en = XTextWidth(Scr->TitleBarFont.font, "n", 1); +#endif +*/ +/* djhjr - 10/18/02 + int width = Scr->TBInfo.titlex + tmp_win->name_width + 2 * en; +*/ + + /* + * If a special highlight pixmap was given, use that. Otherwise, + * use a nice, even gray pattern. The old horizontal lines look really + * awful on interlaced monitors (as well as resembling other looks a + * little bit too closely), but can be used by putting + * + * Pixmaps { TitleHighlight "hline2" } + * + * (or whatever the horizontal line bitmap is named) in the startup + * file. If all else fails, use the foreground color to look like a + * solid line. + */ + +/* + * re-written to use an Image structure for XPM support + * + * djhjr - 5/17/98 + */ +#ifdef ORIGINAL_PIXMAPS + if (!Scr->hilitePm) { + + /* djhjr - 4/20/96 */ + /* was 'Scr->use3Dtitles' - djhjr - 8/11/98 */ + if (Scr->TitleBevelWidth > 0 && (Scr->Monochrome != COLOR)) + Scr->hilitePm = XCreateBitmapFromData (dpy, tmp_win->title_w, + (char *)black_bits, gray_width, gray_height); + else + Scr->hilitePm = XCreateBitmapFromData (dpy, tmp_win->title_w, + gray_bits, gray_width, gray_height); + + Scr->hilite_pm_width = gray_width; + Scr->hilite_pm_height = gray_height; + } + if (Scr->hilitePm) { + pm = XCreatePixmap (dpy, tmp_win->title_w, + Scr->hilite_pm_width, Scr->hilite_pm_height, + Scr->d_depth); + gcv.foreground = tmp_win->title.fore; + gcv.background = tmp_win->title.back; + gcv.graphics_exposures = False; + gc = XCreateGC (dpy, pm, + (GCForeground|GCBackground|GCGraphicsExposures), + &gcv); + if (gc) { + XCopyPlane (dpy, Scr->hilitePm, pm, gc, 0, 0, + Scr->hilite_pm_width, Scr->hilite_pm_height, + 0, 0, 1); + XFreeGC (dpy, gc); + } else { + XFreePixmap (dpy, pm); + pm = None; + } + } + if (pm) { + valuemask = CWBackPixmap; + attributes.background_pixmap = pm; + } else { + valuemask = CWBackPixel; + attributes.background_pixel = tmp_win->title.fore; + } +#else /* ORIGINAL_PIXMAPS */ + if (!Scr->hilitePm) + { + Scr->hilitePm = (Image *)malloc(sizeof(Image)); + if (Scr->hilitePm) + { + Scr->hilitePm->width = gray_width; + Scr->hilitePm->height = gray_height; + Scr->hilitePm->mask = None; + + /* djhjr - 4/20/96 */ + /* was 'Scr->use3Dtitles' - djhjr - 8/11/98 */ + if (Scr->TitleBevelWidth > 0 && (Scr->Monochrome != COLOR)) + Scr->hilitePm->pixmap = XCreateBitmapFromData (dpy, + tmp_win->title_w, (char *)black_bits, + Scr->hilitePm->width, Scr->hilitePm->height); + else + Scr->hilitePm->pixmap = XCreateBitmapFromData (dpy, + tmp_win->title_w, gray_bits, + Scr->hilitePm->width, Scr->hilitePm->height); + } + } + + pm_numcolors = 0; + +/* djhjr - 5/23/98 9/2/98 */ +#ifndef NO_XPM_SUPPORT +/* removed this for non-transparent pixmaps - djhjr - 5/26/98 + if (Scr->hilitePm->mask != None) +*/ + pm_numcolors = SetPixmapsBackground(Scr->hilitePm, Scr->Root, + tmp_win->title.back); +#endif + + /* + * Modified to handle non-transparent pixmaps - Jason Gloudon + */ + if (Scr->hilitePm->pixmap) + { + if (pm_numcolors > 2) /* not a bitmap */ + { + valuemask = CWBackPixmap; + attributes.background_pixmap = Scr->hilitePm->pixmap; + } + else + { + pm = XCreatePixmap (dpy, tmp_win->title_w, + Scr->hilitePm->width, Scr->hilitePm->height, + Scr->d_depth); + + gcv.foreground = tmp_win->title.fore; + gcv.background = tmp_win->title.back; + gcv.graphics_exposures = False; + + gc = XCreateGC (dpy, pm, + (GCForeground | GCBackground | GCGraphicsExposures), + &gcv); + + if (gc) + { + /* the copy plane works on color ! */ + XCopyPlane (dpy, Scr->hilitePm->pixmap, pm, gc, 0, 0, + Scr->hilitePm->width, Scr->hilitePm->height, + 0, 0, 1); + + XFreeGC(dpy, gc); + + valuemask = CWBackPixmap; + attributes.background_pixmap = pm; + } + else + { + valuemask = CWBackPixel; + attributes.background_pixel = tmp_win->title.fore; + } + } + } + else + { + valuemask = CWBackPixel; + attributes.background_pixel = tmp_win->title.fore; + } +#endif /* ORIGINAL_PIXMAPS */ + +/* djhjr - 10/18/02 */ +#if 0 + /* djhjr - 4/19/96 */ + /* was 'Scr->use3Dtitles' - djhjr - 8/11/98 */ + if (Scr->TitleBevelWidth > 0) +/* djhjr - 4/25/96 + w = XCreateWindow (dpy, tmp_win->title_w, 0, Scr->FramePadding + 2, + (unsigned int) Scr->TBInfo.width, (unsigned int) (h - 4), +*/ +/* djhjr - 4/1/98 + w = XCreateWindow (dpy, tmp_win->title_w, 0, Scr->FramePadding + 3, + (unsigned int) Scr->TBInfo.width, (unsigned int) (h - 6), +*/ + w = XCreateWindow (dpy, tmp_win->title_w, width, Scr->FramePadding + 4, + ComputeHighlightWindowWidth(tmp_win), (unsigned int) (h - 8), + + (unsigned int) 0, + Scr->d_depth, (unsigned int) CopyFromParent, + Scr->d_visual, valuemask, &attributes); + + else +/* djhjr - 4/1/98 + w = XCreateWindow (dpy, tmp_win->title_w, 0, Scr->FramePadding, + (unsigned int) Scr->TBInfo.width, (unsigned int) h, +*/ + w = XCreateWindow (dpy, tmp_win->title_w, width, Scr->FramePadding + 2, + ComputeHighlightWindowWidth(tmp_win), (unsigned int) (h - 4), + (unsigned int) 0, + Scr->d_depth, (unsigned int) CopyFromParent, + Scr->d_visual, valuemask, &attributes); +#else + w = XCreateWindow (dpy, tmp_win->title_w, + tmp_win->highlightx, Scr->FramePadding + 1, + ComputeHighlightWindowWidth(tmp_win), (unsigned int) h, + (unsigned int) 0, + Scr->d_depth, (unsigned int) CopyFromParent, + Scr->d_visual, valuemask, &attributes); +#endif + + if (pm) XFreePixmap (dpy, pm); + + return w; +} + + +void ComputeCommonTitleOffsets () +{ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + int en = MyFont_TextWidth(&Scr->TitleBarFont, "n", 1); +#else + /* djhjr - 10/18/02 */ + int en = XTextWidth(Scr->TitleBarFont.font, "n", 1); +#endif + + int buttonwidth = (Scr->TBInfo.width + Scr->TBInfo.pad); + + Scr->TBInfo.leftx = Scr->TBInfo.rightoff = Scr->FramePadding; + + if (Scr->TBInfo.nleft > 0) + Scr->TBInfo.leftx += Scr->ButtonIndent; + + /* 'en' was 'Scr->TitlePadding' - djhjr - 10/18/02 */ + Scr->TBInfo.titlex = (Scr->TBInfo.leftx + + (Scr->TBInfo.nleft * buttonwidth) - Scr->TBInfo.pad + + en); + + if (Scr->TBInfo.nright > 0) + Scr->TBInfo.rightoff += (Scr->ButtonIndent + + ((Scr->TBInfo.nright * buttonwidth) - + Scr->TBInfo.pad)); + return; +} + +void ComputeWindowTitleOffsets (tmp_win, width, squeeze) + TwmWindow *tmp_win; + int width; + Bool squeeze; +{ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + int en = MyFont_TextWidth(&Scr->TitleBarFont, "n", 1); +#else + /* djhjr - 10/18/02 */ + int en = XTextWidth(Scr->TitleBarFont.font, "n", 1); +#endif + + /* added 'en' - djhjr - 10/18/02 */ + tmp_win->highlightx = Scr->TBInfo.titlex + tmp_win->name_width + en; + +/* djhjr - 10/18/02 + * djhjr - 4/1/98 * + * was 'Scr->use3Dtitles' - djhjr - 8/11/98 * + if (Scr->TitleBevelWidth > 0) + { +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + int en = MyFont_TextWidth(&Scr->TitleBarFont, "n", 1); +#else + int en = XTextWidth(Scr->TitleBarFont.font, "n", 1); +#endif + tmp_win->highlightx += en; + + * rem'd out - djhjr - 4/19/96 * + * reinstated - djhjr - 4/1/98 * + tmp_win->highlightx += 6; + } + + if (tmp_win->hilite_w || Scr->TBInfo.nright > 0) + tmp_win->highlightx += Scr->TitlePadding; +*/ + + tmp_win->rightx = width - Scr->TBInfo.rightoff; + + if (squeeze && tmp_win->squeeze_info) + { + /* djhjr - 3/13/97 8/11/98 */ + /* this used to care about title bevels - djhjr - 10/18/02 */ + int rx = tmp_win->highlightx + + ((tmp_win->titlehighlight) ? Scr->TitleHeight * 2 : 0); + + if (rx < tmp_win->rightx) tmp_win->rightx = rx; + } + + return; +} + + +/* + * ComputeTitleLocation - calculate the position of the title window. + * + * substantially re-written - djhjr - 1/8/98 + */ +void ComputeTitleLocation (tmp) + TwmWindow *tmp; +{ + tmp->title_x = tmp->frame_bw3D - tmp->frame_bw; + tmp->title_y = tmp->frame_bw3D - tmp->frame_bw; + + if (tmp->squeeze_info) + { + SqueezeInfo *si = tmp->squeeze_info; + int basex; + int fw = tmp->frame_bw + tmp->frame_bw3D; + + if (si->denom != 0 && si->num != 0) + basex = ((tmp->frame_width - tmp->title_width) / si->denom) * si->num + fw; + else + if (si->denom == 0 && si->num != 0) + basex = si->num + fw; + else + switch (si->justify) + { + case J_LEFT: + basex = tmp->title_x + fw; + break; + case J_CENTER: + basex = tmp->frame_width / 2 - (tmp->title_width / 2 - fw); + break; + case J_RIGHT: + basex = tmp->frame_width - tmp->title_width; + break; + } + + if (basex > tmp->frame_width - tmp->title_width) + basex = tmp->frame_width - tmp->title_width; + if (basex < 0) + basex = tmp->title_x + fw; + + tmp->title_x = basex - fw; + } +} + + +static void CreateWindowTitlebarButtons (tmp_win) + TwmWindow *tmp_win; +{ + unsigned long valuemask; /* mask for create windows */ + XSetWindowAttributes attributes; /* attributes for create windows */ + TitleButton *tb; + TBWindow *tbw; + int boxwidth = Scr->TBInfo.width + Scr->TBInfo.pad; + unsigned int h = Scr->TBInfo.width - Scr->TBInfo.border * 2; + int x, y = Scr->FramePadding + Scr->ButtonIndent; /* init - djhjr - 10/18/02 */ + int nb, leftx, rightx; + + if (tmp_win->title_height == 0) + { + tmp_win->hilite_w = 0; + return; + } + + /* + * create the title bar windows; let the event handler deal with painting + * so that we don't have to spend two pixmaps (or deal with hashing) + */ + ComputeWindowTitleOffsets (tmp_win, tmp_win->attr.width, False); + +/* djhjr - 10/18/02 + leftx = y = Scr->TBInfo.leftx; +*/ + leftx = Scr->TBInfo.leftx; + rightx = tmp_win->rightx; + + attributes.background_pixel = tmp_win->title.back; + attributes.border_pixel = tmp_win->title.fore; + attributes.event_mask = (ButtonPressMask | ButtonReleaseMask | ExposureMask); + attributes.cursor = Scr->ButtonCursor; + + valuemask = (CWWinGravity | CWBackPixel | CWBorderPixel | CWEventMask | CWCursor); + + tmp_win->titlebuttons = NULL; + nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + if (nb > 0) { + tmp_win->titlebuttons = (TBWindow *) malloc (nb * sizeof(TBWindow)); + if (!tmp_win->titlebuttons) { + fprintf (stderr, "%s: unable to allocate %d titlebuttons\n", + ProgramName, nb); + } else { + for (tb = Scr->TBInfo.head, tbw = tmp_win->titlebuttons; tb; + tb = tb->next, tbw++) { + if (tb->rightside) { + x = rightx; + rightx += boxwidth; + attributes.win_gravity = NorthEastGravity; + } else { + x = leftx; + leftx += boxwidth; + attributes.win_gravity = NorthWestGravity; + } + + tbw->window = XCreateWindow (dpy, tmp_win->title_w, x, y, h, h, + (unsigned int) Scr->TBInfo.border, + 0, (unsigned int) CopyFromParent, + (Visual *) CopyFromParent, + valuemask, &attributes); + + tbw->info = tb; + } /* end for(...) */ + } + } + +/* djhjr - 4/5/98 + tmp_win->hilite_w = (tmp_win->titlehighlight + ? CreateHighlightWindow (tmp_win) : None); + + XMapSubwindows(dpy, tmp_win->title_w); + +* djhjr - 4/25/96 + if (tmp_win->hilite_w) + XUnmapWindow(dpy, tmp_win->hilite_w); +* + PaintTitleHighlight(tmp_win, off); +*/ + /* was '!Scr->SunkFocusWindowTitle' - djhjr - 10/25/02 */ + tmp_win->hilite_w = + (tmp_win->titlehighlight && !Scr->hiliteName) ? + CreateHighlightWindow(tmp_win) : None; + + return; +} + + +/* + * re-written to use an Image structure for XPM support + * + * djhjr - 5/17/98 + */ +#ifdef ORIGINAL_PIXMAPS +void SetHighlightPixmap (filename) + char *filename; +{ + Pixmap pm = GetBitmap (filename); + + if (pm) { + if (Scr->hilitePm) { + XFreePixmap (dpy, Scr->hilitePm); + } + Scr->hilitePm = pm; + Scr->hilite_pm_width = JunkWidth; + Scr->hilite_pm_height = JunkHeight; + } +} +#else /* ORIGINAL_PIXMAPS */ +void SetHighlightPixmap (filename) + char *filename; +{ + /* added this 'if (...) else' - djhjr - 10/25/02 */ + if (filename[0] == ':') + Scr->hiliteName = filename; + else + + if (!Scr->hilitePm) Scr->hilitePm = SetPixmapsPixmap(filename); +} +#endif /* ORIGINAL_PIXMAPS */ + + +void FetchWmProtocols (tmp) + TwmWindow *tmp; +{ + unsigned long flags = 0L; + Atom *protocols = NULL; + int n; + + if (XGetWMProtocols (dpy, tmp->w, &protocols, &n)) { + register int i; + register Atom *ap; + + for (i = 0, ap = protocols; i < n; i++, ap++) { + if (*ap == _XA_WM_TAKE_FOCUS) flags |= DoesWmTakeFocus; + if (*ap == _XA_WM_SAVE_YOURSELF) flags |= DoesWmSaveYourself; + if (*ap == _XA_WM_DELETE_WINDOW) flags |= DoesWmDeleteWindow; + } + if (protocols) XFree ((char *) protocols); + } + tmp->protocols = flags; +} + +TwmColormap * +CreateTwmColormap(c) + Colormap c; +{ + TwmColormap *cmap; + cmap = (TwmColormap *) malloc(sizeof(TwmColormap)); + if (!cmap || + XSaveContext(dpy, c, ColormapContext, (caddr_t) cmap)) { + if (cmap) free((char *) cmap); + return (NULL); + } + cmap->c = c; + cmap->state = 0; + cmap->install_req = 0; + cmap->w = None; + cmap->refcnt = 1; + return (cmap); +} + +ColormapWindow * +CreateColormapWindow(w, creating_parent, property_window) + Window w; + Bool creating_parent; + Bool property_window; +{ + ColormapWindow *cwin; + TwmColormap *cmap; + XWindowAttributes attributes; + + cwin = (ColormapWindow *) malloc(sizeof(ColormapWindow)); + if (cwin) { + if (!XGetWindowAttributes(dpy, w, &attributes) || + XSaveContext(dpy, w, ColormapContext, (caddr_t) cwin)) { + free((char *) cwin); + return (NULL); + } + + if (XFindContext(dpy, attributes.colormap, ColormapContext, + (caddr_t *)&cwin->colormap) == XCNOENT) { + cwin->colormap = cmap = CreateTwmColormap(attributes.colormap); + if (!cmap) { + XDeleteContext(dpy, w, ColormapContext); + free((char *) cwin); + return (NULL); + } + } else { + cwin->colormap->refcnt++; + } + + cwin->w = w; + /* + * Assume that windows in colormap list are + * obscured if we are creating the parent window. + * Otherwise, we assume they are unobscured. + */ + cwin->visibility = creating_parent ? + VisibilityPartiallyObscured : VisibilityUnobscured; + cwin->refcnt = 1; + + /* + * If this is a ColormapWindow property window and we + * are not monitoring ColormapNotify or VisibilityNotify + * events, we need to. + */ + if (property_window && + (attributes.your_event_mask & + (ColormapChangeMask|VisibilityChangeMask)) != + (ColormapChangeMask|VisibilityChangeMask)) { + XSelectInput(dpy, w, attributes.your_event_mask | + (ColormapChangeMask|VisibilityChangeMask)); + } + } + + return (cwin); +} + +void FetchWmColormapWindows (tmp) + TwmWindow *tmp; +{ + register int i, j; + Window *cmap_windows = NULL; + Bool can_free_cmap_windows = False; + int number_cmap_windows = 0; + ColormapWindow **cwins = NULL; + int previously_installed; + extern void free_cwins(); + + number_cmap_windows = 0; + + if ((previously_installed = + (Scr->cmapInfo.cmaps == &tmp->cmaps) && tmp->cmaps.number_cwins)) { + cwins = tmp->cmaps.cwins; + for (i = 0; i < tmp->cmaps.number_cwins; i++) + cwins[i]->colormap->state = 0; + } + + if (XGetWMColormapWindows (dpy, tmp->w, &cmap_windows, + &number_cmap_windows) && + number_cmap_windows > 0) { + + can_free_cmap_windows = False; + /* + * check if the top level is in the list, add to front if not + */ + for (i = 0; i < number_cmap_windows; i++) { + if (cmap_windows[i] == tmp->w) break; + } + if (i == number_cmap_windows) { /* not in list */ + Window *new_cmap_windows = + (Window *) malloc (sizeof(Window) * (number_cmap_windows + 1)); + + if (!new_cmap_windows) { + fprintf (stderr, + "%s: unable to allocate %d element colormap window array\n", + ProgramName, number_cmap_windows+1); + goto done; + } + new_cmap_windows[0] = tmp->w; /* add to front */ + for (i = 0; i < number_cmap_windows; i++) { /* append rest */ + new_cmap_windows[i+1] = cmap_windows[i]; + } + XFree ((char *) cmap_windows); + can_free_cmap_windows = True; /* do not use XFree any more */ + cmap_windows = new_cmap_windows; + number_cmap_windows++; + } + + cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *) * + number_cmap_windows); + if (cwins) { + for (i = 0; i < number_cmap_windows; i++) { + + /* + * Copy any existing entries into new list. + */ + for (j = 0; j < tmp->cmaps.number_cwins; j++) { + if (tmp->cmaps.cwins[j]->w == cmap_windows[i]) { + cwins[i] = tmp->cmaps.cwins[j]; + cwins[i]->refcnt++; + break; + } + } + + /* + * If the colormap window is not being pointed by + * some other applications colormap window list, + * create a new entry. + */ + if (j == tmp->cmaps.number_cwins) { + if (XFindContext(dpy, cmap_windows[i], ColormapContext, + (caddr_t *)&cwins[i]) == XCNOENT) { + if ((cwins[i] = CreateColormapWindow(cmap_windows[i], + (Bool) tmp->cmaps.number_cwins == 0, + True)) == NULL) { + int k; + for (k = i + 1; k < number_cmap_windows; k++) + cmap_windows[k-1] = cmap_windows[k]; + i--; + number_cmap_windows--; + } + } else + cwins[i]->refcnt++; + } + } + } + } + + /* No else here, in case we bailed out of clause above. + */ + if (number_cmap_windows == 0) { + + number_cmap_windows = 1; + + cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *)); + if (XFindContext(dpy, tmp->w, ColormapContext, (caddr_t *)&cwins[0]) == + XCNOENT) + cwins[0] = CreateColormapWindow(tmp->w, + (Bool) tmp->cmaps.number_cwins == 0, False); + else + cwins[0]->refcnt++; + } + + if (tmp->cmaps.number_cwins) + free_cwins(tmp); + + tmp->cmaps.cwins = cwins; + tmp->cmaps.number_cwins = number_cmap_windows; + if (number_cmap_windows > 1) + tmp->cmaps.scoreboard = + (char *) calloc(1, ColormapsScoreboardLength(&tmp->cmaps)); + + if (previously_installed) + InstallWindowColormaps(PropertyNotify, (TwmWindow *) NULL); + + done: + if (cmap_windows) { + if (can_free_cmap_windows) + free ((char *) cmap_windows); + else + XFree ((char *) cmap_windows); + } + + return; +} + + +void GetWindowSizeHints (tmp) + TwmWindow *tmp; +{ + long supplied = 0; + + if (!XGetWMNormalHints (dpy, tmp->w, &tmp->hints, &supplied)) + tmp->hints.flags = 0; + + if (tmp->hints.flags & PResizeInc) { + if (tmp->hints.width_inc == 0) tmp->hints.width_inc = 1; + if (tmp->hints.height_inc == 0) tmp->hints.height_inc = 1; + } + + if (!(supplied & PWinGravity) && (tmp->hints.flags & USPosition)) { + static int gravs[] = { SouthEastGravity, SouthWestGravity, + NorthEastGravity, NorthWestGravity }; + int right = tmp->attr.x + tmp->attr.width + 2 * tmp->old_bw; + int bottom = tmp->attr.y + tmp->attr.height + 2 * tmp->old_bw; + +/* djhjr - 4/19/96 + tmp->hints.win_gravity = + gravs[((Scr->MyDisplayHeight - bottom < tmp->title_height) ? 0 : 2) | + ((Scr->MyDisplayWidth - right < tmp->title_height) ? 0 : 1)]; +*/ + tmp->hints.win_gravity = + gravs[((Scr->MyDisplayHeight - bottom < + tmp->title_height + 2 * tmp->frame_bw3D) ? 0 : 2) | + ((Scr->MyDisplayWidth - right < + tmp->title_height + 2 * tmp->frame_bw3D) ? 0 : 1)]; + + tmp->hints.flags |= PWinGravity; + } +} + diff --git a/add_window.h b/add_window.h new file mode 100644 index 0000000..768b56a --- /dev/null +++ b/add_window.h @@ -0,0 +1,62 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/********************************************************************** + * + * $XConsortium: add_window.h,v 1.7 90/04/17 14:04:33 jim Exp $ + * + * AddWindow include file + * + * 31-Mar-88 Tom LaStrange Initial Version. + * + **********************************************************************/ + +#ifndef _ADD_WINDOW_ +#define _ADD_WINDOW_ + +extern char NoName[]; + +extern TwmWindow *AddWindow(); +extern int MappedNotOverride(); +extern void GrabButtons(); +extern void GrabKeys(); +extern void GrabModKeys(); +extern void UngrabModKeys(); +extern void GetWindowSizeHints(); +extern void FetchWmProtocols(); +extern void FetchWmColormapWindows(); +extern void GetGravityOffsets(); +extern void AddDefaultBindings(); + +extern int AddingX; +extern int AddingY; +extern int AddingW; +extern int AddingH; + +#endif /* _ADD_WINDOW_ */ + diff --git a/applets.c b/applets.c new file mode 100644 index 0000000..165a25b --- /dev/null +++ b/applets.c @@ -0,0 +1,209 @@ +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/********************************************************************** + * + * applets.c + * + * Applet region related routines + * + * 4/26/99 D. J. Hawkey Jr. + * + **********************************************************************/ + +#include +#include +#include "twm.h" +#include "screen.h" +#include "regions.h" +#include "gram.h" +#include "parse.h" +#include "util.h" + +extern void twmrc_error_prefix(); +extern int MatchName(); + +extern void splitRegionEntry(); +extern int roundEntryUp(); +extern RegionEntry *prevRegionEntry(); +extern void mergeRegionEntries(); +extern void downRegionEntry(); +extern RootRegion *AddRegion(); + +int appletWidth(tmp_win) +TwmWindow *tmp_win; +{ + /* submitted by Tim Wiess - 8/23/02 */ + if (Scr->NoBorders || LookInList(Scr->NoBorder, tmp_win->full_name, &tmp_win->class)) + return tmp_win->attr.width; + else + return Scr->BorderWidth * 2 + tmp_win->attr.width; +} + +int appletHeight(tmp_win) +TwmWindow *tmp_win; +{ + /* submitted by Tim Wiess - 8/23/02 */ + /* added 'tmp_win->title_height +' - djhjr - 11/11/03 */ + if (Scr->NoBorders || LookInList(Scr->NoBorder, tmp_win->full_name, &tmp_win->class)) + return tmp_win->title_height + tmp_win->attr.height; + else + return Scr->BorderWidth * 2 + tmp_win->title_height + tmp_win->attr.height; +} + +int PlaceApplet(tmp_win, def_x, def_y, final_x, final_y) +TwmWindow *tmp_win; +int def_x, def_y; +int *final_x, *final_y; +{ + RootRegion *rr; + RegionEntry *re; + int matched, w, h; + + for (rr = Scr->FirstAppletRegion; rr; rr = rr->next) + { + matched = 0; + w = roundEntryUp (appletWidth (tmp_win), rr->stepx); + h = roundEntryUp (appletHeight (tmp_win), rr->stepy); + + for (re = rr->entries; re; re = re->next) + { + if (!matched) + { + /* these were 'match()' - djhjr - 10/20/01 */ + if (MatchName(tmp_win->full_name, re->u.name, &re->re, re->type)) + if (MatchName(tmp_win->class.res_name, re->u.name, &re->re, re->type)) + if (MatchName(tmp_win->class.res_class, re->u.name, &re->re, re->type)) + continue; + + matched = 1; + } + + if (re->usedby) continue; +/* don't include grid spacing - djhjr - 5/22/99 + if (re->w < w || re->h < h) continue; +*/ + if (re->w < appletWidth(tmp_win) || re->h < appletHeight(tmp_win)) + continue; + + splitRegionEntry (re, rr->grav1, rr->grav2, w, h); + re->usedby = USEDBY_TWIN; + re->u.twm_win = tmp_win; + +/* evenly spaced applet placement - djhjr - 4/24/99 + *final_x = re->x + (re->w - appletWidth (tmp_win)) / 2; + *final_y = re->y + (re->h - appletHeight (tmp_win)) / 2; +*/ + *final_x = re->x; + *final_y = re->y; + + /* adjust for region gravity - djhjr 4/26/99 */ + if (rr->grav2 == D_EAST) + *final_x += re->w - appletWidth(tmp_win); + if (rr->grav1 == D_SOUTH) + *final_y += re->h - appletHeight(tmp_win); + + return 1; + } + } + + *final_x = def_x; + *final_y = def_y; + + return 0; +} + +static RegionEntry * +FindAppletEntry (tmp_win, rrp) + TwmWindow *tmp_win; + RootRegion **rrp; +{ + RootRegion *rr; + RegionEntry *re; + + for (rr = Scr->FirstAppletRegion; rr; rr = rr->next) { + for (re = rr->entries; re; re=re->next) + if (re->u.twm_win == tmp_win) { + if (rrp) + *rrp = rr; + return re; + } + } + return 0; +} + +void +AppletDown (tmp_win) + TwmWindow *tmp_win; +{ + RegionEntry *re; + RootRegion *rr; + + re = FindAppletEntry (tmp_win, &rr); + if (re) + downRegionEntry(rr, re); +} + +RootRegion * +AddAppletRegion(geom, grav1, grav2, stepx, stepy) +char *geom; +int grav1, grav2, stepx, stepy; +{ + RootRegion *rr; + + rr = AddRegion(geom, grav1, grav2, stepx, stepy); + + if (Scr->LastAppletRegion) + Scr->LastAppletRegion->next = rr; + Scr->LastAppletRegion = rr; + if (!Scr->FirstAppletRegion) + Scr->FirstAppletRegion = rr; + + return rr; +} + +void +AddToAppletList(list_head, name, type) +RootRegion *list_head; +char *name; +short type; +{ + RegionEntry *nptr; + + if (!list_head) return; /* ignore empty inserts */ + + nptr = (RegionEntry *)malloc(sizeof(RegionEntry)); + if (nptr == NULL) + { + twmrc_error_prefix(); + fprintf (stderr, "unable to allocate %d bytes for RegionEntry\n", + sizeof(RegionEntry)); + Done(); + } + + nptr->next = list_head->entries; + /* djhjr - 10/20/01 */ + nptr->type = type; + nptr->usedby = USEDBY_NAME; + nptr->u.name = (char*)strdup(name); + list_head->entries = nptr; +} + diff --git a/contrib/nexpm/Imakefile b/contrib/nexpm/Imakefile new file mode 100644 index 0000000..94c720d --- /dev/null +++ b/contrib/nexpm/Imakefile @@ -0,0 +1,5 @@ +USRLIBDIR = /usr/lib/X11 +LOCAL_LIBRARIES = -lXpm $(XMULIB) $(XTOOLLIB) $(XLIB) + DEPLIBS = $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) + +SimpleProgramTarget(nexpm) diff --git a/contrib/nexpm/README b/contrib/nexpm/README new file mode 100644 index 0000000..2805222 --- /dev/null +++ b/contrib/nexpm/README @@ -0,0 +1,55 @@ +INTRODUCTION + +If you use vtwm, perhaps you would like to set or change the +background of the "Virtual Desktop" panner window... + +This posting provides a simple program, based on sxpm, xMoveIt, +and xsetroot, that draws a pixmap in *any* existing window. + +Instead of drawing a pixmap, you can make it set a solid background +color for the window -- which is useful to cancel the effects of a +previous nexpm invocation! + +There is a special parameter for operating on the vtwm panner +window; otherwise, the target window is specified either by name, by +numeric ID, or by using the mouse pointer. + +It is possible that the Compensate() routine, which is the only +original code here, is vtwm-specific. + +There is probably no use for this technology except when applied to +the panner window. Putting a pixmap in the background of an xterm +window may be hazardous to your mental health. + +INSTALLATION + +xmkmf +make + +COMPATIBILITY + +My version of xpm is, from README, "3.0 (91/10/03)"; +older xpm libraries will not understand the built-in default +"plaid" pixmap. + +OTHER USES + +The same hack could be applied to xmartin, xv, xloadimage, xneko, or +anything else, if you have source for them, to make them capable of +displaying in other windows. + +FILES + +Imakefile +README +nexpm.c this is what it's all about +patchlevel.h required +xpm.COPYRIGHT came with sxpm... + +DISCLAIMER + +I'm not responsible. This is free stuff, and I wrote very little of +it. Enjoy! + +--Ralph Betza + gnohmon@ssiny.com diff --git a/contrib/nexpm/nexpm.c b/contrib/nexpm/nexpm.c new file mode 100644 index 0000000..6ffccce --- /dev/null +++ b/contrib/nexpm/nexpm.c @@ -0,0 +1,516 @@ +/**********************************************************/ +/* */ +/* pxpm.c: this is sxpm.c hacked by Ralph Betza so that */ +/* it can be used to set a background picture for the */ +/* vtwm panner window, */ +/* */ +/* Works for vtwm, not for tvtwm. */ +/* */ +/* And then also changed to set backgrounds for */ +/* *any* window. */ +/* Ralph Betza, June 1993 gnohmon@ssiny.com */ +/**********************************************************/ + +/* Copyright 1990,91 GROUPE BULL -- See licence conditions in file COPYRIGHT */ +/* Since most of the code is from sxpm.c, the above copyright should +** still apply. +*/ + +/*****************************************************************************\ +* sxpm.c: * +* * +* Show XPM File program * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include + +#ifdef VMS +#include "decw$include:Xlib.h" +#include "decw$include:Intrinsic.h" +#include "decw$include:Shell.h" +#include "decw$include:shape.h" +#else +#include +#include +#include +#include +#include +#endif + +#include + +Window window_by_name(); +Window point_to_window(); + +/* XPM */ +/* plaid pixmap */ +static char *plaid[] = +{ +/* width height ncolors chars_per_pixel */ + "22 22 4 2", +/* colors */ + " c red m white s light_color", + "Y c green m black s lines_in_mix", + "+ c yellow m white s lines_in_dark", + "x m black s dark_color", +/* pixels */ + "x x x x x x x x x x x x + x x x x x ", + " x x x x x x x x x x x x x x x x ", + "x x x x x x x x x x x x + x x x x x ", + " x x x x x x x x x x x x x x x x ", + "x x x x x x x x x x x x + x x x x x ", + "Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ", + "x x x x x x x x x x x x + x x x x x ", + " x x x x x x x x x x x x x x x x ", + "x x x x x x x x x x x x + x x x x x ", + " x x x x x x x x x x x x x x x x ", + "x x x x x x x x x x x x + x x x x x ", + " x x x x Y x x x ", + " x x x Y x x ", + " x x x x Y x x x ", + " x x x Y x x ", + " x x x x Y x x x ", + "x x x x x x x x x x x x x x x x x x x x x x ", + " x x x x Y x x x ", + " x x x Y x x ", + " x x x x Y x x x ", + " x x x Y x x ", + " x x x x Y x x x " +}; + +/* #define win XtWindow(topw) */ +Window win; +Window Compensate(); +#define dpy XtDisplay(topw) +#define screen XtScreen(topw) +#define colormap XDefaultColormapOfScreen(screen) +#define root XRootWindowOfScreen(screen) +#define xrdb XtDatabase(dpy) + +int sDoByName; +int sDoByNumber; +char * pTargetWindowName; + +void Usage(); +void ErrorMessage(); +void Punt(); + +#define IWIDTH 50 +#define IHEIGHT 50 + +typedef struct _XpmIcon { + Pixmap pixmap; + Pixmap mask; + XpmAttributes attributes; +} XpmIcon; + +static char **command; +static Widget topw; +static XpmIcon view; + +char *point_txt[] = { +" ====> Please select the window", +" ====> whose background you wish to", +" ====> change by clicking the", +" ====> pointer in that window.", +0}; + +XColor NameToXColor(); +unsigned long NameToPixel(); + +main(argc, argv) + unsigned int argc; + char **argv; +{ + int ErrorStatus; + unsigned int stdinf = 0; + unsigned int sSolid = 0; + unsigned int w_rtn; + unsigned int h_rtn; + char *input = NULL; + unsigned int numsymbols = 0; + XpmColorSymbol symbols[10]; + char *stype; + XrmValue val; + unsigned long valuemask = 0; + int n; + char *solid_color = NULL; + Arg args[3]; + + topw = XtInitialize(argv[0], "Nexpm", + (void*)0, 0, &argc, argv); + + if (!topw) { + fprintf(stderr, "Nexpm Error... [ Undefined DISPLAY ]\n"); + exit(1); + } + + /* + * arguments parsing + */ + + command = argv; + if (argc < 2) + Usage(); + for (n = 1; n < argc; n++) { + + if ( ! strcmp( argv[ n ], "-target" )) + { sDoByName = 1; + pTargetWindowName = argv[++n]; + continue; + } + if ( ! strcmp( argv[ n ], "-vtwm" )) + { sDoByName = 1; + pTargetWindowName = "VTWM Desktop"; + continue; + } + if ( ! strcmp( argv[ n ], "-id" )) + { sDoByNumber = 1; + pTargetWindowName = argv[++n]; + continue; + } + + if (!strcmp("-solid", argv[n])) { + solid_color = argv[++n]; + sSolid = 1; + continue; + } + if (strncmp(argv[n], "-plaid", 3) == 0) { + continue; + } + if (strncmp(argv[n], "-in", 3) == 0) { + input = argv[++n]; + continue; + } + if (strncmp(argv[n], "-stdin", 5) == 0) { + stdinf = 1; + continue; + } + if (strncmp(argv[n], "-s", 2) == 0) { + if (n < argc - 2) { + valuemask |= XpmColorSymbols; + symbols[numsymbols].name = argv[++n]; + symbols[numsymbols++].value = argv[++n]; + continue; + } + } + if (strncmp(argv[n], "-p", 2) == 0) { + if (n < argc - 2) { + valuemask |= XpmColorSymbols; + symbols[numsymbols].name = argv[++n]; + symbols[numsymbols].value = NULL; + symbols[numsymbols++].pixel = atol(argv[++n]); + continue; + } + } + if (strncmp(argv[n], "-rgb", 3) == 0) { + if (n < argc - 1) { + valuemask |= XpmRgbFilename; + view.attributes.rgb_fname = argv[++n]; + continue; + } + } + Usage(); + } + + n = 0; + XtSetArg(args[n], XtNwidth, 1); + n++; + XtSetArg(args[n], XtNheight, 1); + n++; + XtSetArg(args[n], XtNmappedWhenManaged, False); + n++; + XtSetValues(topw, args, n); + XtRealizeWidget(topw); + + view.attributes.colorsymbols = symbols; + view.attributes.numsymbols = numsymbols; + view.attributes.valuemask = valuemask; + + if ( sDoByName ) + { win = window_by_name( root, pTargetWindowName ); + win = Compensate( win ); + } + else if ( sDoByNumber ) + { + win = strtol( pTargetWindowName, (void *)0, 0 ); + } + else + { char ** ptr; + for (ptr = point_txt; *ptr; ptr++) + printf("%s\n",*ptr); + + win = point_to_window(); /* use pointer to get window */ + win = Compensate( win ); + } + + if ( ! sSolid ) + { + if (input || stdinf) { + view.attributes.valuemask |= XpmReturnInfos; + view.attributes.valuemask |= XpmReturnPixels; + ErrorStatus = XpmReadFileToPixmap(dpy, win, input, + &view.pixmap, &view.mask, + &view.attributes); + ErrorMessage(ErrorStatus, "Read"); + } else { + + ErrorStatus = XpmCreatePixmapFromData(dpy, win, plaid, + &view.pixmap, &view.mask, + &view.attributes); + ErrorMessage(ErrorStatus, "Plaid"); + } +/* Now we are ready to display it... */ + XSetWindowBackgroundPixmap(dpy, win, view.pixmap); + } + else + { + XSetWindowBackground(dpy, win, NameToPixel( solid_color, + 0L )); + } + + XClearWindow(dpy, win); + XFlush( dpy ); + Punt(0); +} + +void +Usage() +{ + fprintf(stderr, "\nUsage: %s [options...]\n", command[0]); + fprintf(stderr, "%s\n", "Where options are:"); + fprintf(stderr, "%s\n", + "[-vtwm] Target is the vtwm panner."); + fprintf(stderr, "%s\n", + "[-id window_id target Window's numeric ID."); + fprintf(stderr, "%s\n", + "[-target window_name] target Window's name."); + fprintf(stderr, "%s\n", + " (if none of the above specified, target is selected by mouse)"); + fprintf(stderr, "%s\n", +"[-solid color_name] Ignore all pixmap parameters, set\ + background color."); + fprintf(stderr, "%s\n", + "[-d host:display] Display to connect to."); + fprintf(stderr, "%s\n", + "[-s symbol_name color_name] Overwrite color defaults."); + fprintf(stderr, "%s\n", + "[-p symbol_name pixel_value] Overwrite color defaults."); + fprintf(stderr, "%s\n", + "[-plaid] Read the included plaid pixmap."); + fprintf(stderr, "%s\n", + "[-in filename] Read input from file `filename`."); + fprintf(stderr, "%s\n", + "[-stdin] Read input from stdin."); + fprintf(stderr, "%s\n\n", + "[-rgb filename] Search color names in the \ +rgb text file `filename`."); + exit(0); +} + + +void +ErrorMessage(ErrorStatus, tag) + int ErrorStatus; + char *tag; +{ + char *error = NULL; + char *warning = NULL; + + switch (ErrorStatus) { + case XpmSuccess: + return; + case XpmColorError: + warning = "Could not parse or alloc requested color"; + break; + case XpmOpenFailed: + error = "Cannot open file"; + break; + case XpmFileInvalid: + error = "invalid XPM file"; + break; + case XpmNoMemory: + error = "Not enough memory"; + break; + case XpmColorFailed: + error = "Color not found"; + break; + } + + if (warning) + printf("%s Xpm Warning: %s.\n", tag, warning); + + if (error) { + printf("%s Xpm Error: %s.\n", tag, error); + Punt(1); + } +} + +void +Punt(i) + int i; +{ + if (view.pixmap) { + XFreePixmap(dpy, view.pixmap); + if (view.mask) + XFreePixmap(dpy, view.mask); + + XFreeColors(dpy, colormap, + view.attributes.pixels, view.attributes.npixels, 0); + + XpmFreeAttributes(&view.attributes); + } + exit(i); +} + +Window window_by_name(wdw,name) +Window wdw; +char *name; +{ +/**********************************************************/ +/* */ +/* Copied from xcursor.c, who copied it from xwininfo. */ +/* */ +/**********************************************************/ + + Window *offspring; /* Any children */ + Window junk; /* Just that */ + Window w = 0; /* Found window */ + int count; /* Number of kids */ + int loop; /* Loop counter */ + char *wdw_name; /* Returnewd name */ + if (XFetchName(dpy,wdw,&wdw_name) && !strcmp(wdw_name,name)) + return(wdw); + if (!XQueryTree(dpy,wdw,&junk,&junk,&offspring,&count)) + return(0); + for (loop = 0; loop < count; loop++) + { + w = window_by_name(offspring[loop],name); + if (w) + break; + } + if (offspring) + XFree(offspring); + /* fprintf( stderr, "w=%x\n", w ); */ + return(w); +} + +Window point_to_window() +{ /* from xcursor.c, also from blast.c */ + int status; + Cursor cursor; + XEvent event; + Window target_win = None; + int buttons = 0; + + /* Make the target cursor */ + cursor = XCreateFontCursor(dpy, XC_crosshair); + + /* Grab the pointer using target cursor, letting it room all over */ + status = XGrabPointer(dpy, root, False, + ButtonPressMask|ButtonReleaseMask, GrabModeSync, + GrabModeAsync, None, cursor, CurrentTime); + if (status != GrabSuccess) + { + fprintf(stderr,"Can't grab the mouse."); + exit(4); + } + + /* Let the user select a window... */ + while ((target_win == None) || (buttons != 0)) /* allow one more event */ + { + XAllowEvents(dpy, SyncPointer, CurrentTime); + XWindowEvent(dpy, root, + ButtonPressMask|ButtonReleaseMask, &event); + switch (event.type) + { + case ButtonPress: + if (target_win == None) + { + /* window selected */ + target_win = event.xbutton.subwindow; + if (target_win == None) + target_win = root; + } + buttons++; + break; + + /* there may have been some down before we started */ + case ButtonRelease: + if (buttons > 0) + buttons--; + break; + } + } + + XUngrabPointer(dpy, CurrentTime); /* Done with pointer */ + + target_win = XmuClientWindow( dpy, target_win ); +/* XmuClientWindow() is suggested by blast.c, but ifdeffed out. +** What happens is that blast gets the ID of the frame window, +** created by the window manager, not the ID of the window you +** really pointed to; but for blast it's OK: the shape *should* be +** given to the frame. +*/ + + return(target_win); +} + +Window +Compensate( win ) +Window win; +{ + Window dummy; + Window dummy2; + Window * children; + unsigned int n; + + if ( XQueryTree( dpy, win, &dummy, &dummy2, &children, &n )) + { + /* Test for children submitted by Steve Ratcliffe */ + if (children) + { + win = *children; + XFree( children ); + } + } +/**********************************************************/ +/* */ +/* It is possible that Compensate() is vtwm-specific. */ +/* */ +/* In any case, xlswins() reveals that the window ID we */ +/* get from the pointer or from the name is always the */ +/* *parent* of the window we really want, and since it */ +/* is always at the bottom of the stacking order we */ +/* know that it is the first window returned by */ +/* XQueryTree. */ +/* */ +/**********************************************************/ + return win; +} + + +unsigned long NameToPixel(name, pixel) + char *name; + unsigned long pixel; +{ + XColor ecolor; + + if (!name || !*name) + return pixel; + if (!XParseColor(dpy,colormap,name,&ecolor)) { + fprintf(stderr,"nexpm: unknown color \"%s\"\n",name); + exit(1); + /*NOTREACHED*/ + } + if (!XAllocColor(dpy, colormap,&ecolor)) + { + fprintf(stderr, "nexpm: unable to allocate color for \"%s\"\n", + name); + exit(1); + /*NOTREACHED*/ + } + return(ecolor.pixel); +} diff --git a/contrib/nexpm/patchlevel.h b/contrib/nexpm/patchlevel.h new file mode 100644 index 0000000..ba66466 --- /dev/null +++ b/contrib/nexpm/patchlevel.h @@ -0,0 +1 @@ +0.0 diff --git a/contrib/nexpm/xpm.COPYRIGHT b/contrib/nexpm/xpm.COPYRIGHT new file mode 100644 index 0000000..09aa185 --- /dev/null +++ b/contrib/nexpm/xpm.COPYRIGHT @@ -0,0 +1,33 @@ +The following still applies to the parts of sxpm.c that were used to +create nexpm.c: + +/* + * Copyright 1990, 1991 GROUPE BULL + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of GROUPE BULL not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. GROUPE BULL makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * GROUPE BULL disclaims all warranties with regard to this software, + * including all implied warranties of merchantability and fitness, + * in no event shall GROUPE BULL be liable for any special, + * indirect or consequential damages or any damages + * whatsoever resulting from loss of use, data or profits, + * whether in an action of contract, negligence or other tortious + * action, arising out of or in connection with the use + * or performance of this software. + * + */ + +Arnaud LE HORS BULL Research FRANCE -- Koala Project + (XPM - X PixMap format version 2 & 3) + Internet: lehors@sophia.inria.fr +Surface Mail: Arnaud LE HORS, INRIA - Sophia Antipolis, + 2004, route des Lucioles, 06565 Valbonne Cedex -- FRANCE + Voice phone: (33) 93.65.77.71, Fax: (33) 93 65 77 66, Telex: 97 00 50 F diff --git a/contrib/support/sysrc_add_apps.sh b/contrib/support/sysrc_add_apps.sh new file mode 100644 index 0000000..e0c665d --- /dev/null +++ b/contrib/support/sysrc_add_apps.sh @@ -0,0 +1,206 @@ +#!/bin/sh +# +# Adds installed applications to the box-stock system.vtwmrc file. + +syntax () +{ + # could be a "here-doc", but it'd break at least one shell + echo + echo "Usage: ${0##*/} [-i in_file] [-o out_file] [-m menu_decl] \\" + echo " [-a app_list | -A app_file] [-f] [-h]" + echo + echo "Default in_file: $DEF_INPUT" + echo "Default out_file: $DEF_OUTPUT" + echo "Default menu_decl: $DEF_MENU_DECL" + echo "Default app_list: $DEF_LIST" + echo + echo "app_file is a list, each line containing one application specification" + echo "(or the keywords \"SEPARATOR\" or \"TITLE::string\"). The specification is" + echo "of the form \"name::string\", where \"name\" is the menu entry and \"string\"" + echo "is the command to execute. Whitespace in either part is indicated with" + echo "a single colon." + echo + + exit +} + +check_replace () +{ + CWD=$PWD + cd `dirname "$INPUT"` && INDIR=$PWD && INNAME=`basename "$INPUT"` + cd `dirname "$OUTPUT"` && OUTDIR=$PWD && OUTNAME=`basename "$OUTPUT"` + cd $CWD + if [ "$INDIR" = "$OUTDIR" -a "$INNAME" = "$OUTNAME" ]; then + if [ $NO_PROMPT -eq 1 ]; then + echo "Replacing in_file with out_file." + else + echo -n "Replace in_file with out_file (y/n)? " + read ANS + [ "$ANS" != "y" -a "$ANS" != "Y" ] && \ + echo "Exiting." && exit + fi + + OUTPUT=$TMPOUT + fi +} + +check_X_path () +{ + ANS=`which xterm 2>/dev/null` + if [ -z "$ANS" ]; then + if [ $NO_PROMPT -eq 1 ]; then + echo "No path to X applications (xterm)." + else + echo "The path to X applications (xterm) isn't set." + while true; do + echo -n "Enter full X path: " + read ANS + [ -z "$ANS" ] && echo "Exiting." && exit + [ -d "$ANS" -a -f "$ANS/xterm" -a \ + -x "$ANS/xterm" ] && break + done + PATH=$PATH:$ANS + fi + fi +} + +check_proceed () +{ + echo + echo "in_file: $INPUT" + if [ "$OUTPUT" = "$TMPOUT" ]; then + echo "out_file: $INPUT" + else + echo "out_file: $OUTPUT" + fi + echo "menu_decl: $MENU_DECL" + echo "app_list: $APP_LIST" + echo "app_file: $APP_FILE" + echo "Search path: $PATH" + echo + if [ $NO_PROMPT -eq 1 ]; then + echo "Proceeding..." + else + echo -n "Proceed (y/n)? " + read ANS + [ "$ANS" != "y" -a "$ANS" != "Y" ] && echo "Exiting." && exit + fi +} + +check_app () +{ + if [ "$1" = "SEPARATOR" ]; then + printf "\t\"\"\t\tf.separator\n" >>$2 + else + CMD=${1%%::*} + STR=${1##*::} + + if [ "$CMD" = "TITLE" ]; then + printf "\t\" %s \"\t\tf.title\n" $STR \ + |sed -e 's/:/ /g' >>$2 + else + [ -z "`which $CMD 2>/dev/null`" ] && return + printf "\t\"%s\"\t\tf.exec \"%s &\"\n" $CMD $STR \ + |sed -e 's/:/ /g' >>$2 + fi + fi +} + +DEF_INPUT=./system.vtwmrc +DEF_OUTPUT=./custom.vtwmrc + +DEF_LIST="TITLE::Shells emu eterm mxterm rxvt xterm xvt" +DEF_LIST="$DEF_LIST midc::xterm:-e:midc top::xterm:-e:top" +DEF_LIST="$DEF_LIST TITLE::Editors nedit xcoral xvile" +DEF_LIST="$DEF_LIST vi::xterm:-e:vi vile::xterm:-e:vile vim::xterm:-e:vim" +DEF_LIST="$DEF_LIST SEPARATOR gimp xfig xpaint xv xbmbrowser bitmap pixmap" +DEF_LIST="$DEF_LIST TITLE::Desktop applix soffice abiword lyx ted::Ted" +DEF_LIST="$DEF_LIST gnumeric ghostview gv xcal xcalendar" +DEF_LIST="$DEF_LIST SEPARATOR tkman xman" +DEF_LIST="$DEF_LIST SEPARATOR gmplayer xine xmcd xmmix xmms" +DEF_LIST="$DEF_LIST SEPARATOR hexcalc xcalc editres" +DEF_LIST="$DEF_LIST xbiff xcb xev xeyes xload xmag" +DEF_LIST="$DEF_LIST SEPARATOR moonclock mouseclock oclock" +DEF_LIST="$DEF_LIST rclock sunclock t3d xarclock xclock xdaliclock" +DEF_LIST="$DEF_LIST TITLE::Network chimera ie mozilla netscape opera" +DEF_LIST="$DEF_LIST links::xterm:-e:links lynx::xterm:-e:lynx" +DEF_LIST="$DEF_LIST SEPARATOR exmh knews xdir" +DEF_LIST="$DEF_LIST ftp::xterm:-e:ftp telnet::xterm:-e:telnet" +DEF_LIST="$DEF_LIST elm::xterm:-e:elm mutt::xterm:-e:mutt" +DEF_LIST="$DEF_LIST pine::xterm:-e:pine tin::xterm:-e:tin" + +DEF_MENU_DECL="menu \"apps\"" + +NO_PROMPT=0 + +TMPOUT=out.$$ +LISTOUT=list.$$ + +while getopts "i:o:m:a:A:fh" OPT; do + case $OPT in + i) INPUT=$OPTARG;; + o) OUTPUT=$OPTARG;; + m) MENU_DECL=$OPTARG;; + a) APP_LIST=$OPTARG;; + A) APP_FILE=$OPTARG;; + f) NO_PROMPT=1;; + *) syntax;; + esac +done + +[ -z "$INPUT" ] && INPUT=$DEF_INPUT +[ -z "$OUTPUT" ] && OUTPUT=$DEF_OUTPUT +[ -z "$APP_LIST" ] && APP_LIST=$DEF_LIST +[ -n "$APP_FILE" ] && APP_LIST= +[ -z "$MENU_DECL" ] && MENU_DECL=$DEF_MENU_DECL + +[ ! -f "$INPUT" ] && echo "$INPUT: File not found" && syntax + +check_replace +check_X_path +check_proceed + +if [ -n "$APP_LIST" ]; then + for APP in $APP_LIST; do + check_app $APP $LISTOUT + done +else + if [ -f "$APP_FILE" ]; then + while read APP; do + check_app $APP $LISTOUT + done <"$APP_FILE" + else + echo "$APP_FILE: File not found" + exit + fi +fi + +[ ! -s $LISTOUT ] && echo "No applications added." && exit + +uniq $LISTOUT $$.$$ +mv $$.$$ $LISTOUT + +cat "$INPUT" \ + |awk -v list="$LISTOUT" -v menu="$MENU_DECL" \ + 'BEGIN { \ + split(menu, menu); \ + } { \ + if ($1 == menu[1] && $2 == menu[2]) { \ + print $0; \ + do { \ + if ($1 == "{") print "{"; \ + a = getline; \ + } while (a && $1 != "}"); \ + if (a && $1 == "}") { \ + while (getline app "$OUTPUT" + +[ -s $TMPOUT ] && mv $TMPOUT "$INPUT" +rm -f *.$$ +echo "Done." diff --git a/contrib/vtwmrc/images/byzantine.xpm b/contrib/vtwmrc/images/byzantine.xpm new file mode 100644 index 0000000..36b4934 --- /dev/null +++ b/contrib/vtwmrc/images/byzantine.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char *byzantine[] = { +/* width height num_colors chars_per_pixel */ +"32 13 3 1", +/* colors */ +" s None c None", +". c grey75", +"X c grey35", +/* pixels */ +" ..............X ..............X", +" .XXXXXXXXXXXX.X .XXXXXXXXXXXX.X", +" .X .X .X .X", +" .X ........X .X .X ........X .X", +" .X .XXXXXX.X .X .X .XXXXXX.X .X", +" .X .X .X .X .X .X .X .X", +" .X .....X .X .X .X .X .....X .X", +" .X XXXX.X .X .X .X .X .XXXXX .X", +" .X .X .X .X .X .X .X .X", +" ........X .X .X .X .X ........X", +" XXXXXXXXX .X .X .X .X XXXXXXXXX", +" .X .X .X .X ", +"............X ....X ............"}; diff --git a/contrib/vtwmrc/images/djhjr.xpm b/contrib/vtwmrc/images/djhjr.xpm new file mode 100644 index 0000000..3b5cbe0 --- /dev/null +++ b/contrib/vtwmrc/images/djhjr.xpm @@ -0,0 +1,70 @@ +/* XPM */ +static char *djhjr[] = { +/* width height num_colors chars_per_pixel */ +" 320 48 15 1", +/* colors */ +". c #595959", +"# c #656565", +"a c #6d6d6d", +"b c #757575", +"c c #797979", +"d c #828282", +"e c #8a8a8a", +"f c #999999", +"g c #a2a2a2", +"h c #a6a6a6", +"i c #b2b2b2", +"j c #bababa", +"k c #c3c3c3", +"l c #c7c7c7", +"m c #d3d3d3", +/* pixels */ +"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeefeffffffffffffffffffffffffffffffffffffffefeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeefefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffedcbcdefffffffffffffffffffffffffffffffffffedccdeffffffffffffffffffffffffffffffffffffffffffffffffffffffffecbbdfghgfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedcddeffffffffffffffffffffffffffedbaabdfffffffffffffffffffffffffeeeffffffffdcbcdffgffffffffffffffffffffffffffffffffffffffffffffffffffffffebbbefhigfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"ffffffffffffffffffffffffffedddeefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdcccdffgffffffffffffffffffffffffdcba#ceffgfffffffffffffffffffffddddefffffffdcbcefhhgffffffffffffffffffffffffffffffffffffffffffffffffffffedbbbfhjihfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"ffffffffffffffffffeeeeeeddccbbcdeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdbbcdfhhffffffffffffffffffffffffdbabbefgggggffffffffffffffffffedcccefffffffdbbcfgiigffffffffffffffffffffffffffffffffffffffffffffffffffffdcabdgijihfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"fffffffffffffefeeedccbbbbbbabbcdeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdbbdfghigfffffffffffffffffffffffdbbcdfghgghgffffffffffffffffffecbbdffhgfffedbbdgijigffffffffffffffffffffffffffffffffffffffffffffffffffffdbacehijigfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"fffffffffeeccbbbbbaaabbbbbbcdeefffffffffffffffffffffffffffffffffffffffffffffffffffeeeffffffffffffffffffffffffdccefhiigfffffffffffffffffffffffdbbdffghgfhhgfffffffffffffffffebbcefihhfffecabehijigffffffffffffffffffffffffffffffffffffffffffffffffffffdbbdfhjjhffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"ffeddcccccbbbabbbbbcddeefffggffffghhgfffffffffffffffffffffffffffffffffffffffffffeddddefffffffffffffffffffffffedcefghigfffffffffffffffffffffffdbbdfffgfgiihfffffffffffffffffdbbcfhjihfffcbbcfhjjhgffffffffffffffffffffffffffffffffffffffffffffffffffffdbbdfiijgffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"ffdcbbbbbbbbccdeeefffgghhiiihgfffhihhgffffffffffffffffffffffffffffffffffffffffffecccdffgffffffffffffffffffffffecdffgigfffffffffffffffffffffffdbbeffffffiiigfffffffffffffffedabdfijihffecbbdfjjigfffffffffffffffffffffffffffffffffffffffffffffffffffffcbbefiijgffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", +"ffdcbccddddeffffghhijiiijjjigfdegijihgffffffffffffffffffffffffffffffffffffffffffecbcdfgggfffffffffffffffffffffedcdfgihhffffffffffffffffffffffdbbdfffffgiiiffffffffffffffffdcabegijigfffcbbefjiigffffffffffffffffffffffffffffffffffffffffffffffffffffecbbegijigfffffffffffffffffffffffffffffffffffffffffffefeffffffffffffffffffff", +"ffdddefffgggghhijjjjjjiiiihgeccdfijihfffffffffffffffffffffffffffffffffffffffffffecccefhhgfffffffffffffffffffffeccdegiihffffffffffffffffffffffdbbdfffffgiiigfffffffffffffffdbacfhjjhgffecbcegjjhffffffffffffffffffffffffffffffffffffffffffffffffffffedbacfhjiigfffffffffffffffffffffffffffffffffffffffffeddcdeeffffffffffffffffff", +"fffffghiijhhhghiijiihgfffffdbbcfhjjigffffffffffffffffffffffffffffeedddefffffffffedddffhhgffffffffffffffffffffffcccffiihffffffffffffffffffffffdbbdeffffgijiffffffffffffffffcbbdfiijgffffbbcffjjiffffffffffffffffffffffffffffffffffffffffffffffffffffecbbdfijihfffffffffffffffffffffffffffffffffffffffffedcbccefffffffffffffffffff", +"ffffghiiiihfeffghhgfgfffffecbbcfijihffffffffffffffffffffffffffffedcccdeffffffffffeddefghhgfffffffffffffffffffffddcefhihffffffffffffffffffffffdbbceeffghjiiffffffffffffffffcbbdfiiigfffecbcegijhgfffffffffffffffffffffffffffffffffffffffffffffffffffebbbegijigffffffffffffffffffffffffffffffffffffffffeeccbdeggggffffffffffffffff", +"ffffgggghgedcdegghffffffffdcabehijigfffffffffffffffffffffffffffedcbcdfffgfffffffffdddffhhhfffffffffffffffffffffedcefghhgfffffffffffffffffffffdbbcdeffhijihgfffffffffffffffccbefijifffffbbcegjjhffffffffffffffffffffffffffffffffffffffffffffffffffffebbcegiihfffffffffffffffffffffffffffffffffffffffffeedddfghihgffffffffffffffff", +"ffffffffffccbdfhhiffffffffcbacfhiihffffffffffffffffffffffffffffeddcdfghhhgffffffffeddefhihffffffffffffffffffffffecdefghhgffffffffffffffffffffdbbbcefhiijigffffffffffffffffccbefijiffffecbcegijiffffffffefffffffffffffffffffffffffffffffffffffffffffebbcfgjjhffffffffffffffffffffffffffffffffffffffffffeeffgijihgffffffffffffffff", +"ffffffffffedcefghiffffffedbbbfhihfdcccdddefffffffffffffffffffffffffhiiihggfffffffffecdefhhhgffffffffffffffffffffedddfghhgffffffffffffffffffffba#abfhljjigfffffffffffffffffccbegiiiffffecbcegijifffffedcccccddeeffffffffffffffffffffffffffffffffffffebbcfgjjhffffffffffffffffffffffffffffffffffffffffffffffffgffeddeeffffffffffff", +"fffffffffffdceffhhhfffffecbbcfiigfdcddddddddeeefffffffffffffffffffgghhggfffffffffffeddefghhgfffffffffffffffffffffeddefghhgffffffffffffffeeddca..adhjlkihgfffffffffffffffffccbefijigffffcccffiihgffffedccdddddddddeeefffffffffffffffffffffffffffffffebccfgjjhfffffffffffffffffffffffffffffffffffffffffffeeddeedcccceeffffffffffff", +"fffffffffffeddefghhgffffdbacehiigfeefeeedddddddeffffffffffffffffffffgfffffffffffffffdddffihgffffffffffffffffffffffdddffhhhfffffefefffffedccbb#.#cfilmjihffffffffffffffffffccbegiiifffffdcceghihfffffeeeeeefeedddddddfefffffffffffffffffffffffffffffebbcfgjjhfffffffffffffffffffffffffffffffffffffffffffdcbbbcccbcdffgfffffffffff", +"fffffffffffedddffihgfffedbbcfijihffffgffffdddcdddeffffffffffffffffffffffffffffffffffeddffghhffffffffffffffffffffffdddefhhhgfffddcddeffeccbabbaacfhklligfffffffffffffffffffccbefiiiffffeddcefghhffffffffffffffffddcdddeefffffffffffffffffffffffeedeeebbcfgjjhffffffffffffffffffffffffffffffffffffffffffeca#aacddcefghhhgfffffffff", +"ffffffffffffdddffhhhfffecabehijigfgghhigffdccdeefffffffffffffffffffffffffffffffffffffedeffgggfffffffffffffffffffffedcefghiffeddbbcdfffecaabcfeefgikkkhffedcbbcceefffffffffccbegiihfdcbbba#acdffffffffffgghihhfedcddefffffffffffffffffffffffffeedddedbbcfgjjhffffffffffffffffffffffffffffffffffffffffffdb#.abeffghijiigffffffffff", +"fffffffffffffdceffhhgfecbbcfijjhgfffffefeedeeffgghhggffffffffffffffffffffffffffffffffeedefggggfffffffffffffffffffffeceefhhhfecbabdfggffcccefhgffgijjjgfdcbbbbbccddddefffffcbacefgfcbabbba#abdeffeeefffffffefeeedeeffgghggfffffffffffffffffffffdccddeccdfgijhffffeedcdddefffffffffffffffffffffffffffffdca.#behijijjiihggfffffffff", +"fffffffffffffeddefhihfdbbbegjjigfedccccccdefghiiiihffeddddddddddddeeffffffffffffffffffeddffghgfffffffffffffffffffffeddefghhfdbbbdfhihgfdddffigfffgiiifdcbbbcddeedddddddddda##bdfffcbccddcbbcefgffefeffedcbcccddefghijiigffedddddddeeefffffffffeccceedddfgjjhffeedcbbbccdddedeeffffffffffffeedeeeffffedcaabegikkjiihggfffffffffff", +"fffffffffffffeddefghifcabcfijigfdcbbabbcdefghjijihffccbbbbbbccbcbbccdeeeeeefffffffffffedddfgihgfffffffffffffffffffffdddffhifcbbcfijjigffeeffhgffffhhgecbccefffgffeedddcccb#..bdfffeefffgfeeffhihgffffecbbabbcdffghjjjigfeccbccbcbbcceeeeffffffecccfefeefgiihfeeccbbbccdddccccddeeeeeeeeeedccbccdefffedccddfhjkjjhgffffffffffffff", +"fffffffffffffedceffhiecacehjjhfdcbbbcdefgghhhgffffdccbbcccccccccccccdcccbbcddefffffffffdddffhhhfffffffffffffffffffffdddffhhfcbbegjjjggffeddefffffffffcbcefhijihhfffffeedcb##aceghihiiijihgfghjjjhhggfdcbbcdffgghhggfffedccbbccccccccdccdddeffeebcdfgffffghihfdcbbbdefffffddcccccccbbbbbbbbaabbcdefffeeeffffhhijhgfffffffffffffff", +"ffffffffffffffeddefghfcbdfiiifdbbbcefghgggffffeedcccdeeffffffffffffffedccbccdccccceefffddcefhhhffffffffffffffffffffffdceffhgeccefghgffffdccefhigfffffeefgiijjiihihhhgffffeedefhjkkjjjjjiigfghiikihgfedcdefghgggfffeeedcccdeefffffffffeddcdcdccbabdghigfffhhfdcbbdfghihhgffffffeedcbbbbbbbbbcdeeffffffffgffffghiigfffffffffffffff", +"fffffffffffffffccdffgedcegiihebbbdffggffffeeedeeefffghhhhhhhhhhhhhhgfffefeeeeedccccddddddceffhigfffffffffffffffffffffdddefhgfedfffgfddccbacehijigfffffghiiihhgggghhhhhhhhhgffhijkkjihhggffeeffhiigfeeeeffgfgfffeedeeeffffghhhhhhhhhgffffeeddccbcdfhjigffffffdccefhijjiihhhhhhgfffeeeeeeeefffgggffffffffgfedefhiigfffffffffffffff", +"ffffffffffffffeccdffgfddfhjifdbbdefffffeeeeefffgghiijjijjjjjjjjjjiihhhgggggfffeededdddddccdefhhhgffffffffffffffffffffedcefghgfeffffedccbbbdfijiigfffhhijiihgfffffggghhhiijihgggiijihgfffffdddffigfdcdefffffeeeeeefffgghiijijjjjjjiihhhgfgffeedeffhjiiffefffeedeghjiihhhhhhiiihhggggggggghhiijihgffffgggffddefghigfffffffffffffff", +"fffffffffffffffdddfgffeefjjhfdbcdffffeeeeffghiijjjjjjiihihihihihihihhhiiiiiihgfgffffeededccdfghhgfffeefefffffffffffffeeceffhhgffffffeedcdeghjjigfffghijiiggffffffffffgghhihgffffghhgffffffdddefhgfcccefffeeeeeffhhijijjjjiiihihihihihhhhhggfggghjjiihffeeffffggiiihggffffghhhhhhiiiijjijijjjjihfeeffhhgffdddffghgfffffffffffffff", +"fffffffffffffffeefggffffhjjhfddeffffeffghijjjjjjiiihhgfffffffffffffffghhiiiiiiiiihhgffffecccefgigfddcbbcdeefffffffffffeddefgihgfgggffffgghjjjihgfffgghhhgfffffffffffffffffffcddfghhgffffffedcefggfeeeffffeffhhjjjjjjjiiihhgffffffffffghhihiiiijjjjhhgffefffhiijjihgfffffffffffgghiiiiijiiiihhgfdddfghhhfffdddfghhhffffffffffffff", +"ffffffffffffffffffffeeffijihfeeffghhhiijjjjjihhgffgfffffffffffffffffffffffffgghhiiihhhhgfeccefghhfdcbbbcccdcdccddefffffdddffihhfggghhhiiijjiigffffffffffffffffffffffffffffffdddffhigfffffffedeffggffffghhhiijjjjiihhggfffffffffffffffffffgghiiiiihgfffffffhijjihhgfffffffffffffffffgfgffffgffffedcffhhhfffccdegiihffffffffffffff", +"fffffffffffffffffffdddfhijigffffghiijjjiiihhggfffffffffffffffffffffffffffffffffggggghhhhgfeefgijhfecccdeeeddccbccddddddcccffhhhfffgghiiijiihgfffffffffffffffffffffffffffffffeddefgghffffffffdeefghggfghijjjjiihhhggfffffffffffffffffffffffffgggggffffffffgghiihhgffffffffffffffffffffffffffffffeecefghhgffcccefiiiffffffffffffff", +"fffffffffffffffffdcbbegijigfffffggghggfffffffffffffffffffffffffffffffffffffffffffffffffffgfgijkkihffgghihgffffffffeedccccbdfghihgfffffffffffffffffffffffffffffffffffffffffffffeefghhigfffffffffghihiggghgggfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeccdfhiigfdccefhihgfffffffffffff", +"ffffffffffffffffedbbbfhjiiffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffggiijiihfgghiiihiiiiiihgffffffeeffiiihgffffffffffffffffffffffffffffffffffffffffffffffefghiigfffffffffgghiggfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdcbdfhiigfedcefghiffffffffffffff", +"ffffffffffffffffecbbdfijihffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffgghhgffffgfgfgghiiiihihhhhggffhijjihgffffffffffffffffffffffffffffffffffffffffffffffffghhiggfffffffffggggffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffebbdfhjjgffecdffghhgffffffffffff", +"ffffffffffffffffdbacehjjhgfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffggggggghhiiihhhiijiigffffffffffffffffffffffffffffffffffffffffffffffffffhhggffffffffffffffgfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffebbdfhjigffecddfgihgffffffffffff", +"fffffffffffffffecbbdfijihfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffgghhhhhiiiihggfffffffffffffffffffffffffffffffffffffffffffffffffffgfgffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdcbdfhjjgffeccdfgiigffffffffffff", +"fffffffffffffffdcabehijigfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffgghhhgffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffebbdfhjihffebbcfgjihffffffffffff", +"ffffffffffffffecbbcfijjhgfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffebbdfhjjgffebbcfgjjhffffffffffff", +"ffffffffffffffecbbdfjjigffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdcbdfhjigffebbcfgjjhffffffffffff", +"fffffffffffffedbbbfhjjhgffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdbbdfhjihffebbcfhjihffffffffffff", +"fffffffffffffecbbcgijihffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedbbdgijigfedbbdfhjihffffffffffff", +"fffffffffffffdbacehikigffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecabehijihfecabdgijjhffffffffffff", +"fffffffffffffdccefijjhfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcbacfijjhgfdccdfhjjhgffffffffffff", +"fffffffffffffeddfgijigffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecbbdgijigffeddfgijihfffffffffffff", +"fffffffffffffeeffiiiifffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdbbcfhjiigffeeffhiiigfffffffffffff", +"ffffffffffffffffghhhhgffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdcdegijihffffffghihgffffffffffffff", +"fffffffffffffffffgggfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeedefhjjhgffffffggggfffffffffffffff" +}; diff --git a/contrib/vtwmrc/images/dot1x3.xbm b/contrib/vtwmrc/images/dot1x3.xbm new file mode 100644 index 0000000..3cd0c9f --- /dev/null +++ b/contrib/vtwmrc/images/dot1x3.xbm @@ -0,0 +1,4 @@ +#define dot1x3_width 1 +#define dot1x3_height 3 +static unsigned char dot1x3_bits[] = { + 0x01, 0x00, 0x00}; diff --git a/contrib/vtwmrc/images/eyesline.xpm b/contrib/vtwmrc/images/eyesline.xpm new file mode 100644 index 0000000..673b5cb --- /dev/null +++ b/contrib/vtwmrc/images/eyesline.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char *eyesline[] = { +/* width height num_colors chars_per_pixel */ +" 1024 13 3 1", +/* colors */ +". s None c None", +"# c black", +"a c gray90", +/* pixels */ +"................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +"........####.........####.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +".......###.............###......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +"...........###.....###..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +"..........###a#...###a#.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +".........###aaa#.###aaa#........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +"....#....##aaaa#.##aaaa#...#..#.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +"##.###...##a##a#.##a##a#..##.###................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +"#######..##a###..##a###..#######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################", +"aaaaaaaa..####....####...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", +"...........##......##...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", +"................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................" +}; diff --git a/contrib/vtwmrc/images/nestedsqu.xbm b/contrib/vtwmrc/images/nestedsqu.xbm new file mode 100644 index 0000000..d6e6166 --- /dev/null +++ b/contrib/vtwmrc/images/nestedsqu.xbm @@ -0,0 +1,35 @@ +#define realscr_width 64 +#define realscr_height 48 +static char realscr_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, + 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0xc6, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x63, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, + 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x63, 0xc6, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x63, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x63, + 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x63, 0xc6, 0xe1, 0xff, 0xff, + 0xff, 0xff, 0x87, 0x63, 0xc6, 0xe1, 0xff, 0xff, 0xff, 0xff, 0x87, 0x63, + 0xc6, 0xe1, 0xff, 0xff, 0xff, 0xff, 0x87, 0x63, 0xc6, 0xe1, 0xff, 0xff, + 0xff, 0xff, 0x87, 0x63, 0xc6, 0xe1, 0x01, 0x00, 0x00, 0x80, 0x87, 0x63, + 0xc6, 0xe1, 0x01, 0x00, 0x00, 0x80, 0x87, 0x63, 0xc6, 0xe1, 0x01, 0x00, + 0x00, 0x80, 0x87, 0x63, 0xc6, 0xe1, 0x01, 0x00, 0x00, 0x80, 0x87, 0x63, + 0xc6, 0xe1, 0x01, 0x00, 0x00, 0x80, 0x87, 0x63, 0xc6, 0xe1, 0xc1, 0xff, + 0xff, 0x83, 0x87, 0x63, 0xc6, 0xe1, 0xc1, 0xff, 0xff, 0x83, 0x87, 0x63, + 0xc6, 0xe1, 0xc1, 0xff, 0xff, 0x83, 0x87, 0x63, 0xc6, 0xe1, 0xc1, 0xff, + 0xff, 0x83, 0x87, 0x63, 0xc6, 0xe1, 0x01, 0x00, 0x00, 0x80, 0x87, 0x63, + 0xc6, 0xe1, 0x01, 0x00, 0x00, 0x80, 0x87, 0x63, 0xc6, 0xe1, 0x01, 0x00, + 0x00, 0x80, 0x87, 0x63, 0xc6, 0xe1, 0x01, 0x00, 0x00, 0x80, 0x87, 0x63, + 0xc6, 0xe1, 0x01, 0x00, 0x00, 0x80, 0x87, 0x63, 0xc6, 0xe1, 0xff, 0xff, + 0xff, 0xff, 0x87, 0x63, 0xc6, 0xe1, 0xff, 0xff, 0xff, 0xff, 0x87, 0x63, + 0xc6, 0xe1, 0xff, 0xff, 0xff, 0xff, 0x87, 0x63, 0xc6, 0xe1, 0xff, 0xff, + 0xff, 0xff, 0x87, 0x63, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x63, + 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x63, 0xc6, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x63, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x63, + 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0xc6, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x63, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/contrib/vtwmrc/images/photon_close.xpm b/contrib/vtwmrc/images/photon_close.xpm new file mode 100644 index 0000000..482ea41 --- /dev/null +++ b/contrib/vtwmrc/images/photon_close.xpm @@ -0,0 +1,47 @@ +/* XPM */ +static char *photon_close[] = { +/* width height num_colors chars_per_pixel */ +" 18 18 22 1", +/* colors */ +". c #000084", +"# c #c6c3c6", +"a c #636163", +"b c #949294", +"c s None c None", +"d c #a5a2a5", +"e c #cecfce", +"f c #b5b2b5", +"g c #9c9a9c", +"h c #e7e3e7", +"i c #ffffff", +"j c #f7f3f7", +"k c #d6d3d6", +"l c #848284", +"m c #737173", +"n c #424142", +"o c #313031", +"p c #42494a", +"q c #000000", +"r c #525152", +"s c #101010", +"t c #212021", +/* pixels */ +"cccccd#e#fdccccccc", +"cccchijhke#fdlcccc", +"ccgiiihke#fffdmccc", +"cgiiihke##ffggbacc", +"chiihe#ffffddgbbpc", +"giih#fffdfddgbblar", +"#ihefsqadlsqmbllmn", +"kjk#flqqpsqpbbllmo", +"kk#ffdaqqqtdbblmmo", +"#e#fddrqqqtgbllmmt", +"f##fdlqqaqqpblmmao", +"cfffgsqrdlsqalmaro", +"cdfdddgddgbblmaaon", +"cldggggbbbblmmaroc", +"cclgbbbbbllmaarooc", +"cccllblllmmaaroocc", +"cccccammmmaroooccc", +"cccccccpoooonccccc" +}; diff --git a/contrib/vtwmrc/images/photon_help.xpm b/contrib/vtwmrc/images/photon_help.xpm new file mode 100644 index 0000000..cde77c1 --- /dev/null +++ b/contrib/vtwmrc/images/photon_help.xpm @@ -0,0 +1,47 @@ +/* XPM */ +static char *photon_help[] = { +/* width height num_colors chars_per_pixel */ +" 18 18 22 1", +/* colors */ +". c #000084", +"# c #c6c3c6", +"a c #636163", +"b c #949294", +"c s None c None", +"d c #a5a2a5", +"e c #cecfce", +"f c #b5b2b5", +"g c #9c9a9c", +"h c #e7e3e7", +"i c #ffffff", +"j c #f7f3f7", +"k c #d6d3d6", +"l c #848284", +"m c #737173", +"n c #424142", +"o c #313031", +"p c #42494a", +"q c #000000", +"r c #525152", +"s c #101010", +"t c #212021", +/* pixels */ +"cccccd#e#fdccccccc", +"cccchijhke#fdlcccc", +"ccgiiihke#fffdmccc", +"cgiiihke##ffggbacc", +"chiihelnopbddgbbpc", +"giiheaqqqqqlgbblar", +"#ihefsqolsqrgbllmn", +"kjk#fblbaqqlbbllmo", +"kk#ffddrqqmgbblmmo", +"#e#fdddqqmddbllmmt", +"f##ffdgllgdgblmmao", +"cfffdddqqmdgblmaro", +"cdfddddqqlbblmaaon", +"cldggbgbbbllmaaroc", +"cclgbbbbbllmaarooc", +"cccllblllmmaaroocc", +"cccccammmmaroooccc", +"ccccccapoooonccccc" +}; diff --git a/contrib/vtwmrc/images/photon_maximize.xpm b/contrib/vtwmrc/images/photon_maximize.xpm new file mode 100644 index 0000000..af26377 --- /dev/null +++ b/contrib/vtwmrc/images/photon_maximize.xpm @@ -0,0 +1,47 @@ +/* XPM */ +static char *photon_maximize[] = { +/* width height num_colors chars_per_pixel */ +" 18 18 22 1", +/* colors */ +". c #000084", +"# c #c6c3c6", +"a c #636163", +"b c #949294", +"c s None c None", +"d c #a5a2a5", +"e c #cecfce", +"f c #b5b2b5", +"g c #9c9a9c", +"h c #e7e3e7", +"i c #ffffff", +"j c #f7f3f7", +"k c #d6d3d6", +"l c #848284", +"m c #737173", +"n c #424142", +"o c #313031", +"p c #42494a", +"q c #000000", +"r c #525152", +"s c #101010", +"t c #212021", +/* pixels */ +"cccccd#e#ffccccccc", +"cccchijhh##fdlcccc", +"ccgiiihke#fffdmccc", +"cgiiihk###ffggbacc", +"chiiqqqqqqqqqgbbpc", +"giihqqqqqqqqqbblar", +"#iheqqdddddqqbllmn", +"kjk#qqdddddqqbllmo", +"kk##qqdddddqqblmmo", +"#e#fqqdddddqqllmmt", +"f##fqqdddddqqlmmao", +"cfffqqqqqqqqqlmaro", +"cdfdototottttmaaon", +"cldgggbbbbblmmaroc", +"cclgbbbbbllmaarooc", +"cccllblllmmaaroocc", +"ccccmammmmaroooccc", +"ccccccapoooonccccc" +}; diff --git a/contrib/vtwmrc/images/photon_menu.xpm b/contrib/vtwmrc/images/photon_menu.xpm new file mode 100644 index 0000000..0d2c48c --- /dev/null +++ b/contrib/vtwmrc/images/photon_menu.xpm @@ -0,0 +1,47 @@ +/* XPM */ +static char *photon_menu[] = { +/* width height num_colors chars_per_pixel */ +" 18 18 22 1", +/* colors */ +". c #000084", +"# c #c6c3c6", +"a c #636163", +"b c #949294", +"c s None c None", +"d c #a5a2a5", +"e c #cecfce", +"f c #b5b2b5", +"g c #9c9a9c", +"h c #e7e3e7", +"i c #ffffff", +"j c #f7f3f7", +"k c #d6d3d6", +"l c #848284", +"m c #737173", +"n c #424142", +"o c #313031", +"p c #42494a", +"q c #000000", +"r c #525152", +"s c #101010", +"t c #212021", +/* pixels */ +"cccccd#e#fdccccccc", +"cccchijhke#fdlcccc", +"ccgiiihke##ffdmccc", +"cgiiihke##ffggbacc", +"chiihe#ffffddgbbpc", +"giihaarrrrrrrbblac", +"#iheaqqqqqqqtbllmn", +"kjk#gsqqqqqqlbllmo", +"kk##daqqqqqpbblmmo", +"#e#ffdtqqqqgbllmmt", +"f##fddlqqqmgblmmao", +"cfffdddnqtgbblmaro", +"cdfdddgbqmgblmaaon", +"cldggggbmbllmaaroc", +"cclgbbbbbllmaarooc", +"cccllblllmmaaroocc", +"ccccmammmmaroooccc", +"ccccccapoooonccccc" +}; diff --git a/contrib/vtwmrc/images/photon_minimize.xpm b/contrib/vtwmrc/images/photon_minimize.xpm new file mode 100644 index 0000000..81d92f5 --- /dev/null +++ b/contrib/vtwmrc/images/photon_minimize.xpm @@ -0,0 +1,47 @@ +/* XPM */ +static char *photon_minimize[] = { +/* width height num_colors chars_per_pixel */ +" 18 18 22 1", +/* colors */ +". c #000084", +"# c #c6c3c6", +"a c #636163", +"b c #949294", +"c s None c None", +"d c #a5a2a5", +"e c #cecfce", +"f c #b5b2b5", +"g c #9c9a9c", +"h c #e7e3e7", +"i c #ffffff", +"j c #f7f3f7", +"k c #d6d3d6", +"l c #848284", +"m c #737173", +"n c #424142", +"o c #313031", +"p c #42494a", +"q c #000000", +"r c #525152", +"s c #101010", +"t c #212021", +/* pixels */ +"cccccg#e#fdccccccc", +"cccchijhke#fdlcccc", +"ccgiiihke##ffdmccc", +"cgiiihke##ffggbacc", +"chiihe#ffffddgbbpc", +"giih#ffdfdddgbblac", +"#iheffddddddgbllmn", +"kjk#fdddddddgbllmo", +"kk#ffdddddddbblmmo", +"#e#fddddddddbllmmt", +"f##ffqqqoqqqblmmao", +"cfffdotoptotblmaro", +"cdfddgdgggbblmaaon", +"cldgggggbbblmmaroc", +"cclgbbblbllmaarooc", +"cccllblllmmaaroocc", +"ccccmammmmaroooccc", +"ccccccapoooonccccc" +}; diff --git a/contrib/vtwmrc/images/photon_rarrow.xpm b/contrib/vtwmrc/images/photon_rarrow.xpm new file mode 100644 index 0000000..abce6f2 --- /dev/null +++ b/contrib/vtwmrc/images/photon_rarrow.xpm @@ -0,0 +1,19 @@ +/* XPM */ +static char *photon_rarrow[] = { +"14 14 2 1", +" s None c None", +". c #000000000000", +" ", +" ", +" .. ", +" .... ", +" ..... ", +" ....... ", +" ........ ", +" ....... ", +" ..... ", +" .... ", +" .. ", +" ", +" ", +" "}; diff --git a/contrib/vtwmrc/images/vtwm.gif b/contrib/vtwmrc/images/vtwm.gif new file mode 100644 index 0000000..aefaa10 Binary files /dev/null and b/contrib/vtwmrc/images/vtwm.gif differ diff --git a/contrib/vtwmrc/images/win95_close.xpm b/contrib/vtwmrc/images/win95_close.xpm new file mode 100644 index 0000000..4b05d76 --- /dev/null +++ b/contrib/vtwmrc/images/win95_close.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *win95_close[] = { +/* width height num_colors chars_per_pixel */ +" 15 15 4 1", +/* colors */ +", c None s None", +". c #000000", +"a c #acacac", +"b c #ebebeb", +/* pixels */ +",,,,,,,,,,,,,,,", +"bbbbbbbbbbbbbb.", +"baaaaaaaaaaaaa.", +"baaaaaaaaaaaaa.", +"baa..aaaaa..aa.", +"baaa..aaa..aaa.", +"baaaa..a..aaaa.", +"baaaaa...aaaaa.", +"baaaa..a..aaaa.", +"baaa..aaa..aaa.", +"baa..aaaaa..aa.", +"baaaaaaaaaaaaa.", +"baaaaaaaaaaaaa.", +"...............", +",,,,,,,,,,,,,,," +}; diff --git a/contrib/vtwmrc/images/win95_menu.xpm b/contrib/vtwmrc/images/win95_menu.xpm new file mode 100644 index 0000000..40d8efe --- /dev/null +++ b/contrib/vtwmrc/images/win95_menu.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *win95_menu[] = { +/* width height num_colors chars_per_pixel */ +" 15 15 4 1", +/* colors */ +", c None s None", +". c #ebebeb", +"# c #000000", +"a c #acacac", +/* pixels */ +",,,,,,,,,,,,,,,", +"..............#", +".aaaaaaaaaaaaa#", +".aaaaaaaaaaaaa#", +".aaaaaaaaaaaaa#", +".aa#########aa#", +".aaa#######aaa#", +".aaaa#####aaaa#", +".aaaaa###aaaaa#", +".aaaaaa#aaaaaa#", +".aaaaaaaaaaaaa#", +".aaaaaaaaaaaaa#", +".aaaaaaaaaaaaa#", +"###############", +",,,,,,,,,,,,,,," +}; diff --git a/contrib/vtwmrc/images/win95_minimize.xpm b/contrib/vtwmrc/images/win95_minimize.xpm new file mode 100644 index 0000000..2c52ca5 --- /dev/null +++ b/contrib/vtwmrc/images/win95_minimize.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *win95_minimize[] = { +/* width height num_colors chars_per_pixel */ +" 15 15 4 1", +/* colors */ +", c None s None", +". c #000000", +"a c #acacac", +"b c #ebebeb", +/* pixels */ +",,,,,,,,,,,,,,,", +"bbbbbbbbbbbbbb.", +"baaaaaaaaaaaaa.", +"baaaaaaaaaaaaa.", +"baaaaaaaaaaaaa.", +"baaaaaaaaaaaaa.", +"baaaaaaaaaaaaa.", +"baaaaaaaaaaaaa.", +"baaaaaaaaaaaaa.", +"baaaaaaaaaaaaa.", +"baaa.......aaa.", +"baaa.......aaa.", +"baaaaaaaaaaaaa.", +"...............", +",,,,,,,,,,,,,,,," +}; diff --git a/contrib/vtwmrc/images/win95_rarrow.xpm b/contrib/vtwmrc/images/win95_rarrow.xpm new file mode 100644 index 0000000..9c88f85 --- /dev/null +++ b/contrib/vtwmrc/images/win95_rarrow.xpm @@ -0,0 +1,19 @@ +/* XPM */ +static char *win95_rarrow[] = { +"14 14 2 1", +" s None c None", +". c #000000000000", +" ", +" ", +" . ", +" .. ", +" ... ", +" .... ", +" ..... ", +" .... ", +" ... ", +" .. ", +" . ", +" ", +" ", +" "}; diff --git a/contrib/vtwmrc/images/win95_unzoom.xpm b/contrib/vtwmrc/images/win95_unzoom.xpm new file mode 100644 index 0000000..22ac6ac --- /dev/null +++ b/contrib/vtwmrc/images/win95_unzoom.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *win95_unzoom[] = { +/* width height num_colors chars_per_pixel */ +" 15 15 4 1", +/* colors */ +", c None s None", +". c #000000", +"a c #acacac", +"b c #ebebeb", +/* pixels */ +",,,,,,,,,,,,,,,", +"bbbbbbbbbbbbbb.", +"baaaaaaaaaaaaa.", +"baaaa......aaa.", +"baaaa......aaa.", +"baaaa.aaaa.aaa.", +"baa......a.aaa.", +"baa......a.aaa.", +"baa.aaaa...aaa.", +"baa.aaaa.aaaaa.", +"baa.aaaa.aaaaa.", +"baa......aaaaa.", +"baaaaaaaaaaaaa.", +"...............", +",,,,,,,,,,,,,,," +}; diff --git a/contrib/vtwmrc/images/win95_zoom.xpm b/contrib/vtwmrc/images/win95_zoom.xpm new file mode 100644 index 0000000..afd9c97 --- /dev/null +++ b/contrib/vtwmrc/images/win95_zoom.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static char *win95_zoom[] = { +/* width height num_colors chars_per_pixel */ +" 15 15 4 1", +/* colors */ +", c None s None", +". c #000000", +"a c #acacac", +"b c #ebebeb", +/* pixels */ +",,,,,,,,,,,,,,,", +"bbbbbbbbbbbbbb.", +"baaaaaaaaaaaaa.", +"baa.........aa.", +"baa.........aa.", +"baa.aaaaaaa.aa.", +"baa.aaaaaaa.aa.", +"baa.aaaaaaa.aa.", +"baa.aaaaaaa.aa.", +"baa.aaaaaaa.aa.", +"baa.aaaaaaa.aa.", +"baa.........aa.", +"baaaaaaaaaaaaa.", +"...............", +",,,,,,,,,,,,,,," +}; diff --git a/contrib/vtwmrc/sounds/applause1.au b/contrib/vtwmrc/sounds/applause1.au new file mode 100644 index 0000000..8727229 Binary files /dev/null and b/contrib/vtwmrc/sounds/applause1.au differ diff --git a/contrib/vtwmrc/sounds/applause2.au b/contrib/vtwmrc/sounds/applause2.au new file mode 100644 index 0000000..d1e3ff5 Binary files /dev/null and b/contrib/vtwmrc/sounds/applause2.au differ diff --git a/contrib/vtwmrc/sounds/bleebloo.au b/contrib/vtwmrc/sounds/bleebloo.au new file mode 100644 index 0000000..5f0e7fd Binary files /dev/null and b/contrib/vtwmrc/sounds/bleebloo.au differ diff --git a/contrib/vtwmrc/sounds/boing1.au b/contrib/vtwmrc/sounds/boing1.au new file mode 100644 index 0000000..f736fec Binary files /dev/null and b/contrib/vtwmrc/sounds/boing1.au differ diff --git a/contrib/vtwmrc/sounds/boing2.au b/contrib/vtwmrc/sounds/boing2.au new file mode 100644 index 0000000..bd73296 Binary files /dev/null and b/contrib/vtwmrc/sounds/boing2.au differ diff --git a/contrib/vtwmrc/sounds/boing3.au b/contrib/vtwmrc/sounds/boing3.au new file mode 100644 index 0000000..551557f Binary files /dev/null and b/contrib/vtwmrc/sounds/boing3.au differ diff --git a/contrib/vtwmrc/sounds/boip.au b/contrib/vtwmrc/sounds/boip.au new file mode 100644 index 0000000..5975108 Binary files /dev/null and b/contrib/vtwmrc/sounds/boip.au differ diff --git a/contrib/vtwmrc/sounds/break1.au b/contrib/vtwmrc/sounds/break1.au new file mode 100644 index 0000000..28a4bfd Binary files /dev/null and b/contrib/vtwmrc/sounds/break1.au differ diff --git a/contrib/vtwmrc/sounds/break2.au b/contrib/vtwmrc/sounds/break2.au new file mode 100644 index 0000000..dc6ec98 Binary files /dev/null and b/contrib/vtwmrc/sounds/break2.au differ diff --git a/contrib/vtwmrc/sounds/cardshuffle.au b/contrib/vtwmrc/sounds/cardshuffle.au new file mode 100644 index 0000000..ccd7b7e Binary files /dev/null and b/contrib/vtwmrc/sounds/cardshuffle.au differ diff --git a/contrib/vtwmrc/sounds/cashregister.au b/contrib/vtwmrc/sounds/cashregister.au new file mode 100644 index 0000000..5e310ab Binary files /dev/null and b/contrib/vtwmrc/sounds/cashregister.au differ diff --git a/contrib/vtwmrc/sounds/chime1.au b/contrib/vtwmrc/sounds/chime1.au new file mode 100644 index 0000000..ddda79b Binary files /dev/null and b/contrib/vtwmrc/sounds/chime1.au differ diff --git a/contrib/vtwmrc/sounds/chime2.au b/contrib/vtwmrc/sounds/chime2.au new file mode 100644 index 0000000..4978438 Binary files /dev/null and b/contrib/vtwmrc/sounds/chime2.au differ diff --git a/contrib/vtwmrc/sounds/chime3.au b/contrib/vtwmrc/sounds/chime3.au new file mode 100644 index 0000000..a880fbb Binary files /dev/null and b/contrib/vtwmrc/sounds/chime3.au differ diff --git a/contrib/vtwmrc/sounds/chime4.au b/contrib/vtwmrc/sounds/chime4.au new file mode 100644 index 0000000..bb68e3e Binary files /dev/null and b/contrib/vtwmrc/sounds/chime4.au differ diff --git a/contrib/vtwmrc/sounds/chime5.au b/contrib/vtwmrc/sounds/chime5.au new file mode 100644 index 0000000..6ec6ba1 Binary files /dev/null and b/contrib/vtwmrc/sounds/chime5.au differ diff --git a/contrib/vtwmrc/sounds/coinslot.au b/contrib/vtwmrc/sounds/coinslot.au new file mode 100644 index 0000000..0d92362 Binary files /dev/null and b/contrib/vtwmrc/sounds/coinslot.au differ diff --git a/contrib/vtwmrc/sounds/ddl.au b/contrib/vtwmrc/sounds/ddl.au new file mode 100644 index 0000000..fea6370 Binary files /dev/null and b/contrib/vtwmrc/sounds/ddl.au differ diff --git a/contrib/vtwmrc/sounds/ddloo.au b/contrib/vtwmrc/sounds/ddloo.au new file mode 100644 index 0000000..489c88b Binary files /dev/null and b/contrib/vtwmrc/sounds/ddloo.au differ diff --git a/contrib/vtwmrc/sounds/dedoo.au b/contrib/vtwmrc/sounds/dedoo.au new file mode 100644 index 0000000..aef4108 Binary files /dev/null and b/contrib/vtwmrc/sounds/dedoo.au differ diff --git a/contrib/vtwmrc/sounds/doh1.au b/contrib/vtwmrc/sounds/doh1.au new file mode 100644 index 0000000..f63b6fc Binary files /dev/null and b/contrib/vtwmrc/sounds/doh1.au differ diff --git a/contrib/vtwmrc/sounds/doh2.au b/contrib/vtwmrc/sounds/doh2.au new file mode 100644 index 0000000..0dafb49 Binary files /dev/null and b/contrib/vtwmrc/sounds/doh2.au differ diff --git a/contrib/vtwmrc/sounds/doh3.au b/contrib/vtwmrc/sounds/doh3.au new file mode 100644 index 0000000..399580f Binary files /dev/null and b/contrib/vtwmrc/sounds/doh3.au differ diff --git a/contrib/vtwmrc/sounds/doh4.au b/contrib/vtwmrc/sounds/doh4.au new file mode 100644 index 0000000..45acccb Binary files /dev/null and b/contrib/vtwmrc/sounds/doh4.au differ diff --git a/contrib/vtwmrc/sounds/highhat.wav b/contrib/vtwmrc/sounds/highhat.wav new file mode 100644 index 0000000..0c8240f Binary files /dev/null and b/contrib/vtwmrc/sounds/highhat.wav differ diff --git a/contrib/vtwmrc/sounds/hithere.au b/contrib/vtwmrc/sounds/hithere.au new file mode 100644 index 0000000..033a635 Binary files /dev/null and b/contrib/vtwmrc/sounds/hithere.au differ diff --git a/contrib/vtwmrc/sounds/ping.au b/contrib/vtwmrc/sounds/ping.au new file mode 100644 index 0000000..b068470 Binary files /dev/null and b/contrib/vtwmrc/sounds/ping.au differ diff --git a/contrib/vtwmrc/sounds/pop1.wav b/contrib/vtwmrc/sounds/pop1.wav new file mode 100644 index 0000000..6740d3f Binary files /dev/null and b/contrib/vtwmrc/sounds/pop1.wav differ diff --git a/contrib/vtwmrc/sounds/pop2.wav b/contrib/vtwmrc/sounds/pop2.wav new file mode 100644 index 0000000..1b69cd1 Binary files /dev/null and b/contrib/vtwmrc/sounds/pop2.wav differ diff --git a/contrib/vtwmrc/sounds/pop3.au b/contrib/vtwmrc/sounds/pop3.au new file mode 100644 index 0000000..5093e91 Binary files /dev/null and b/contrib/vtwmrc/sounds/pop3.au differ diff --git a/contrib/vtwmrc/sounds/shutdown.wav b/contrib/vtwmrc/sounds/shutdown.wav new file mode 100644 index 0000000..f74629f Binary files /dev/null and b/contrib/vtwmrc/sounds/shutdown.wav differ diff --git a/contrib/vtwmrc/sounds/splat1.wav b/contrib/vtwmrc/sounds/splat1.wav new file mode 100644 index 0000000..fd15ace Binary files /dev/null and b/contrib/vtwmrc/sounds/splat1.wav differ diff --git a/contrib/vtwmrc/sounds/splat2.wav b/contrib/vtwmrc/sounds/splat2.wav new file mode 100644 index 0000000..4ea5d11 Binary files /dev/null and b/contrib/vtwmrc/sounds/splat2.wav differ diff --git a/contrib/vtwmrc/sounds/squeezetoy.au b/contrib/vtwmrc/sounds/squeezetoy.au new file mode 100644 index 0000000..8efc4d0 Binary files /dev/null and b/contrib/vtwmrc/sounds/squeezetoy.au differ diff --git a/contrib/vtwmrc/sounds/startup.wav b/contrib/vtwmrc/sounds/startup.wav new file mode 100644 index 0000000..225d5b5 Binary files /dev/null and b/contrib/vtwmrc/sounds/startup.wav differ diff --git a/contrib/vtwmrc/sounds/touch1.au b/contrib/vtwmrc/sounds/touch1.au new file mode 100644 index 0000000..31301bc Binary files /dev/null and b/contrib/vtwmrc/sounds/touch1.au differ diff --git a/contrib/vtwmrc/sounds/touch2.au b/contrib/vtwmrc/sounds/touch2.au new file mode 100644 index 0000000..3ddbc20 Binary files /dev/null and b/contrib/vtwmrc/sounds/touch2.au differ diff --git a/contrib/vtwmrc/sounds/touch3.au b/contrib/vtwmrc/sounds/touch3.au new file mode 100644 index 0000000..a9c02e7 Binary files /dev/null and b/contrib/vtwmrc/sounds/touch3.au differ diff --git a/contrib/vtwmrc/sounds/touch4.au b/contrib/vtwmrc/sounds/touch4.au new file mode 100644 index 0000000..638e76e Binary files /dev/null and b/contrib/vtwmrc/sounds/touch4.au differ diff --git a/contrib/vtwmrc/sounds/touch5.au b/contrib/vtwmrc/sounds/touch5.au new file mode 100644 index 0000000..c06eb4b Binary files /dev/null and b/contrib/vtwmrc/sounds/touch5.au differ diff --git a/contrib/vtwmrc/sounds/tshhh.wav b/contrib/vtwmrc/sounds/tshhh.wav new file mode 100644 index 0000000..253d568 Binary files /dev/null and b/contrib/vtwmrc/sounds/tshhh.wav differ diff --git a/contrib/vtwmrc/sounds/warp1.au b/contrib/vtwmrc/sounds/warp1.au new file mode 100644 index 0000000..8df4775 Binary files /dev/null and b/contrib/vtwmrc/sounds/warp1.au differ diff --git a/contrib/vtwmrc/sounds/warp2.au b/contrib/vtwmrc/sounds/warp2.au new file mode 100644 index 0000000..c03b69d Binary files /dev/null and b/contrib/vtwmrc/sounds/warp2.au differ diff --git a/contrib/vtwmrc/sounds/warp3.au b/contrib/vtwmrc/sounds/warp3.au new file mode 100644 index 0000000..f2db035 Binary files /dev/null and b/contrib/vtwmrc/sounds/warp3.au differ diff --git a/contrib/vtwmrc/sounds/whoosh1.wav b/contrib/vtwmrc/sounds/whoosh1.wav new file mode 100644 index 0000000..a2651b8 Binary files /dev/null and b/contrib/vtwmrc/sounds/whoosh1.wav differ diff --git a/contrib/vtwmrc/sounds/whoosh2.wav b/contrib/vtwmrc/sounds/whoosh2.wav new file mode 100644 index 0000000..1f6d278 Binary files /dev/null and b/contrib/vtwmrc/sounds/whoosh2.wav differ diff --git a/contrib/vtwmrc/sounds/whoosh3.wav b/contrib/vtwmrc/sounds/whoosh3.wav new file mode 100644 index 0000000..6740f19 Binary files /dev/null and b/contrib/vtwmrc/sounds/whoosh3.wav differ diff --git a/contrib/vtwmrc/sounds/whoosh4.au b/contrib/vtwmrc/sounds/whoosh4.au new file mode 100644 index 0000000..79520cd Binary files /dev/null and b/contrib/vtwmrc/sounds/whoosh4.au differ diff --git a/contrib/vtwmrc/sounds/whoosh5.au b/contrib/vtwmrc/sounds/whoosh5.au new file mode 100644 index 0000000..6c2d9d8 Binary files /dev/null and b/contrib/vtwmrc/sounds/whoosh5.au differ diff --git a/contrib/vtwmrc/vtwmrc-95ish b/contrib/vtwmrc/vtwmrc-95ish new file mode 100644 index 0000000..23c2356 --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-95ish @@ -0,0 +1,274 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-95ish +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# m4 Variables +# + +define(WMname, `95ish') + +# Border width, autopan border width, desktop and door bevel widths... +define(WMborder, 5) define(WMpanborder, 5) +define(WMdesktopbevel, 1) define(WMdoorbevel, 1) +# Title heights (must be set manually for VTWM windows and applets)... +define(WMdesktoptitle, 0) define(WMdoortitle, 0) +define(WMiconmgrtitle, 0) define(WMapplettitle, 0) + +# +# Boolean Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-bools) + +ShallowReliefWindowButton + +NoBorderDecorations + +# +# Parametered Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-parms) + +# See also 'Lists' below... +IconManagerGeometry "+5+5" 1 + +RealScreenBorderWidth 0 + +# Gap between frame and titlebar font (titlebar changes) +FramePadding 2 +# Gap between FramePadding and buttons (buttons change) +ButtonIndent 0 +# Gap between titlebar elements +TitlePadding 2 +# Button border width (TitleForeground color) +TitleButtonBorderWidth 0 + +ClearBevelContrast 60 +DarkBevelContrast 60 + +BorderBevelWidth 1 +ButtonBevelWidth 0 +DoorBevelWidth WMdoorbevel +IconBevelWidth 1 +IconManagerBevelWidth 1 +InfoBevelWidth 1 +MenuBevelWidth 1 +TitleBevelWidth 0 +VirtualDesktopBevelWidth WMdesktopbevel + +UnknownIcon "xlogo32" + +TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +ResizeFont "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" +MenuFont "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" +MenuTitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +IconFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +InfoFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +IconManagerFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +DoorFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +#VirtualDesktopFont "-adobe-helvetica-medium-r-normal--*-75-*-*-*-*-*-*" + +# +# Functions and Bindings +# + +# Read in the bindings file... +include(HOME/vtwm/vtwmrc-binds) + +LeftTitleButton "win95_menu.xpm" = f.menu "ArrangeMenu" +RightTitleButton "win95_minimize.xpm" = f.iconify +RightTitleButton "win95_zoom.xpm" = f.fullzoom +RightTitleButton "win95_unzoom.xpm" = f.resize +#RightTitleButton "win95_close.xpm" = f.menu "CloseMenu" + +Function "decorate-virtual" +{ + f.exec "nexpm -vtwm -in HOME/vtwm/images/djhjr.xpm &" +} + +Function "clear-virtual" +{ + f.exec "nexpm -vtwm -solid gray67 &" +} + +# +# Lists +# + +# Read in the sound file... +include(ifelse(SOUND, `Yes', `HOME/vtwm/vtwmrc-sound')) + +# Read in the lists file... +include(HOME/vtwm/vtwmrc-lists) + +# Check 'BorderColor', as that's the highlight color... +NoHighlight + +#NoTitleHighlight + +#SqueezeTitle +#DontSqueezeTitle {} + +Pixmaps +{ + TitleHighlight "eyesline.xpm" +# TitleHighlight "byzantine.xpm" +# VirtualBackgroundPixmap "djhjr.xpm" + MenuIconPixmap "win95_rarrow.xpm" +} + +# Box-stock Background is, of course, "maroon" +# Box-stock Foreground and IconBorderColor is "gray85" +# Box-stock MenuTitleBackground and BorderColor is "gray70" +Color +{ + DefaultBackground "gray67" + DefaultForeground "black" + MenuBackground "gray67" + MenuForeground "black" + MenuTitleBackground "gray67" + MenuTitleForeground "black" + RealScreenBackground "gray57" + RealScreenForeground "black" + VirtualBackground "gray67" + VirtualForeground "black" + BorderColor "gray67" + BorderTileBackground "gray67" + BorderTileForeground "gray67" + TitleBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + TitleForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + IconForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconBorderColor "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + IconManagerBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + IconManagerForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconManagerHighlight "gray90" + DoorBackground "gray67" + DoorForeground "black" + DesktopDisplayBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + DesktopDisplayForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } +} + +# +# Menus +# + +# Read in the menus file... +include(HOME/vtwm/vtwmrc-menus) + +menu "CloseMenu" +{ + " Close " f.title + "Delete" f.delete + "Destroy" f.destroy +} + diff --git a/contrib/vtwmrc/vtwmrc-MWMish b/contrib/vtwmrc/vtwmrc-MWMish new file mode 100644 index 0000000..aacb17c --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-MWMish @@ -0,0 +1,237 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-MWMish +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# m4 Variables +# + +define(WMname, `MWMish') + +# Border width, autopan border width, desktop and door bevel widths... +define(WMborder, 5) define(WMpanborder, 5) +define(WMdesktopbevel, 1) define(WMdoorbevel, 1) +# Title heights (must be set manually for VTWM windows and applets)... +define(WMdesktoptitle, 0) define(WMdoortitle, 0) +define(WMiconmgrtitle, 0) define(WMapplettitle, 0) + +# +# Boolean Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-bools) + +ShallowReliefWindowButton + +ButtonColorIsFrame + +# +# Parametered Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-parms) + +# See also 'Lists' below... +IconManagerGeometry "+5+5" 1 + +RealScreenBorderWidth 0 + +# Gap between frame and titlebar font (titlebar changes) +FramePadding 2 +# Gap between FramePadding and buttons (buttons change) +ButtonIndent -2 +# Gap between titlebar elements +TitlePadding 0 +# Button border width (TitleForeground color) +TitleButtonBorderWidth 0 + +ClearBevelContrast 40 +DarkBevelContrast 40 + +BorderBevelWidth 2 +ButtonBevelWidth 1 +DoorBevelWidth WMdoorbevel +IconBevelWidth 2 +IconManagerBevelWidth 1 +InfoBevelWidth 2 +MenuBevelWidth 2 +TitleBevelWidth 1 +VirtualDesktopBevelWidth WMdesktopbevel + +UnknownIcon "xlogo32" + +TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +ResizeFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +MenuFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +MenuTitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +IconFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +InfoFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +IconManagerFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +DoorFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +#VirtualDesktopFont "-adobe-helvetica-medium-r-normal--*-75-*-*-*-*-*-*" + +# +# Functions and Bindings +# + +# Read in the bindings file... +include(HOME/vtwm/vtwmrc-binds) + +# These are nice built-in 3D buttons... +LeftTitleButton ":xpm:darrow" = f.menu "ArrangeMenu" +RightTitleButton ":xpm:dot" = f.iconify +RightTitleButton ":xpm:resize" = f.resize + +Function "decorate-virtual" +{ + f.exec "nexpm -vtwm -in HOME/vtwm/images/djhjr.xpm &" +} + +Function "clear-virtual" +{ + f.exec "nexpm -vtwm -solid gray60 &" +} + +# +# Lists +# + +# Read in the sound file... +include(ifelse(SOUND, `Yes', `HOME/vtwm/vtwmrc-sound')) + +# Read in the lists file... +include(HOME/vtwm/vtwmrc-lists) + +# Check 'BorderColor', as that's the highlight color... +NoHighlight + +#NoTitleHighlight + +SqueezeTitle +#DontSqueezeTitle {} + +Pixmaps +{ +# TitleHighlight "eyesline.xpm" +# TitleHighlight "byzantine.xpm" + TitleHighlight ":xpm:sunkenlines" +# VirtualBackgroundPixmap "djhjr.xpm" + MenuIconPixmap ":xpm:rarrow" + IconManagerPixmap ":xpm:zoom" +} + +# Box-stock Background is, of course, "maroon" +# Box-stock Foreground and IconBorderColor is "gray85" +# Box-stock MenuTitleBackground and BorderColor is "gray70" +Color +{ + DefaultBackground "gray60" + DefaultForeground "gray90" + MenuBackground "gray60" + MenuForeground "gray90" + MenuTitleBackground "gray60" + MenuTitleForeground "gray90" + RealScreenBackground "gray50" + RealScreenForeground "black" + VirtualBackground "gray60" + VirtualForeground "black" + BorderColor "gray75" + BorderTileBackground "gray60" + BorderTileForeground "gray60" + TitleBackground "DeepSkyBlue4" + { + "VTWM*" "gray60" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray60" + "xcb" "gray60" + "*clock" "gray60" + "xload" "gray60" + "as*" "gray60" + } + TitleForeground "gray90" + IconBackground "DeepSkyBlue4" + { + "VTWM*" "gray60" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray60" + "xcb" "gray60" + "*clock" "gray60" + "xload" "gray60" + "as*" "gray60" + } + IconForeground "gray90" + IconBorderColor "gray75" +# IconBorderColor "DeepSkyBlue4" +# { +# "VTWM*" "gray60" +# "XTerm" "SeaGreen" +# "Xqsh" "maroon" +# "ssh:*" "maroon" +# "telnet:*" "maroon" +# "rlogin:*" "maroon" +# "*ftp:*" "maroon" +# "xbiff*" "gray60" +# "xcb" "gray60" +# "*clock" "gray60" +# "xload" "gray60" +# "as*" "gray60" +# } + IconManagerBackground "DeepSkyBlue4" + { + "VTWM*" "gray60" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray60" + "xcb" "gray60" + "*clock" "gray60" + "xload" "gray60" + "as*" "gray60" + } + IconManagerForeground "gray90" + IconManagerHighlight "gray90" + DoorBackground "gray60" + DoorForeground "gray90" + DesktopDisplayBackground "DeepSkyBlue4" + { + "VTWM*" "gray60" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray60" + "xcb" "gray60" + "*clock" "gray60" + "xload" "gray60" + "as*" "gray60" + } + DesktopDisplayForeground "gray90" +} + +# +# Menus +# + +# Read in the menus file... +include(HOME/vtwm/vtwmrc-menus) + diff --git a/contrib/vtwmrc/vtwmrc-NoBorder b/contrib/vtwmrc/vtwmrc-NoBorder new file mode 100644 index 0000000..b1a424b --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-NoBorder @@ -0,0 +1,272 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-NoBorder +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# m4 Variables +# + +define(WMname, `NoBorder') + +# Border width, autopan border width, desktop and door bevel widths... +define(WMborder, 0) define(WMpanborder, 5) +define(WMdesktopbevel, 1) define(WMdoorbevel, 1) +# Title heights (must be set manually for VTWM windows and applets)... +define(WMdesktoptitle, 0) define(WMdoortitle, 0) +define(WMiconmgrtitle, 0) define(WMapplettitle, 0) + +# +# Boolean Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-bools) + +DecorateTransients + +NoIconManagerHighlight + +ShallowReliefWindowButton + +ButtonColorIsFrame + +# +# Parametered Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-parms) + +# See also 'Lists' below... +IconManagerGeometry "+5+5" 1 + +RealScreenBorderWidth 0 + +# Gap between frame and titlebar titlebar font (titlebar changes) +FramePadding 3 +# Gap between FramePadding and buttons (buttons change) +ButtonIndent -1 +# Gap between titlebar elements +TitlePadding 2 +# Button border width (TitleForeground color) +TitleButtonBorderWidth 0 + +ClearBevelContrast 50 +DarkBevelContrast 60 + +BorderBevelWidth 0 +ButtonBevelWidth 1 +DoorBevelWidth WMdoorbevel +IconBevelWidth 1 +IconManagerBevelWidth 1 +InfoBevelWidth 1 +MenuBevelWidth 1 +TitleBevelWidth 1 +VirtualDesktopBevelWidth WMdesktopbevel + +UnknownIcon "xlogo32" + +TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +ResizeFont "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" +MenuFont "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" +MenuTitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +IconFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +InfoFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +IconManagerFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +DoorFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +#VirtualDesktopFont "-adobe-helvetica-medium-r-normal--*-75-*-*-*-*-*-*" + +# +# Functions and Bindings +# + +# Read in the bindings file... +include(HOME/vtwm/vtwmrc-binds) + +# These are nice built-in 3D buttons... +LeftTitleButton ":xpm:darrow" = f.menu "ArrangeMenu" +RightTitleButton ":xpm:dot" = f.iconify +RightTitleButton ":xpm:resize" = f.resize + +Function "decorate-virtual" +{ + f.exec "nexpm -vtwm -in HOME/vtwm/images/djhjr.xpm &" +} + +Function "clear-virtual" +{ + f.exec "nexpm -vtwm -solid gray67 &" +} + +# +# Lists +# + +# Read in the sound file... +include(ifelse(SOUND, `Yes', `HOME/vtwm/vtwmrc-sound')) + +# Read in the lists file... +include(HOME/vtwm/vtwmrc-lists) + +# Check 'BorderColor', as that's the highlight color... +NoHighlight + +#NoTitleHighlight + +#SqueezeTitle +#DontSqueezeTitle {} + +Pixmaps +{ +# TitleHighlight "eyesline.xpm" +# TitleHighlight "byzantine.xpm" + TitleHighlight ":xpm:raisedlines" +# VirtualBackgroundPixmap "djhjr.xpm" + MenuIconPixmap ":xpm:rarrow" + IconManagerPixmap ":xpm:zoom" +} + +# Box-stock Background is, of course, "maroon" +# Box-stock Foreground and IconBorderColor is "gray85" +# Box-stock MenuTitleBackground and BorderColor is "gray70" +Color +{ + DefaultBackground "gray73" + DefaultForeground "black" + MenuBackground "gray73" + MenuForeground "black" + MenuTitleBackground "gray73" + MenuTitleForeground "black" + RealScreenBackground "gray57" + RealScreenForeground "black" + VirtualBackground "gray67" + VirtualForeground "black" + BorderColor "gray73" + BorderTileBackground "gray67" + BorderTileForeground "gray67" + TitleBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + TitleForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + IconForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconBorderColor "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + IconManagerBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + IconManagerForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconManagerHighlight "gray90" + DoorBackground "gray67" + DoorForeground "black" + DesktopDisplayBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + DesktopDisplayForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } +} + +# +# Menus +# + +# Read in the menus file... +include(HOME/vtwm/vtwmrc-menus) + diff --git a/contrib/vtwmrc/vtwmrc-PWMish b/contrib/vtwmrc/vtwmrc-PWMish new file mode 100644 index 0000000..7d2c8f7 --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-PWMish @@ -0,0 +1,263 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-PWMish +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# m4 Variables +# + +define(WMname, `PWMish') + +# Border width, autopan border width, desktop and door bevel widths... +define(WMborder, 5) define(WMpanborder, 5) +define(WMdesktopbevel, 1) define(WMdoorbevel, 1) +# Title heights (must be set manually for VTWM windows and applets)... +define(WMdesktoptitle, 0) define(WMdoortitle, 0) +define(WMiconmgrtitle, 0) define(WMapplettitle, 0) + +# +# Boolean Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-bools) + +NoBorderDecorations + +# +# Parametered Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-parms) + +# See also 'Lists' below... +IconManagerGeometry "+5+5" 1 + +RealScreenBorderWidth 0 + +# Gap between frame and titlebar font (titlebar changes) +FramePadding 4 +# Gap between FramePadding and buttons (buttons change) +ButtonIndent -2 +# Gap between titlebar elements +TitlePadding 3 +# Button border width (TitleForeground color) +TitleButtonBorderWidth 0 + +ClearBevelContrast 40 +DarkBevelContrast 40 + +BorderBevelWidth 1 +ButtonBevelWidth 0 +DoorBevelWidth WMdoorbevel +IconBevelWidth 1 +IconManagerBevelWidth 1 +InfoBevelWidth 1 +MenuBevelWidth 1 +TitleBevelWidth 1 +VirtualDesktopBevelWidth WMdesktopbevel + +UnknownIcon "xlogo32" + +TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +ResizeFont "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" +MenuFont "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" +MenuTitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +IconFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +InfoFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +IconManagerFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +DoorFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +#VirtualDesktopFont "-adobe-helvetica-medium-r-normal--*-75-*-*-*-*-*-*" + +# +# Functions and Bindings +# + +# Read in the bindings file... +include(HOME/vtwm/vtwmrc-binds) + +LeftTitleButton "photon_menu.xpm" = f.menu "ArrangeMenu" +RightTitleButton "photon_minimize.xpm" = f.iconify +RightTitleButton "photon_maximize.xpm" = f.fullzoom + +Function "decorate-virtual" +{ + f.exec "nexpm -vtwm -in HOME/vtwm/images/djhjr.xpm &" +} + +Function "clear-virtual" +{ + f.exec "nexpm -vtwm -solid gray75 &" +} + +# +# Lists +# + +# Read in the sound file... +include(ifelse(SOUND, `Yes', `HOME/vtwm/vtwmrc-sound')) + +# Read in the lists file... +include(HOME/vtwm/vtwmrc-lists) + +# Check 'BorderColor', as that's the highlight color... +#NoHighlight + +NoTitleHighlight + +#SqueezeTitle +DontSqueezeTitle {} + +Pixmaps +{ +# TitleHighlight "eyesline.xpm" +# TitleHighlight "byzantine.xpm" +# VirtualBackgroundPixmap "djhjr.xpm" + MenuIconPixmap "photon_rarrow.xpm" +} + +# Box-stock Background is, of course, "maroon" +# Box-stock Foreground and IconBorderColor is "gray85" +# Box-stock MenuTitleBackground and BorderColor is "gray70" +Color +{ + DefaultBackground "gray75" + DefaultForeground "black" + MenuBackground "gray75" + MenuForeground "black" + MenuTitleBackground "gray75" + MenuTitleForeground "black" + RealScreenBackground "gray65" + RealScreenForeground "black" + VirtualBackground "gray75" + VirtualForeground "black" + BorderColor "gray75" + BorderTileBackground "gray60" + BorderTileForeground "gray60" + TitleBackground "DeepSkyBlue4" + { + "VTWM*" "gray75" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray75" + "xcb" "gray75" + "*clock" "gray75" + "xload" "gray75" + "as*" "gray75" + } + TitleForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconBackground "DeepSkyBlue4" + { + "VTWM*" "gray75" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray75" + "xcb" "gray75" + "*clock" "gray75" + "xload" "gray75" + "as*" "gray75" + } + IconForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconBorderColor "DeepSkyBlue4" + { + "VTWM*" "gray75" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray75" + "xcb" "gray75" + "*clock" "gray75" + "xload" "gray75" + "as*" "gray75" + } + IconManagerBackground "DeepSkyBlue4" + { + "VTWM*" "gray75" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray75" + "xcb" "gray75" + "*clock" "gray75" + "xload" "gray75" + "as*" "gray75" + } + IconManagerForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconManagerHighlight "gray90" + DoorBackground "gray75" + DoorForeground "black" + DesktopDisplayBackground "DeepSkyBlue4" + { + "VTWM*" "gray75" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray75" + "xcb" "gray75" + "*clock" "gray75" + "xload" "gray75" + "as*" "gray75" + } + DesktopDisplayForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } +} + +# +# Menus +# + +# Read in the menus file... +include(HOME/vtwm/vtwmrc-menus) + diff --git a/contrib/vtwmrc/vtwmrc-TWM3d b/contrib/vtwmrc/vtwmrc-TWM3d new file mode 100644 index 0000000..c25fc23 --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-TWM3d @@ -0,0 +1,270 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-TWM3d +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# m4 Variables +# + +define(WMname, `TWM3d') + +# Border width, autopan border width, desktop and door bevel widths... +define(WMborder, 4) define(WMpanborder, 5) +define(WMdesktopbevel, 1) define(WMdoorbevel, 1) +# Title heights (must be set manually for VTWM windows and applets)... +define(WMdesktoptitle, 0) define(WMdoortitle, 0) +define(WMiconmgrtitle, 0) define(WMapplettitle, 0) + +# +# Boolean Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-bools) + +NoBorderDecorations + +ShallowReliefWindowButton + +ButtonColorIsFrame + +# +# Parametered Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-parms) + +# See also 'Lists' below... +IconManagerGeometry "+5+5" 1 + +RealScreenBorderWidth 0 + +# Gap between frame and titlebar titlebar font (titlebar changes) +FramePadding 2 +# Gap between FramePadding and buttons (buttons change) +ButtonIndent -1 +# Gap between titlebar elements +TitlePadding 2 +# Button border width (TitleForeground color) +TitleButtonBorderWidth 0 + +ClearBevelContrast 50 +DarkBevelContrast 60 + +BorderBevelWidth 1 +ButtonBevelWidth 1 +DoorBevelWidth WMdoorbevel +IconBevelWidth 1 +IconManagerBevelWidth 1 +InfoBevelWidth 1 +MenuBevelWidth 1 +TitleBevelWidth 0 +VirtualDesktopBevelWidth WMdesktopbevel + +UnknownIcon "xlogo32" + +TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +ResizeFont "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" +MenuFont "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" +MenuTitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +IconFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +InfoFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +IconManagerFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +DoorFont "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" +#VirtualDesktopFont "-adobe-helvetica-medium-r-normal--*-75-*-*-*-*-*-*" + +# +# Functions and Bindings +# + +# Read in the bindings file... +include(HOME/vtwm/vtwmrc-binds) + +# These are nice built-in 3D buttons... +LeftTitleButton ":xpm:bar" = f.menu "ArrangeMenu" +RightTitleButton ":xpm:dot" = f.iconify +RightTitleButton ":xpm:resize" = f.resize + +Function "decorate-virtual" +{ + f.exec "nexpm -vtwm -in HOME/vtwm/images/djhjr.xpm &" +} + +Function "clear-virtual" +{ + f.exec "nexpm -vtwm -solid gray67 &" +} + +# +# Lists +# + +# Read in the sound file... +include(ifelse(SOUND, `Yes', `HOME/vtwm/vtwmrc-sound')) + +# Read in the lists file... +include(HOME/vtwm/vtwmrc-lists) + +# Check 'BorderColor', as that's the highlight color... +NoHighlight + +#NoTitleHighlight + +SqueezeTitle +#DontSqueezeTitle {} + +Pixmaps +{ +# TitleHighlight "eyesline.xpm" +# TitleHighlight "byzantine.xpm" + TitleHighlight ":xpm:raisedlines" +# VirtualBackgroundPixmap "djhjr.xpm" + MenuIconPixmap ":xpm:bar" + IconManagerPixmap ":xpm:zoom" +} + +# Box-stock Background is, of course, "maroon" +# Box-stock Foreground and IconBorderColor is "gray85" +# Box-stock MenuTitleBackground and BorderColor is "gray70" +Color +{ + DefaultBackground "gray73" + DefaultForeground "black" + MenuBackground "gray73" + MenuForeground "black" + MenuTitleBackground "gray73" + MenuTitleForeground "black" + RealScreenBackground "gray57" + RealScreenForeground "black" + VirtualBackground "gray67" + VirtualForeground "black" + BorderColor "gray73" + BorderTileBackground "gray67" + BorderTileForeground "gray67" + TitleBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + TitleForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + IconForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconBorderColor "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + IconManagerBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + IconManagerForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } + IconManagerHighlight "gray90" + DoorBackground "gray67" + DoorForeground "black" + DesktopDisplayBackground "DeepSkyBlue4" + { + "VTWM*" "gray67" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray67" + "xcb" "gray67" + "*clock" "gray67" + "xload" "gray67" + "as*" "gray67" + } + DesktopDisplayForeground "gray90" + { + "VTWM*" "black" + "xbiff*" "black" + "xcb" "black" + "*clock" "black" + "xload" "black" + "as*" "black" + } +} + +# +# Menus +# + +# Read in the menus file... +include(HOME/vtwm/vtwmrc-menus) + diff --git a/contrib/vtwmrc/vtwmrc-TWMish b/contrib/vtwmrc/vtwmrc-TWMish new file mode 100644 index 0000000..b7eaf0e --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-TWMish @@ -0,0 +1,232 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-TWMish +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# m4 Variables +# + +define(WMname, `TWMish') + +# Border width, autopan border width, desktop and door bevel widths... +define(WMborder, 2) define(WMpanborder, 5) +define(WMdesktopbevel, 0) define(WMdoorbevel, 0) +# Title heights (must be set manually for VTWM windows and applets)... +define(WMdesktoptitle, 0) define(WMdoortitle, 0) +define(WMiconmgrtitle, 0) define(WMapplettitle, 0) + +# +# Boolean Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-bools) + +DecorateTransients + +# +# Parametered Variables +# + +# Read in the variables file... +include(HOME/vtwm/vtwmrc-parms) + +# See also 'Lists' below... +IconManagerGeometry "+5+5" 1 + +RealScreenBorderWidth 0 + +# Gap between frame and titlebar font (titlebar changes) +FramePadding 2 +# Gap between FramePadding and buttons (buttons change) +ButtonIndent 0 +# Gap between titlebar elements +TitlePadding 5 +# Button border width (TitleForeground color) +TitleButtonBorderWidth 1 + +ClearBevelContrast 40 +DarkBevelContrast 40 + +BorderBevelWidth 0 +ButtonBevelWidth 0 +DoorBevelWidth WMdoorbevel +IconBevelWidth 0 +IconManagerBevelWidth 0 +InfoBevelWidth 0 +MenuBevelWidth 0 +TitleBevelWidth 0 +VirtualDesktopBevelWidth WMdesktopbevel + +UnknownIcon "xlogo32" + +TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +ResizeFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +MenuFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +MenuTitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +IconFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +InfoFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +IconManagerFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +DoorFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +#VirtualDesktopFont "-adobe-helvetica-medium-r-normal--*-75-*-*-*-*-*-*" + +# +# Functions and Bindings +# + +# Read in the bindings file... +include(HOME/vtwm/vtwmrc-binds) + +# These are the box-stock flat buttons... +LeftTitleButton ":darrow" = f.menu "ArrangeMenu" +RightTitleButton ":dot" = f.iconify +RightTitleButton ":resize" = f.resize + +Function "decorate-virtual" +{ + f.exec "nexpm -vtwm -in HOME/vtwm/images/djhjr.xpm &" +} + +Function "clear-virtual" +{ + f.exec "nexpm -vtwm -solid gray60 &" +} + +# +# Lists +# + +# Read in the sound file... +include(ifelse(SOUND, `Yes', `HOME/vtwm/vtwmrc-sound')) + +# Read in the lists file... +include(HOME/vtwm/vtwmrc-lists) + +# Check 'BorderColor', as that's the highlight color... +#NoHighlight + +#NoTitleHighlight + +SqueezeTitle +#DontSqueezeTitle {} + +Pixmaps +{ +# TitleHighlight "dot1x3.xbm" + TitleHighlight "hlines3" + MenuIconPixmap ":rarrow" +} + +# Box-stock Background is, of course, "maroon" +# Box-stock Foreground and IconBorderColor is "gray85" +# Box-stock MenuTitleBackground and BorderColor is "gray70" +Color +{ + DefaultBackground "gray60" + DefaultForeground "gray90" + MenuBackground "gray60" + MenuForeground "gray90" + MenuTitleBackground "gray60" + MenuTitleForeground "gray90" + RealScreenBackground "gray50" + RealScreenForeground "black" + VirtualBackground "gray60" + VirtualForeground "black" + BorderColor "gray75" + BorderTileBackground "gray60" + BorderTileForeground "gray60" + TitleBackground "DeepSkyBlue4" + { + "VTWM*" "gray60" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray60" + "xcb" "gray60" + "*clock" "gray60" + "xload" "gray60" + "as*" "gray60" + } + TitleForeground "gray90" + IconBackground "DeepSkyBlue4" + { + "VTWM*" "gray60" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray60" + "xcb" "gray60" + "*clock" "gray60" + "xload" "gray60" + "as*" "gray60" + } + IconForeground "gray90" + IconBorderColor "gray75" +# IconBorderColor "DeepSkyBlue4" +# { +# "VTWM*" "gray60" +# "XTerm" "SeaGreen" +# "Xqsh" "maroon" +# "ssh:*" "maroon" +# "telnet:*" "maroon" +# "rlogin:*" "maroon" +# "*ftp:*" "maroon" +# "xbiff*" "gray60" +# "xcb" "gray60" +# "*clock" "gray60" +# "xload" "gray60" +# "as*" "gray60" +# } + IconManagerBackground "DeepSkyBlue4" + { + "VTWM*" "gray60" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray60" + "xcb" "gray60" + "*clock" "gray60" + "xload" "gray60" + "as*" "gray60" + } + IconManagerForeground "gray90" + IconManagerHighlight "gray75" + DoorBackground "gray60" + DoorForeground "gray90" + DesktopDisplayBackground "DeepSkyBlue4" + { + "VTWM*" "gray60" + "XTerm" "SeaGreen" + "Xqsh" "maroon" + "ssh:*" "maroon" + "telnet:*" "maroon" + "rlogin:*" "maroon" + "*ftp:*" "maroon" + "xbiff*" "gray60" + "xcb" "gray60" + "*clock" "gray60" + "xload" "gray60" + "as*" "gray60" + } + DesktopDisplayForeground "gray90" +} + +# +# Menus +# + +# Read in the menus file... +include(HOME/vtwm/vtwmrc-menus) + diff --git a/contrib/vtwmrc/vtwmrc-binds b/contrib/vtwmrc/vtwmrc-binds new file mode 100644 index 0000000..95bb955 --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-binds @@ -0,0 +1,120 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-binds +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# Functions and Bindings +# + +# See $(HOME)/.xinitrc... +#Function "VTWM Profile" +#{ +# f.exec "startxclients &" +#} + +Function "move-or-raise" +{ + f.move +# These two set up a click-to-type focus policy +# (omitting the first allows it to be "togglable")... +# f.unfocus +# f.focus + f.deltastop + f.raise +} + +Function "move-or-iconify" +{ + f.move + f.deltastop + f.iconify +} + +# This is for warping from the icon manager... +Function "deiconify-and-warp" +{ + f.deiconify + f.warp +} + +# This is for warping from the virtual desktop... +Function "move-or-warp" +{ + f.playsound "HOME/vtwm/sounds/whoosh4.au" + f.move + f.deltastop + f.warp +} + +# This is for warping from the virtual desktop... +Function "resize-or-warp" +{ + f.playsound "HOME/vtwm/sounds/whoosh4.au" + f.resize + f.deltastop + f.warp +} + +Button1 = : root : f.version +Button3 = : root : f.menu "XWindowsMenu" + +Button1 = : title : f.function "move-or-raise" +Button2 = : title : f.resize +Button3 = : title : f.raiselower + +Button1 = : frame : f.function "move-or-raise" +Button2 = : frame : f.resize +Button3 = : frame : f.iconify + +Button1 = : icon : f.function "move-or-iconify" +Button3 = : icon : f.menu "ArrangeMenu" + +Button1 = : iconmgr : f.iconify +Button3 = : iconmgr : f.function "deiconify-and-warp" + +Button1 = : door : f.enterdoor +Button2 = : door : f.namedoor +Button3 = : door : f.deletedoor + +Button1 = : virtual | desktop : f.movescreen +Button2 = : desktop : f.function "move-or-warp" +Button3 = : desktop : f.function "resize-or-warp" +# If you've got nothing better to do with 'em... +#Button2 = : virtual | desktop : f.function "decorate-virtual" +#Button3 = : virtual | desktop : f.function "clear-virtual" + +"Up" = : iconmgr : f.backiconmgr +"Down" = : iconmgr : f.forwiconmgr +"Return" = : iconmgr : f.function "deiconify-and-warp" +"BackSpace" = : iconmgr : f.iconify + +"Return" = : door : f.enterdoor + +"Up" = : virtual | desktop : f.panup "100" +"Down" = : virtual | desktop : f.pandown "100" +"Left" = : virtual | desktop : f.panleft "100" +"Right" = : virtual | desktop : f.panright "100" + +"Meta_L" = c : all : f.warpring "prev" +"Control_R" = m : all : f.warpring "prev" +"Control_L" = m : all : f.warpring "next" +"Meta_R" = c : all : f.warpring "next" + +"Meta_L" = c : root : f.warpto "*Icon Manager" +"Control_R" = m : root : f.warpto "*Icon Manager" +"Control_L" = m : root : f.warpto "*Icon Manager" +"Meta_R" = c : root : f.warpto "*Icon Manager" + +"Shift_L" = c : all : f.warpclassprev "" +"Shift_R" = c : all : f.warpclassprev "" +"Control_L" = s : all : f.warpclassnext "" +"Control_R" = s : all : f.warpclassnext "" + +"Shift_L" = m : all : f.warptoiconmgr "" +"Shift_R" = m : all : f.warptoiconmgr "" +"Meta_L" = s : all : f.warptoiconmgr "" +"Meta_R" = s : all : f.warptoiconmgr "" + diff --git a/contrib/vtwmrc/vtwmrc-bools b/contrib/vtwmrc/vtwmrc-bools new file mode 100644 index 0000000..da15068 --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-bools @@ -0,0 +1,53 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-bools +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# Boolean Variables +# + +RestartPreviousState +NoGrabServer + +RandomPlacement +#DeiconifyToScreen +StaticIconPositions +#WarpSnug +#WarpVisible +#WarpWindows +DontDeiconifyTransients + +# Left unset so class and ring warps ignore the iconified - +# see 'Functions and Bindings' below... +#WarpUnmapped + +NoCaseSensitive +NoIconManagerFocus +ShowIconManager +SortIconManager + +# see Zoom in 'Parametered'... +#PrettyZoom + +RightHandSidePulldownMenus +OldFashionedVtwmWindowsMenu +#StayUpOptionalMenus +#StayUpMenus + +SnapRealScreen +NaturalAutoPanBehavior +NotVirtualGeometries +FixManagedVirtualGeometries +FixTransientVirtualGeometries +VirtualReceivesMotionEvents +VirtualSendsMotionEvents + +# See 'Functions and Bindings' below... +#NoDefaultTitleButtons +#NoDefaultMouseOrKeyboardBindings +# Covers both of the above... +NoDefaults + diff --git a/contrib/vtwmrc/vtwmrc-lists b/contrib/vtwmrc/vtwmrc-lists new file mode 100644 index 0000000..365d640 --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-lists @@ -0,0 +1,197 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-lists +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# Lists +# + +WindowRing +NoWindowRing +{ + "VTWM*" + "as*" +} + +IconifyByUnmapping + +WarpCursor + +#OpaqueMove +#NoOpaqueMove {} + +#OpaqueResize +#NoOpaqueResize {} + +UsePPosition "off" +{ + "MPlayer" "on" +} + +Cursors +{ + Button "arrow" +# Frame "arrow" + IconMgr "arrow" + Menu "arrow" + Title "arrow" +} + +# In addition to the default icon manager... +IconManagers +{ + "Xcoral*" "+5+405" 1 + "xv *" "+5+605" 1 +} + +NailedDown +{ + "VTWM*" + "xbiff*" + "xcb" + "*clock" + "xeyes" + "xload" + "xpostit" + "as*" +} + +IconManagerDontShow +{ + "VTWM*" +# "xbiff*" +# "xcb" +# "*clock" +# "xeyes" +# "xload" +# "xpostit" + "as*" +} + +DontShowInDisplay +{ + "VTWM*" + "xbiff*" + "xcb" + "*clock" + "xeyes" + "xload" + "xpostit" + "as*" +} + +NoTitle +{ +ifelse(WMdesktoptitle, 0, `"VTWM Desktop"') +ifelse(WMdoortitle, 0, `"VTWM Door"') +ifelse(WMiconmgrtitle, 0, `"VTWM Icon Manager"') +ifelse(WMname, `95ish', `"MPlayer"', WMname, `MWMish', `"MPlayer"') +ifelse(WMname, `PWMish', `"MPlayer"', WMname, `TWM3d', `"MPlayer"') +ifelse(WMname, `TWMish', `"MPlayer"') +ifelse(WMname, `95ish', `"xbiff*"', WMname, `MWMish', `"xbiff*"') +ifelse(WMname, `PWMish', `"xbiff*"', WMname, `TWM3d', `"xbiff*"') +ifelse(WMname, `TWMish', `"xbiff*"') +ifelse(WMname, `95ish', `"xcb"', WMname, `MWMish', `"xcb"') +ifelse(WMname, `PWMish', `"xcb"', WMname, `TWM3d', `"xcb"') +ifelse(WMname, `TWMish', `"xcb"') +ifelse(WMname, `95ish', `"*clock"', WMname, `MWMish', `"*clock"') +ifelse(WMname, `PWMish', `"*clock"', WMname, `TWM3d', `"*clock"') +ifelse(WMname, `TWMish', `"*clock"') + "xeyes" +ifelse(WMname, `95ish', `"xload"', WMname, `MWMish', `"xload"') +ifelse(WMname, `PWMish', `"xload"', WMname, `TWM3d', `"xload"') +ifelse(WMname, `TWMish', `"xload"') +ifelse(WMname, `95ish', `"xpostit"', WMname, `MWMish', `"xpostit"') +ifelse(WMname, `PWMish', `"xpostit"', WMname, `TWM3d', `"xpostit"') +ifelse(WMname, `TWMish', `"xpostit"') +ifelse(WMapplettitle, 0, `"as*"') +} + +# Confusing if click-to-type focus is enabled... +AutoRaise +{ + "VTWM*" + "XTerm" + "Xqsh" + "xbiff*" + "xcb" + "*clock" + "xeyes" + "xload" + "xpostit" + "as*" + "XVroot" + "XVschnauze" +} + +# These are dependant on the virtual desktop size... +# Set the window dimensions... +define(Dwidth, 20) define(Dheight, 19) +# Translate to an X geometry string... +define(Dgeometry, translit(Dwidth*Dheight, *, x)) +#Doors +#{ +# "1" "Dgeometry" "+eval(WIDTH * 0)+0" +# "2" "Dgeometry" "+eval(WIDTH * 1)+0" +# "3" "Dgeometry" "+eval(WIDTH * 2)+0" +# "4" "Dgeometry" "+eval(WIDTH * 3)+0" +# "5" "Dgeometry" "+eval(WIDTH * 4)+0" +#} + +# Calculate the region dimensions... +define(R0width, eval(WIDTH - VDwidth - 50)) +define(R0height, eval(Dheight + 2 * WMborder + WMdoortitle)) +# Calculate the region coordinates... +define(R0x, WMpanborder) +define(R0y, eval(HEIGHT - (R0height + WMpanborder))) +# Translate to an X geometry string... +define(R0geometry, translit(R0width*R0height+R0x+R0y, *, x)) +# Calculate the grids... +define(R0gridx, eval(2 * WMborder + 5)) +define(R0gridy, 0) +# Set the resource... +AppletRegion "R0geometry" South East R0gridx R0gridy +{ + "VTWM Door" +} + +# Calculate the region dimensions... +define(R1width, eval(WIDTH - 200)) +define(R1height, eval(64 + 2 * WMborder + WMapplettitle)) +# Translate to an X geometry string... +define(R1geometry, translit(R1width*R1height-WMpanborder+WMpanborder, *, x)) +# Calculate the grids... +define(R1gridx, eval(2 * WMborder + 2)) +define(R1gridy, 0) +# Set the resource... +AppletRegion "R1geometry" North East R1gridx R1gridy +{ + "as*" +} + +# Calculate the region coordinates... +define(R2x, WMpanborder) define(R2y, eval(R1height + 20)) +# Calculate the region dimensions... +define(R2width, eval(100 + 2 * WMborder)) +define(R2height, eval(HEIGHT - R2y - (VDheight + WMdesktoptitle))) +# Translate to an X geometry string... +define(R2geometry, translit(R2width*R2height-R2x+R2y, *, x)) +# Calculate the grids... +define(R2gridx, 0) +define(R2gridy, eval(2 * WMborder + 4)) +# Set the resource... +AppletRegion "R2geometry" North East R2gridx R2gridy +{ + "xbiff*" + "xcb" + "xload" + "oclock" + "xarclock" + "xclock" + "xdaliclock" + "xpostit" +} + diff --git a/contrib/vtwmrc/vtwmrc-menus b/contrib/vtwmrc/vtwmrc-menus new file mode 100644 index 0000000..7dc0934 --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-menus @@ -0,0 +1,266 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-menus +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# Menus +# + +menu "XWindowsMenu" +{ + `"'SERVERHOST`"' f.title + "Shells" f.menu "ShellsMenu" + "Editors" f.menu "EditorsMenu" + "" f.separator + "Desktop" f.menu "DesktopMenu" + "Network" f.menu "NetworkMenu" + "Toybox" f.menu "ToyboxMenu" + "Wallpaper" f.menu "WallpaperMenu" + "" f.separator + "Arrange" f.menu "ArrangeMenu" + "" f.separator + "VTWM" f.menu "VTWMMenu" +} + +menu "ShellsMenu" +{ + " Shells " f.title + "mc" f.exec "HOME/bin/startxterm -g 80x43 -title 'mc' -name 'mc' -e mc &" + "rxvt" f.exec "HOME/bin/startrxvt &" + "xterm" f.exec "HOME/bin/startxterm &" +} + +menu "EditorsMenu" +{ + " Editors " f.title + "nedit" f.exec "nedit &" + "ted" f.exec "Ted 2>/dev/null &" + "tkhtml" f.exec "tkHTML &" + "vi" f.exec "HOME/bin/startxterm -title 'vi' -name 'vi' -e vi &" + "vile" f.exec "HOME/bin/startxterm -title 'vile' -name 'vile' -e vile &" + "xcoral" f.exec "xcoral &" + "xvile" f.exec "xvile &" + "" f.separator + "bitmap" f.exec "bitmap &" + "editres" f.exec "editres &" + "gimp" f.exec "gimp &" + "pixmap" f.exec "pixmap &" + "xfig" f.exec "xfig 2>/dev/null &" + "xpaint" f.exec "xpaint 2>/dev/null &" + "xv" f.exec "xv &" +# "xv +vsp" f.exec "xv +vsp &" +} + +menu "DesktopMenu" +{ + " Desktop " f.title + "asbutton" f.exec "asbutton -n 4 &" + "ghostview" f.exec "ghostview &" + "gv" f.exec "gv &" + "hexcalc" f.exec "hexcalc &" + "jpilot" f.exec "jpilot &" + "meltdown" f.exec "meltdown -s &" + "tkman" f.exec "tkman &" + "xbmbrowser" f.exec "xbmbrowser &" + "xcb" f.exec "xcb &" + "xcalc" f.exec "xcalc &" + "xcalendar" f.exec "xcalendar &" + "xload" f.exec "xload -jumpscroll 20 -update 3 -g 96x93 &" + "xlock" f.exec "xscreensaver-command -lock &" + "xmcd" f.exec "xmcd &" + "xmmix" f.exec "xmmix 2>/dev/null &" + "xpostit" f.exec "xpostit -g 96x40 &" + "xtplaygizmo" f.exec "xtplaygizmo &" + "" f.separator + "asclock" f.exec "asclock -exe xcalendar -led grey85 &" + "oclock" f.exec "oclock -g 96x93 -bd SeaGreen -fg SeaGreen -transparent &" + "mouseclock" f.exec "mouseclock &" + "rclock" f.exec "rclock &" + "sunclock" f.exec "sunclock &" + "t3d" f.exec "t3d -nice 2 &" + "xarclock" f.exec "xarclock -g 97x93 -arabic -fg white -bg black -fn -adobe-helvetica-medium-r-normal--*-80-*-*-p-*-iso8859-* &" + "xclock" f.exec "xclock &" +# "xdaliclock" f.exec "xdaliclock -fg SeaGreen -transparent -fn -adobe-utopia-medium-i-normal-*-*-260-*-*-p-*-iso8859-* &" + "xdaliclock" f.exec "xdaliclock -fg SeaGreen -transparent -fn -adobe-times-bold-i-normal-*-*-260-*-*-p-*-iso8859-* &" +} + +menu "NetworkMenu" +{ + " Network " f.title + "asmail" f.exec "asmail &" + "chimera" f.exec "chimera &" + "knews" f.exec "knews &" +# "mosaic" f.exec "Mosaic &" + "mozilla" f.exec "mozilla &" + "mutt" f.exec "HOME/bin/startxterm -title mutt -name mutt -e mutt &" + "netscape" f.exec "netscape &" + "xarchie" f.exec "xarchie &" + "xbiff++" f.exec "xbiff++ -update 60 -g 96x93 &" + "xdir" f.exec "xdir &" + "xgopher" f.exec "xgopher &" + "" f.separator + "FTP" f.menu "FTPMenu" + "Login" f.menu "LoginMenu" + "SSH" f.menu "SSHMenu" + "Telnet" f.menu "TelnetMenu" +} + +menu "FTPMenu" +{ + " FTP " f.title + "host1" f.exec "HOME/bin/startxterm -title 'ftp:host1' -name 'ftp:host1' -e ftp host1 &" + "" f.separator +# "host2" f.exec "HOME/bin/startxterm -title 'ftp:host2' -name 'ftp:host2' -e ftp host2 &" + "host3" f.exec "HOME/bin/startxterm -title 'ftp:host3' -name 'ftp:host3' -e ftp host3 &" +# "host4" f.exec "HOME/bin/startxterm -title 'ftp:host4' -name 'ftp:host4' -e ftp host4 &" + "" f.separator + "host5" f.exec "HOME/bin/startxterm -title 'ftp:host5' -name 'ftp:host5' -e ftp host5 &" +} + +menu "LoginMenu" +{ + " Remote Login " f.title +# "host1" f.exec "HOME/bin/startxterm -title 'rlogin:host1' -name 'rlogin:host1' -e rlogin host1 &" +# "" f.separator +# "host2" f.exec "HOME/bin/startxterm -title 'rlogin:host2' -name 'rlogin:host2' -e rlogin host2 &" + "host3" f.exec "HOME/bin/startxterm -title 'rlogin:host3' -name 'rlogin:host3' -e rlogin host3 &" +# "host4" f.exec "HOME/bin/startxterm -title 'rlogin:host4' -name 'rlogin:host4' -e rlogin host4 &" + "" f.separator + "host5" f.exec "HOME/bin/startxterm -title 'rlogin:host5' -name 'rlogin:host5' -e rlogin host5 &" +} + +menu "SSHMenu" +{ + " SSH " f.title + "host1" f.exec "HOME/bin/startxterm -title 'ssh:host1' -name 'ssh:host1' -e ssh -l username host1 &" + "" f.separator +# "host2" f.exec "HOME/bin/startxterm -title 'ssh:host2' -name 'ssh:host2' -e ssh -l username host2 &" +# "host3" f.exec "HOME/bin/startxterm -title 'ssh:host3' -name 'ssh:host3' -e ssh -l username host3 &" +# "host4" f.exec "HOME/bin/startxterm -title 'ssh:host4' -name 'ssh:host4' -e ssh -l username -p 27 host4 &" +# "" f.separator +# "host5" f.exec "HOME/bin/startxterm -title 'ssh:host5' -name 'ssh:host5' -e ssh host5 &" + "host6" f.exec "HOME/bin/startxterm -title 'ssh:host6' -name 'ssh:host6' -e ssh host6 &" +# "host7" f.exec "HOME/bin/startxterm -title 'ssh:host7' -name 'ssh:host7' -e ssh host7 &" +} + +menu "TelnetMenu" +{ + " Telnet " f.title + "host1" f.exec "HOME/bin/startxterm -tn $TELTERM -title 'telnet:host1' -name 'telnet:host1' -e telnet host1 &" +# "host2" f.exec "HOME/bin/startxterm -tn $TELTERM -title 'telnet:host2' -name 'telnet:host2' -e telnet -8 host2 &" + "" f.separator +# "host3" f.exec "HOME/bin/startxterm -tn $TELTERM -title 'telnet:host3' -name 'telnet:host3' -e telnet host3 &" + "host4" f.exec "HOME/bin/startxterm -tn $TELTERM -title 'telnet:host4' -name 'telnet:host4' -e telnet host4 &" +# "host5" f.exec "HOME/bin/startxterm -tn $TELTERM -title 'telnet:host5' -name 'telnet:host5' -e telnet host5 &" + "" f.separator + "host6" f.exec "HOME/bin/startxterm -title 'telnet:host6' -name 'telnet:host6' -e telnet -8 host6 &" +} + +menu "ToyboxMenu" +{ + " Toybox " f.title + "blast" f.exec "blast &" + "xbl" f.exec "xbl -draw 2 -keyboard 4 -buffer 2 -buttonheight 4 &" + "xboing" f.exec "xboing -sound &" + "xeyes" f.exec "xeyes &" + "xmine" f.exec "xmine &" + "xneko" f.exec "xneko -t 0.07 &" + "xoids" f.exec "xoids &" + "xtetris" f.exec "xtetris &" +} + +menu "WallpaperMenu" +{ + " Wallpaper " f.title + "ico" f.exec "HOME/bin/stopxroot; nice -2 ico -softdbl -faces -colors green blue yellow red white -delta +10+10 -r &" + "pyro" f.exec "HOME/bin/stopxroot; pyro -root &" + "xcursor" f.exec "xcursor &" + "xearth" f.exec "HOME/bin/stopxroot; xearth &" + "xfishtank" f.exec "HOME/bin/stopxroot; xfishtank -m 25 -C 25 -c black -r 0.08 -i 0.04 -b 20 &" + "xneko" f.exec "HOME/bin/stopxroot; xneko -t 0.07 -r &" + "xroach" f.exec "HOME/bin/stopxroot; xroach -rc grey -speed 8 &" + "" f.separator + "logo" f.exec "xsetbg -grey -border black -center /home/hawkeyd/vtwm/vtwm.gif &" + "none" f.exec "HOME/bin/stopxroot &" +} + +menu "ArrangeMenu" +{ + " Arrange " f.title + "Auto Raise" f.autoraise + "Raise" f.raise + "Lower" f.lower +# I just never use this... +# "Raise Lower" f.raiselower + "Nail" f.nail + "Ring" f.ring + "" f.separator + "Focus" f.focus + "Unfocus" f.unfocus + "" f.separator + "Move" f.move + "Size" f.resize + "Iconify" f.iconify + "" f.separator + "Full Zoom" f.fullzoom + "Horiz Zoom" f.horizoom + "Vert Zoom" f.zoom + "" f.separator + "Left Title" f.squeezeleft + "Center Title" f.squeezecenter + "Right Title" f.squeezeright + "" f.separator + "Bind Buttons" f.bindbuttons + "Unbind Buttons" f.unbindbuttons + "Bind Keys" f.bindkeys + "Unbind Keys" f.unbindkeys + "" f.separator + "Identify" f.identify + "" f.separator + "Delete" f.delete + "Destroy" f.destroy +} + +menu "VTWMMenu" +{ + " VTWM " f.title +# These are dependant on the virtual screen counts... +# "Virtual 1" f.setrealscreen "+eval(WIDTH * 0)+0" +# "Virtual 2" f.setrealscreen "+eval(WIDTH * 1)+0" +# "Virtual 3" f.setrealscreen "+eval(WIDTH * 2)+0" +# "Virtual 4" f.setrealscreen "+eval(WIDTH * 3)+0" +# "Virtual 5" f.setrealscreen "+eval(WIDTH * 4)+0" +# "" f.separator + "Auto Pan" f.autopan + "New Door" f.newdoor + "Snap Screen" f.snaprealscreen +ifelse(SOUND, `Yes', `"Sounds" f.sounds') + "Static Icons" f.staticiconpositions + "Strict Icon Mgr" f.stricticonmgr + "Warp Snug" f.warpsnug + "Warp Visible" f.warpvisible + "" f.separator + "Icon Mgr" f.showiconmgr + "Virtual Mgr" f.showdesktopdisplay + "" f.separator +# "VTWM Windows" f.menu "VTWM Windows" +# "" f.separator + "Refresh" f.refresh + "Restart 95ish" f.startwm "vtwm -d :0.0 -s -m -p -f vtwm/vtwmrc-95ish" + "Restart MWMish" f.startwm "vtwm -d :0.0 -s -m -p -f vtwm/vtwmrc-MWMish" + "Restart PWMish" f.startwm "vtwm -d :0.0 -s -m -p -f vtwm/vtwmrc-PWMish" + "Restart TWMish" f.startwm "vtwm -d :0.0 -s -m -p -f vtwm/vtwmrc-TWMish" + "Restart TWM3d" f.startwm "vtwm -d :0.0 -s -m -p -f vtwm/vtwmrc-TWM3d" + "Restart borderless" f.startwm "vtwm -d :0.0 -s -m -p -f vtwm/vtwmrc-NoBorder" + "Start MWM" f.startwm "mwm -display :0.0" + "Start TVTWM" f.startwm "tvtwm -display :0.0" + "Start TWM" f.startwm "twm -display :0.0" + "" f.separator +changequote(%, %) + "Exit" f.exec "HOME/bin/stopxroot; kill `cat HOME/vtwm.pid`" +changequote(,) +} + diff --git a/contrib/vtwmrc/vtwmrc-parms b/contrib/vtwmrc/vtwmrc-parms new file mode 100644 index 0000000..7a9dbe8 --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-parms @@ -0,0 +1,66 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-parms +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +# +# Parametered Variables +# + +WarpCentered "off" + +# Lower this if PrettyZoom used (see 'Booleans')... +#Zoom 150 + +# This spec works when (count * scale < phys_size) in each dimension. +# The size is then (phys_size * count / scale + bevel * 2) in each dimension. +# -- It's best if the window sizes work out to exact whole numbers -- +# +# This window is (1024 * 5 / 16 + 1 * 2) x (768 * 1 / 16 + 1 * 2) = 322 x 50. +# +# Use one of these (LLC or LRC) if you want it titled... +#VirtualDesktop "5x1+5-30" 16 +#VirtualDesktop "5x1+690+685" 16 +# Use one of these (LLC or LRC) if not... +#VirtualDesktop "5x1+5-10" 16 +#VirtualDesktop "5x1+690+705" 16 +# +# Using m4, calculate coordinates for most common phys_size dimensions. +# +# Horizontal and vertical screen counts, desktop scale... +define(VDhoriz, 5) define(VDvert, 1) define(VDscale, 16) +# Calculate the window dimensions... +define(VDwidth, eval(WIDTH * VDhoriz / VDscale + (WMdesktopbevel * 2 + WMborder * 2))) +define(VDheight, eval(HEIGHT * VDvert / VDscale + (WMdesktopbevel * 2 + WMborder * 2 + WMdesktoptitle))) +# Calculate the window coordinates (this is for LRC)... +define(VDx, eval(WIDTH - (VDwidth + WMpanborder))) +define(VDy, eval(HEIGHT - (VDheight + WMpanborder))) +# Translate to an X geometry string (set VDx to WMpanborder for LLC)... +define(VDgeometry, translit(VDhoriz*VDvert+VDx+VDy, *, x)) +# Set the resource... +VirtualDesktop "VDgeometry" VDscale + +PanDistanceX 100 +PanDistanceY 100 +PanResistance 750 +AutoPan 100 +# Nice if 'NaturalAutoPanBehavior' is not used... +#AutoPanExtraWarp 30 + +MoveDelta 10 + +BorderWidth WMborder +AutoPanBorderWidth WMpanborder + +# Windows are snappier if 'NoBackingStore' is not used when this is... +RaiseDelay 80 + +XorValue 65535 + +ResizeRegion "NorthEast" + +# Ignore the Caps, Num, and Scroll lock states... +IgnoreModifiers l | m2 | m5 + diff --git a/contrib/vtwmrc/vtwmrc-sound b/contrib/vtwmrc/vtwmrc-sound new file mode 100644 index 0000000..ef93777 --- /dev/null +++ b/contrib/vtwmrc/vtwmrc-sound @@ -0,0 +1,90 @@ + +# +# DESCRIPTION FILE FOR vtwm - $(HOME)/vtwm/vtwmrc-sound +# +# PRE-PROCESSED BY vtwm-5.4.6 USING m4 +# + +PauseOnExit 3 +PauseOnQuit 3 + +Sounds +{ + "(vtwm start)" "HOME/vtwm/sounds/startup.wav" + "(vtwm stop)" "HOME/vtwm/sounds/shutdown.wav" + +# "f.exec" "HOME/vtwm/sounds/ping.au" + "f.newdoor" "HOME/vtwm/sounds/ping.au" + "(client map)" "HOME/vtwm/sounds/ping.au" + + "f.delete" "HOME/vtwm/sounds/doh2.au" + "f.deletedoor" "HOME/vtwm/sounds/doh1.au" + "f.destroy" "HOME/vtwm/sounds/doh3.au" + "(client unmap)" "HOME/vtwm/sounds/ping.au" + + "f.bottomzoom" "HOME/vtwm/sounds/bleebloo.au" 50 + "f.fullzoom" "HOME/vtwm/sounds/bleebloo.au" 50 + "f.horizoom" "HOME/vtwm/sounds/bleebloo.au" 50 + "f.leftzoom" "HOME/vtwm/sounds/bleebloo.au" 50 + "f.rightzoom" "HOME/vtwm/sounds/bleebloo.au" 50 + "f.topzoom" "HOME/vtwm/sounds/bleebloo.au" 50 + "f.zoom" "HOME/vtwm/sounds/bleebloo.au" 50 + + "f.squeezeleft" "HOME/vtwm/sounds/tshhh.wav" 50 + "f.squeezecenter" "HOME/vtwm/sounds/tshhh.wav" 50 + "f.squeezeright" "HOME/vtwm/sounds/tshhh.wav" 50 + + "f.iconify" "HOME/vtwm/sounds/dedoo.au" 30 + "f.hidedesktopdisplay" "HOME/vtwm/sounds/dedoo.au" 30 + "f.hideiconmgr" "HOME/vtwm/sounds/dedoo.au" 30 + "f.showdesktopdisplay" "HOME/vtwm/sounds/dedoo.au" 30 + "f.showiconmgr" "HOME/vtwm/sounds/dedoo.au" 30 + "f.stricticonmgr" "HOME/vtwm/sounds/bleebloo.au" 50 + + "f.resize" "HOME/vtwm/sounds/chime5.au" + "f.movescreen" "HOME/vtwm/sounds/chime5.au" + "f.move" "HOME/vtwm/sounds/chime5.au" + "f.forcemove" "HOME/vtwm/sounds/chime5.au" + + "f.deiconify" "HOME/vtwm/sounds/whoosh4.au" 50 +# "f.warp" "HOME/vtwm/sounds/whoosh4.au" 50 + "f.warpclassnext" "HOME/vtwm/sounds/whoosh4.au" 50 + "f.warpclassprev" "HOME/vtwm/sounds/whoosh4.au" 50 + "f.warpring" "HOME/vtwm/sounds/whoosh4.au" 50 + "f.warpto" "HOME/vtwm/sounds/whoosh4.au" 50 + "f.warptoiconmgr" "HOME/vtwm/sounds/whoosh4.au" 50 + "f.warptonewest" "HOME/vtwm/sounds/whoosh4.au" 50 + + "f.panup" "HOME/vtwm/sounds/whoosh1.wav" + "f.pandown" "HOME/vtwm/sounds/whoosh1.wav" + "f.panleft" "HOME/vtwm/sounds/whoosh1.wav" + "f.panright" "HOME/vtwm/sounds/whoosh1.wav" + "f.enterdoor" "HOME/vtwm/sounds/whoosh1.wav" + "(autopan event)" "HOME/vtwm/sounds/whoosh1.wav" + + "f.autopan" "HOME/vtwm/sounds/pop1.wav" 30 + "f.snaprealscreen" "HOME/vtwm/sounds/pop1.wav" 30 + "f.staticiconpositions" "HOME/vtwm/sounds/pop1.wav" 30 + "f.nail" "HOME/vtwm/sounds/pop1.wav" 30 + "f.ring" "HOME/vtwm/sounds/pop1.wav" 30 + "f.warpsnug" "HOME/vtwm/sounds/pop1.wav" 30 + "f.warpvisible" "HOME/vtwm/sounds/pop1.wav" 30 + + "f.autoraise" "HOME/vtwm/sounds/pop1.wav" 30 +# "f.raise" "HOME/vtwm/sounds/pop1.wav" 30 +# "f.lower" "HOME/vtwm/sounds/pop1.wav" 30 + "f.focus" "HOME/vtwm/sounds/pop1.wav" 30 + "f.unfocus" "HOME/vtwm/sounds/pop1.wav" 30 + "f.bindbuttons" "HOME/vtwm/sounds/pop1.wav" 30 + "f.unbindbuttons" "HOME/vtwm/sounds/pop1.wav" 30 + "f.bindkeys" "HOME/vtwm/sounds/pop1.wav" 30 + "f.unbindkeys" "HOME/vtwm/sounds/pop1.wav" 30 + + "(menu map)" "HOME/vtwm/sounds/chime3.au" +# "(menu unmap)" "HOME/vtwm/sounds/chime3.au" + "f.identify" "HOME/vtwm/sounds/chime4.au" +# "(info unmap)" "HOME/vtwm/sounds/chime4.au" + + "(bell event)" "HOME/vtwm/sounds/chime1.au" +} + diff --git a/cursor.c b/cursor.c new file mode 100644 index 0000000..a04fe27 --- /dev/null +++ b/cursor.c @@ -0,0 +1,179 @@ +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/*********************************************************************** + * + * $XConsortium: cursor.c,v 1.10 89/12/14 14:52:23 jim Exp $ + * + * cursor creation code + * + * 05-Apr-89 Thomas E. LaStrange File created + * + ***********************************************************************/ + +#include +#include "twm.h" +#include +#include "screen.h" +#include "util.h" + +void NewBitmapCursor(); + +static struct _CursorName { + char *name; + unsigned int shape; + Cursor cursor; +} cursor_names[] = { + +{"X_cursor", XC_X_cursor, None}, +{"arrow", XC_arrow, None}, +{"based_arrow_down", XC_based_arrow_down, None}, +{"based_arrow_up", XC_based_arrow_up, None}, +{"boat", XC_boat, None}, +{"bogosity", XC_bogosity, None}, +{"bottom_left_corner", XC_bottom_left_corner, None}, +{"bottom_right_corner", XC_bottom_right_corner, None}, +{"bottom_side", XC_bottom_side, None}, +{"bottom_tee", XC_bottom_tee, None}, +{"box_spiral", XC_box_spiral, None}, +{"center_ptr", XC_center_ptr, None}, +{"circle", XC_circle, None}, +{"clock", XC_clock, None}, +{"coffee_mug", XC_coffee_mug, None}, +{"cross", XC_cross, None}, +{"cross_reverse", XC_cross_reverse, None}, +{"crosshair", XC_crosshair, None}, +{"diamond_cross", XC_diamond_cross, None}, +{"dot", XC_dot, None}, +{"dotbox", XC_dotbox, None}, +{"double_arrow", XC_double_arrow, None}, +{"draft_large", XC_draft_large, None}, +{"draft_small", XC_draft_small, None}, +{"draped_box", XC_draped_box, None}, +{"exchange", XC_exchange, None}, +{"fleur", XC_fleur, None}, +{"gobbler", XC_gobbler, None}, +{"gumby", XC_gumby, None}, +{"hand1", XC_hand1, None}, +{"hand2", XC_hand2, None}, +{"heart", XC_heart, None}, +{"icon", XC_icon, None}, +{"iron_cross", XC_iron_cross, None}, +{"left_ptr", XC_left_ptr, None}, +{"left_side", XC_left_side, None}, +{"left_tee", XC_left_tee, None}, +{"leftbutton", XC_leftbutton, None}, +{"ll_angle", XC_ll_angle, None}, +{"lr_angle", XC_lr_angle, None}, +{"man", XC_man, None}, +{"middlebutton", XC_middlebutton, None}, +{"mouse", XC_mouse, None}, +{"pencil", XC_pencil, None}, +{"pirate", XC_pirate, None}, +{"plus", XC_plus, None}, +{"question_arrow", XC_question_arrow, None}, +{"right_ptr", XC_right_ptr, None}, +{"right_side", XC_right_side, None}, +{"right_tee", XC_right_tee, None}, +{"rightbutton", XC_rightbutton, None}, +{"rtl_logo", XC_rtl_logo, None}, +{"sailboat", XC_sailboat, None}, +{"sb_down_arrow", XC_sb_down_arrow, None}, +{"sb_h_double_arrow", XC_sb_h_double_arrow, None}, +{"sb_left_arrow", XC_sb_left_arrow, None}, +{"sb_right_arrow", XC_sb_right_arrow, None}, +{"sb_up_arrow", XC_sb_up_arrow, None}, +{"sb_v_double_arrow", XC_sb_v_double_arrow, None}, +{"shuttle", XC_shuttle, None}, +{"sizing", XC_sizing, None}, +{"spider", XC_spider, None}, +{"spraycan", XC_spraycan, None}, +{"star", XC_star, None}, +{"target", XC_target, None}, +{"tcross", XC_tcross, None}, +{"top_left_arrow", XC_top_left_arrow, None}, +{"top_left_corner", XC_top_left_corner, None}, +{"top_right_corner", XC_top_right_corner, None}, +{"top_side", XC_top_side, None}, +{"top_tee", XC_top_tee, None}, +{"trek", XC_trek, None}, +{"ul_angle", XC_ul_angle, None}, +{"umbrella", XC_umbrella, None}, +{"ur_angle", XC_ur_angle, None}, +{"watch", XC_watch, None}, +{"xterm", XC_xterm, None}, +}; + +void NewFontCursor (cp, str) + Cursor *cp; + char *str; +{ + int i; + + for (i = 0; i < sizeof(cursor_names)/sizeof(struct _CursorName); i++) + { + if (strcmp(str, cursor_names[i].name) == 0) + { + if (cursor_names[i].cursor == None) + cursor_names[i].cursor = XCreateFontCursor(dpy, + cursor_names[i].shape); + *cp = cursor_names[i].cursor; + return; + } + } + fprintf (stderr, "%s: unable to find font cursor \"%s\"\n", + ProgramName, str); +} + +void NewBitmapCursor(cp, source, mask) +Cursor *cp; +char *source, *mask; +{ + XColor fore, back; + int hotx, hoty; + int sx, sy, mx, my; + unsigned int sw, sh, mw, mh; + Pixmap spm, mpm; + Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c; + + fore.pixel = Scr->Black; + XQueryColor(dpy, cmap, &fore); + back.pixel = Scr->White; + XQueryColor(dpy, cmap, &back); + + spm = GetBitmap(source); + if ((hotx = HotX) < 0) hotx = 0; + if ((hoty = HotY) < 0) hoty = 0; + mpm = GetBitmap(mask); + + /* make sure they are the same size */ + + XGetGeometry(dpy, spm, &JunkRoot, &sx, &sy, &sw, &sh, &JunkBW,&JunkDepth); + XGetGeometry(dpy, mpm, &JunkRoot, &mx, &my, &mw, &mh, &JunkBW,&JunkDepth); + if (sw != mw || sh != mh) + { + fprintf (stderr, + "%s: cursor bitmaps \"%s\" and \"%s\" not the same size\n", + ProgramName, source, mask); + return; + } + *cp = XCreatePixmapCursor(dpy, spm, mpm, &fore, &back, hotx,hoty); +} diff --git a/desktop.c b/desktop.c new file mode 100644 index 0000000..b9f8140 --- /dev/null +++ b/desktop.c @@ -0,0 +1,1562 @@ +/* + * $Id: desktop.c,v 3.0 90/11/20 16:13:09 dme Exp Locker: dme $ + * + * Copyright (c) 1990 Dave Edmondson. + * Copyright (c) 1990 Imperial College of Science, Technoology & Medicine + * All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Dave Edmondson or Imperial College + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Dave Edmondson and + * Imperial College make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#include +#include "twm.h" +#include "screen.h" +#include "add_window.h" +#include "menus.h" +#include "parse.h" +#include "events.h" +#include "desktop.h" + +#define strdup Strdup /* avoid conflict with system header files */ +extern char *strdup(char *); + +extern void SetRealScreenInternal(); +extern void SetRealScreen(); +extern void SnapRealScreen(); +extern void SetMapStateProp(); +extern void twmrc_error_prefix(); + +void SetVirtualPixmap(); +void SetRealScreenPixmap(); + +/* djhjr - 4/27/98 */ +static int starting_x, starting_y; + +/* djhjr - 11/3/03 */ +static int original_x, original_y; + +static void GetDesktopWindowCoordinates(tmp_win, x, y, w, h) +TwmWindow *tmp_win; +int *x, *y, *w, *h; +{ + /* djhjr - 4/27/98 */ + int border = tmp_win->frame_bw + tmp_win->frame_bw3D; + + /* Stig Ostholm */ + if (tmp_win->nailed) + { if (x) + *x = tmp_win->frame_x / Scr->VirtualDesktopDScale; + if (y) +/* *y = tmp_win->virtual_frame_y / Scr->VirtualDesktopDScale; */ + *y = tmp_win->frame_y / Scr->VirtualDesktopDScale; /* DSE */ + /* RFB 4/92 no SCALE_D */ + /* *x = SCALE_D(tmp_win->virtual_frame_x); */ + /* *y = SCALE_D(tmp_win->virtual_frame_y); */ + } else { + if (x) + *x = tmp_win->virtual_frame_x / Scr->VirtualDesktopDScale; + if (y) + *y = tmp_win->virtual_frame_y / Scr->VirtualDesktopDScale; + /* RFB 4/92 no SCALE_D */ + /* *x = SCALE_D(tmp_win->virtual_frame_x); */ + /* *y = SCALE_D(tmp_win->virtual_frame_y); */ + } + + if (w) + { *w = SCALE_D( + tmp_win->frame_width + Scr->VirtualDesktopDScale / 2 + +/* djhjr - 4/27/98 + + tmp_win->frame_bw + tmp_win->frame_bw ) +*/ + + (2 * border) ) + + - 2; + if ( *w <= 0 ) *w = 1; /* 4/92 RFB */ + } + + if (h) + { *h = SCALE_D( + tmp_win->frame_height + Scr->VirtualDesktopDScale / 2 +/* #ifdef SHAPE */ + /* + tmp_win->title_height */ +/* #ifdef SHAPE */ + +/* djhjr - 4/27/98 + + tmp_win->frame_bw + tmp_win->frame_bw ) - 2; +*/ + + (2 * border) ) - 2; + +/* 4/92 RFB -- subtract borderwidth from windowwidth... */ + if ( *h <= 0 ) *h = 1; /* 4/92 RFB */ + } +} /* Stig Ostholm */ + + +/* + * create the virtual desktop display and store the window in the screen structure + */ +void CreateDesktopDisplay() +{ + int width, height; + int border; + +/* djhjr - 5/17/98 */ +#ifndef ORIGINAL_PIXMAPS + Pixmap pm = None; + GC gc; + XGCValues gcv; + XSetWindowAttributes attributes; /* attributes for create windows */ + unsigned long valuemask; + unsigned int pm_numcolors; +#endif + + if (!Scr->Virtual) + return; + + width = Scr->VirtualDesktopWidth / Scr->VirtualDesktopDScale; + height = Scr->VirtualDesktopHeight / Scr->VirtualDesktopDScale; + +/* done in SetVirtualDesktop() - djhjr - 9/26/01 + * we have some checking for negative (x,y) to do * + if (Scr->VirtualDesktopDX < 0) { + Scr->VirtualDesktopDX = Scr->MyDisplayWidth - width - + (2 * Scr->BorderWidth) + Scr->VirtualDesktopDX; + } + if (Scr->VirtualDesktopDY < 0) { + Scr->VirtualDesktopDY = Scr->MyDisplayHeight - height - + (2 * Scr->BorderWidth) + Scr->VirtualDesktopDY; + } +*/ + + Scr->VirtualDesktopDisplayOuter = + XCreateSimpleWindow(dpy, Scr->Root, + Scr->VirtualDesktopDX, Scr->VirtualDesktopDY, + +/* djhjr - 2/7/99 + width, height, +*/ + width + (Scr->VirtualDesktopBevelWidth * 2), + height + (Scr->VirtualDesktopBevelWidth * 2), + +/* was 'Scr->BorderWidth' - submitted by Rolf Neugebauer */ + 0, + + Scr->Black, Scr->VirtualDesktopDisplayC.back); + + /* djhjr - 2/7/99 */ + { + XSetWindowAttributes attr; + + attr.backing_store = True; + XChangeWindowAttributes(dpy, Scr->VirtualDesktopDisplayOuter, + CWBackingStore, &attr); + } + + if ( width != Scr->VirtualDesktopMaxWidth ) + Scr->VirtualDesktopMaxWidth = width; + if ( height != Scr->VirtualDesktopMaxHeight ) + Scr->VirtualDesktopMaxHeight = height; +/* vtwm 5.2: RFB growable but not unreasonable interior window! */ + +/* + * re-written to use an Image structure for XPM support + * + * djhjr - 5/17/98 + */ +#ifdef ORIGINAL_PIXMAPS + Scr->VirtualDesktopDisplay = + XCreateSimpleWindow(dpy, Scr->VirtualDesktopDisplayOuter, + +/* djhjr - 2/7/99 + 0, 0, +*/ + Scr->VirtualDesktopBevelWidth, + Scr->VirtualDesktopBevelWidth, + + Scr->VirtualDesktopMaxWidth, + Scr->VirtualDesktopMaxHeight, + 0, + Scr->VirtualDesktopDisplayBorder, + Scr->VirtualC.back);/*RFB VCOLOR*/ + + XDefineCursor( dpy, Scr->VirtualDesktopDisplay, + Scr->VirtualCursor ); /*RFBCURSOR*/ + + if ( Scr->virtualPm ) /*RFB PIXMAP*/ + { /* Background pixmap, copied from tvtwm */ + Pixmap pm = None; + GC gc; + XGCValues gcv; + + pm = XCreatePixmap( dpy, Scr->VirtualDesktopDisplay, + Scr->virtual_pm_width, Scr->virtual_pm_height, + Scr->d_depth); + gcv.foreground = Scr->VirtualC.fore; + gcv.background = Scr->VirtualC.back; + gcv.graphics_exposures = False; + gc = XCreateGC (dpy, Scr->Root, + (GCForeground|GCBackground|GCGraphicsExposures), + &gcv); + if (gc) + { + XCopyPlane (dpy, Scr->virtualPm, pm, gc, 0, 0, + Scr->virtual_pm_width, Scr->virtual_pm_height, + 0, 0, 1); + XFreeGC (dpy, gc); + XSetWindowBackgroundPixmap( dpy, Scr->VirtualDesktopDisplay, + pm ); + XClearWindow( dpy, Scr->VirtualDesktopDisplay ); + } + XFreePixmap (dpy, pm); + } +#else /* ORIGINAL_PIXMAPS */ + pm_numcolors = 0; + +/* djhjr - 5/23/98 9/2/98 */ +#ifndef NO_XPM_SUPPORT + if (Scr->virtualPm) + pm_numcolors = SetPixmapsBackground(Scr->virtualPm, Scr->Root, + Scr->VirtualC.back); +#endif + + if (pm_numcolors > 2) /* not a bitmap */ + { + valuemask = CWBackPixmap; + attributes.background_pixmap = Scr->virtualPm->pixmap; + + Scr->VirtualDesktopDisplay = XCreateWindow(dpy, + Scr->VirtualDesktopDisplayOuter, + +/* djhjr - 2/7/99 + 0, 0, +*/ + Scr->VirtualDesktopBevelWidth, + Scr->VirtualDesktopBevelWidth, + + Scr->VirtualDesktopMaxWidth, + Scr->VirtualDesktopMaxHeight, + 0, + Scr->d_depth, (unsigned int) CopyFromParent, + Scr->d_visual, valuemask, &attributes); + } + else + { + Scr->VirtualDesktopDisplay = XCreateSimpleWindow(dpy, + Scr->VirtualDesktopDisplayOuter, + +/* djhjr - 2/7/99 + 0, 0, +*/ + Scr->VirtualDesktopBevelWidth, + Scr->VirtualDesktopBevelWidth, + + Scr->VirtualDesktopMaxWidth, + Scr->VirtualDesktopMaxHeight, + 0, + Scr->VirtualDesktopDisplayBorder, + Scr->VirtualC.back); /*RFB VCOLOR*/ + + if (Scr->virtualPm) + { + pm = XCreatePixmap( dpy, Scr->VirtualDesktopDisplay, + Scr->virtualPm->width, Scr->virtualPm->height, + Scr->d_depth); + + gcv.foreground = Scr->VirtualC.fore; + gcv.background = Scr->VirtualC.back; + gcv.graphics_exposures = False; + + gc = XCreateGC(dpy, Scr->Root, + (GCForeground | GCBackground | GCGraphicsExposures), + &gcv); + + if (gc) + { + XCopyPlane(dpy, Scr->virtualPm->pixmap, pm, gc, 0, 0, + Scr->virtualPm->width, Scr->virtualPm->height, + 0, 0, 1); + + XFreeGC (dpy, gc); + + XSetWindowBackgroundPixmap(dpy, Scr->VirtualDesktopDisplay, pm); + + XClearWindow(dpy, Scr->VirtualDesktopDisplay); + } + + XFreePixmap(dpy, pm); + } + } + + XDefineCursor(dpy, Scr->VirtualDesktopDisplay, Scr->VirtualCursor); /*RFB CURSOR */ +#endif /* ORIGINAL_PIXMAPS */ + + XSetStandardProperties(dpy, Scr->VirtualDesktopDisplayOuter, + +/* djhjr - 4/27/96 + "Virtual Desktop", "Virtual Desktop", +*/ +/* djhjr - 5/19/98 + "VTWM Desktop", "VTWM Desktop", +*/ + VTWM_DESKTOP_CLASS, VTWM_DESKTOP_CLASS, + + None, NULL, 0, NULL); + +/* Stig Ostholm moved a few lines away from here */ + +/* djhjr - 2/15/99 + border = 0; + if ( Scr->UseRealScreenBorder ) + { + * border = 2; * + border = Scr->RealScreenBorderWidth; * DSE * + } +*/ + border = Scr->RealScreenBorderWidth; + +/* + * re-written to use an Image structure for XPM support + * + * djhjr - 5/17/98 + */ +#ifdef ORIGINAL_PIXMAPS + /* create the real screen display */ + Scr->VirtualDesktopDScreen = + XCreateSimpleWindow(dpy, Scr->VirtualDesktopDisplay, + 0, 0, + +/* djhjr - 2/15/99 + SCALE_D(Scr->MyDisplayWidth - 2 * border), + SCALE_D(Scr->MyDisplayHeight - 2 * border), +*/ + SCALE_D(Scr->MyDisplayWidth) - 2 * border, + SCALE_D(Scr->MyDisplayHeight) - 2 * border, + + border, /* make it distinctive */ +/* RFB 4/92: make borderwidth 0 instead of 2 */ +/* RFB 5.2: some people need the border... */ + Scr->VirtualDesktopDisplayBorder, + Scr->RealScreenC.back ); /* RFB 4/92 */ + + if ( Scr->RealScreenPm ) /*RFB PIXMAP*/ + { /* Background pixmap */ + Pixmap pm = None; + GC gc; + XGCValues gcv; + + pm = XCreatePixmap( dpy, Scr->VirtualDesktopDScreen, + Scr->RealScreen_pm_width, Scr->RealScreen_pm_height, + Scr->d_depth); + gcv.foreground = Scr->RealScreenC.fore; + gcv.background = Scr->RealScreenC.back; + gcv.graphics_exposures = False; + gc = XCreateGC (dpy, Scr->Root, + (GCForeground|GCBackground|GCGraphicsExposures), + &gcv); + if (gc) + { + XCopyPlane (dpy, Scr->RealScreenPm, pm, gc, 0, 0, + Scr->RealScreen_pm_width, Scr->RealScreen_pm_height, + 0, 0, 1); + XFreeGC (dpy, gc); + XSetWindowBackgroundPixmap( dpy, Scr->VirtualDesktopDScreen, + pm ); + XClearWindow( dpy, Scr->VirtualDesktopDScreen ); + } + XFreePixmap (dpy, pm); + } +#else /* ORIGINAL_PIXMAPS */ + pm_numcolors = 0; + +/* djhjr - 5/23/98 9/2/98 */ +#ifndef NO_XPM_SUPPORT + if (Scr->realscreenPm) + pm_numcolors = SetPixmapsBackground(Scr->realscreenPm, + Scr->Root, Scr->RealScreenC.back); +#endif + + if (pm_numcolors > 2) /* not a bitmap */ + { + valuemask = CWBackPixmap | CWBorderPixel; + attributes.background_pixmap = Scr->realscreenPm->pixmap; + attributes.border_pixel = Scr->VirtualDesktopDisplayBorder; + + Scr->VirtualDesktopDScreen = XCreateWindow(dpy, + Scr->VirtualDesktopDisplay, + 0, 0, + +/* djhjr - 2/15/99 + SCALE_D(Scr->MyDisplayWidth - 2 * border), + SCALE_D(Scr->MyDisplayHeight - 2 * border), +*/ + SCALE_D(Scr->MyDisplayWidth) - 2 * border, + SCALE_D(Scr->MyDisplayHeight) - 2 * border, + + border, + Scr->d_depth, (unsigned int) CopyFromParent, + Scr->d_visual, valuemask, &attributes); + } + else + { + Scr->VirtualDesktopDScreen = XCreateSimpleWindow(dpy, + Scr->VirtualDesktopDisplay, + 0, 0, + +/* djhjr - 2/15/99 + SCALE_D(Scr->MyDisplayWidth - 2 * border), + SCALE_D(Scr->MyDisplayHeight - 2 * border), +*/ + SCALE_D(Scr->MyDisplayWidth) - 2 * border, + SCALE_D(Scr->MyDisplayHeight) - 2 * border, + + border, /* make it distinctive */ +/* RFB 4/92: make borderwidth 0 instead of 2 */ +/* RFB 5.2: some people need the border... */ + Scr->VirtualDesktopDisplayBorder, + Scr->RealScreenC.back ); /* RFB 4/92 */ + + if (Scr->realscreenPm) + { + pm = XCreatePixmap(dpy, Scr->VirtualDesktopDScreen, + Scr->realscreenPm->width, Scr->realscreenPm->height, + Scr->d_depth); + + gcv.foreground = Scr->RealScreenC.fore; + gcv.background = Scr->RealScreenC.back; + gcv.graphics_exposures = False; + + gc = XCreateGC(dpy, Scr->Root, + (GCForeground | GCBackground | GCGraphicsExposures), + &gcv); + + if (gc) + { + XCopyPlane(dpy, Scr->realscreenPm->pixmap, pm, gc, 0, 0, + Scr->realscreenPm->width, Scr->realscreenPm->height, + 0, 0, 1); + + XFreeGC(dpy, gc); + + XSetWindowBackgroundPixmap(dpy, Scr->VirtualDesktopDScreen, pm); + + XClearWindow(dpy, Scr->VirtualDesktopDScreen); + } + + XFreePixmap(dpy, pm); + } + } +#endif /* ORIGINAL_PIXMAPS */ + + /* declare our interest */ + XSelectInput(dpy, Scr->VirtualDesktopDisplay, ButtonPressMask | ButtonReleaseMask | + KeyPressMask | KeyReleaseMask | ExposureMask); + +/* Stig Ostholm moved some lines to here: */ + Scr->VirtualDesktopDisplayTwin = + AddWindow(Scr->VirtualDesktopDisplayOuter, FALSE, NULL); + + /* djhjr - 5/19/98 */ + Scr->VirtualDesktopDisplayTwin->class.res_name = strdup(VTWM_DESKTOP_CLASS); + Scr->VirtualDesktopDisplayTwin->class.res_class = strdup(VTWM_DESKTOP_CLASS); + XSetClassHint(dpy, Scr->VirtualDesktopDisplayOuter, &Scr->VirtualDesktopDisplayTwin->class); + + /* limit the minimum size of the virtual desktop - djhjr - 2/23/99 */ + Scr->VirtualDesktopDisplayTwin->hints.flags |= PMinSize; + Scr->VirtualDesktopDisplayTwin->hints.min_width = + SCALE_D(Scr->MyDisplayWidth) + (Scr->VirtualDesktopBevelWidth * 2); + Scr->VirtualDesktopDisplayTwin->hints.min_height = + SCALE_D(Scr->MyDisplayHeight) + (Scr->VirtualDesktopBevelWidth * 2); + +#ifdef GROSS_HACK + /* this is a gross hack, but people wanted it */ + Scr->VirtualDesktopDisplayTwin->nailed = TRUE; +#endif /* GROSS_HACK */ + + SetMapStateProp(Scr->VirtualDesktopDisplayTwin, NormalState); +/* :ereh ot senil emos devom mlohtsO gitS */ + + /* position the representation */ + DisplayScreenOnDesktop(); + + /* map them all */ + XMapWindow(dpy, Scr->VirtualDesktopDScreen); + XMapWindow(dpy, Scr->VirtualDesktopDisplay); + XMapWindow(dpy, Scr->VirtualDesktopDisplayOuter); + + /* create the autopan windows if we are doing this */ + if (Scr->AutoPanX > 0) { + short l; + + /* left */ + Scr->VirtualDesktopAutoPan[0] = XCreateWindow(dpy, Scr->Root, + 0, + 0, + AP_SIZE, + Scr->MyDisplayHeight, + 0, + CopyFromParent, + InputOnly, + CopyFromParent, + 0, NULL); + /* right */ + Scr->VirtualDesktopAutoPan[1] = XCreateWindow(dpy, Scr->Root, + Scr->MyDisplayWidth - AP_SIZE, + 0, + AP_SIZE, + Scr->MyDisplayHeight, + 0, + CopyFromParent, + InputOnly, + CopyFromParent, + 0, NULL); + /* top */ + Scr->VirtualDesktopAutoPan[2] = XCreateWindow(dpy, Scr->Root, + 0, + 0, + Scr->MyDisplayWidth, + AP_SIZE, + 0, + CopyFromParent, + InputOnly, + CopyFromParent, + 0, NULL); + /* bottom */ + Scr->VirtualDesktopAutoPan[3] = XCreateWindow(dpy, Scr->Root, + 0, + Scr->MyDisplayHeight - AP_SIZE, + Scr->MyDisplayWidth, + AP_SIZE, + 0, + CopyFromParent, + InputOnly, + CopyFromParent, + 0, NULL); + + /* set the event masks on the windows */ + for(l = 0; l <= 3; l++) { + XSetStandardProperties(dpy, Scr->VirtualDesktopAutoPan[l], + "Automatic Pan", "Automatic Pan", + None, NULL, 0, NULL); + + /* + * Added the leave event for pan resistance - + * see events.c:HandleEnterNotify(). + * + * djhjr - 11/16/98 + */ + XSelectInput(dpy, Scr->VirtualDesktopAutoPan[l], + EnterWindowMask | LeaveWindowMask); + + XMapWindow(dpy, Scr->VirtualDesktopAutoPan[l]); + } /* end for l */ + + } /* end if Scr->AutoPan */ +} + +/* + * re-written to use an Image structure for XPM support + * + * djhjr - 5/17/98 + */ +#ifdef ORIGINAL_PIXMAPS +void SetVirtualPixmap (filename) +char *filename; +{/*RFB PIXMAP*/ + Pixmap pm = GetBitmap (filename); + + if (pm) { + if (Scr->virtualPm) { + XFreePixmap (dpy, Scr->virtualPm); + } + Scr->virtualPm = pm; + Scr->virtual_pm_width = JunkWidth; + Scr->virtual_pm_height = JunkHeight; + } +} +#else /* ORIGINAL_PIXMAPS */ +void SetVirtualPixmap (filename) +char *filename; +{ + if (!Scr->virtualPm) Scr->virtualPm = SetPixmapsPixmap(filename); +} +#endif /* ORIGINAL_PIXMAPS */ + +/* + * re-written to use an Image structure for XPM support + * + * djhjr - 5/17/98 + */ +#ifdef ORIGINAL_PIXMAPS +void SetRealScreenPixmap (filename) +char *filename; +{/*RFB PIXMAP*/ + Pixmap pm = GetBitmap (filename); + + if (pm) { + if (Scr->RealScreenPm) { + XFreePixmap (dpy, Scr->RealScreenPm); + } + Scr->RealScreenPm = pm; + Scr->RealScreen_pm_width = JunkWidth; + Scr->RealScreen_pm_height = JunkHeight; + } +} +#else /* ORIGINAL_PIXMAPS */ +void SetRealScreenPixmap (filename) +char *filename; +{ + if (!Scr->realscreenPm) Scr->realscreenPm = SetPixmapsPixmap(filename); +} +#endif /* ORIGINAL_PIXMAPS */ + +/* + * add this window to the virtual desktop - aka nail it + */ +void UpdateDesktop(tmp_win) +TwmWindow *tmp_win; +{ + int x, y, width, height; + Window dwindow; + + if (!Scr->Virtual) + return; + + if (!tmp_win->showindesktopdisplay) + return; + + if (tmp_win->icon) { + XUnmapWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); + return; + } + + GetDesktopWindowCoordinates(tmp_win, &x, &y, &width, &height); +/* Stig Ostholm these 3 lines */ + dwindow = (tmp_win->nailed) + ? Scr->VirtualDesktopDScreen : Scr->VirtualDesktopDisplay; + + /* if it already has a vd display window, just move it to the right place + and map it, else actually create the window */ + if (!tmp_win->VirtualDesktopDisplayWindow) { + Pixel background, border; + +#ifdef notdef + if (!GetColorFromList(Scr->VirtualDesktopColorBL, tmp_win->full_name, + &tmp_win->class, &background) && + !GetColorFromList(Scr->TitleBackgroundL, tmp_win->full_name, + &tmp_win->class, &background)) + background = Scr->VirtualDesktopDisplayC.back; +#endif /* notdef */ + background = tmp_win->virtual.back; + + /* 7/10/90 - uses border list not foreground */ + if(!GetColorFromList(Scr->VirtualDesktopColorBoL, tmp_win->full_name, + &tmp_win->class, &border) && + !GetColorFromList(Scr->TitleForegroundL, tmp_win->full_name, + &tmp_win->class, &border)) + border = Scr->VirtualDesktopDisplayBorder; + + /* the position and size don't matter */ + tmp_win->VirtualDesktopDisplayWindow = + XCreateSimpleWindow(dpy, + dwindow, x, y, width, height, /* Stig */ + 1, border, background); + +/*RFBCURSOR*/XDefineCursor( dpy, tmp_win->VirtualDesktopDisplayWindow, +/*RFBCURSOR*/Scr->DesktopCursor ); + + /* listen for expose events to redraw the name */ + if (Scr->NamesInVirtualDesktop) + XSelectInput(dpy, tmp_win->VirtualDesktopDisplayWindow, + ExposureMask); + + /* save the twm window on the window */ + XSaveContext(dpy, tmp_win->VirtualDesktopDisplayWindow, + VirtualContext, (caddr_t) tmp_win); + XSaveContext(dpy, tmp_win->VirtualDesktopDisplayWindow, + TwmContext, (caddr_t) tmp_win); + + +#if 0 +0 /* Stig Ostholm */ +0 /* comment out this section */ +0 } else +0 /* unmap whilst we reconfigure it */ +0 XUnmapWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); +0 +0 if (tmp_win->nailed) { +0 x = tmp_win->frame_x / Scr->VirtualDesktopDScale; +0 y = tmp_win->frame_y / Scr->VirtualDesktopDScale; +0/* RFB 4/92 no SCALE_D */ +0 /* x = SCALE_D(tmp_win->frame_x); */ +0 /* y = SCALE_D(tmp_win->frame_y); */ +0 +0 /* reparent this window into the little screen representation */ +0 XReparentWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, +0 Scr->VirtualDesktopDScreen, x, y); +0 } else { +0 x = tmp_win->virtual_frame_x / Scr->VirtualDesktopDScale; +0 y = tmp_win->virtual_frame_y / Scr->VirtualDesktopDScale; +0/* RFB 4/92 no SCALE_D */ +0 /* x = SCALE_D(tmp_win->virtual_frame_x); */ +0 /* y = SCALE_D(tmp_win->virtual_frame_y); */ +0 +0 XReparentWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, +0 Scr->VirtualDesktopDisplay, x, y); +0 } +0 +0 /* calculate the sizes and position */ +0 width = SCALE_D( +0 tmp_win->frame_width + Scr->VirtualDesktopDScale / 2 +0 + tmp_win->frame_bw + tmp_win->frame_bw ) +0 - 2; +0 height = SCALE_D( +0 tmp_win->frame_height + Scr->VirtualDesktopDScale / 2 +0/* #ifdef SHAPE */ +0 /* + tmp_win->title_height */ +0/* #endif */ +0 + tmp_win->frame_bw + tmp_win->frame_bw ) - 2; +0/* 4/92 RFB -- subtract borderwidth from windowwidth... */ +0 if ( width <= 0 ) width = 1; /* 4/92 RFB */ +0 if ( height <= 0 ) height = 1; /* 4/92 RFB */ +0 +0#ifdef DEBUG +0 fprintf(stderr, "%d*%d+%d+%d\n", x, y, width, height); +0#endif /* DEBUG */ +0 +0 /* move and size it */ +0 XMoveWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, +0 x, y); +0 XResizeWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, +0 width, height); +#else /* 0, Stig */ + } else { /* Unmapping is fixed by XReparentWindow */ + XReparentWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, + dwindow, x, y); + XResizeWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, + width, height); + } +#endif + XMapWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); +} + +#if 0 /* Stig */ +0/* Stig Ostholm */ +0/* +0 * remove a window from the desktop display - aka unnail it +0 */ +0void RemoveFromDesktop(tmp_win) +0TwmWindow *tmp_win; +0{ +0 int x, y; +0 +0 if (!Scr->Virtual) +0 return; +0 +0 /* +0 if (tmp_win->VirtualDesktopDisplayWindow) +0 XUnmapWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); +0 */ +0 /* reparent its representation out of the real screen window */ +0 x = tmp_win->virtual_frame_x /Scr->VirtualDesktopDScale; +0 y = tmp_win->virtual_frame_y / Scr->VirtualDesktopDScale; +0/* RFB 4/92 no SCALE_D */ +0 /* x = SCALE_D(tmp_win->virtual_frame_x); */ +0 /* y = SCALE_D(tmp_win->virtual_frame_y); */ +0 +0 XReparentWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, +0 Scr->VirtualDesktopDisplay, x, y); +0} +#endif /* 0, Stig */ + +/* Stig Ostholm + * Nail/unnail a window on the desktop display. + */ +void NailDesktop(tmp_win) +TwmWindow *tmp_win; +{ + int x, y; + + if (!tmp_win->VirtualDesktopDisplayWindow + || !Scr->Virtual + || tmp_win->icon) + return; + + GetDesktopWindowCoordinates(tmp_win, &x, &y, (int *) 0, (int *) 0); + XReparentWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, + (tmp_win->nailed) + ? Scr->VirtualDesktopDScreen + : Scr->VirtualDesktopDisplay, + x, y); + XMapWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); +} + +/* + * state during the move + */ +static unsigned int moving_x, moving_y, moving_w, moving_h, moving_bw; +static unsigned int moving_off_x, moving_off_y; +Window moving_window; +TwmWindow *moving_twindow; + +/**********************************************************/ +/* */ +/* RFB 7/16/93 -- moved these static variables up to */ +/* this part of the file so that I could use moving_bw */ +/* in DisplayScreenOnDesktop(). */ +/* */ +/* Note that moving_bw is set to 0 if you clicked *in* */ +/* the window; therefore it can only have a non-zero */ +/* value if you clicked at a random location in the */ +/* panner, making the RealScreen jump to the pointer, */ +/* AND you also had RealScreenBorderWidth set. */ +/* */ +/* This is almost the final step in getting the panner */ +/* to behave pefectly! It still jitters a bit at the */ +/* edges... */ +/* */ +/**********************************************************/ + +/* + * correctly position the real screen representation on the virtual desktop display + */ +void DisplayScreenOnDesktop() +{ + int border; + + if (!Scr->Virtual) + return; + +/* djhjr - 2/15/99 + border = ( Scr->UseRealScreenBorder ) ? moving_bw : 0; + moving_bw = 0; +*/ + border = moving_bw = 0; + + /* the -3 is to account for the 2 pixel border and the 1 pixel + * offset added by SCALE_D.... */ + XMoveWindow(dpy, Scr->VirtualDesktopDScreen, + Scr->VirtualDesktopX / Scr->VirtualDesktopDScale - border, + Scr->VirtualDesktopY / Scr->VirtualDesktopDScale - border + /* SCALE_D(Scr->VirtualDesktopX), */ /* - RFB changed 3 to 1 */ + /* SCALE_D(Scr->VirtualDesktopY) */ /* - RFB changed 3 to 1 */ + ); +/* 4/92 RFB -- simply use SCALE_D; well, no... +** the problem is that SCALE_D adds 1 if the result is 0, but +** just gives the right result otherwise. +*/ + + /* Way back, somebody wrote: */ + /* I've convinced myself that this is not necessary */ + /* XLowerWindow(dpy, Scr->VirtualDesktopDScreen); */ +} + +void ResizeDesktopDisplay(w, h) +int w, h; +{ + int bw, x, y, np; + + if (!Scr->Virtual) + return; + + + /* added compensation for the titlebar - djhjr - 2/23/99 */ + h -= Scr->VirtualDesktopDisplayTwin->title_height; + + /* added compensation for frame and bevel widths - djhjr - 2/7/99 */ + bw = Scr->VirtualDesktopBevelWidth * 2; + if (Scr->BorderBevelWidth) bw += Scr->BorderWidth * 2; + + np = 0; + if ( w - bw != Scr->VirtualDesktopMaxWidth ) + { Scr->VirtualDesktopMaxWidth = w - bw; + np = 1; + } + if ( h - bw != Scr->VirtualDesktopMaxHeight ) + { Scr->VirtualDesktopMaxHeight = h - bw; + np = 1; + } + if ( np ) + { XResizeWindow( dpy, Scr->VirtualDesktopDisplay, + Scr->VirtualDesktopMaxWidth, + Scr->VirtualDesktopMaxHeight ); + } + + /* calculate the new vd size */ + Scr->VirtualDesktopWidth = SCALE_U(w - bw); + Scr->VirtualDesktopHeight = SCALE_U(h - bw); + + x = SCALE_D(Scr->VirtualDesktopX); + y = SCALE_D(Scr->VirtualDesktopY); + + /* redraw it so that the real screen representation ends up on the display */ + np = SCALE_D(Scr->VirtualDesktopWidth) - SCALE_D(Scr->MyDisplayWidth); + if (x > np) + x = np; + + np = SCALE_D(Scr->VirtualDesktopHeight) - SCALE_D(Scr->MyDisplayHeight); + if (y > np) + y = np; + +#ifdef FUDGING + /* this is a bit of a fudge factor to account for the borderwidth */ + x -= 2; + y -= 2; +#endif /* FUDGING */ + + SetRealScreen(SCALE_U(x), SCALE_U(y)); + + /* done in setrealscreen now */ +#ifdef notdef + /* move the display window */ + XMoveWindow(dpy, Scr->VirtualDesktopDScreen, x - 1, y - 1); +#endif /* notdef */ +} + + +/* + * F_MOVESCREEN function + * move a window in the desktop display - possible including the `real' screen + */ +void StartMoveWindowInDesktop(ev) +XMotionEvent ev; +{ + int xoff, yoff; +#ifdef notdef + TwmWindow *Tmp_win; +#endif /* notdef */ + + if (!Scr->Virtual) + return; + + moving_window = ev.subwindow; + + if (!moving_window) + moving_window = Scr->VirtualDesktopDScreen; + + XGrabPointer(dpy, Scr->VirtualDesktopDisplayOuter, True, + ButtonPressMask | ButtonReleaseMask | ButtonMotionMask, + GrabModeAsync, GrabModeAsync, + Scr->VirtualDesktopDisplay, Scr->NoCursor, CurrentTime); + + moving_x = ev.x; + moving_y = ev.y; + + /* djhjr - 4/27/98 */ + starting_x = ev.x; + starting_y = ev.y; + + /* find the window by looking at the context on the little window */ + if ((moving_window != Scr->VirtualDesktopDScreen) && + (XFindContext(dpy, moving_window, VirtualContext, + (caddr_t *) &moving_twindow) == XCNOENT)) { + /* i don't think that this should _ever_ happen */ + moving_window = None; + moving_twindow = NULL; + return; + } + + /* use Junk globals - djhjr - 4/28/98 */ + XGetGeometry(dpy, moving_window, &JunkChild, &xoff, &yoff, + &moving_w, &moving_h, &moving_bw, &JunkMask); + + moving_off_x = moving_off_y = 0; + if ( xoff <= moving_x && moving_x <= ( xoff + moving_w ) + && yoff <= moving_y && moving_y <= ( yoff + moving_h )) + { /* The pointer is IN the window. + ** don't start by moving the window so its upper-left is at + ** the cursor! RFB + */ + moving_off_x = xoff - moving_x; + moving_off_y = yoff - moving_y; + moving_bw = 0; + } + + /* djhjr - 4/28/98 */ + XMapRaised(dpy, Scr->SizeWindow); + InstallRootColormap(); + if (moving_window == Scr->VirtualDesktopDScreen) + JunkX = JunkY = 0; + else + { + XGetGeometry(dpy, moving_twindow->frame, &JunkChild, &JunkX, &JunkY, + &JunkWidth, &JunkHeight, &JunkBW, &JunkMask); + + /* djhjr - 9/28/99 */ + { + int hilite = moving_twindow->highlight; + + moving_twindow->highlight = True; + SetBorder(moving_twindow, (hilite) ? True : False); + moving_twindow->highlight = hilite; + + Scr->Focus = moving_twindow; /* evil */ + + EventHandler[EnterNotify] = HandleUnknown; + EventHandler[LeaveNotify] = HandleUnknown; + } + + /* djhjr - 10/2/02 */ + if (Scr->VirtualSendsMotionEvents && + (moving_window != Scr->VirtualDesktopDScreen && !moving_twindow->opaque_move)) + MoveOutline(Scr->Root, + JunkX, JunkY, + moving_twindow->frame_width, + moving_twindow->frame_height, + moving_twindow->frame_bw, + moving_twindow->title_height + moving_twindow->frame_bw3D); + + } + + /* added 'original_? = ' - djhjr - 11/3/03 */ + original_x = JunkX + Scr->VirtualDesktopX; + original_y = JunkY + Scr->VirtualDesktopY; + DisplayPosition(original_x, original_y); + + /* get things going */ + DoMoveWindowOnDesktop(ev.x, ev.y); +} + +void DoMoveWindowOnDesktop(x, y) +int x, y; +{ + if (!Scr->Virtual) + return; + + /* + * cancel the effects of scaling errors by skipping the code + * if nothing is actually moved - djhjr - 4/27/98 + */ + if (x == starting_x && y == starting_y) + return; + + /* djhjr - 2/7/99 */ + x -= Scr->VirtualDesktopBevelWidth; + y -= Scr->VirtualDesktopBevelWidth; + + x += moving_off_x; + y += moving_off_y; + /* check that we are legit */ + if (x < 0) + x = 0; + else { + + /* added real screen's border!? - djhjr - 2/15/99 */ + int np = ( Scr->VirtualDesktopWidth / + Scr->VirtualDesktopDScale ) - moving_w - + Scr->RealScreenBorderWidth * 2; + +/* RFB 4/92 no SCALE_D */ + if (x > np) + x = np; + } + if (y < 0) + y = 0; + else { + + /* added real screen's border!? - djhjr - 2/15/99 */ + int np = ( Scr->VirtualDesktopHeight / + Scr->VirtualDesktopDScale ) - moving_h - + Scr->RealScreenBorderWidth * 2; + +/* RFB 4/92 no SCALE_D */ + if (y > np) + y = np; + } + + moving_x = x; + moving_y = y; + + /* move the display window */ + /* removed '- moving_bw' - djhjr - 2/15/99 */ + XMoveWindow(dpy, moving_window, x/* - moving_bw*/, y/* - moving_bw*/); + + /* djhjr - 4/28/98 */ + DisplayPosition(SCALE_U(x), SCALE_U(y)); + +/* nah... it's pretty easy! - djhjr - 4/17/98 + * move the real window * + * this is very difficult on anything not very powerful * + * XMoveWindow(dpy, moving_twindow->frame, SCALE_U(x), SCALE_U(y)); * +*/ + if (Scr->VirtualSendsMotionEvents) + if (moving_window != Scr->VirtualDesktopDScreen) + { + if (moving_twindow->opaque_move) + XMoveWindow(dpy, moving_twindow->frame, + SCALE_U(x) - Scr->VirtualDesktopX, + SCALE_U(y) - Scr->VirtualDesktopY); + else + MoveOutline(Scr->Root, + SCALE_U(x) - Scr->VirtualDesktopX, + SCALE_U(y) - Scr->VirtualDesktopY, + moving_twindow->frame_width, + moving_twindow->frame_height, + moving_twindow->frame_bw, + moving_twindow->title_height + moving_twindow->frame_bw3D); + + /* djhjr - 9/28/99 */ + Scr->Focus = moving_twindow; /* evil */ + } +} + +void EndMoveWindowOnDesktop() +{ + if (!Scr->Virtual) + return; + + /* djhjr - 4/28/98 */ + XUnmapWindow(dpy, Scr->SizeWindow); + UninstallRootColormap(); + + if (moving_window == Scr->VirtualDesktopDScreen) { + /* added '(Cancel) ? ... :' - djhjr - 11/3/03 */ + SetRealScreen((Cancel) ? original_x : SCALE_U(moving_x),/* - moving_bw,*/ + (Cancel) ? original_y : SCALE_U(moving_y) /*- moving_bw*/ ); + } else { + /* djhjr - 4/17/98 10/2/02 */ + if (Scr->VirtualSendsMotionEvents && + (moving_window != Scr->VirtualDesktopDScreen && !moving_twindow->opaque_move)) + /* erase the move outline */ + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + + /* same little check as at the top of DoMoveWindowOnDesktop() - djhjr - 4/27/98 */ + if (moving_x != starting_x || moving_y != starting_y) + { + /* move the window in virtual space */ + /* added '(Cancel) ? ... :' - djhjr - 11/3/03 */ + moving_twindow->virtual_frame_x = + (Cancel) ? original_x : SCALE_U(moving_x); + moving_twindow->virtual_frame_y = + (Cancel) ? original_y : SCALE_U(moving_y); + + /* move it in real space */ + moving_twindow->frame_x = V_TO_R_X(moving_twindow->virtual_frame_x); + moving_twindow->frame_y = V_TO_R_Y(moving_twindow->virtual_frame_y); + + /* djhjr - 11/3/03 */ + if (Cancel) + XMoveWindow(dpy, moving_window, + SCALE_D(original_x), SCALE_D(original_y)); + + XMoveWindow(dpy, moving_twindow->frame, + moving_twindow->frame_x, moving_twindow->frame_y); + + /* notify the window */ + SendConfigureNotify(moving_twindow, + moving_twindow->frame_x, moving_twindow->frame_y); + } + + /* djhjr - 9/28/99 */ + { + int hilite = moving_twindow->highlight; + + moving_twindow->highlight = True; + SetBorder(moving_twindow, False); + moving_twindow->highlight = hilite; + + Scr->Focus = NULL; /* evil */ + + EventHandler[EnterNotify] = HandleEnterNotify; + EventHandler[LeaveNotify] = HandleLeaveNotify; + } + + /* added '!Cancel &&' - djhjr - 11/3/03 */ + if (!Cancel && !Scr->NoRaiseMove) { + XRaiseWindow(dpy, moving_twindow->frame); + XRaiseWindow(dpy, moving_twindow->VirtualDesktopDisplayWindow); + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + } + + /* djhjr - 6/4/98 */ + if (Scr->VirtualSendsMotionEvents && !moving_twindow->opaque_move) + { + XUnmapWindow(dpy, Scr->VirtualDesktopDisplay); + XMapWindow(dpy, Scr->VirtualDesktopDisplay); + } + + moving_window = None; + + return; + } + moving_window = None; + moving_twindow = NULL; +} + +/* Stig Ostholm + * move and resize a window on the desktop. + */ +void MoveResizeDesktop(tmp_win, noraise) +TwmWindow *tmp_win; +int noraise; +{ + int x, y, w, h; + + if (!tmp_win->VirtualDesktopDisplayWindow + || !Scr->Virtual + || tmp_win->icon) + return; + + GetDesktopWindowCoordinates(tmp_win, &x, &y, &w, &h); + /* Resize the desktop representation window */ + XMoveResizeWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, + x, y, w, h); + if (!noraise) + XRaiseWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); +} + +void SetVirtualDesktop(geom, scale) +char *geom; +int scale; +{ + + if (Scr->Virtual) { + twmrc_error_prefix(); + fprintf(stderr, "VirtualDesktop already defined -- ignored.\n"); + return; + } + + if (scale < 0) { + twmrc_error_prefix(); + fprintf(stderr, + "VirtualDesktop scale must be positive, not %d\n", scale); + return; + } + Scr->VirtualDesktopDScale = scale; + + JunkMask = XParseGeometry (geom, &JunkX, &JunkY, &JunkWidth, &JunkHeight); + + if ((JunkMask & (WidthValue | HeightValue)) != + (WidthValue | HeightValue)) { + twmrc_error_prefix(); + fprintf (stderr, "bad VirtualDesktop \"%s\"\n", geom); + return; + } + if (JunkWidth <= 0 || JunkHeight <= 0) { + twmrc_error_prefix(); + fprintf (stderr, "VirtualDesktop \"%s\" must be positive\n", geom); + return; + } + + /* + * More flexible way of selecting size of virtual desktop (ala tvtwm) + * M.J.E. Mol marcel@duteca.et.tudelft.nl + */ + if (JunkWidth > Scr->MyDisplayWidth) + /* specified as total pixels */ + JunkWidth /= Scr->VirtualDesktopDScale; + else if (JunkWidth*Scr->VirtualDesktopDScale < Scr->MyDisplayWidth) { + /* specified as number of physical screens */ + JunkWidth *= Scr->MyDisplayWidth; + JunkWidth /= Scr->VirtualDesktopDScale; + } + /* else specified as size of panner window */ + + if (JunkHeight > Scr->MyDisplayHeight) + /* specified as total pixels */ + JunkHeight /= Scr->VirtualDesktopDScale; + else if (JunkHeight*Scr->VirtualDesktopDScale < Scr->MyDisplayHeight) { + /* specified as number of physical screens */ + JunkHeight *= Scr->MyDisplayHeight; + JunkHeight /= Scr->VirtualDesktopDScale; + } + /* else specified as size of panner window */ + + /* tar@math.ksu.edu: fix handling of -0 X and Y geometry */ +/* account for VirtualDesktopBevelWidth - djhjr - 9/26/01 */ + if (JunkMask & XValue) { + if (JunkMask & XNegative) { + Scr->VirtualDesktopDX = Scr->MyDisplayWidth + - JunkWidth - (2 * Scr->BorderWidth) + - (2 * Scr->VirtualDesktopBevelWidth) + JunkX; + } + else Scr->VirtualDesktopDX = JunkX; + } + if (JunkMask & YValue) { + if (JunkMask & YNegative) { + Scr->VirtualDesktopDY = Scr->MyDisplayHeight + - JunkHeight - (2 * Scr->BorderWidth) + - (2 * Scr->VirtualDesktopBevelWidth) + JunkY; + } + else Scr->VirtualDesktopDY = JunkY; + } + + JunkWidth *= Scr->VirtualDesktopDScale; + JunkHeight *= Scr->VirtualDesktopDScale; + + /* check that the vd is at least as big as the screen */ +/* handled above, M.J.E. Mol +** if ((JunkWidth < Scr->MyDisplayWidth) +** || (JunkHeight < Scr->MyDisplayHeight)) +** { +** twmrc_error_prefix(); +** fprintf(stderr, +** "VirtualDesktop must be larger than screen (%dx%d)\n", +** Scr->MyDisplayWidth, Scr->MyDisplayHeight); +** return; +** } +*/ + Scr->VirtualDesktopWidth = JunkWidth; + Scr->VirtualDesktopHeight = JunkHeight; + + /* all of the values looked reasonable */ + Scr->Virtual = TRUE; +} + +void VirtualMoveWindow(t, x, y) +TwmWindow *t; +int x, y; +{ + if (!Scr->Virtual) + return; + + /* move window in virtual space */ + t->virtual_frame_x = x; + t->virtual_frame_y = y; + + /* move it in real space */ + t->frame_x = V_TO_R_X(x); + t->frame_y = V_TO_R_Y(y); + + XMoveWindow(dpy, t->frame, + t->frame_x, t->frame_y); + + /* update the display */ + /* UpdateDesktop(t); Stig */ + MoveResizeDesktop(t, FALSE); /* Stig */ + + if (!Scr->NoRaiseMove) { + XRaiseWindow(dpy, t->frame); + /* XRaiseWindow(dpy, t->VirtualDesktopDisplayWindow); Stig */ + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + } +} + +/* + * F_SNAP function + * for Kevin Twidle + * this snaps the real screen to a grid defined by the pandistance values. + */ +void SnapRealScreen() +{ + int newx, newy; + int mod, div; + + mod = Scr->VirtualDesktopX % Scr->VirtualDesktopPanDistanceX; + div = Scr->VirtualDesktopX / Scr->VirtualDesktopPanDistanceX; + + if (mod > (Scr->VirtualDesktopPanDistanceX / 2)) + newx = Scr->VirtualDesktopPanDistanceX * (div + 1); + else + newx = Scr->VirtualDesktopPanDistanceX * div; + + mod = Scr->VirtualDesktopY % Scr->VirtualDesktopPanDistanceY; + div = Scr->VirtualDesktopY / Scr->VirtualDesktopPanDistanceY; + + if (mod > (Scr->VirtualDesktopPanDistanceY / 2)) + newy = Scr->VirtualDesktopPanDistanceY * (div + 1); + else + newy = Scr->VirtualDesktopPanDistanceY * div; + + SetRealScreenInternal(newx, newy, FALSE, NULL, NULL); /* DSE */ +} + + +void SetRealScreen(x, y) +int x, y; +{ + if (Scr->snapRealScreen) + SetRealScreenInternal(x, y, TRUE, NULL, NULL); /* DSE */ + else + SetRealScreenInternal(x, y, FALSE, NULL, NULL); /* DSE */ +} + +/* + * handles the possibility of snapping + */ +void SetRealScreenInternal(x, y, dosnap, dx, dy) +int x, y; +int *dx, *dy; /* a pointer to an integer that contains the value + (AutoPanBorderWidth + AutoPanExtraWarp) is passed in to + both dx and dy when autopanning, or NULL is passed. On + return, the value is modified to store how much the pointer + should actually be warped, in case + AutoPanWarpWithRespectToRealScreen is nonzero. -- DSE */ +short dosnap; +{ + int xdiff, ydiff; + TwmWindow *Tmp_win; + + /* check bounds */ + if (x < 0) x = 0; + if (y < 0) y = 0; + if (x > (Scr->VirtualDesktopWidth - Scr->MyDisplayWidth)) + x = Scr->VirtualDesktopWidth - Scr->MyDisplayWidth; + if (y > (Scr->VirtualDesktopHeight - Scr->MyDisplayHeight)) + y = Scr->VirtualDesktopHeight - Scr->MyDisplayHeight; + + /* if ( Scr->RealScreenBorderWidth ) */ + /* { x -= 2; */ + /* y -= 2; */ + /* } */ + + /* how big a move is this ? */ + xdiff = Scr->VirtualDesktopX - x; + ydiff = Scr->VirtualDesktopY - y; + + { + /* calculate how much we might warp the pointer */ + int x_warp = ((xdiff<0) ? -1 : 1) * + ((50 + abs(xdiff) * Scr->AutoPanWarpWithRespectToRealScreen) / 100); + int y_warp = ((ydiff<0) ? -1 : 1) * + ((50 + abs(ydiff) * Scr->AutoPanWarpWithRespectToRealScreen) / 100); + + /* make sure the pointer warps enought with respect to the real screen + so that it can get out of the autopan windows. */ + if (dx) + if ( abs (*dx) < abs(x_warp) ) *dx = x_warp; + if (dy) + if ( abs (*dx) < abs(y_warp) ) *dy = y_warp; + } + + /* make sure it isn't warped too much in case ``AutoPan 100'' and + ``AutoPanWarpWithRespectToRealScreen 100'' (also known as + ``NaturalAutopanBehavior'') are set. -- DSE */ + { + int max_x_warp = ((xdiff<0) ? -1 : 1) * + (Scr->MyDisplayWidth - 2 * Scr->AutoPanBorderWidth); + int max_y_warp = ((ydiff<0) ? -1 : 1) * + (Scr->MyDisplayHeight - 2 * Scr->AutoPanBorderWidth); + if (dx) + if ( abs(*dx) > abs(max_x_warp) ) *dx = max_x_warp; + if (dy) + if ( abs(*dy) > abs(max_y_warp) ) *dy = max_y_warp; + } + + /* move all of the windows by walking the twm list */ + for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL; Tmp_win = Tmp_win->next) + { + if (Scr->StaticIconPositions && Tmp_win->icon && Tmp_win->icon_w) + { + /* + * Make icons "stay put" on the virtual desktop when + * not otherwise nailed - djhjr - 12/14/98 + */ + XGetGeometry(dpy, Tmp_win->icon_w, &JunkRoot, &JunkX, &JunkY, + &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth); + + XMoveWindow(dpy, Tmp_win->icon_w, + JunkX + xdiff, JunkY + ydiff); + } + + if (Tmp_win->nailed || (Scr->DeIconifyToScreen && Tmp_win->icon)) + { + /* + * The window is nailed or... + * The window is currently an icon, we are trying to + * keep things on the screen, so move it around the + * virtual desktop so that it stays on the real screen + */ + Tmp_win->virtual_frame_x -= xdiff; + Tmp_win->virtual_frame_y -= ydiff; + } + else + { + /* + * move the window + */ + Tmp_win->frame_x += xdiff; + Tmp_win->frame_y += ydiff; + + if (!dosnap) + { + XMoveWindow(dpy, Tmp_win->frame, + Tmp_win->frame_x, Tmp_win->frame_y); + SendConfigureNotify(Tmp_win, + Tmp_win->frame_x, Tmp_win->frame_y); + } + } + } + + Scr->VirtualDesktopX = x; + Scr->VirtualDesktopY = y; + + if (dosnap) + SnapRealScreen(); + else + DisplayScreenOnDesktop(); +} + +/* + * pan the real screen on the virtual desktop by (xoff, yoff) + */ +void PanRealScreen(xoff, yoff, dx, dy) +int xoff, yoff; +int *dx, *dy; /* DSE */ +{ + /* panning the screen can never mean that you need to snap */ + SetRealScreenInternal(Scr->VirtualDesktopX + xoff, Scr->VirtualDesktopY + yoff, +/* why not? - djhjr - 1/24/98 + FALSE, dx, dy); +*/ + Scr->snapRealScreen, dx, dy); + /* DSE */ +} + +/* + * raise the auto-pan windows if needed + */ + +void RaiseAutoPan() +{ + int i; + if (Scr->AutoPanX > 0) + for (i = 0; i <= 3; i++) + XRaiseWindow(dpy, Scr->VirtualDesktopAutoPan[i]); +} + +/* + * Raise sticky windows if StickyAbove is set. -- DSE + */ + +void RaiseStickyAbove () { + if (Scr->StickyAbove) { + TwmWindow *Tmp_win; + for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL; + Tmp_win = Tmp_win->next) + if (Tmp_win->nailed) { + XRaiseWindow(dpy,Tmp_win->w); + XRaiseWindow(dpy,Tmp_win->VirtualDesktopDisplayWindow); + XRaiseWindow(dpy,Tmp_win->frame); + } + } +} + +/* + * Lower sticky windows. -- DSE + */ + +void LowerSticky () { + TwmWindow *Tmp_win; + for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL; + Tmp_win = Tmp_win->next) + if (Tmp_win->nailed) { + XLowerWindow(dpy,Tmp_win->w); + XLowerWindow(dpy,Tmp_win->VirtualDesktopDisplayWindow); + XLowerWindow(dpy,Tmp_win->frame); + } +} + diff --git a/desktop.h b/desktop.h new file mode 100644 index 0000000..5e61487 --- /dev/null +++ b/desktop.h @@ -0,0 +1,61 @@ +/* + * $Id: desktop.h,v 3.0 90/11/20 16:13:13 dme Exp Locker: dme $ + * + * Copyright (c) 1990 Dave Edmondson. + * Copyright (c) 1990 Imperial College of Science, Technoology & Medicine + * All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Dave Edmondson or Imperial College + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Dave Edmondson and + * Imperial College make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +extern Window moving_window; /* indicates that we are doing a move in the vd display */ + +extern void CreateDesktopDisplay(); +extern void UpdateDesktop(); +/* extern void RemoveFromDesktop(); */ +extern void MoveResizeDesktop(); +extern void NailDesktop(); + +extern void DisplayScreenOnDesktop(); +extern void StartMoveWindowInDesktop(); +extern void StartMoveWindowOnDesktop(); +extern void EndMoveWindowOnDesktop(); +extern void DoMoveWindowOnDesktop(); +extern void ResizeDesktopDisplay(); +extern void VirtualMoveWindow(); +extern void SnapRealScreen(); +extern void SetRealScreen(); +extern void PanRealScreen(); +extern void RaiseStickyAbove(); /* DSE */ +extern void LowerSticky(); /* DSE */ +extern void RaiseAutoPan(); + +/* convert real space to virtual space */ +#define R_TO_V_X(x) ((x) + Scr->VirtualDesktopX) +#define R_TO_V_Y(y) ((y) + Scr->VirtualDesktopY) + +/* convert virtual space to real space */ +#define V_TO_R_X(x) (-(Scr->VirtualDesktopX - (x))) +#define V_TO_R_Y(y) (-(Scr->VirtualDesktopY - (y))) + +/* scale up and down from desktop display to real sizes */ +/* #define SCALE_D(x) (((x)/Scr->VirtualDesktopDScale)+1) */ +/* don't pass me something like `x++' - please */ +#define SCALE_D(x) ((((x)/Scr->VirtualDesktopDScale) < 1) ? 1 : (x)/Scr->VirtualDesktopDScale) +#define SCALE_U(x) ((x)*Scr->VirtualDesktopDScale) + +/* how wide/high the autopan windows are */ +#define AP_SIZE (Scr->AutoPanBorderWidth) /* DSE */ + +/* djhjr - 5/19/98 */ +#define VTWM_DESKTOP_CLASS "VTWM Desktop" + diff --git a/doc/.vtwmrc-marcel b/doc/.vtwmrc-marcel new file mode 100644 index 0000000..01e457b --- /dev/null +++ b/doc/.vtwmrc-marcel @@ -0,0 +1,754 @@ +############################################################ +## ## +## Fri Jul 30 14:37:25 EDT 1993 ## +## ## +## I am including this vtwmrc in the distribution ## +## because it is so incredibly well organized and shows ## +## the differences between twm, vtwm, and tvtwm. ## +## ## +## As an example of what you can learn from this, the ## +## vtwm VirtualDesktopFont and the tvtwm VirtualFont ## +## both mean the same thing and *ought* to have the ## +## same name! ## +## ## +############################################################ + + + +#============================================================================= +# File: ~/.?twmrc V1.00 93/07/08 M.J.E. Mol +# marcel@duteca.et.tudelft.nl +# +# This file is read by the twm, vtwm or tvtwm Xwindow managers. +# + + +############################################################################ +# Font Section +############################################################################ +# +# TWM Fonts +# +# ResizeFont "fixed" # resize dimension indicator # "9x15" +ResizeFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +# IconManagerFont "6x12" #"variable" # "6x10" +IconManagerFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*" +# MenuFont "variable" # "6x10" "-*-helvetica-bold-r-normal--*-140-*-*-*-*-iso8859-1" +MenuFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +# TitleFont "variable" # "6x13" "6x10" +TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +# +# VTWM Fonts +# +# DoorFont "6x10" # Needed to allow doors +DoorFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*" +VirtualDesktopFont "variable" +# +# TVTWM Fonts +# +#VirtualFont "variable" # 5x8 +#MenuTitleFont "-adobe-helvetica-bold-r-normal--*-140-*-*-*-*-*-*" + + +############################################################################ +# Variables Section +############################################################################ +# +# TWM Boolean Variables +# +AutoRelativeResize # Allow resize from any point within the window +ClientBorderWidth # Take border width from initial border width of window +DecorateTransients # Transient windows should have titlebars +DontMoveOff # Do not allow windows to be moved of the screen +# ForceIcons # Force use of "Icons" list instead of client-supplied one +# InterpolateMenuColors # Gradually changing menu colors +# NoBackingStore # Backing store for twm's menus +NoCaseSensitive # For sorting icon names in icon manager +# NoDefaults # Needed when building own title buttons and bindings +NoGrabServer # When popping up menus or moving opaque windows +# NoIconManagers # Don't create icon managers +# NoMenuShadows # Don't draw drop shadows behind menus +# NoRaiseOnDeiconify # Don't automatically raise windows on de-iconify +# NoRaiseOnMove # Don't automatically raise when windows are moved +# NoRaiseOnResize # Don't automatically raise when windows are resized +# NoRaiseOnWarp # Don't automatically raise window when f.warpto +# NoSaveUnders # Repaint instead of save-under for menu selection +# NoTitleFocus # Don't set input focus when window is entered +# OpaqueMove # F.move window instead of just an outline +# RandomPlacement # Don't give ouline-drag for no-geometry windows +RestartPreviousState # 'Remember' previous state when window manager is restarted +ShowIconManager # Show icon manager on startup +# SortIconManager # Sort icons alphabetically in iconmanager +WarpUnmapped # Allow f.warpto to de-iconify windows + +# +# VTWM Boolean Variables +# +# DeiconifyToScreen # De-iconifying puts window on physical screen instead of old position +#NotVirtualGeometries # Geometries relative to screen, not over whole desktop +# SnapRealScreen # Snap to grid defined in PanDistanceX and PanDistanceY +# WarpWindows # move window to real screen instead of moveing real screen + +# +# TVTWM Boolean Variables +# +#PannerOpaqueScroll # Only useful when StickyAbove is set +#ShowVirtualNames # Give virtual desktop windows a name using VirtualFont +#StayUpMenus # Only select menuitems when they are pushed +#StickyAbove # Sticky windows will always be on top + +# +# TWM Numeric Variables +# +BorderWidth 2 # Frame border width in pixels +ButtonIndent 1 # 0, Title button indentation in pixels +ConstrainedMoveTime 400 # Time (msec) in which double click allows only move in hor or vert direction +FramePadding 2 # Pixelwidth between titlebar decorations and the window frame +IconBorderWidth 2 # Border of icons in pixels +MoveDelta 3 # Number of pixels to move before f.move starts working (also f.deltastop) +TitleButtonBorderWidth 1 # 0, Distance between title buttons +TitlePadding 8 # 16, Distance between title buttons, text and highlight area +# XorValue 1 # Outline color setter for move and resize +Zoom 16 # Iconify/de-iconfy outline show count + +# +# VTWM Numeric Variables +# +# AutoPan 5 # Pan when mouse is with % range of edge of screen +# AutoRaiseDelay 30000 # == RaiseDelay ? +# PanDistanceX 3? # Grid of screens for f.snap +# PanDistanceY 3? # Move real screan to closest grid location +RaiseDelay 3000 # Milliseconds to delay before AutoRaise/f.autoraise + +# +# TVTWM Numeric Variables +# +#PannerScale 20 # Scale of deskto panner to real screen +#ScrollDistanceX 100 # % scroll when scrolling in virtual desktop +#ScrollDistanceY 100 # % scroll when scrolling in virtual desktop +#TitleFontPadding 5 # pixels above window titles + +# +# TWM String Variables +# +# Path to look for bitmaps if they cannot be found in "bitmapFilePath" resource +# IconDirectory "/usr/include/X11/bitmaps" +# IconDirectory "/usr/include/X11/bitmaps:/usr/local/bitmaps/local" +# IconDirectory "/usr/local/X11/bitmaps" +IconDirectory "/usr/X386/lib/X11/xdtm/icons/small" +MaxWindowSize "30000x30000" +UnknownIcon "icon" # icon bitmap to use when no other found +UsePPosition "on" # program requested location, "on" "off" "nonzero" +# +# VTWM String Variables +# +# RealScreenPixmap "realscr.bm" # decorate virt. desktop realscreen (panner) +# VirtualBackgroundPixmap "something" # decoration for virtual desktop +# +# TVTWM String Variables +# +#PannerBackgroundPixmap "realscr.bm" # decoration of panner +#PannerGeometry "=100x250-0+0" +#PannerState "normal" # normal, iconic, withdrawn +#VirtualDesktop "3x2" +#VirtualDesktopBackgroundPixmap "something" # decoration for virtual desktop + +# +# TWM Complex Variables +# +IconManagerGeometry "=100x250-0+0" 1 # 1 column +# Define regions to put icons (multiple lines allowed) +# IconRegion geomstring # define geometry) +# vgrav # North or South fill direction +# hgrav # East for West fill direction +# gridwidth # grid dimensions to put icons in +# gridheight +IconRegion "=300x300+200-0" North East 30 30 + +# +# VTWM Complex Variables +# +#VirtualDesktop "150x100-0-0" 20 # Panner geometry and scale +VirtualDesktop "3x2-0-0" 20 # Panner geometry and scale + +# +# TWM List Variables +# + +Color { + # TWM Simple Color + DefaultBackground "white" # "maroon" Sizing and information windows + DefaultForeground "black" # "gray85" + MenuBackground "maroon" + MenuForeground "black" # "gray85" + MenuShadowColor "blue" + MenuTitleBackground "gray70" # "red" # f.title color + MenuTitleForeground "maroon" # "black" + + # TWM Complex Color + BorderColor "LightGoldenRod" { #"slategrey" + "xterm" "red" + "seyon" "orange" + } + BorderTileBackground "white" { } # Unhighlighted window borders + BorderTileForeground "black" { } + IconBackground "maroon" { } # "white" black + IconBorderColor "black" { } # "gray85"white + IconForeground "black" { } # "gray85" white + IconManagerBackground "white" { } # "maroon" + IconManagerForeground "black" { } # "gray85" + IconManagerHighlight "blue" {"xterm" "red" "seyon" "orange"} + TitleBackground "sea green" {"xterm" "steelblue" "seyon" "brown"} + TitleForeground "white" { } # "gray85" + + # VTWM Simple Color + RealScreenBackground "orange" # virtual desktop realscreen indicator + RealScreenForeground "yellow" # needs RealScreenPixmap + VirtualBackground "green" + VirtualForeground "red" + + # VTWM Complex Color + DesktopDisplayBackground "pink" { } # color of windows in virtual desktop windows and in iconmanager + DesktopDisplayBorder "green" { } # border color of windows in virtual desktop window + DesktopDisplayForeground "white" { } # color of text in windows in virtual desktop window and iconmanager, needs VirtualDesktopFont + DoorBackGround "orange" { } + DoorForeGround "blue" { } + + # TVTWM Simple Color + #PannerBackground "yellow" + #PannerForeground "blue" + #VirtualDesktopBackground "steelblue" # Whole screen, + #VirtualDesktopForeground "black" # use with VirtualBackgroundPixm + + # TVTWM Complex Color + #VirtualBackground "orange" { } + #VirtualForeground "green" { } +} + +Monochrome { + # TWM Simple Color + DefaultBackground "white" + DefaultForeground "black" + MenuBackground "white" + MenuForeground "black" + MenuShadowColor "black" + MenuTitleBackground "white" # black, f.title color + MenuTitleForeground "black" # white + + # TWM Complex Color + BorderColor "black" { } + BorderTileBackground "white" { } + BorderTileForeground "black" { } + IconBackground "white" { } # black + IconBorderColor "black" { } # white + IconForeground "black" { } # white + IconManagerBackground "white" { } + IconManagerForeground "black" { } + IconManagerHighlight "black" { } + TitleBackground "black" { } + TitleForeground "white" { } + + # VTWM Simple Color + RealScreenBackground "black" # virtual desktop realscreen indicator + RealScreenForeground "white" # needs RealScreenPixmap + VirtualBackground "white" + VirtualForeground "black" + + # VTWM Complex Color + DesktopDisplayBackground "black" { } # color of windows in virtual desktop windows and in iconmanager + DesktopDisplayBorder "white" { } # border color of windows in virtual desktop window + DesktopDisplayForeground "white" { } # color of text in windows in virtual desktop window and iconmanager, needs VirtualDesktopFont + DoorBackGround "white" { } + DoorForeGround "black" { } + + # TVTWM Simple Color + #PannerBackground "black" + #PannerForeground "white" + #VirtualDesktopBackground "white" # Whole screen, + #VirtualDesktopForeground "black" # use with VirtualBackgroundPixm + + + # TVTWM Complex Color + #VirtualBackground "white" { } + #VirtualForeground "black" { } +} + +AutoRaise { # Auto raise windows + "XTerm" + "x" + "XV" + "Seyon" + "Post" + "emacs" + "Ghost" + "gv" + "gs" + # TVTWM VTWM + "Virtual Desktop" + "VTWM Icon Manager" + "TWM Icon Manager" + "Twm Door" +} + +Cursors { + # cursorname "string" for names in include/X11/cursorfont.h + # cursoname "image" "mask" for cursors taken from bitmap files + Frame "top_left_arrow" # "spider" + Title "top_left_arrow" + Icon "top_left_arrow" + IconMgr "top_left_arrow" + Move "fleur" + Resize "fleur" + Menu "sb_left_arrow" + Button "hand2" + Wait "watch" + Select "dot" + Destroy "pirate" + + # VTWM + Door "exchange" + Virtual "rtl_logo" + Desktop "dotbox" +} + +# DontIconifyByUnmapping { } # Iconify to icons instead of to icon manager +# IconifyByUnmapping { } # Don't try to map any icons. Remap through iconmanager, f.warpto or TwmWindows menu + +IconManagerDontShow { + "xclock" + "xload" + "xbiff" + "xmeter" + "xcb" + "Virtual Desktop" + "VTWM Icon Manager" + "TWM Icon Manager" + "Twm Door" +} + +IconManagers { # Definition of iconmanagers... + # "winname" ["iconname"] "geometry" columns + # "XTerm" "=300x5+800+5" 5 +} + +# IconManagerShow { } + +Icons { + # "XTerm" "xterm.icon" + "XTerm" "pixmap.xpm" + # "Seyon" "seyon.icon" +} + +# MakeTitle { } # Create title bars even when NoTitle has been specified + +NoHighLight { # i.e. not drawing borders in bordercolor +# "xclock" +# "xload" +# "xeyes" +# "xbiff" +# "xbehold" +# "xmeter" +# "oclock" +# "xcb" + "Virtual Desktop" + "VTWM Icon Manager" + "TWM Icon Manager" + "Twm Door" +} + +NoStackMode { } # ignore stacking request for these windows + +NoTitle { # don't show a titlebar for these windows + "XClock" +# "xclock" +# "xload" +# "xeyes" + "xbiff" +# "xbehold" +# "xmeter" +# "oclock" +# "xcb" + "Virtual Desktop" + "VTWM Icon Manager" + "TWM Icon Manager" + "Twm Door" +} + +NoTitleHighlight { } # don't highlight titlebar when focused in window + +Pixmaps { # "bitmapfile" + # TitleHighlight "gray1" + # VTWM + # RealScreenPixmap "something" + # VirtualBackgroundPixmap "something else" +} + +# SaveColor { } + +# titlebar is only as large as is needed for decorations +# { "name" left|center|right nominator denominator } +# SqueezeTitle { } + +DontSqueezeTitle { } # Don't make title bar as short a possible + +StartIconified { + "console" +} + +WarpCursor { # warp cursor in window when de-iconified + "xterm" + "seyon" + "nn" +} + +WindowRing { # windows to cycle through by f.warpring + "xterm" + "seyon" + "nn" +} + +# +# VTWM List Variables +# + +DontShowInDisplay { # Don't show in virtual desktop window + "xclock" + "XBiff" + # TVTWM VTWM + "TWM Windows" + "Virtual Desktop" + "VTWM Icon Manager" + "TWM Icon Manager" + "Twm Door" +} + +Doors { # remember to set DoorFont + # "winname" "location" "jumpTo" + "Home" "60x15+650+1" "+0+0" + "Screen 1" "60x15+710+1" "+1024+0" + "Screen 2" "60x15+770+1" "+2048+0" + "Screen 3" "60x15+650+16" "+0+1024" + "Screen 4" "60x15+710+16" "+1024+1024" + "Screen 5" "60x15+770+16" "+2048+1024" +} + +# NailedDown { # Keep on physical screen, see Sticky +Sticky { # synomym for naileddown + "xclock" + "xcb" + "Virtual Desktop" + "VTWM Icon Manager" + "TWM Icon Manager" + "Twm Door" +} + +# +# TVTWM List Variables +# +#IconTitle { } # Give titles to icons, even when NoIconTitle is set +#NoIconTitle { } # Give titles to icons, even when NoIconTitle is set + +# +# Put these two in at end of variable section, before bindings section +# +DefaultFunction f.beep # for non-bound keys or buttons +# WindowFunction f.deiconify # function to perform when window is selected from "TwmWindows" menu + + +###################################################################### +# End of Variable Section +###################################################################### + + +# Functions ... +# f.circledown +# f.circleup + +# f.deiconify + + +# f.saveyourself FKEYWORD F_SAVEYOURSELF +# f.setrealscreen FSKEYWORD F_SETREALSCREEN +# f.snap FKEYWORD F_SNAP +# f.snugdesktop FKEYWORD F_SNUGDESKTOP +# f.snugwindow FKEYWORD F_SNUGWINDOW + +# f.nexticonmgr FKEYWORD F_NEXTICONMGR +# f.previconmgr FKEYWORD F_PREVICONMGR + +# f.warptoiconmgr FSKEYWORD F_WARPTOICONMGR +# f.warptoscreen FSKEYWORD F_WARPTOSCREEN + + + +###################################################################### +# Titlebuttons +###################################################################### +# bitmaps are stored in /usr/include/X11/bitmaps +# ":bitmap" uses internal bitmap +# (:dot, :xlogo, :iconify, :resize, :question, :delete, :menu) +#--------------------------------------------------------------------- +RightTitleButton ":menu" = f.menu "WindowSettings" +RightTitleButton ":iconify" = f.iconify +RightTitleButton "jpzoom" = f.zoom +LeftTitleButton ":xlogo" = f.menu "XSettings" + +###################################################################### +# Button/key bindings +###################################################################### +# Button = KEYS : CONTEXT : FUNCTION +# Keys can be m (meta) s (shift) c (control) l (lock) m1-5 (meta1-meta5) +# Context can be window, title, icon, root, frame, virtual, desktop, door, +# iconmgr, all +#--------------------------------------------------------------------- +Button1 = : root : f.menu "Applications" +Button2 = : root : f.menu "WindowManager" +Button3 = : root : f.menu "Rlogins" +Button1 = : door : f.enterdoor +Button1 = : title|icon|iconmgr : f.function "move-or-raise" #f.raise +Button2 = : title : f.move +Button2 = : icon | iconmgr : f.iconify +Button3 = : title|icon|iconmgr : f.function "focus_and_raise" +Button1 = c : door : f.deletedoor +Button1 = s : all : f.menu "Applications" +Button2 = s : title | window : f.move +# Don't want to define next: idraw uses that button... +#Button3 = s : all : f.menu "Applications" +Button1 = m : all : f.menu "WindowSettings" +Button2 = m : title | window : f.forcemove +Button3 = m : title | icon | iconmgr : f.lower +#Button1 = m : window | icon : f.function "move-or-lower" +#Button2 = m : window | icon : f.iconify +#Button3 = m : window | icon : f.function "move-or-raise" +#Button2 = : title : f.raiselower +#Button1 = : icon : f.function "move-or-iconify" + +#"F1" = : all : f.iconify +"F2" = : all : f.function "xvi" +#"F2" = : all : f.raiselower +#"F3" = : all : f.warpring "next" +#"F4" = : all : f.warpto "xmh" +#"F5" = : all : f.warpto "emacs" +"F6" = : title | window : f.iconify +#"F6" = : all : f.colormap "next" +#"F7" = : all : f.colormap "default" +"F9" = : all : f.warpto "idraw" +"F10" = : all : f.warpring "next" +"F11" = : all : f.warpring "prev" +"F14" = : all : f.function "xlock" +#"F20" = : all : f.warptoscreen "next" + +"Delete" = m c : title | window : f.destroy + +"Left" = : iconmgr : f.lefticonmgr # f.backiconmgr +"Right" = : iconmgr : f.righticonmgr # f.forwiconmgr +"Down" = : iconmgr : f.downiconmgr +"Up" = : iconmgr : f.upiconmgr +"Left" = m : all : f.backiconmgr +"Right" = m : all : f.forwiconmgr +"Up" = m : all : f.upiconmgr +"Down" = m : all : f.downiconmgr +# +# VTWM Desktop Scroll +# +"Left" = : root : f.panleft "100" +"Right" = : root : f.panright "100" +"Up" = : root : f.panup "100" +"Down" = : root : f.pandown "100" +"Left" = s : all : f.panleft "100" +"Right" = s : all : f.panright "100" +"Up" = s : all : f.panup "100" +"Down" = s : all : f.pandown "100" +# +# TVTWM Desktop Scroll +# +#"Left" = : root : f.scrolleft +#"Right" = : root : f.scrollright +#"Up" = : root : f.scrollup +#"Down" = : root : f.scrolldown +#"Left" = s : all : f.scrolleft +#"Right" = s : all : f.scrollright +#"Up" = s : all : f.scrollup +#"Down" = s : all : f.scrolldown + + +# +# Fuctions defined for Buttons +#--------------------------------------------------------------------- +Function "focus_and_raise" { f.focus f.raise } +Function "xlock" { !"xlock -mode swarm -font '8x13' &" } +Function "xvi" { !"xvi &" } +Function "move-or-lower" { f.move f.deltastop f.lower } +Function "move-or-raise" { f.move f.deltastop f.raise } +Function "move-or-iconify" { f.move f.deltastop f.iconify } +Function "restore-colormap" { f.colormap "default" f.lower } + + +###################################################################### +# Menus +###################################################################### +# (default font and geometry for "xterm" are defined in ~/.Xdefaults) +#--------------------------------------------------------------------- + +menu "Applications" { + "Applications" ("black":"yellow") f.title + "Lock" f.function "xlock" + "Xterm" !"xterm -geometry =80x24 &" + "nn" ("black":"yellow") !"xnn &" + "" f.nop + "Misc. Appl." f.menu "MiscAppl" + "Window Manager" f.menu "WindowManager" + "XSettings" f.menu "XSettings" + "WindowSettings" ("black":"cyan") f.menu "WindowSettings" + "TWM Windows" f.menu "TWM Windows" + "TwmWindows" f.menu "TwmWindows" + "Rlogins" f.menu "Rlogins" + "Colors" f.menu "Colors" + "Xterms" ("white":"green") f.menu "Xterms" + "File" f.file "/vtwm.file" +} + +menu "WindowManager" { + "Window Manager" f.title + "Refresh" f.refresh + "Refresh Desktop" f.resetdesktop + "Hide Icon Manager" f.hideiconmgr + "Show Icon Manager" f.showiconmgr + "Sort Icon Manager" f.sorticonmgr + "Hide Virtual Desktop" f.hidedesktopdisplay + "Show Virtual Desktop" f.showdesktopdisplay + "Toggle Virtual Geometries" f.virtualgeometries + "Create Door" f.newdoor + "Delete Door" f.deletedoor + "Focus on Root" f.unfocus + "Toggle Autopan" f.autopan + "Restart Twm" f.twmrc # f.restart + "TWM keys" !"xtwmkeys &" + "Backdrops" !"xsetbg `xfiles /usr/local/X11/local/bitmaps`&" + "Version" f.version + "Exit Twm" f.quit +} + +menu "WindowSettings" { + "Window Settings" ("black":"cyan") f.title + "Refresh" f.winrefresh + "AutoRaise" f.autoraise + "Raise" f.raise + "Lower" f.lower + "Focus" f.focus # f.unfocus + "Focus&Raise" f.function "focus_and_raise" + "Move" f.move + "ForceMove" f.forcemove + "Resize" f.resize + "Identify" f.identify + "Iconify" f.iconify + "Zoom" f.menu "Zoom" + "Toggle in WarpRing" f.ring + "Toggle Nail" f.nail + "Squeeze Title Center" f.squeezecenter + "Squeeze Title Left" f.squeezeleft + "Squeeze Title Right" f.squeezeright + "Quit" f.delete + "Destroy" f.destroy +} + +menu "Zoom" { + "FullZoom" f.fullzoom + "LeftZoom" f.leftzoom # f.vlzoom + "RightZoom" f.rightzoom # f.vrzoom + "TopZoom" f.topzoom # f.htzoom + "BottomZoom" f.bottomzoom # f.hbzoom + "VerticalZoom" f.zoom + "HorizontalZoom" f.horizoom # f.hzoom +} + +menu "MiscAppl" { + "Misc. Appl." f.title + "" f.nop +# "nn" ("black":"yellow") !"xnn &" +# "idraw" !"idraw &" + "calc" !"xcalc -rv &" +# "news" !"xrn &" + "man" !"xman &" + "fonts" !"xfbrows &" +# "archie" !"xarchie &" + "bricks" !"xsetroot -bitmap /usr/local/X11/local/bitmaps/wall.xbm&" +# "swarm" !"xswarm &" + "clock" !"xclock &" + "biff" !"xbiff &" + "load" !"xload &" +# "vi" f.function "xvi" +} + +menu "XSettings" { + "XSettings" f.title + "" f.nop + "Bell Loud" !"xset b 100&" + " Normal" !"xset b 50&" + " Off" !"xset b off&" + " High" !"xset b 50 880&" + " Medium" !"xset b 50 440&" + " Low" !"xset b 50 220&" + "Click Loud" !"xset c 80&" + " Normal" !"xset c 40&" + " Off" !"xset c off&" + "Lock On" !"xset l on&" + " Off" !"xset l off&" + "Mouse Fast" !"xset m 4 2&" + " Normal" !"xset m 2 5&" + " Slow" !"xset m 1 1&" +} + +menu "Colors" { + "Colors" f.title + "Next" f.colormap "next" + "Previous" f.colormap "prev" + "Default" f.colormap "default" +} + +# xterm-options: +# The "-name" specifies the name that applies to resources in ~/.Xdefaults +# The "-n" specifies the name that appears in the icon +# The "-title" or "-T" specifies the name that appears in the titlebar +# icon-name and title are default set to the name of the executable (i.e. +# "xterm") or set to the name of the executable after the "-e" option or +# set to the name after the "-name" option + +menu "Xterms" { + "Xterms" f.title + "" f.nop + "xterm -fn 6x13" !"xterm -fn 6x13 -geometry =80x24 &" + "xterm -fn 8x13" !"xterm -fn 8x13 -geometry =80x24 &" + "xterm -fn 9x15" !"xterm -fn 9x15 -geometry =80x24 &" +} + +menu "Rlogins" { + "Rlogins" f.title + "Local" !"xterm -T `hostname` &" + "" f.nop + "baldrick" ("black":"green") !"xterm -T baldrick -e rlogin baldrick &" + "bean" ("black":"green") !"xterm -T bean -e rlogin bean &" + "percy" ("black":"green") !"xterm -T percy -e rlogin percy &" + "" f.nop + "SUN4s" f.menu "SUN4s" + "SUN3s" f.menu "SUN3s" + "" f.nop + "Telnet" ("black":"yellow") !"xterm -name telnet -e telnet &" +} + +menu "SUN4s" { + "SUN4s" f.title + "" f.nop + "baldrick" ("black":"green") !"xterm -T baldrick -e rlogin baldrick &" + "bean" ("black":"green") !"xterm -T bean -e rlogin bean &" +} + +menu "SUN3s" { + "SUN3s" f.title + "" f.nop + "percy" ("black":"green") !"xterm -T percy -e rlogin percy &" + "darling" ("black":"green") !"xterm -T darling -e rlogin darling &" + "bob" ("black":"green") !"xterm -T bob -e rlogin bob &" +} + + diff --git a/doc/1.README b/doc/1.README new file mode 100644 index 0000000..a0c1a7f --- /dev/null +++ b/doc/1.README @@ -0,0 +1,45 @@ +This is based on vtwm-5.0.tar.Z, with the addition of all the +patches I know of except for the "dwim" patch. +The patch authors' names were added to the manual entry. + +It also includes my own enhancements, of course. + +Although many files are unchanged from vtwm-5.0.tar.Z, +I mean for this to supplant that version, so the next +person to take a swing at vtwm will start with my changes! + +There is no excuse for not including raisedelay and +dynamic squeezed titles and dynamic warpring in every +version of twm, including twm, vtwm, tvtwm, and ctwm. +These are essential features. + +RealScreen colors and bitmap are useful. +A sample realscreen.bm file is included. + +Colored entries in the TWM-Windows menu are nice to have. +Being able to turn autopan off and on at will is also handy. + +I rarely use the "snug" functions. + +Panner foreground and bitmap are superseded by my "nexpm" +program: see the nexpm directory for details. + +============================================================ +== == +== TWO EXTRAS INCLUDED == +== == +============================================================ + +The nexpm directory contains a program that decorates +your panner window. + +The vtwmrc directory contains a makefile and scripts that help +maintain the colorlists in your .vtwmrc + +======== + +vtwm has no maintainer, as far as I know. + +Now I am finished with vtwm; somebody else can take a turn next. + +Fri Jun 25 12:20:38 EDT 1993 diff --git a/doc/2.1.ANNOUNCE b/doc/2.1.ANNOUNCE new file mode 100644 index 0000000..7d48412 --- /dev/null +++ b/doc/2.1.ANNOUNCE @@ -0,0 +1,74 @@ +From comp.windows.x Sat Oct 9 17:02:14 1993 +Xref: netnews.louisville.edu comp.windows.x.announce:212 comp.windows.x:53876 +Newsgroups: comp.windows.x.announce,comp.windows.x +Path: netnews.louisville.edu!starbase.spd.louisville.edu!dsembr01 +From: Darren S. Embry +Subject: ANNOUNCING the release of vtwm 5.2.1 +Originator: dsembr01@terra.spd.louisville.edu +Sender: news@netnews.louisville.edu (Netnews) +Message-ID: +Date: Wed, 6 Oct 1993 20:46:34 GMT +Reply-To: dsembr01@starbase.spd.louisville.edu +Nntp-Posting-Host: terra.spd.louisville.edu +Organization: University of Louisville Speed Scientific School + +I am announcing the (unofficial) release of vtwm version 5.2.1. It's +available at: + + ftp.x.org:/contrib/vtwm-5.2.1.tar.gz + +As far as changes from version 5.2 to version 5.2.1 go, they are mostly a few +aesthetic and look-and-feel hacks and a couple of bug fixes. + +I would really like input as to how you like the changes I made. + +-- Darren S. Embry, dsembr01@starbase.spd.louisville.edu + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + MINOR NEW FEATURE (I can't say it's a big deal) + ----------------------------------------------- + Natural Autopan Behavior + + By default, when autopanning, the pointer is warped by only + (AutoPanBorderWidth + AutoPanExtraWarp) pixels on the real + screen. With this option turned on, the pointer is warped by as + many pixels as the screen is scrolled, or by the above number of + pixels, whichever is greater. Thus, the pointer will not + actually move very much (only by AutoPanExtraWarp) in relation to + the virtual desktop. This works very well on faster X terminals, + although I can't say the same thing for slower ones (but setting + AutoPanWarpWithRespectToRealScreen may do a good job). + + NEW VARIABLES to play around with + --------------------------------- + AutoPanBorderWidth + AutoPanExtraWarp + AutoPanWarpWithRespectToRealScreen + EnhancedExecResources + LessRandomZoomZoom + NaturalAutopanBehavior + # synonymous with ``AutoPanWarpWithRespectToRealScreen 100'' + PrettyZoom + RealScreenBorderWidth + RightHandSidePulldownMenus + + OTHER HACKS AND BUG FIXES + ------------------------- + Supports negative and `0,0' door geometries. [ bug fix ] + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +DISCLAIMER: I am not the official maintainer or central programmer of vtwm, +but there isn't one anyway; I just made a few bug fixes, played with the code +to make it a little bit more `configurable' in certain areas, and decided to +see what *you* think of the changes I made. I also don't know much about X +programming, but the changes I made to vtwm haven't caused any major damage +so far. + +-- + letitflowletyourselfgos[ darren s. embry ]lowandlowthatisthetempo + [ dsembr01@starbase ] +beingashamedbecauseyouredif[ .spd.louisville.edu ]ferentisthesickestkindoflie + + diff --git a/doc/2.1.README b/doc/2.1.README new file mode 100644 index 0000000..aede518 --- /dev/null +++ b/doc/2.1.README @@ -0,0 +1,95 @@ +As far as changes from version 5.2 to version 5.2.1 go, they are mostly a few +aesthetic and look-and-feel hacks and a couple of bug fixes. + +I would really like input as to how you like the changes I made. + +-- Darren S. Embry, dsembr01@starbase.spd.louisville.edu + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + MINOR NEW FEATURE (I can't say it's a big deal) + ----------------------------------------------- + Natural Autopan Behavior + + By default, when autopanning, the pointer is warped by only + (AutoPanBorderWidth + AutoPanExtraWarp) pixels on the real + screen. With this option turned on, the pointer is warped by as + many pixels as the screen is scrolled, or by the above number of + pixels, whichever is greater. Thus, the pointer will not + actually move very much (only by AutoPanExtraWarp) in relation to + the virtual desktop. This works very well on faster X terminals, + although I can't say the same thing for slower ones (but setting + AutoPanWarpWithRespectToRealScreen may do a good job). + + NEW VARIABLES to play around with + --------------------------------- + AutoPanBorderWidth + AutoPanExtraWarp + AutoPanWarpWithRespectToRealScreen + EnhancedExecResources + LessRandomZoomZoom + NaturalAutopanBehavior + # synonymous with ``AutoPanWarpWithRespectToRealScreen 100'' + PrettyZoom + RealScreenBorderWidth + RightHandSidePulldownMenus + + OTHER HACKS AND BUG FIXES + ------------------------- + Supports negative and `0,0' door geometries. [ bug fix ] + +CHANGES BY SOURCE FILE +====================== + +Any lines, code or data structures in the code denoted by "/* DSE */" are +changes I made. + + desktop.c: + ---------- + Supports the RealScreenBorderWidth variable now. + + Added dx,dy parameters to SetRealScreenInternal and PanRealScreen so + that they pass information on how much to warp the mouse pointer, + to support my AutoPanWarpWithRespectToRealScreen hack. + + desktop.h: + ---------- + Define AP_SIZE to Scr->AutoPanBorderWidth instead of just 5. + + doors.c + ------- + Supports negative door geometries now (like "120x120-0-0"). + [ bug fix ] + + Also fixes bug that wouldn't allow "+0+0" to be a valid door + position. [ bug fix ] + + events.c + -------- + In HandleEnterNotify(), initial setting of xwarp and ywarp uses + AutopanExtraWarp instead of just 2. + + menus.c + ------- + The RightHandSidePulldownMenus, EnhancedExecResources, and PrettyZoom + hacks are done here. + + parse.c, screen.h + ----------------- + Of course, the new variables were inserted here. + + util.c + ------ + The LessRandomZoomZoom hack was done here. + +DISCLAIMER: I am not the official maintainer or central programmer of vtwm, +but there isn't one anyway; I just made a few fixes, played with the code to +make it a little bit more `configurable' in certain areas, and decided to see +what *you* think of the changes I made. I also don't know much about X +programming, but the changes I made to vtwm haven't caused any major damage +so far. + +-- + letitflowletyourselfgos[ darren s. embry ]lowandlowthatisthetempo + [ dsembr01@starbase ] +beingashamedbecauseyouredif[ .spd.louisville.edu ]ferentisthesickestkindoflie diff --git a/doc/2.2.README b/doc/2.2.README new file mode 100644 index 0000000..b9d7645 --- /dev/null +++ b/doc/2.2.README @@ -0,0 +1,15 @@ +Actually only one change from 5.2.1 to 5.2.2: A bug in my workaround from +5.2.1 regarding supporting negative door geometries has been fixed. I found +this bug by trying to use a +0+0 geometry; it didn't exactly work. + +DISCLAIMER: I am not the official maintainer or central programmer of vtwm, +but there isn't one anyway; I just made a few fixes, played with the code to +make it a little bit more `configurable' in certain areas, and decided to see +what *you* think of the changes I made. I also don't know much about X +programming, but the changes I made to vtwm haven't caused any major damage +so far. + +-- + letitflowletyourselfgos[ darren s. embry ]lowandlowthatisthetempo + [ dsembr01@starbase ] +beingashamedbecauseyouredif[ .spd.louisville.edu ]ferentisthesickestkindoflie diff --git a/doc/2.README b/doc/2.README new file mode 100644 index 0000000..945ff2e --- /dev/null +++ b/doc/2.README @@ -0,0 +1,120 @@ +Version 5.2 of vtwm is a community effort. My name is on it, +but I did less than half the work. There were contributors +from all around the world, every one of whom managed to +figure out how some piece of this program works and do a creditable +job of hacking it. A large number of people have touched this code, +and except for the part of the code that moves windows around, it's +still easily understandable and in terrific shape; this says a lot +about the X style of programming, and the kind of job done by Tom +LaStrange and Dave Edmondson. + +I'm not aware of any program, nor any release of a program, that so +fully embodies the ideal of community software. Perhaps that says a +lot about my ignorance, but ignorance is bliss, so don't enlighten +me. + +The only reason I published 5.1 was because I had a number of +changes that I wanted to see in the "official" vtwm, and had no +better way of getting them in there. + +After I did so, I heard from a number of people who seemed +to be in the same boat; because I needed to fix rescaling the +desktop and to add the UseRealScreenBorder and +OldFashionedTwmWindowsMenu variables ( some folks didn't like the +changes I made and wanted the old-style behavior to be at least +available to them :-( ), + +I agreed to collect patches and come out with a vtwm-5.2! + +Because I was playing with the code in any case, I added f.zoomzoom +and StayUpMenus, and made a big improvement in moving the windows +around in the panner. + + When you click on a window in the panner, it used to jump so + that its top-left corner would be at the pointer position. + Now, when you click inside the little windows, they don't jump; + they also don't jump when you release!, and moving them around + has become much more natural. + + I really like stayup menus, *but* it's kinda confusing to use, + because xterm, xpostit, and the like don't have this feature! + +Perhaps there will be a vtwm-5.3, but I do not plan to be involved, +at least not as the central figure. + +Here is a short list of the changes: + + New variables + StayUpMenus + OldFashionedTwmWindowsMenu + UseRealScreenBorder + + Modified Variables + WindowRing (window list optional) + VirtualDesktop (expanded syntax) + + New functions + f.zoomzoom + f.snaprealscreen + f.virtualgeometries + f.deletedoor + + Modified functions + f.move (can be bound to a keypress) + + Miscellaneous + smoother movement in panner + Allow #rrggbb colors in X11R4 + restored the ability to rescale the desktop + bug fixes + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! !! +!! And here is the known bug: !! +!! !! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +If you invoke resize from a stayup menu or from a titlebar menu, it +moves the window and gets the wrong size. :-( + +This bug was also present in vtwm-5.0.tar.Z, but there was no such +bug in the X11R4 vtvwm.shar.Z + +As I found from putting in StayUpMenus, the movement and resize code +is quite messy; since I didn't create this bug, I will take the +coward's path, and decline to deal with it. (Actually, I wasted a +few hours looking through the code to try to find a clue, and *then* +I gave up.) + +Resizing by dragging the side of the window works quite well, +as does resizing from a non-stayup non-titlebar menu. + +=============================================== + +Supplementary files: + +marcel.vtwmrc is a remarkably-well organized vtwmrc, and it shows +exactly the differences between tvtwm and vtwm. I think it would be +nice if .tvtwmrc and .vtwmrc could be more similar, so perhaps some +of the variables and functions from tvtwm should be added (as +synonyms) to vtwm. + +nexpm is still there; the next release of xpm will presumably +include nexpm, however, and after that there will be no need to +package nexpm along with vtwm. + +============================================== + +Final note: + +Enjoy! + +-- +Ralph Betza (FM), +uunet!ssiny!gnohmon gnohmon@ssiny.com + +"The question of whether a computer can swim is more interesting + than the question of whether a submarine can think" - Lenny Dykstra + + + diff --git a/doc/3.FUTURE b/doc/3.FUTURE new file mode 100644 index 0000000..1061347 --- /dev/null +++ b/doc/3.FUTURE @@ -0,0 +1,9 @@ +NOW IT'S *YOUR* TURN! +===================== + + With this version I'm gonna quit for a while as the semester is just + about to start and I *probably* won't have enough time to fool with vtwm + anymore. If you're willing to work on the next version, just send me + email and I'll forward any mail I get concerning vtwm to you. I had + some real fun working with this thing. --- DSE + diff --git a/doc/3.README b/doc/3.README new file mode 100644 index 0000000..d9676ab --- /dev/null +++ b/doc/3.README @@ -0,0 +1,102 @@ +ANNOUNCEMENT +============ + +vtwm 5.3 is available now via anonymous ftp at: + + ftp.x.org:/contrib/vtwm-5.3.tar.gz + +A SUMMARY OF CHANGES FROM VTWM-5.2.2 TO VTWM-5.3 +================================================ + + The file `CHANGELOG' in the vtwm-5.3 archive contains more detailed info + concerning changes made since version 5.0. + + New Variables: + -------------- + DontInterpolateTitles (from tvtwm) + FixTransientVirtualGeometries (BUG WORKAROUND!!) + MenuTitleFont (from tvtwm) + NailedAbove (aliased to StickyAbove) + NoDefaultMouseAndKeyboardBindings + NoDefaultTitleButtons + NoIconifyIconManagers (from Paul Falstad) + StayUpOptionalMenus (from Paul Falstad) + StickyAbove (like the same feature in tvtwm) + WarpSnug + WarpToTransients (from Paul Falstad) + + New Functions: + -------------- + f.nail (aliased to f.stick) + f.stickyabove (or f.nailedabove) + f.warp (from Paul Falstad) + f.warpclassnext (from Paul Falstad) + f.warpclassprev (from Paul Falstad) + f.warptonewest (from Paul Falstad) + + Other New Features: + ------------------- + The window manager will now execute a special function called + "VTWM Profile" upon the initial startup or restarting of the window + manager. This may prove useful in certain situations. For example, + say you want AutoPan to have a value but you want autopanning + turned off initially: + + AutoPan 25 + . + . + + function "VTWM Profile" { + . + . + + f.autopan # turns it off (you can turn it back on later) + . + . + } + + The feature was created for this very specific purpose in mind, but + the possibilities are endless. + + Other fixes: + ------------ + autopanning (wouldn't work when mouse was over a window on the edge + of the screen sometimes) + nailed windows will *always* go on the real screen, wherever the real + screen is on the virtual desktop. + small fix of an obvious bug in the source regarding nailed windows' + representations on the virtual desktop + patches to Imakefile + + Undocumented functions now documented (please use these at your own risk): + -------------------------------------------------------------------------- + f.cut + f.cutfile + f.file + f.movescreen + f.twmrc [same thing as f.restart anyway] + f.version + +WHAT IS VTWM? +============= + + vtwm (which stands for `Virtual Tab Window Manager') is based upon the + twm window manager, but adds extra functionality in the form of a + VIRTUAL DESKTOP. The virtual desktop is an area larger than the + physical screen, where windows can be placed. On the real screen, a + portion of the virtual desktop the size of the real screen can be seen. + The `virtual desktop window', of course, facilitates navigation around + the desktop and manipulation of windows in the desktop. + +ACKNOWLEDGEMENTS +================ + + * Paul Falstad for f.warp, one of the things I + really wanted to see, among other related things. + * kudos to Chris P. Ross for letting me use some of + his code from tvtwm (MenuTitleFont and DontInterpolateTitles). + * Marty Leisner , small patches to Imakefile. + * Kaur for pointing out f.movescreen to me, and + inspiring me to look for other undocumented stuff and take a stab at + documenting it. + diff --git a/doc/4.4.ANNOUNCE b/doc/4.4.ANNOUNCE new file mode 100644 index 0000000..ab15873 --- /dev/null +++ b/doc/4.4.ANNOUNCE @@ -0,0 +1,30 @@ + +This is the announcement of VTWM 5.4.4, an upgrade of the recently released +VTWM 5.4. The web page, http://www.visi.com/~hawkeyd/vtwm.html, has been +updated, and the archive may be found via a link there, or directly via FTP +at ftp://ftp.visi.com in the /users/hawkeyd/X directory, and ftp://ftp.x.org +in the /contrib/window_managers directory (if and when they move it there +from the /incoming directory). + +The major changes, in a nutshell: + - Squashed two big bugs, involving pan distances and monochrome GCs, that + would crash VTWM. Many other nuisances exterminated, too. + - The border drawing code [finally] renders the top segment of the border + when using 3D squeezed titles, and now correctly renders small windows. + - Enabled a resource to go easy on colormap allocations. + - Added a resource for highlighting icon manager entries, independant of + the border highlighting resource. + - Simplified parameter enterpretation for SqueezeTitle list entries. + - The startup sequence now searches for user and system .vtwmrc files, + then user and system .twmrc files, in this order. + - Color image (XPM) support for icons. + - An up-to-date man page, and support for HTML and Postscript conversions. + - Many additions and fixes to improve portability and operability. + +For those that may not know, VTWM 5.4 is an update of the venerable window +manager that features a fully configurable 3D interface, as well as many +other bells, whistles, and, of course, bug fixes. + +D. J. Hawkey Jr. (hawkeyd@visi.com) +January 27, 1998 + diff --git a/doc/4.4.FUTURE b/doc/4.4.FUTURE new file mode 100644 index 0000000..c9861e8 --- /dev/null +++ b/doc/4.4.FUTURE @@ -0,0 +1,23 @@ + +I have written + "I do not want to be the maintainer of VTWM. I don't even think of myself + as an "X programmer", though I like it, and *I*am*learning*. I will + entertain comments, bug reports, etc., especially to my work, and will + try to respond in kind. I am not planning on further effort, as it now + fills my needs." +and + "It looks like, for the time being anyway, due to incoming mail, I am the + maintainer of VTWM." + +Well, most of the former has been proven false (though I still don't feel +I'm an "X programmer", I am indeed learning), and the latter seems to be +holding true. Whether I want to be the ersatz maintainer doesn't matter, +really, as I'm having a jolly good time doing so! + +I think I can say VTWM definitely has a future. I'll likely continue to +play a part, at least until a few more points in the WISHLIST file are +knocked off. + +D. J. Hawkey Jr. (hawkeyd@visi.com) +January 18, 1998 + diff --git a/doc/4.4.README b/doc/4.4.README new file mode 100644 index 0000000..8e438d7 --- /dev/null +++ b/doc/4.4.README @@ -0,0 +1,9 @@ + +I'm not going to reiterate all the changes from 5.4.3 to 5.4.4 here. + +The 4.4.ANNOUNCE file has an overview, and the CHANGELOG file lists +everything in more detail. Check those out. + +D. J. Hawkey Jr. (hawkeyd@visi.com) +January 18, 1998 + diff --git a/doc/4.5.ANNOUNCE b/doc/4.5.ANNOUNCE new file mode 100644 index 0000000..93f8c6a --- /dev/null +++ b/doc/4.5.ANNOUNCE @@ -0,0 +1,27 @@ + +This is the announcement of VTWM 5.4.5, an upgrade of the three-year +old 5.4 release of the window manager for the X Window System. + +The web page, www.visi.com/~hawkeyd/vtwm.html, has been updated, and +the archive may be found via a link there, or directly via FTP at +ftp.visi.com/users/hawkeyd/X/ and ftp.x.org/contrib/window_managers/ +(if and when they move it there from incoming/). + +Some of the major changes, in a nutshell: + - All the 3D features are now fully configurable. + - Complete color (XPM) image support. + - Improved and consistant warp functionality. + - Many new variables and functions. + - Better keyboarding support. + - Many more bug fixes. + - Better portability. + +And a newly-discovered capability: + - A subset of regex wildcarding for list resources. + +Visit the above web page for screen captures, installation notes, and +complete histories of VTWM since version 5.1. + +D. J. Hawkey Jr. (hawkeyd@visi.com) +September 19, 1998 + diff --git a/doc/4.5.README b/doc/4.5.README new file mode 100644 index 0000000..8e522c3 --- /dev/null +++ b/doc/4.5.README @@ -0,0 +1,9 @@ + +When VTWM 5.4.5 was released on or about Sep 19 1998, this file contained a +list of new or changed features for that version. + +I've since created and maintain a HISTORY file that lists the features added +or changed for all releases of VTWM 5.4. + +--- djhjr + diff --git a/doc/4.6.ANNOUNCE b/doc/4.6.ANNOUNCE new file mode 100644 index 0000000..71ee12c --- /dev/null +++ b/doc/4.6.ANNOUNCE @@ -0,0 +1,40 @@ + +This is the announcement of VTWM 5.4.6, an upgrade of the five-year +old 5.4 release of the window manager for the X Window System. + +Highlighting the major changes from release 5.4.5a: + - m4 preprocessing of the resource file. VTWM can now share a + common .twmrc with TWM and other TWM derivatives, and support + by-user, by-group, and by-feature configurations. + - Regular expressions ("RE"s) support for resource file window + lists. Much more sophisticated than VTWM's own wildcarding. + - Sound effects, by way of the rplay library and daemon. What's + wrong with a little chrome? + - Applet regions, for all those little tools we have up all the + time. + - Scrolling menus, for those with more entries than the display + can handle. + - 3D doors and the virtual desktop. All 3D features are rendered + on opaque resizes (well, except for one case). + - Windows can be resized or moved from the virtual desktop, icon + managers, and menus not of the root or window in question. + - Better (dare I say it, "complete"?) support for multi-headed + systems. +And, of course, many more bug fixes, tweaks, additions, and changes. + +VTWM continues to be 100% backward-compatable with TWM. It can still +build and run under X11R4, and lose no self-supported functionality. +Release 5.4.6 supports the many features expected of "modern" window +managers, is highly configurable, yet it keeps a small footprint and +quick response. VTWM is quite portable; it has been built on over a +dozen different OSes, across nine platforms. + +The web page, www.visi.com/~hawkeyd/vtwm.html, has been updated, and +the archive may be found via a link there, or directly via FTP at +ftp.visi.com/users/hawkeyd/X/ and ftp.x.org/contrib/window_managers/ +(if and when they move it there from contrib/INCOMING/). Visit the +above web page for installation notes, complete histories, and more. + +David J. Hawkey Jr. (hawkeyd@visi.com) +November 3, 2001 + diff --git a/doc/4.6.README b/doc/4.6.README new file mode 100644 index 0000000..dfc6ff7 --- /dev/null +++ b/doc/4.6.README @@ -0,0 +1,5 @@ + +See the HISTORY and CHANGELOG files for version and chronological changes. + +--- djhjr + diff --git a/doc/4.7.README b/doc/4.7.README new file mode 100644 index 0000000..9ffb7cf --- /dev/null +++ b/doc/4.7.README @@ -0,0 +1,25 @@ +This is release 5.4.7 of VTWM the Virtual Tab Window Manager for the X +Window System. See the CHANGELOG and HISTORY files in the doc subdirectory +for further information on changes since the last release. + +This release is dedicated to the memory of David J Hawkey Jr, the previous +maintainer of vtwm, who sadly passed away as this release was being +prepared. The VTWM community acknowledges the countless hours he dedicated +to this project and are proud to carry on this project as his legacy. + +This will also be the first release to be publically available in a +source code repository. + +Callum Gibson 29th May, 2005 +callumgibson@optusnet.com.au + + +---------------------------------------------------------------------- +David John Hawkey Jr. + +Hawkey, David John Jr., age 47, of Mpls., on 10/17/04. Survived by son, +John David; mother, Alicia; father, David Sr.; sister, Lisa; brother, +Chris; and Gayle Hawkey. A farewell party will be planned at a later +date. Cremation Society of MN 612-825-2435 + +Published in the Star Tribune on 10/24/2004. diff --git a/doc/4.ANNOUNCE b/doc/4.ANNOUNCE new file mode 100644 index 0000000..ae21489 --- /dev/null +++ b/doc/4.ANNOUNCE @@ -0,0 +1,44 @@ + + +This is the announcement of VTWM Version 5.4, the first upgrade (by all +accounts contained herein) in over two years. I'm un-officially bumping the +minor number because VTWM-5.3 is the latest I've seen in distribution, and +this is a significant change, both in end-user impression and in code. + +This all started because I wanted an esthetically pleasing alternative to +the Motif window manager, a good workout, and leaner system requirements. +Enhanced and extended functionality is way cool. + +It has taken me about one hobby-month to apply a 3D appearance to VTWM-5.3. +I did it by borrowing (stealing?) code from CTWM-3.1 and plugging it in. +I also added 3D borders to the size, position(!), and info windows. Then I +wanted variable info window fonts. Then resize/position window locations. +And a bunch of other tweaks. + +I have read that VTWM-5.2b has some or all of these enhancements, but I +could not find a package to evaluate (I tried with Xarchie using around 15 +different hosts). CTWM-3.1 is pretty, lean, and fast, but I don't like it's +virtual desktop implementation. I found, made, and tried a version of FVWM, +but it didn't port right (or was way buggy), and I didn't/don't think I +could have overcome that/those bug/s before becoming thoroughly frustrated. + +This is not bug-free code. I "inherited" two documented flaws, and others +may exist. By fixing one, I seem to have introduced another, but it is +easily worked around. + +I do not want to be the maintainer of VTWM. I don't even think of myself as +an "X programmer", though I like it, and *I*am*learning*. I will entertain +comments, bug reports, etc., especially to my work, and will try to respond +in kind. I am not planning on further effort, as it now fills my needs. + +D. J. Hawkey Jr. (hawkeyd@visi.com) +May 15, 1996 + + + +It looks like, for the time being anyway, due to incoming mail, I am the +maintainer of VTWM. + +D. J. Hawkey Jr. (hawkeyd@visi.com) +November 17, 1997 + diff --git a/doc/4.FUTURE b/doc/4.FUTURE new file mode 100644 index 0000000..0acda92 --- /dev/null +++ b/doc/4.FUTURE @@ -0,0 +1,18 @@ + + +I do not want to be the maintainer of VTWM. I don't even think of myself as +an "X programmer", though I like it, and *I*am*learning*. I will entertain +comments, bug reports, etc., especially to my work, and will try to respond +in kind. I am not planning on further effort, as it now fills my needs. + +D. J. Hawkey Jr. (hawkeyd@visi.com) +May 15, 1996 + + + +It looks like, for the time being anyway, due to incoming mail, I am the +maintainer of VTWM. + +D. J. Hawkey Jr. (hawkeyd@visi.com) +November 17, 1997 + diff --git a/doc/4.README b/doc/4.README new file mode 100644 index 0000000..de2e07d --- /dev/null +++ b/doc/4.README @@ -0,0 +1,321 @@ + +---------------------------------------------------------------------------- + +`grep -n 3D *.[ch] > 3Ddiffs.lst` of CTWM-3.1. +This is where VTWM-5.4 began. The exclamation marks denote what I ported. +This is not inclusive or exhaustive. RTSL for the signature 'djhjr'. + +! add_window.c:276: tmp_win->frame_bw3D = Scr->ThreeDBorderWidth; +! add_window.c:279: tmp_win->frame_bw3D = 0; +! add_window.c:282: if (tmp_win->frame_bw3D != 0) { +! add_window.c:446: AddingW = tmp_win->attr.width + bw2 + 2 * tmp_win->frame_bw3D; +! add_window.c:448: bw2 + 2 * tmp_win->frame_bw3D; +! add_window.c:451: tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); +! add_window.c:521: tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); +! add_window.c:634: tmp_win->attr.width = AddingW - bw2 - 2 * tmp_win->frame_bw3D; +! add_window.c:636: bw2 - 2 * tmp_win->frame_bw3D; +! add_window.c:655: int delta = tmp_win->attr.border_width - tmp_win->frame_bw - tmp_win->frame_bw3D; +! add_window.c:725: if (Scr->use3Dtitles && !Scr->BeNiceToColormap) GetShadeColors (&tmp_win->title); +! add_window.c:726: if (Scr->use3Dborders && !Scr->BeNiceToColormap) { +! add_window.c:733: - tmp_win->frame_bw3D; +! add_window.c:735: tmp_win->old_bw - tmp_win->frame_bw - tmp_win->frame_bw3D; +! add_window.c:736: tmp_win->frame_width = tmp_win->attr.width + 2 * tmp_win->frame_bw3D; +! add_window.c:738: 2 * tmp_win->frame_bw3D; +! add_window.c:776: tmp_win->frame_bw3D - tmp_win->frame_bw, +! add_window.c:777: tmp_win->frame_bw3D - tmp_win->frame_bw, +! add_window.c:793: if (Scr->use3Dtitles && (Scr->Monochrome != COLOR)) +! add_window.c:818: tmp_win->title_x = tmp_win->frame_bw3D - tmp_win->frame_bw; +! add_window.c:819: tmp_win->title_y = tmp_win->frame_bw3D - tmp_win->frame_bw; +! add_window.c:851: XReparentWindow(dpy, tmp_win->w, tmp_win->frame, tmp_win->frame_bw3D, +! add_window.c:852: tmp_win->title_height + tmp_win->frame_bw3D); +! add_window.c:1103: if (Scr->use3Dtitles && (Scr->Monochrome != COLOR)) +! add_window.c:1138: if (Scr->use3Dtitles) +! add_window.c:1177: if (Scr->use3Dtitles) tmp_win->highlightx += 6; +! add_window.c:1201: tmp->title_x = tmp->frame_bw3D - tmp->frame_bw; +! add_window.c:1202: tmp->title_y = tmp->frame_bw3D - tmp->frame_bw; +! add_window.c:1244: tmp->title_x = basex - tmp->frame_bw + tmp->frame_bw3D; +! add_window.c:1589: tmp->title_height + 2 * tmp->frame_bw3D) ? 0 : 2) | +! add_window.c:1591: tmp->title_height + 2 * tmp->frame_bw3D) ? 0 : 1)]; + +! ctwm.c:423: Scr->TBInfo.border = -100; /* trick to have different default value if ThreeDTitles +! ctwm.c:499: if (Scr->use3Dtitles) { +! ctwm.c:512: if (Scr->use3Dtitles && !Scr->BeNiceToColormap) GetShadeColors (&Scr->TitleC); +! ctwm.c:513: if (Scr->use3Dmenus && !Scr->BeNiceToColormap) GetShadeColors (&Scr->MenuC); +! ctwm.c:514: if (Scr->use3Dmenus && !Scr->BeNiceToColormap) GetShadeColors (&Scr->MenuTitleC); +! ctwm.c:515: if (Scr->use3Dborders && !Scr->BeNiceToColormap) GetShadeColors (&Scr->BorderColorC); +! ctwm.c:516: if (! Scr->use3Dborders) Scr->ThreeDBorderWidth = 0; +! ctwm.c:526: if (Scr->use3Dtitles) Scr->TitleHeight += 4; +! ctwm.c:732: Scr->FramePadding = -100; /* trick to have different default value if ThreeDTitles +! ctwm.c:737: Scr->ThreeDBorderWidth = 6; +! ctwm.c:797: Scr->use3Diconmanagers = FALSE; +! ctwm.c:798: Scr->use3Dmenus = FALSE; +! ctwm.c:799: Scr->use3Dtitles = FALSE; +! ctwm.c:800: Scr->use3Dborders = FALSE; +! ctwm.c:854: xwc.x += gravx * tmp->frame_bw3D; +! ctwm.c:855: xwc.y += gravy * tmp->frame_bw3D; + +! events.c:1367: if (Scr->use3Dborders && (Event.xany.window == Tmp_win->frame)) { +! events.c:1415: if (Scr->use3Diconmanagers && (Scr->Monochrome != COLOR)) +! events.c:1428: if (Scr->use3Diconmanagers && Tmp_win->list->iconifypm) { +! events.c:2172: Event.xbutton.x = JunkX - Tmp_win->frame_bw3D; +! events.c:2173: Event.xbutton.y = JunkY - Tmp_win->title_height - Tmp_win->frame_bw3D; +! events.c:2202: Event.xbutton.x -= Tmp_win->frame_bw3D; +! events.c:2203: Event.xbutton.y -= (Tmp_win->title_height + Tmp_win->frame_bw3D); +! events.c:2533: if (Scr->use3Dtitles && Scr->SunkFocusWindowTitle && +! events.c:2535: Draw3DBorder (Tmp_win->title_w, Scr->TBInfo.titlex, 0, +! events.c:2557: if (Scr->use3Dtitles && Scr->SunkFocusWindowTitle && +! events.c:2559: Draw3DBorder (Tmp_win->title_w, Scr->TBInfo.titlex, 0, +! events.c:2748: if (Scr->use3Dtitles && Scr->SunkFocusWindowTitle && +! events.c:2750: Draw3DBorder (Tmp_win->title_w, Scr->TBInfo.titlex, 0, +! events.c:2882: x -= ((gravx < 0) ? 0 : Tmp_win->frame_bw3D); +! events.c:2886: y -= ((gravy < 0) ? 0 : Tmp_win->frame_bw3D); +! events.c:2890: width = cre->width + 2 * Tmp_win->frame_bw3D; +! events.c:2893: height = cre->height + Tmp_win->title_height + 2 * Tmp_win->frame_bw3D; + +! iconmgr.c:101: (2 * (Scr->ThreeDBorderWidth ? Scr->ThreeDBorderWidth : Scr->BorderWidth)); +! iconmgr.c:105: (2 * (Scr->ThreeDBorderWidth ? Scr->ThreeDBorderWidth : Scr->BorderWidth)); +! iconmgr.c:475: if (Scr->use3Diconmanagers) { +! iconmgr.c:477: tmp->iconifypm = Create3DIconManagerIcon (tmp->cp); +! iconmgr.c:712: if (Scr->use3Diconmanagers) { +! iconmgr.c:717: Draw3DBorder (tmp->w, 0, 0, tmp->width, tmp->height, shadow_width, +! iconmgr.c:720: Draw3DBorder (tmp->w, 0, 0, tmp->width, tmp->height, shadow_width, +! iconmgr.c:857: bw = ip->twm_win->frame_bw3D ? ip->twm_win->frame_bw3D : ip->twm_win->frame_bw; +! iconmgr.c:869: newwidth + 2 * ip->twm_win->frame_bw3D, +! iconmgr.c:870: ip->height + ip->twm_win->title_height + 2 * ip->twm_win->frame_bw3D, -1); + +! icons.c:405: if (Scr->use3Diconmanagers && !Scr->BeNiceToColormap) GetShadeColors (&icon->iconc); + +! menus.c:344: if (Scr->use3Dtitles) +! menus.c:358: if (Scr->use3Dtitles) { +! menus.c:359: if (!CreateTitleButton (TBPM_3DDOT, F_ICONIFY, "", (MenuRoot *) NULL, +! menus.c:363: if (!CreateTitleButton (TBPM_3DRESIZE, F_RESIZE, "", (MenuRoot *) NULL, +! menus.c:422: if (Scr->use3Dmenus) { +! menus.c:423: Paint3DEntry (mr, mi, exposure); +! menus.c:428:void Paint3DEntry(mr, mi, exposure) +! menus.c:444: Draw3DBorder (mr->w, 2, y_offset, mr->width - 4, Scr->EntryHeight, 1, +! menus.c:476: Scr->pullPm = Create3DMenuIcon (Scr->MenuFont.height, &Scr->pullW, +! menus.c:486: Draw3DBorder (mr->w, 2, y_offset, mr->width - 4, Scr->EntryHeight, 1, +! menus.c:594: if (Scr->use3Dmenus) { +! menus.c:595: Draw3DBorder (mr->w, 0, 0, mr->width, mr->height, 2, Scr->MenuC, off, False, False); +! menus.c:890: if (Scr->use3Dmenus && !Scr->BeNiceToColormap) GetShadeColors (&tmp->normal); +! menus.c:956: if (Scr->use3Dmenus) mr->height += 4; +! menus.c:1004: borderwidth = Scr->use3Dmenus ? 0 : 1; +! menus.c:1018: if (Scr->use3Dmenus && (Scr->Monochrome == COLOR) && (mr->highlight.back == UNUSED_PIXEL)) { +! menus.c:1033: if (Scr->use3Dmenus && (Scr->Monochrome == COLOR) && (mr->highlight.fore == UNUSED_PIXEL)) { +! menus.c:1047: if (Scr->use3Dmenus && !Scr->BeNiceToColormap) GetShadeColors (&mr->highlight); +! menus.c:1072: if (Scr->use3Dmenus && !Scr->BeNiceToColormap) { +! menus.c:1447: AddingW = tmp_win->attr.width + bw2 + 2 * tmp_win->frame_bw3D; +! menus.c:1448: AddingH = tmp_win->attr.height + tmp_win->title_height + bw2 + 2 * tmp_win->frame_bw3D; +! menus.c:1476: tmp_win->title_height + tmp_win->frame_bw3D); +! menus.c:2006: moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D); +! menus.c:2182: moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D); +! menus.c:2224: moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D); +! menus.c:3368: if (Scr->use3Dborders) PaintBorders (tmp, onoroff); + +! parse.c:467:#define kw0_Use3DMenus 33 +! parse.c:468:#define kw0_Use3DTitles 34 +! parse.c:469:#define kw0_Use3DIconManagers 35 +! parse.c:470:#define kw0_Use3DBorders 36 +! parse.c:512:#define kwn_ThreeDBorderWidth 21 +! parse.c:772: { "threedborderwidth", NKEYWORD, kwn_ThreeDBorderWidth }, +! parse.c:784: { "usethreedborders", KEYWORD, kw0_Use3DBorders }, +! parse.c:785: { "usethreediconmanagers", KEYWORD, kw0_Use3DIconManagers }, +! parse.c:786: { "usethreedmenus", KEYWORD, kw0_Use3DMenus }, +! parse.c:787: { "usethreedtitles", KEYWORD, kw0_Use3DTitles }, +! parse.c:948: case kw0_Use3DBorders: +! parse.c:949: Scr->use3Dborders = TRUE; +! parse.c:952: case kw0_Use3DIconManagers: +! parse.c:953: Scr->use3Diconmanagers = TRUE; +! parse.c:956: case kw0_Use3DMenus: +! parse.c:957: Scr->use3Dmenus = TRUE; +! parse.c:960: case kw0_Use3DTitles: +! parse.c:961: Scr->use3Dtitles = TRUE; +! parse.c:1131: case kwn_ThreeDBorderWidth: +! parse.c:1132: if (Scr->FirstTime) Scr->ThreeDBorderWidth = num; + +! resize.c:179: tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); +! resize.c:214: tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); +! resize.c:361: tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); +! resize.c:488: tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); +! resize.c:523: dheight = height - tmp_win->title_height - 2 * tmp_win->frame_bw3D; +! resize.c:524: dwidth = width - 2 * tmp_win->frame_bw3D; +! resize.c:592: tmp_win->iconmgrp->width = (int) (((dragWidth - 2 * tmp_win->frame_bw3D) * +! resize.c:669: dwidth -= 2 * tmp_win->frame_bw3D; +! resize.c:670: dheight -= (tmp_win->title_height + 2 * tmp_win->frame_bw3D); +! resize.c:777: *widthp = dwidth + 2 * tmp_win->frame_bw3D; +! resize.c:778: *heightp = dheight + tmp_win->title_height + 2 * tmp_win->frame_bw3D; +! resize.c:840: tmp_win->iconmgrp->width = w - (2 * tmp_win->frame_bw3D); +! resize.c:841: h = tmp_win->iconmgrp->height + tmp_win->title_height + (2 * tmp_win->frame_bw3D); +! resize.c:855: title_width = xwc.width = w - (2 * tmp_win->frame_bw3D); +! resize.c:885: tmp_win->title_x = xwc.x = tmp_win->frame_bw3D - bw; +! resize.c:886: tmp_win->title_y = xwc.y = tmp_win->frame_bw3D - bw; +! resize.c:893: tmp_win->attr.width = w - (2 * tmp_win->frame_bw3D); +! resize.c:894: tmp_win->attr.height = h - tmp_win->title_height - (2 * tmp_win->frame_bw3D); +! resize.c:911: XMoveResizeWindow (dpy, tmp_win->w, tmp_win->frame_bw3D, +! resize.c:912: tmp_win->title_height + tmp_win->frame_bw3D, +! resize.c:922: if (Scr->use3Dtitles) xwc.width -= 4; +! resize.c:937: WMapSetupWindow (tmp_win, x + tmp_win->frame_bw3D, +! resize.c:938: y + tmp_win->title_height + tmp_win->frame_bw3D, +! resize.c:948: + tmp_win->frame_bw3D); +! resize.c:951: + tmp_win->frame_bw3D); +! resize.c:1100: tmp->frame_bw3D, tmp->title_height + tmp->frame_bw3D, tmp->w, +! resize.c:1126: newBounding[0].x = tmp->title_x - tmp->frame_bw3D; +! resize.c:1127: newBounding[0].y = tmp->title_y - tmp->frame_bw3D; +! resize.c:1128: newBounding[0].width = tmp->title_width + fbw2 + 2 * tmp->frame_bw3D; +! resize.c:1129: newBounding[0].height = tmp->title_height + tmp->frame_bw3D; +! resize.c:1131: newBounding[1].y = Scr->TitleHeight + tmp->frame_bw3D; +! resize.c:1132: newBounding[1].width = tmp->attr.width + fbw2 + 2 * tmp->frame_bw3D; +! resize.c:1133: newBounding[1].height = tmp->attr.height + fbw2 + tmp->frame_bw3D; +! resize.c:1137: newClip[0].x = tmp->title_x + tmp->frame_bw - tmp->frame_bw3D; +! resize.c:1139: newClip[0].width = tmp->title_width + 2 * tmp->frame_bw3D; +! resize.c:1140: newClip[0].height = Scr->TitleHeight + tmp->frame_bw3D; +! resize.c:1142: newClip[1].y = tmp->title_height + tmp->frame_bw3D; +! resize.c:1143: newClip[1].width = tmp->attr.width + 2 * tmp->frame_bw3D; +! resize.c:1144: newClip[1].height = tmp->attr.height + tmp->frame_bw3D; + +! util.c:91:static Image *Create3DMenuImage (); +! util.c:92:static Image *Create3DDotImage (); +! util.c:93:static Image *Create3DResizeImage (); +! util.c:94:static Image *Create3DZoomImage (); +! util.c:95:static Image *Create3DBarImage (); + util.c:96:static Image *Create3DResizeAnimation (); +! util.c:1341:static Image *Create3DDotImage (cp) +! util.c:1355: Draw3DBorder (image->pixmap, 0, 0, h, h, 2, cp, off, True, False); +! util.c:1356: Draw3DBorder (image->pixmap, (h / 2) - 2, (h / 2) - 2, 5, 5, 2, cp, off, True, False); +! util.c:1364:static Image *Create3DBarImage (cp) +! util.c:1378: Draw3DBorder (image->pixmap, 0, 0, h, h, 2, cp, off, True, False); +! util.c:1379: Draw3DBorder (image->pixmap, 4, (h / 2) - 2, h - 8, 5, 2, cp, off, True, False); +! util.c:1387:static Image *Create3DMenuImage (cp) +! util.c:1401: Draw3DBorder (image->pixmap, 0, 0, h, h, 2, cp, off, True, False); +! util.c:1403: Draw3DBorder (image->pixmap, 4, i, h - 8, 4, 2, cp, off, True, False); +! util.c:1412:static Image *Create3DResizeImage (cp) +! util.c:1426: Draw3DBorder (image->pixmap, 0, 0, h, h, 2, cp, off, True, False); +! util.c:1427: Draw3DBorder (image->pixmap, 0, h / 4, ((3 * h) / 4) + 1, ((3 * h) / 4) + 1, 2, +! util.c:1429: Draw3DBorder (image->pixmap, 0, h / 2, (h / 2) + 1, (h / 2) + 1, 2, cp, off, True, False); +! util.c:1437:static Image *Create3DZoomImage (cp) +! util.c:1451: Draw3DBorder (image->pixmap, 0, 0, h, h, 2, cp, off, True, False); +! util.c:1452: Draw3DBorder (image->pixmap, h / 4, h / 4, (h / 2) + 2, (h / 2) + 2, 2, cp, off, True, False); +! util.c:1466:Pixmap Create3DMenuIcon (height, widthp, heightp, cp) +! util.c:1493: Draw3DBorder (col->pix, 0, 0, w, h, 1, cp, off, True, False); +! util.c:1495: Draw3DBorder (col->pix, 4, i, w - 8, 3, 1, Scr->MenuC, off, True, False); +! util.c:1502:Pixmap Create3DIconManagerIcon (cp) +! util.c:1519: Draw3DBorder (col->pix, 0, 0, w, h, 4, cp, off, True, False); + util.c:1526:static Image *Create3DResizeAnimation (cp) + util.c:1539: Draw3DBorder (im->pixmap, 0, 0, h, h, 2, cp, off, True, False); + util.c:1540: Draw3DBorder (im->pixmap, i, i, h - (2 * i), h - (2 * i), 2, cp, off, True, False); +! util.c:1663:void Draw3DBorder (w, x, y, width, height, bw, cp, state, fill, forcebw) +! util.c:1775:void Draw3DCorner (w, x, y, width, height, thick, bw, cp, type) +! util.c:1781: Draw3DBorder (w, x, y, width, height, bw, cp, off, True, False); +! util.c:1784: Draw3DBorder (w, x + thick - bw, y + thick - bw, +! util.c:1789: Draw3DBorder (w, x - bw, y + thick - bw, +! util.c:1794: Draw3DBorder (w, x - bw, y - bw, +! util.c:1799: Draw3DBorder (w, x + thick - bw, y - bw, + util.c:1813: if (tmp_win->frame_bw3D) +! util.c:1839: Draw3DBorder (tmp_win->frame, +! util.c:1845: Draw3DBorder (tmp_win->frame, +! util.c:1846: tmp_win->frame_bw3D - 2, +! util.c:1847: tmp_win->frame_bw3D - 2, +! util.c:1848: tmp_win->frame_width - 2 * tmp_win->frame_bw3D + 4, +! util.c:1849: tmp_win->frame_height - 2 * tmp_win->frame_bw3D + 4, +! util.c:1853: Draw3DBorder (tmp_win->frame, +! util.c:1857: tmp_win->frame_bw3D, +! util.c:1859: Draw3DBorder (tmp_win->frame, +! util.c:1860: tmp_win->frame_bw3D + Scr->TitleHeight, +! util.c:1861: tmp_win->frame_height - tmp_win->frame_bw3D, +! util.c:1862: tmp_win->frame_width - 2 * (Scr->TitleHeight + tmp_win->frame_bw3D), +! util.c:1863: tmp_win->frame_bw3D, +! util.c:1865: Draw3DBorder (tmp_win->frame, +! util.c:1867: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1868: tmp_win->frame_bw3D, +! util.c:1869: tmp_win->frame_height - 2 * (Scr->TitleHeight + tmp_win->frame_bw3D), +! util.c:1871: Draw3DBorder (tmp_win->frame, +! util.c:1872: tmp_win->frame_width - tmp_win->frame_bw3D, +! util.c:1873: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1874: tmp_win->frame_bw3D, +! util.c:1875: tmp_win->frame_height - 2 * (Scr->TitleHeight + tmp_win->frame_bw3D), +! util.c:1877: Draw3DCorner (tmp_win->frame, +! util.c:1878: tmp_win->title_x - tmp_win->frame_bw3D, +! util.c:1880: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1881: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1882: tmp_win->frame_bw3D, 2, cp, 0); +! util.c:1883: Draw3DCorner (tmp_win->frame, +! util.c:1886: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1887: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1888: tmp_win->frame_bw3D, 2, cp, 1); +! util.c:1889: Draw3DCorner (tmp_win->frame, +! util.c:1890: tmp_win->frame_width - (Scr->TitleHeight + tmp_win->frame_bw3D), +! util.c:1891: tmp_win->frame_height - (Scr->TitleHeight + tmp_win->frame_bw3D), +! util.c:1892: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1893: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1894: tmp_win->frame_bw3D, 2, cp, 2); +! util.c:1895: Draw3DCorner (tmp_win->frame, +! util.c:1897: tmp_win->frame_height - (Scr->TitleHeight + tmp_win->frame_bw3D), +! util.c:1898: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1899: Scr->TitleHeight + tmp_win->frame_bw3D, +! util.c:1900: tmp_win->frame_bw3D, 2, cp, 3); +! util.c:1906: if (Scr->use3Dtitles) +! util.c:1909: Draw3DBorder (tmp_win->title_w, Scr->TBInfo.titlex, 0, +! util.c:1914: Draw3DBorder (tmp_win->title_w, Scr->TBInfo.titlex, 0, +! util.c:1922: if (Scr->use3Dtitles) { +! util.c:1942: if (Scr->use3Diconmanagers) { +! util.c:1943: Draw3DBorder (tmp_win->icon->w, 0, tmp_win->icon->height, +! util.c:2095: { TBPM_3DDOT, Create3DDotImage }, +! util.c:2096: { TBPM_3DRESIZE, Create3DResizeImage }, +! util.c:2097: { TBPM_3DMENU, Create3DMenuImage }, +! util.c:2098: { TBPM_3DZOOM, Create3DZoomImage }, +! util.c:2099: { TBPM_3DBAR, Create3DBarImage }, + util.c:2123: { "%xpm:resize", Create3DResizeAnimation } + util.c:2128: if ((image = Create3DResizeAnimation (cp)) != None) { + + workmgr.c:1137: Draw3DBorder (Scr->workSpaceMgr.workspaceWindow.w, 0, 0, width, height, 2, + workmgr.c:1294: Draw3DBorder (Scr->workSpaceMgr.occupyWindow.w, 0, 0, width, height, 2, + workmgr.c:1347: Draw3DBorder (w, 0, 0, bwidth, bheight, Scr->WMgrButtonShadowDepth, + workmgr.c:1353: Draw3DBorder (w, 0, 0, bwidth, bheight, Scr->WMgrButtonShadowDepth, + +! screen.h:167: short use3Dmenus; +! screen.h:168: short use3Dtitles; +! screen.h:169: short use3Diconmanagers; +! screen.h:170: short use3Dborders; +! screen.h:236: int ThreeDBorderWidth; /* 3D border width of twm windows */ + +! twm.h:250: int frame_bw3D; /* 3D borderwidth of frame */ +! twm.h:323:#define TBPM_3DDOT ":xpm:dot" /* name of titlebar pixmap for dot */ +! twm.h:324:#define TBPM_3DRESIZE ":xpm:resize" /* name of titlebar pixmap for resize button */ +! twm.h:325:#define TBPM_3DMENU ":xpm:menu" /* name of titlebar pixmap for menus */ +! twm.h:326:#define TBPM_3DZOOM ":xpm:zoom" +! twm.h:327:#define TBPM_3DBAR ":xpm:bar" +! twm.h:381:extern Pixmap Create3DMenuIcon(); + +! util.h:65:void Draw3DBorder (); +! util.h:66:void Draw3DCorner (); + +! protos:137:extern void Paint3DEntry(struct MenuRoot *,struct MenuItem *,int ); +! ...in menus.c +! protos:232:extern unsigned long Create3DMenuIcon(unsigned int ,unsigned int *,unsigned int *,struct ColorPair ); +! ...in twm.h +! protos:234:extern unsigned long Create3DIconManagerIcon(struct ColorPair ); +! ...in twm.h +! protos:237:extern void Draw3DBorder(unsigned long ,int ,int ,int ,int ,int ,struct ColorPair ,int ,int ,int ); +! ...in twm.h +! protos:239:extern void Draw3DCorner(unsigned long ,int ,int ,int ,int ,int ,int ,struct ColorPair ,int ); +! ...in util.c + +---------------------------------------------------------------------------- + +`grep -in separator *.[chy] > separator.lst` of CTWM-3.1. +This is what it took for menu separators. The exclamation marks denote +what I ported. RTSL for the signature 'djhjr'. + +! gram.y:741: if ($2 == F_SEPARATOR) { +! gram.y:751: if ($7 == F_SEPARATOR) { +! parse.c:633: { "f.separator", FKEYWORD, F_SEPARATOR }, +! parse.h:105:#define F_SEPARATOR 58 + +---------------------------------------------------------------------------- + +See the files 4.ANNOUNCE, BUGS and CHANGELOG for a summary of these and +other changes - djhjr - + +---------------------------------------------------------------------------- + + diff --git a/doc/BUGS b/doc/BUGS new file mode 100644 index 0000000..e9bd262 --- /dev/null +++ b/doc/BUGS @@ -0,0 +1,80 @@ + +A LISTING OF BUGS +================= + +This is the bug list as distributed with VTWM 5.3. + + * Behavior of transients on the virtual desktop, when the real screen is + not at (0,0), is almost unpredictable. Hence the + FixTransientVirtualGeometries variable, new to 5.3, which is not + guaranteed to work in every case. --- DSE + + * When the Zoom count is a largish number and PrettyZoom is set, some + artifacts may be left on formerly obscured windows. Decrease the count + value. --- djhjr + + * Not a bug, but the IconRegion variable should take a list. --- DSE + + * Not a bug, but the resource manager should have been used instead of + all of the window lists. --- DSE + +Bugs created as a result of my hacking VTWM 5.4. --- djhjr + + * Icon borders will not do 3D, and I don't want to to mess with it. + The icons themselves are 3D when IconBevelWidth is non-zero, however, + and the IconBorderWidth variable is automatically set to 0. + + * The code to vertically center a door name in the window is correct. + It just won't appear so, due to the window and font heights. Play with + the door geometry. + + * Behavior of managed windows when used as transients on the virtual + desktop, when the real screen is not at (0,0), is sometimes flawed. + Hence the FixManagedVirtualGeometries variable, new to 5.4.4, which + is also guaranteed to not work in every case. + + * Only titlebar buttons, and therefore the titlebar itself, can adjust + to the height of external images. + + * All images should either tile or center as required. + + * VTWM recognizes two-color pixmaps, but incorrectly uses them as + bitmaps. + + * When 3D bevel widths reach double digits, things start going weird, + and I don't know why. Hence an imposed limit of nine pixels. + + * The region resources don't like 0 or 1 for a horizontal grid space. + A kludge is in that fixes it (I think). + + * The f.warpto function doesn't recognize a regular expression. + + * It is possible to place a window sufficiently off-screen as to defeat + warp functions (ex: The visible part wholly within AutoPanBorderWidth + pixels of screen edge). + + * When warping the screen to a window during a move or resize operation, + any number of exposed clients may not get drawn. + + * Menus can become unresponsive. I don't know what triggers this, though + submenu selections seem to be involved. + + * At least one application seems to foul up the window ring. At present, + restarting VTWM is the only cure. + +Bugs encountered and not fixed while hacking VTWM 5.4. --- djhjr + + * Opaque resizing of windows with squeezed titlebars can kill the X + server. A hack prevents this by raising the window before the resize. + + * If there is an order of precedence regarding contexts, it's broken. + + * There are precious few safeguards against binding functions to objects + inappropriately, particularly where the virtual desktop is concerned. + + * Redefining a bound function doesn't behave as one would expect; really + strange things occur. + + * Not a bug, but the sample resource file .vtwmrc-marcel is quite out + of date regarding various VTWM features. + diff --git a/doc/CHANGELOG b/doc/CHANGELOG new file mode 100644 index 0000000..79b83c2 --- /dev/null +++ b/doc/CHANGELOG @@ -0,0 +1,1375 @@ + +============================================================ +A COMPLETE LISTING OF CHANGES MADE TO VTWM SINCE VERSION 5.0 +IN CHRONOLOGICAL ORDER FROM MOST RECENT CHANGES TO EARLIEST. +============================================================ + +============ vtwm-5.4.N.tar.gz ============= +hawkeyd@visi.com (D. J. Hawkey Jr. aka djhjr) + + May 2005 + VTWM 5.4.7 release + [add_window.c] [iconmgr.c] [parse.c] [screen.h] [twm.c] + Added PointerPlacement + [menus.c] + Fix no-sound support + + October 1, 2004 + VTWM 5.4.6b (bugfix release) released for public consumption. + vtwm-5.4.6a-to-5.4.6b.udiff patch file released. + + March 9, 2004 + [events.c] [menus.c] + Added checks for the number of rodent buttons and VTWM + Windows entries. Fixed a bug causing sporadic restarts + when realizing unmanaged windows. + + From Jennifer Elaan , Seth Robertson + , and Callum Gibson : + Patches for the above. + + November 2 - 11, 2003 + [applets.c] [desktop.c] [events.c] [menus.c] [parse.c] [resize.c] + [twm.c] [screen.h] + Fixed a vertical placement error in applet regions. The + f.movescreen function supports sound and honors cancels now + (moved functionality from event handlers to the function + itself). Fixed "raise window regardless of MoveDelta" bugs + introduced on May 23 - 27. Optionally preserve the previous + move and resize raise behaviour. Some shaping optimizations. + Depreciated the motion event handler. Reduced server grabs. + + Added the following variable: + RaiseOnStart + + September 21 & 22, 2003 + Tweaked stuff all over the place for a cleaner compile. + + [add_window.c] [events.c] [menus.c] + Fixed an UsePPosition bug, a restart bug, a sound bug, and + an instance of unfreed memory. + + September 18, 2003 + [*akefile*] [parse.c] + Let lexers track line numbers by default. + + September 14 - 17, 2003 + Moved the nexpm/ directory into contrib/. Moved the sample + resource files and directories in the contrib/ directory into + contrib/vtwmrc/. + + [*akefile*] [add_window.c] [doors.c] [events.c] [gc.c] [icons.c] + [menus.c] [parse.c] [resize.c] [twm.c] [util.c] [twm.h] [util.h] + Added internationalization (I18N) support. Woo-woo! + Better handling of missing or empty string resources. + + September 10, 2003 + [add_window.c] [gram.y] [menus.c] [parse.c] [twm.c] [add_window.h] + [screen.h] [twm.h] + Added code to ignore "shift states" for bindings. + + Added the following variable: + IgnoreModifiers k + + June 3, 2003 + [menus.c] + Better sound handling in the (de)iconify and warp functions. + + May 27, 2003 + [iconmgr.c] [events.c] [menus.c] [resize.c] + Fixed a bug when removing icon manager entries. Almost fixed + stacking order bugs when resizing windows (the raise still + occurs before the movement when opaque resizes are done on + windows with squeezed titlebars). Cancelled resizes now work + correctly, except for the above case. + + May 23 & 24, 2003 + [menus.c] + Fixed stacking order bugs when moving windows (the raise + now occurs after the movement). Cancelled moves now work + correctly. + + November 15, 2002 + [menus.c] [parse.c] [sound.c] [parse.h] [sound.h] + Allow sounds to be played "ad hoc". + + Added the following function: + f.playsound s + + November 8 & 11, 2002 + [add_window.c] [events.c] [ parse.c] [twm.h] + Support for MWM hints (currently, honor "noborder" and + "notitle" hints). Fixed some off-by-clientborderwidth + window placement bugs, an off-by-one malloc(), a null + pointer reference, and a ConfigureNotify propogation bug. + + From Jonathan Paisley : + Patches for the above. + + November 6 & 7, 2002 + [*akefile*] [twm.c] [vtwm.man] + Reduced the size of the compiled-in system.vtwmrc array. + The command line can specify that no startup file be used. + Updated the man page to reflect the compiled-in defaults. + + October 30 & 31, 2002 + [system.vtwmrc*] [add_window.c] [events.c] [icons.c] [gram.y] + [iconmgr.c] [menus.c] [parse.c] [twm.c] [util.c] [iconmgr.h] + [menus.h] [screen.h] [twm.h] + Opened up icon managers and menus to user-specified images. + The interfaces to all the built-in pixmap drawing functions + have been made uniform. + + Added the following keywords: + IconManagerPixmap s + MenuIconPixmap s + Changed the following variable: + ShallowReliefWindowButton + + October 27, 2002 + [add_window.c] [gram.y] [events.c] [menus.c] [parse.c] [twm.c] + [menus.h] [screen.h] + The f.warpto function accepts VTWM-style wildcards now. + The f.warpring function has been fixed. Again. + Prohibit windows from being added to the WindowRing list. + + From Jonathan Paisley : + Patches for NoWindowRing. + + Added the following variable: + NoWindowRing l + + October 25 & 26, 2002 + [add_window.c] [events.c] [parse.c] [resize.c] [twm.c] [util.c] + [screen.h] [twm.h] + Obsoleted the SunkFocusHighlightWindow variable with new + built-in highlight pixmaps, :xpm:raisedbox, :xpm:sunkenbox, + :xpm:raisedlines, and :xpm:sunkenlines. Fixed some titlebar + highlight exposure bugs. + + Changed the following keyword: + TitleHighlight s + Removed the following variable: + SunkFocusHighlightWindow + + October 20, 2002 + [parse.c] [twm.c] [util.c] [screen.h] + Chmod 0600 $(HOME)/vtwm.pid. + Allow the 3D borders of titled windows to be unadorned. + Fixed the 3D borders of titled windows when BeNiceToColormap + is set. + + Added the following variable: + NoBorderDecorations + + October 17 & 18, 2002 + [system.vtwmrc*] [add_window.c] [gram.y] [menus.c] [twm.c] + [util.c] + Refinements to the titlebar: The title bevel can now frame + the entire titlebar when built-in 3D buttons are not full + height. Buttons can now "extend into" the title bevel and + frame padding. The highlight area (or absence of) is handled + correctly now. The built-in 3D highlight is now available + with or without a title bevel. Enabled signed-integer data + handling in the resource file parser. + + Changed the following variables: + ButtonIndent n + FramePadding n + TitleBevelWidth n + TitlePadding n + + October 16, 2002 + [gram.y] [menus.c] [parse.c] [twm.c] [screen.h] + Allow warp functions to position the pointer at the center + of windows. + + Added the following variable: + WarpCentered s + + September 30, October 2 - 6, 2002 + [desktop.c] [events.c] [menus.c] [resize.c] [events.h] [menus.h] + [resize.h] + Refinements to the f.resize and f.move functions: Both are + now single rodent button operations from any context, and both + warp the pointer back to the virtual desktop when started from + there. The wireframe is drawn immediately, ignoring MoveDelta. + MoveDelta is otherwise used consistantly now. Fixed some icon + move and resize bugs. Large chunks of relevant code changed, + moving operations from event handlers to the function itself + and merging/removing redundant code. + + Changed the following functions: + f.move + f.resize + + September 26, 2002 + [menus.c] + Removed the limitations of the f.startwm argument. + + Changed the following function: + f.startwm s + + September 24, 2002 + [add_window.c] [gram.y] [parse.c] [twm.c] [screen.h] + The UsePPosition variable accepts a list now. + + Changed the following variable: + UsePPosition s l + + September 17, 2002 + [menus.c] + Fixed a race condition when f.squeeze* functions are invoked + from a window menu while Opaque* variables are set. + Prevent f.squeeze* functions when DontSqueezeTitle is set. + + September 13, 2002 + [resize.c] + Adjust the pointer back to the window at the end of window + resizes as required. + Constrain virtual desktop resizes to multiples of PanDistance + when SnapRealScreen is set. + + September 9, 2002 + [menus.c] [parse.c] [parse.h] + Fixed warp bugs when windows are borderless or shaped. + + From Seth Robertson : + Patches for passing raw key and rodent button events + to windows. + + Added the following functions: + f.bindbuttons + f.bindkeys + f.unbindbuttons + f.unbindkeys + + September 1, 2002 + VTWM 5.4.6a released for public consumption. + vtwm-5.4.6-to-5.4.6a.udiff patch file released. + + August 25, 2002 + [add_window.c] + Better random placement of large windows. + + From Seth Robertson : + Patch for the above. + + August 23, 2002 + [add_window.c] [applets.c] [gram.y] [parse.c] [twm.c] [screen.h] + Support for borderless windows. + + From Tim Wiess : + Patches for the above. + + Added the following variable: + NoBorder l + + April 28, 2002 + Improved the list parser in contrib/support/sysrc_add_apps.sh. + + April 9, 2002 + [events.c] + Fixed a focus problem with transient windows. + + December 2, 2001 + [menus.c] [twm.c] + Added "-p" command line switch for a runtime PID file, + $HOME/vtwm.pid. + + November 20, 2001 + [add_window.c] + MakeTitle now overrides NoTitle like it's supposed to. + + November 15, 2001 + [add_window.c] [doors.c] [menus.c] + Doors are drawn during opaque interactive creation now. + + November 8, 2001 + [events.c] [menus.c] [version.c] + Fixed bugs I introduced regarding icon managers and warp + rings. This should end f.warpring problems. + + November 3, 2001 + VTWM 5.4.6 released for public consumption. + + October 20 & 21, 2001 + [*akefile*] [applets.c] [gram.y] [icons.c] [lex.l] [list.c] + [menus.c] [parse.c] [regions.c] [util.c] [list.h] [regions.h] + Added support for POSIX 1003.2 regular expressions ("RE"s) + in resource file window lists. + + October 11, 2001 + [menus.c] [parse.c] [resize.c] [twm.c] [util.c] [screen.h] + Fixed window resizing via icon managers and the virtual + desktop and window moves (f.move) via the virtual desktop. + Improved virtual desktop updates after window resizes and + moves. Zooms are aware of icon managers now. Random zooms + during deiconification are controlled by a variable now. + + Added the following variable: + ZoomZoom + + October 2 & 3, 2001 + [events.c] [iconmgr.c] [menus.c] [parse.c] [twm.c] [parse.h] + [screen.h] + A new feature to make icon managers function strictly as + icon managers, listing only iconified windows. + + Added the following variable: + StrictIconManager + Added the following function: + f.stricticonmgr + + September 24 - 28, 2001 + A new script in the contrib/support directory can add installed + applications to the system default resource file. + + [*akefile*] [system.vtwmrc*] [add_window.c] [desktop.c] + [iconmgr.c] + Ensure the compiled-in resources and build info are current. + Made the system default resource files a bit more useful + and appealing. Fixed transposed default desktop foreground + and background colors. + + From Michael Dales : + Work on the bug where windows may be mapped in desktop + (0,0) regardless of the desktop's virtual location. + + From Rolf Neugebauer : + Fixed positioning errors for the icon manager and + virtual desktop windows. + + August 16, 2001 + [gram.y] [parse.c] [sound.c] + Added micro-manageable volume control. + + Changed the following variable: + Sounds l + + August 3, 2001 + Added another build hint to the INSTALL file. + + June 22 & 23, 2001 + Updated the doc and contrib directories. + + [*akefile*] [events.c] [gram.y] [iconmgr.c] [menus.c] [parse.c] + [sound.c] [twm.c] [menus.h] [parse.h] [screen.h] [sound.h] [twm.h] + Sound effects are now supported, by way of the rplay library + and daemon. + + Added the following variables: + PauseOnExit n + PauseOnQuit n + SoundHost s + Sounds l + SoundVolume n + Added the following function: + f.sounds + + October 24 & 31, 2000 + [doors.c] [menus.c] + Sanity checks on door renames. Fixed two menu repaint bugs. + + August 23, 2000 + [menus.c] + Fixed a menu scroll bug. + + June 14 & 21, 2000 + [menus.c] + Plugged holes where executing f.warptoiconmgr when thene + is no icon manager to warp to, and f.warpclass* when there + is no class, window, or focus, blew VTWM out of the water. + + June 4, 2000 + [twm.c] [util.c] [screen.h] [twm.h] + Added four new built-in window button images: ":darrow", + ":rarrow", ":xpm:darrow", and ":xpm:rarrow". + + May 28 - 31, 2000 + Added two more build hints to the INSTALL file. + + [iconmgr.c] [menus.c] [parse.c] [twm.c] [menus.h] [parse.h] + [screen.h] + When the pointer would end up in an AutoPan border on warps, + it is adjusted out, preventing unwanted screen pans. All the + f.*iconmgr warp functions honor the WarpSnug and WarpWindows + variables now (or absence of). The WarpSnug state can now be + toggled. + + From Ugen Antsilevitch : + Support for warping only to visible windows. + + Added the following variable: + WarpVisible + Added the following functions: + f.warpsnug + f.warpvisible + + May 22 - 24, 2000 + [menus.c] [parse.c] [twm.c] [menus.h] [screen.h] + Added "scrollability" to menus that would be taller than the + display (inspired by the neXtaw SimpleMenu widget). + + Added the following variables: + MenuScrollBorderWidth n + MenuScrollJump n + + April 1, 2000 + Added another build hint to the INSTALL file. + + [menus.c] + Made the pointer warp to the titlebar on a squeeze operation + if WarpCursor is set on, a la zoom operations. + + September 28, 1999 + [desktop.c] [icons.c] [util.c] + When moving an application window in the virtual desktop, the + border of the corresponding real screen window now highlights + as required. Streamlined the handling of transparent pixmaps + for window buttons, improving exposure response to pointer- + driven focus changes. + + September 21, 1999 + [add_window.c] [iconmgr.c] [menus.c] + Icon managers now honor the IconifyByUnmapping resource. + Fixed a bug where removing the last entry in an iconified + icon manager didn't unmap that icon, and it contained an + empty entry when deiconified. Fixed the f.hideiconmgr and + f.showiconmgr functions so that they now work against icon + managers that are defined with the IconManagers resource. + More work on the "Don't iconify if can't deiconify" logic. + + September 14 & 15, 1999 + [*akefile*] [events.c] [menus.c] + Fixed the notorious "Can't resize or move from icon managers + and menus not of the root or window in question" bug. Woo-woo! + + From Mehul N. Sanghvi : + Additional tweaks to the *akefile*s for more flexible + installations. + + September 10 & 11, 1999 + Moved the man page into the doc directory. On request, renamed + the lnf directory to contrib. + + [*akefile*] [events.c] [menus.c] [resize.c] + Changed the *akefile*s to accomodate the above, as the man + page is now included in 'make install'. Reverted the setting + of the context of a door's frame to that prior to the change + on May 13 (it wasn't needed after all). Added code to prevent + iconifying windows that don't have provision to deiconify or + otherwise restore them. Fixed f.destroy and f.delete so that + they can be safely used on doors, icon managers, and the + virtual desktop. Fixed the zooming of doors, icon managers + and the virtual desktop so that their contents adjust to the + new size. + + June 18 & 22, 1999 + [menus.c] [parse.c] [twm.c] [util.c] [screen.h] + Fixed a bug, noted by "digs", where the truncation of long + titles messed up in titlebars that don't have any left-side + buttons. Added a new variable to see that iconified transient + windows of an iconified parent window aren't deiconified when + that parent is. + + Added the following variable: + DontDeiconifyTransients + + May 22, 1999 + [applets.c] [icons.c] + The same small tweak in both to have the region layout + logic disregard grid spacing in determining whether a + window will fit (clarified the man page accordingly). + + May 10 & 13, 1999 + [doors.c] [events.c] [menus.c] [util.c] + Relaxed the door geometry parser, allowing omission of + the position. Fixed a bug where rodent button events on a + door's frame didn't correctly set the context, and added + a kludge to "fix" not getting the rodent button up event. + Applied the XPM library's color closeness attribute to + external pixmap images. Updated the resource files in lnf + to demonstrate some of m4's capabilities. + + April 26 & 27, 1999 + [*akefile*] [add_window.c] [applets.c] [doors.c] [events.c] + [gram.y] [icons.c] [menus.c] [parse.c] [regions.c] [twm.c] + [regions.h] [screen.h] + By cleverly re-using the code for icon regions, a new window + management scheme, applet regions, is born! Moved the generic + functions of icons.c into a new regions.c, renamed icons.h + to regions.h, copied and modified the remaining icons.c to + create applets.c, and made all this known to the rest of the + modules above. Setting up all those little tool applications + is now just a matter of dropping them into a list resource! + + Added the following variable: + AppletRegion g s s n n l + + February 28 & March 1, 1999 + [doors.c] [events.c] [iconmgr.c] [menus.c] [resize.c] [events.h] + Doors, icon managers, and the virtual desktop now get redrawn + during opaque resizes (I have yet to figure out how to redraw + doors during interactive creation). The first two also have + minimum sizes imposed on them now. Fixed the icon manager's + class assignment; it's visible to resource list entries now. + Skip re-mapping of the virtual desktop to clean up outline + droppings if the window moved or resized is itself. + + February 22 & 23, 1999 + [desktop.c] [menus.c] [resize.c] + Added a trap to prevent resizing windows via the virtual + desktop (it's horribly broken). Imposed a minimum size on + the virtual desktop, that of the scaled real screen. + + February 20, 1999 + [add_window.c] [events.c] [parse.c] [twm.c] + The window's icon name now has it's own memory space; this + to keep some apps from blowing VTWM out of the water when + they change it. Added support for user-defined m4 parameters + passed from the command line. + + February 15 & 16, 1999 + [desktop.c] [icons.c] [parse.c] [twm.c] [screen.h] + If the RealScreenBorderWidth resource is defined, is there any + reason why the UseRealScreenBorder resource wouldn't be? More + fixes for the virtual desktop; these to properly accomodate the + real screen's border. + + From Caveh Frank Jalali : + A last tweak for icon images on multiple screens. + + Removed the following variable: + UseRealScreenBorder + + February 10 & 13, 1999 + [events.c] [resize.c] [util.c] + Hacked in code to see that the virtual desktop's bevel gets + redrawn after being resized. Ick. + + From Caveh Frank Jalali : + Tweaks to correct the painting of external images on + multiple screens. + + February 5 - 9, 1999 + [system.vtwmrc*] [desktop.c] [doors.c] [events.c] [parse.c] + [twm.c] [util.c] [screen.h] [twm.h] + Doors and the virtual desktop can now be rendered in 3D. + Doors now override real screen snapping on entry. Fixed a + few bugs regarding the virtual desktop when it's resized; + these may have been responsible for the problems noted in + previous releases, because they don't happen anymore! + Added a resource to override title truncation when in short + titlebars and icon managers. + + Added the following variables: + DoorBevelWidth n + VirtualDesktopBevelWidth n + NoPrettyTitles + + January 30, 1999 + [*akefile*] [menus.c] [parse.c] [twm.c] [version.c] + Added compiled-in options to the build info in the version + window. + + From Jason Gloudon : + Added m4 pre-processing of resource files. Woo-woo! + + January 10 & 14, 1999 + [add_window.c] [doors.c] [menus.c] [parse.c] + Added proper tests for success of XGetWindowProperty() calls + to fix getting icon names, window states, and pixel atoms from + the X server. Fixed a bug in the display of a renamed door. + + December 26 & 28, 1998 + [icons.c] [twm.c] [util.c] [screen.h] + Fixed a bug where icon bitmaps were rendered with the wrong + color. The X database resource "*bitmapFilePath" is now + searched for pixmap image files, like that for bitmap image + files. + + December 10 & 14, 1998 + [desktop.c] [menus.c] [parse.c] [twm.c] [menus.h] [parse.h] + [screen.h] + Non-nailed icons can now stay put at their locations on the + virtual desktop. The titlebar height now adjusts to external + button images. Added a few button image files to lnf. + + Added the following variable: + StaticIconPositions + Added the following function: + f.staticiconpositions + + November 15 - 16, 1998 + [Imakefile] [desktop.c] [events.c] [menus.c] + Fixed the PanResistance resource's not recognizing when the + pointer has left the autopan windows. Fixed the "orphaning" + of intermediate parent menu(s) when skipping them for some + superior parent menu. + + From Steve Ratcliffe : + Moved $(NO_XPM_SUPPORT) into DEFINES for global + visibility, and removed several SpecialObjectRule()s. + + From Michel Eyckmans : + Fixed deferred execution on keyboard events when the + root window has focus. + + September 27, 1998 + [menus.c] [resize.c] [version.c] + + From Goran Larsson : + Fixed text display bug in the size and position windows. + + VTWM 5.4.5a released for public consumption. + vtwm-5.4.5-to-5.4.5a.txt patch file released. + + September 14, 1998 + Established a directory, doc, for all the documentation + that has accumulated through time. The HINTS file is now + called INSTALL, and is more comprehensive. + + [util.c] + The menu, resize and X logo built-in bitmaps now account + for the ButtonBevelWidth variable. + + VTWM 5.4.5 released for public consumption. + + September 8 - 10, 1998 + [events.c] [iconmgr.c] [parse.c] [twm.c] [screen.h] + Fixed a bug with icon manager geometries that would blow + VTWM out of the water. Added code to make it a little + harder to accidentally pan to an adjacent virtual screen. + + Added the following variable: + PanResistance n + + September 4 - 5, 1998 + [events.c] [menus.c] [resize.c] [resize.h] + Fixed another pixmap oversight, this one for icons, + noted by C. F. Jalali. Applied the MoveDelta variable + to window resizing and initial menu highlighting. + + From Steve Ratcliffe : + Fixed a bug for the AutoPan variable, when the pan + windows are obscured by a newly-raised window. + + September 2, 1998 + [add_window.c] [desktop.c] [util.c] [util.h] + Plugged a memory leak, as noted by Jason Gloudon, where + transparent pixmap resources weren't freed before re-use. + + August 23 - 27, 1998 + [add_window] [events.c] [icons.c] [menus.c] [parse.c] [twm.c] + [util.c] + Fixed a bug where the titlebar highlight wasn't + erased when focus was unset and the BeNiceToColormap + and SunkFocusWindowTitle variables were used. + + From Steve Ratcliffe : + Tweaks to suppress menu highlighting on mapping, + relieve CPU consumption on menus bound to rodent + buttons, and allow a second rodent button press to + cancel menus. A safer approach to the RaiseDelay + variable's timeout. + + From Jason Gloudon : + Tweaks to streamline icon bitmap handling, and + fixed the painting of non-transparent titlebar + highlight pixmaps. + + From Caveh Frank Jalali : + Fixed a bug I introduced where non-3D borders were + always rendered as highlighted! Tweaks to correct + the painting of built-in images on multiple screens. + Fixed some bugs in colormap management. Tweaks for + application-defined icon border widths. + + August 10 - 14, 1998 + All references to and mention of the shadow contrast and + shadow width variables have been changed to *BevelContrast + and *BevelWidth. + + [add_window.c] [doors.c] [events.c] [iconmgr.c] [icons.c] + [menus.c] [parse.c] [resize.c] [twm.c] [util.c] [version.c] + [screen.h] + Fixed an oversight, color (XPM) image support for the + UnknownIcon variable and application-specified icons. + Window buttons are now beveled when external images are + used. The *BevelWidth variables render the UseThreeD* + variables obsolete. The ThreeDBorderWidth variable is + superfluous, too, no? + + Removed the following variables: + UseThreeDBorders + UseThreeDIcons + UseThreeDIconManagers + UseThreeDMenus + UseThreeDTitles + ThreeDBorderWidth n + Added the following variables: + ButtonBevelWidth n + IconBevelWidth n + Changed the following variable: + UnknownIcon s + + July 31 & August 3, 1998 + Discovered that VTWM supports a subset of regex wildcards for + list variables! It's in the man page now. + + [events.c] [menus.c] [twm.c] [twm.h] + Another tweak to the f.warpclass* functions, to properly + handle multiple icon managers. Added a signal handler for + external restarts (adapted from TVTWM pl11). + + July 15 - 17, 1998 + [desktop.c] [menus.c] [parse.c] [resize.c] [parse.h] + Added code to restart using a specified window manager. + A few changes to grab the server during non-opaque moves + and resizes, regardless of the NoGrabServer variable. + + Added the following function: + f.startwm s + + July 2 & 14, 1998 + [events.c] + Made the borders of windows without titlebars forward key + events to the application, like titlebars do. I think the + various warps from icon managers are sorted out now. + + June 25, 1998 + [gram.y] [menus.c] [parse.c] [twm.c] [screen.h] + Aliased a new variable, OldFashionedVtwmWindowsMenu, to the + OldFashionedTwmWindowsMenu variable, just for consistancy. + + From Erik Agsjo : + Added code to support two new variable(s). + + Added the following variables: + DontShowInTwmWindows l + DontShowInVtwmWindows l + OldFashionedVtwmWindowsMenu + + June 10 - 15, 1998 + [events.c] [iconmgr.c] [menus.c] + Had to make an exception for icon managers regarding warps, + that their window border isn't the destination, because I + can't figure out how to make the appropriate entry active + when one isn't without screwing up something else. BAH! Added + a few "prevents" when there isn't an icon manager mapped. The + f.warpclass* functions now behave correctly when an empty + string is used on windows without titlebars or on VTWM-specific + windows. + + June 3 - 6, 1998 + [add_window.c] [desktop.c] [events.c] [menus.c] [resize.c] + Made initial window placement adjust to client borderwidths, + depending on related variables. The virtual desktop is now + re-mapped after non-opaque moves and resizes to clean up any + outline droppings left on it when the Virtual*MotionEvents + variables are set. The window border of the virtual desktop + now honors key bindings to "virtual". Doors and their borders + are now sensitive to key bindings, too. + + May 27, 1998 + [events.c] [parse.c] [twm.c] [screen.h] + Added code to not set focus from icon manager entries to + the corresponding application windows, for binding keys that + otherwise would get forwarded. + + Added the following variable: + NoIconManagerFocus + + May 24, 1998 + Established a directory, lnf (look n' feel), for the previously + included sample resource and image files, and added a couple + more to it. Renamed some files: marcel.vtwm to .vtwmrc-marcel, + djhjr.vtwmrc to .vtwmrc-95ish, djhjr.vtwmpm to djhjr.xpm, + realscr.bm to nestedsqu.xbm, and siconify.bm to siconify.xbm. + + [iconmgr.c] [util.c] + Changed to handle the above. + + May 17 - 23, 1998 + [add_window.c] [desktop.c] [iconmgr.c] [menus.c] [twm.c] [util.c] + [screen.h] [util.h] + Found and plugged the hole in the original menu handler that + would blow VTWM out of the water when the pointer scrolled + down past the last entry. Gave the icon manager and virtual + desktop resource classes. The f.warpclass* functions will now + exhibit reasonable behavior when an empty string is used on + windows without titlebars or on VTWM-specific windows. The + three entries of the Pixmaps variable now fully support color + (XPM) images - this does render the nexpm utility obsolete in + regard to VTWM, but it's still included in the distribution. + The external image support for window buttons is better, but + still not perfect (see BUGS). + + Changed the following variable: + Pixmaps l + + May 11 - 13, 1998 + [add_window.c] [events.c] [menus.c] [twm.h] + The f.warpclassprev and f.warpclassnext functions now accept + an empty string, meaning the class of the window with focus, + and the first actually goes backwards now! Tweaks made to those + and the f.warpring function so its destination is a titlebar or + border like the other warp functions, and it now remembers the + window to warp to when invoked from the root window, unless the + target window was unmapped (leaving the pointer on the root + window), in which case it will no longer skip the first window + in the ring. All warping functions now honor the WarpUnmapped + variable a la the f.warpto function. + + Changed the following functions: + f.warpclassprev s + f.warpclassnext s + f.warpnewest + f.warpring s + f.warptoiconmgr s + + April 26 - May 5, 1998 + [add_window.c] [desktop.c] [events.c] [gram.y] [iconmgr.c] + [icons.c] [menus.c] [parse.c] [resize.c] [twm.c] [util.c] + [menus.h] [screen.h] [twm.h] + The 3D rendition of icons is now governed by its own variable. + The 3D bevel widths are configurable now, and related elements + are sized and positioned accordingly. Virtual window geometries + now account for 3D borders. Virtual-to-real window scaling and + positioning errors have been reduced. The position window now + reports during moves in the virtual desktop. Re-instated the + effects of the RightHandSidePulldownMenus variable! Changed the + foreground color for the built-in "TwmWindows" menu to that of + the global variable, and aliased it's name to "VTWM Windows", + just for consistancy's sake. + + Added the following variables: + UseThreeDIcons + BorderBevelWidth n + IconManagerBevelWidth n + InfoBevelWidth n + MenuBevelWidth n + TitleBevelWidth n + + From Nelson H. F. Beebe : + Even more tweaks for portability, most notably, restoring + X11R4 compatability by not including the X11R5,6 headers + Xosdefs.h and Xfuncs.h! X11R5,6 don't seem to mind. + + April 20 - 23, 1998 + [nexpm/nexpm.c] + + From Steve Ratcliffe : + Added a test for the child window of the selected window. + + [*akefile*] [add_window.c] [desktop.c] [doors.c] [events.c] + [lex.l] [menus.c] [parse.c] [twm.c] [util.c] [doors.h] [parse.h] + Purged GNU-specific syntax from this new Imakefile, and changed + the NO_PUTENV definition to NEED_PUTENV_F, for consistancy. + Added code to support pasting a name into a door (adapted from + VTWM 5.2b). + + Added the following function: + f.namedoor + + From Steve Ratcliffe : + Many tweaks made in the name of Portability. The snug + variables now take border width into account. + + From Nelson H. F. Beebe : + Many more tweaks for portability's sake. + + April 14 - 17, 1998 + [add_window.c] [desktop.c] [menus.c] [parse.c] [resize.c] + [twm.c] [resize.h] [screen.h] + When windows are created, they now honor the opaque variables + when the RandomPlacement variable is not set. While moving and + resizing windows on the real screen, the virtual desktop now + responds in kind, and visa-versa. The NoGrabServer variable now + sees to it the server is actually not grabbed! The position + window now reports during constrained moves. + + Added the following variables: + VirtualReceivesMotionEvents + VirtualSendsMotionEvents + + April 1 - 8, 1998 + [*akefile*] [system.vtwmrc*] [add_window.c] [gram.y] [menus.c] + [parse.c] [resize.c] [twm.c] [util.c] [screen.h] [twm.h] [util.h] + Added a define supporting a 2D or 3D system default resource + file, and made that file a bit more useful. Added code for + opaque resizing, and all opaque variables now support lists. + Many tweaks to make titlebar-related variables consistant with + respect to each other and 3D rendition of the various elements. + + Added the following variables: + OpaqueResize [l] + NoOpaqueResize [l] + NoOpaqueMove [l] + Changed the following variable: + OpaqueMove [l] + + March 29 - 30, 1998 + [Imakefile] [events.c] [util.c] + Added the system Imake.tmpl macro for flex's library (should + be absent or an empty string on systems with lex). Added code + to properly truncate, then add ellipses to, titles that are + longer than the space they're drawn on. + + March 23 - 24, 1998 + [gram.y] [util.c] + Fixed the rendition of a squeezed titlebar's right-side 3D + border (a silly gunkulation error). + + From Jason Gloudon : + Support for bison. + + March 20 - 22, 1998 + [add_window.c] [util.c] [version.c] + Added color image (XPM) support for window buttons. Jason's + code for color icon images made it a breeze, but it's not + perfect (see BUGS). + + VTWM 5.4.4c released for public consumption. + vtwm-5.4.4b-to-5.4.4c.txt patch file released. + + March 14 - 15, 1998 + [events.c] [menus.c] [version.c] + Fixed a bug where the window buttons would get painted with + the border color when the background color should have been + used. + + From Steve Ratcliffe : + Fixed warping to titlebars not flush left. + + VTWM 5.4.4b released for public consumption. + vtwm-5.4.4a-to-5.4.4b.txt patch file released. + + February 5, 1998 + [*akefile*] [events.c] [menus.c] [util.c] [version.c] + Tweaks to accomodate the following made to the *akefile*s. + + From Takeharu Kato : + Fixed a fault causing a SIGSEGV in the info window, + and the use of a depreciated constant in the XPM library. + + VTWM 5.4.4a released for public consumption. + vtwm-5.4.4-to-5.4.4a.txt patch file released. + + February 2, 1998 + VTWM 5.4.4 released for public consumption. + + January 27, 1998 + [add_window.c] [iconmgr.c] [parse.c] [twm.c] [screen.h] [gram.y] + Added a variable to tell the icon manager whether or not to + highlight its entries as an indication of pointer location, + regardless of the NoHighlight variable. + + Added the following variable: + NoIconManagerHighlight + + From Nicholas Jacobs : + A better effort at getting a name for the window. + + January 24, 1998 + [desktop.c] [menus.c] + Allow screen warps to honor the SnapRealScreen variable. + Added a kludge to "fix" screen warps to deiconifying windows + not on the real screen (high degree of confidence it's not + the source of the problem). + + January 21, 1998 + Added the HINTS file to the distribution. Moved and added many + function declarations into header files (quieter builds!). Other + miscellaneous tweaks. + + December 28, 1997, January 1 - 19, 1998 + [nexpm/nexpm.c] + Changed the window name sought by `nexpm -vtwm ...` to match + the virtual desktop's name. It's a wonder nobody's noticed! + + [*akefile*] [add_window.c] [cursor.c] [desktop.c] [doors.c] + [events.c] [gc.c] [icons.c] [list.c] [menus.c] [parse.c] [resize.c] + [twm.c] [util.c] [util.h] [version.c] [screen.h] [gram.y] + Rewrote most of the 3D border code, adding, among other things, + drawing the top border segment when 3D borders are used with + squeezed titlebars! Simplified the meaning of the SqueezeTitle + variable list parameters. Fixed a bug causing SIGFPEs when pan + distances are set to zero. Added a bug workaround to try to + make managed windows used as transients behave, a la the + FixTransientVirtualGeometries variable (seldom needed, just as + bad, but mostly works). Fixed an oversight of mine, not + initializing monochrome GCs! Enabled a variable to go easy on + the colormap (doesn't render perfectly yet). Use the system + Imake.tmpl macro for yacc and removed all escaped characters + from the lastmake.c rule in the *akefile*s. Clarified the pan + distance variable descriptions in the man page. + + Added the following variables: + BeNiceToColormap + FixManagedVirtualGeometries + + From Nelson H. F. Beebe : + On startup, VTWM now searches for user and system .vtwmrc + files, then user and system .twmrc files, in this order. + Fixed and added many declarations and definitions. Updated + the man page. Support for HTML and Postscript versions of + the man page added to the *akefile*s. + + From Jason Gloudon : + Color image (XPM) support for icons. + + Added a pixmap (djhjr.vtwmpm) referenced in my resource file + (djhjr.vtwmrc) for an example of the nexpm utility. + + Pruned the R4 Imakefile from the tree. + + Pruned the vtwmrc/ directory from the distribution tree. No offense + to Mr. Betza, but it made little sense (to me), was five years old, + was very esoteric, and anyone who wants it probably already has it. + + November 17, 1997 + VTWM 5.4.3 released for public consumption. + + November 17 - 19, 1997 + [events.c] [menus.c] [util.c] [util.h] [version.c] + Fixed a bug where the wrong variable was being used to + highlight the window border that has focus. Fixed an omission + where the window buttons would not follow the border color + when highlighted and the ButtonColorIsFrame variable is true. + Added a hack to trap corrupted/invalid window button names. + + October 27, 1997 + VTWM 5.4.2 released for public consumption. + + March 12 - 14, 1997 + [add_window.c] [menus.c] [twm.c] [util.c] + Added code to properly paint the window buttons in the same + color as their titlebar on a restart operation. Woo-woo! + Numerous changes to accomodate added buttons and squeezed + titlebars - I had previously overlooked these. Made a few + variables un-alterable when 3D appearances are used. Now + closes the display before spawning the new WM on a restart + operation - free alloc'd memory in the X server? + + September 25 - 26, 1996 + [menus.c] + Changed code to properly scale menus to the fonts used. + + September 14 - 21, 1996 + [*akefile*] [add_window.c] [iconmgr.c] [menus.c] [resize.c] + [twm.h] [util.c] [version.h] [*akefil*] [vtwm.man] + Fixed a bug in zooms that I introduced! Applied the backing + store and NoBackingStore variables to the Icon Manager and + titlebars (defeats effects of RaiseDelay). Made the pointer + warp to the titlebar on a zoom operation if WarpCursor is + set on. The function f.showdesktopdisplay now deiconifies as + required. Working on code to make the window buttons stay the + same color as their titlebar on a restart operation (obviously + wasn't thought about much before). Added build info to the + version window by having the *akefile*s create a temporary C + module. + + Added the following variable: + ButtonColorIsFrame + + September 10 - 12, 1996 + [events.c] [menus.c] + Added code preventing the virtual desktop window and Door + windows from doing harm. Fixed a bug when trying to move the + virtual desktop window with the pointer; see the notes in + djhjr.vtwmrc pertaining to the virtual desktop, it's related, + and the BUGS file. + + June 26, 1996 + [screen.h] [parse.c] [twm.c] [util.c] [vtwm.man] + Tweaked the 3D menu icons to look a little more like menus. + Made the 3D Icon Manager iconified indicators "shallow" to + match the 3D menu icons. Added code for Motif-ish "shallow" + relief in 3D titlebars and buttons to matches the others. + + Added the following variable: + ShallowReliefWindowButton + + June 11, 1996 + [icons.c] [events.c] + Tweaked the hard-coded geometries for a better 3D appearance + on icons (looks best with IconBorderWidth set to 0). + + April 18 - May 19, 1996 + [add_window.c] [desktop.c] [doors.c] [doors.h] [events.c] + [gram.y] [iconmgr.c] [iconmgr.h] [icons.c] [menus.c] [menus.h] + [parse.c] [resize.c] [screen.h] [twm.c] [twm.h] [util.c] [util.h] + [version.c] + Modifications and/or additions to the above modules for + a 3D appearance, menu separators, a position window, info + window fonts, resize/position window locations, and other + minor tweaks (listed below). All should be initialled and + dated. Changed as many as convenient boolean shorts to bits in + a Slim-Fast effort (the only executable code changed was due + to renaming the variable SnapRealScreen to snapRealScreen; the + shorts maybe reinstated with '#define ORIGINAL_SHORTS'). + Changed "Twm Door" to "VTWM Door", in the name of Consistancy. + Changed "Virtual Desktop" to "VTWM Desktop". Ditto. Changed the + code to center Door names in their windows. It *is* correct, + but only looks more correct. Took liberties with the + SunkFocusWindowTitle function. I think it more pleasing. Took + liberties with other code too, look for '#ifdef ORIGINAL_'. + A couple of changes for a cleaner compile (what were 'int' + functions are now 'void', etc.). Rem'd out code no longer + valid due to these changes. + + Added the following variables: + SunkFocusWindowTitle + UseThreeDIconManagers + UseThreeDMenus + UseThreeDTitles + UseThreeDBorders + ThreeDBorderWidth n + ClearBevelContrast n + DarkBevelContrast n + InfoFont s + ResizeRegion s + Added the following function: + f.separator + + Updated the man page. + Included my .vtwmrc (djhjr.vtwmrc) in this distribution. + + See also the files 4.ANNOUNCE, 4.README, and BUGS. + +============ vtwm-5.3.tar.gz ============= +dsembr01@starbase.spd.louisville.edu (Darren S. Embry) + + Tuesday, 1994 January 4, 16:43:32 EST + [menus.c] Autopanned windows are now raised when Autopan is + turned back on via f.autopan. + + Monday, 1994 January 3, 20:49:22 EST + f.stickyabove (or f.nailedabove) + + Monday, 1994 January 3, 19:29:07 EST / dsembr01 + [twm.c] The "VTWM Profile" function is now executed after + starting/restarting the window manager. + + Friday, 1993 November 26, 15:37:01 EST / dsembr01 + [vtwm.man] Some previously undocumented functions have now + been documented. Please use them at your own risk: + + f.cut + f.cutfile + f.file + f.movescreen + f.twmrc [same as f.restart anyway] + f.version + + Saturday, 1993 November 6, 19:03:28 EST / dsembr01 + [desktop.c] Small bug fix regarding representations of + nailed windows on the virtual desktop; it was obvious and + obviously unintentional. + + Tue Nov 2 20:05:44 EST 1993 dsembr01 + WarpSnug + + Wed Oct 27 12:29:38 EDT 1993 dsembr01 + MenuTitleFont (this code also came from tvtwm) + + Tue Oct 26 19:41:04 EDT 1993 pf@z-code.z-code.com (Paul Falstad) + NoIconifyIconManagers + StayUpOptionalMenus + WarpToTransients + f.warp + f.warpclassnext + f.warpclassprev + f.warptonewest + + Mon Oct 25 21:08:40 EDT 1993 dsembr01 + If StickyAbove is set, f.nail will raise all sticky windows + to make sure nailed windows stay above. + + Mon Oct 25 19:48:33 EDT 1993 dsembr01 + FixTransientVirtualGeometries, a BUG WORKAROUND!! + (Any better ideas, folks? -- DSE) + + Mon Oct 25 17:13:00 EDT 1993 dsembr01 + DontInterpolateTitles, from tvtwm -- thanks to + cross@eng.umd.edu (Chris P. Ross) for letting me use his + code. + + Sun Oct 24 16:16:52 EDT 1993 dsembr01 + f.lower now won't lower the window if it is nailed down and + StickyAbove is set. + + Tue Oct 19 18:03:35 EDT 1993 dsembr01 + StickyAbove (I didn't take any of the code for this from + tvtwm; just the idea.) + + Mon Oct 18 21:14:04 EDT 1993 dsembr01 + Fixed autopanning bug that would *sometimes* not allow + AutoPan to work if the focus was on a window, since + the autopan windows (on the edges of the real screen) + weren't raised. + + Sat Oct 16 18:23:43 EDT 1993 dsembr01 + Nailed windows now *always* go on the real screen, wherever + the real screen is. + + Wed Oct 13 12:21:54 EDT 1993 dsembr01 + Aliased "f.stick" to "f.nail", for greater compatibility + (or less incompatibility) between .vtwmrc and .tvtwmrc, + just for the hell of it. + + Mon Oct 11 21:06:09 EDT 1993 dsembr01 + Fixed a bug that would make the window manager mess up if + "AutoPan 100" and "AutoPanWarpWithRespectToRealScreen 100" + (a.k.a. "NaturalAutoPanBehavior") were set. I wanted to + set my window manager to behave like fvwm (in the + autopanning sense of the word) when I discovered this. + + Mon Oct 11 09:14:58 PDT 1993 leisner@eso.mc.xerox.com (Marty Leisner) + Included small patches to Imakefile from Marty Leisner. + + Mon Oct 11 17:04:35 EDT 1993 dsembr01 + NoDefaultTitleButtons + NoDefaultMouseAndKeyboardBindings + so someone could use either the default title or + keyboard bindings, but not necessarily both. + +============ vtwm-5.2.2.tar.gz ============= + + dsembr01@starbase.spd.louisville.edu (Darren S. Embry) + Used another bug workaround to support negative door + geometries; the old one I did messed up with positive door + geometries, especially "+0+0". + +============ vtwm-5.2.1.tar.gz ============= + + dsembr01@starbase.spd.louisville.edu (Darren S. Embry) + AutoPanBorderWidth + AutoPanExtraWarp + AutoPanWarpWithRespectToRealScreen + EnhancedExecResources + LessRandomZoomZoom + NaturalAutopanBehavior + PrettyZoom + RealScreenBorderWidth + RightHandSidePulldownMenus + + Support for negative and "0,0" door geometries. + +============ vtwm-5.2.tar.Z ============= + +Various contributions: + + gnohmon@ssiny.com (Ralph Betza) + f.zoomzoom + StayUpMenus from tvtwm code + OldFashionedTwmWindowsMenu + UseRealScreenBorder + f.snaprealscreen + + Improved window movement in the panner + Restored the ability to rescale the desktop + + futzi@uni-paderborn.de (Michael Kutzner) + Class-name was compared twice in menus.c + (applies also to vtwm-5.0) + + Stig Ostholm + Problem when windows are resized without vtwm interaction + cleaning up of the desktop code to minimize vtwm - server + interaction. + Imakefile patch allows vtwm to be installed in another + location + (applies also to vtwm-5.0) + + eyckmans@imec.be (M. Eyckmans) + Allow #rrggbb colors in X11R4 + + Tony Brannigan + AutoPanX, AutoPanY + + dana@thumper.bellcore.com (Dana A. Chee) + Added fix which allows key presses to move a window (menus.c, + events.c) + + Alec Wolman + WindowRing can now specify "all windows" by leaving off the + Window List + + Can specify x or y = 0 in door location now + +Tue Jul 20 15:22:49 EDT 1993 + Thu Oct 1 17:47:37 1992 Dana A. Chee (dana@dino) + * Added fix which allows key presses to move a window (menus.c, + events.c) + Fri May 29 14:20:53 1992 Dana A. Chee (dana@dino) + * Fixed bug in do_single_keyword (break should be return), sent in + by George Ross (parse.c) +[Editor's note: a very popular bug to send in the fix for!] + * Autoraise can now specify "all windows" by leaving off the + Window List, sent in by Alec Wolman +[Editor's note: this was previously done by the RaiseDelay patch] + * WindowRing can now specify "all windows" by leaving off the + Window List, sent in by Alec Wolman + (add_window.c, gram.y, screen.h, twm.c, vtwm.man) + * Initial Placement of virtual desktop fixed, sent in by Alec Wolman +[Editor's note: this was previously done] + * Can specify x or y = 0 in door location now, sent in by Alec + Wolman (doors.c) + * Update man page to mention NoVirtualGeometries variable + (vtwm.man) + * Updated patchlevel (patchlevel.h) +[Editor's note: we don't have one! ] + Thu Mar 26 12:31:09 1992 Dana A. Chee (dana@dino) + * F_LOWER now lowers the window in the virtual desktop as well + +Thu Jul 15 14:03:01 DST 1993 Marcel Mol (marcel@duteca.et.tudelft.nl) + * Includes F_WARPTO patch from futzi@uni-paderborn.de (Michael Kutzner) + Patched this patch to check for name, class and classname in a + single for loop. + * Changed syntax of 'VirtualDesktop' variable. Now can set desktop + as number of screens, as size of virtual desktop window or as + size of whole desktop. + * Fixed unharmful bug when NotVirtualGeometries was set. + (vtwm comlains about "unknown singleton keyword") + * Added f.virtualgeometries function to toggle virtual geometries + settings. + * Added f.deletedoor function to delete a door. Don't know if I + correctly released all memory allocated to the door. Any X-Wizard??? + * Updated man page + +========= vtwm-5.1.tar.Z ============== + +Thu Jun 24 15:24:36 EDT 1993 Ralph Betza (gnohmon@ssiny.com) + + * Includes RaiseDelay patch from + Warren Jessop, University of Washington, whj@cs.washington.edu + + * Includes snug patch from thoth@reef.cis.ufl.edu (Gilligan) + + * Includes patch vtwm.5.1.ptch from tar@math.ksu.edu (Tim Ramsey) + + * Includes panner background pixmap, panner foreground color, + dynamic warpring, dynamic squeezetitle, TWM-Window menu + colors, RealScreen foreground, background, and colors, + corrections to placement of the little windows in the + panner, additional cursors, and maybe a few other things I + forgot to mention, from me, + Ralph Betza (gnohmon@ssiny.com) + +Tue Mar 24 13:15:11 1992 Dana A. Chee (dana@dino) + + * fixed problem with key presses in virtual desktop not working + (had an if test wrong in events.c) + * released to export. + +Wed Feb 19 13:37:57 1992 Dana A. Chee (dana at dino) + + * Converted vtwm to use the source of twm from R5 (my base was + vtwm 4.0 gamma). Released it to export.lcs.mit.edu + * Cut and paste missed resize grabs, added them back in + * Botched ask_user stuff in add_window, fixed that up. + * Removed broken copy from export. + diff --git a/doc/DEVELOPERS b/doc/DEVELOPERS new file mode 100644 index 0000000..8eef831 --- /dev/null +++ b/doc/DEVELOPERS @@ -0,0 +1,33 @@ + +A FEW THOUGHTS TO FUTURE MAINTAINERS/DEVELOPERS/HACKERS +======================================================= + + - If you feel compelled to add more compile-time options (i.e., Java + support, etc.), please follow the "NO_" and "NEED_" conventions in the + make files. Also, add code as appropriate to menus.c:Identify() and + parse.c:make_m4_cmdline(). + + - Likewise, please follow what few coding conventions are in place. Don't + use C++'s double-slash comments, keep up with the K&R style functions, + etc. + + - Keep VTWM portable. There are only two "#ifdef __PLATFORM__"s in this + code, yet it runs on platforms I've never seen. GNU isn't everywhere. + Neither is POSIX or ANSI. Seek out variety through beta-testers in the + X-related newsgroups. Finally, remember that it's X11R4 compliant. + + - Just because you can't live without such-and-such doesn't mean everyone + can't. It's a window manager, not an environment. Help keep VTWM lean. + + - Add no memory leaks! I haven't read every line of this code, but have + had to fix very few, and have seen that none have been introduced. + 'Nuff said 'bout that. + + - Document! The code is a long commentary on VTWM's evolution, and though + it does get hard to read, I've come to think it a Good Thing. Keep the + files in the in the doc directory current. + +Sorry if this reads a little belligerent. I'm just tired of fighting all +sorts of platform-specific implementations and lazy coding practices while +porting stuff. I'm sure you are too. VTWM should never be such. --- djhjr + diff --git a/doc/HISTORY b/doc/HISTORY new file mode 100644 index 0000000..4bcfd0d --- /dev/null +++ b/doc/HISTORY @@ -0,0 +1,530 @@ + +VERSION HISTORY OF VTWM 5.4 +=========================== + +VTWM 5.4.7 + + New Features + - Added internationalization (I18N) support. + - Support ignoring "shift states" when determining if a key + or rodent button event is bound (added the IgnoreModifiers + variable). + - Support passing raw key and rodent button events to windows + (added the f.bindbuttons, f.bindkeys, f.unbindbuttons and + f.unbindkeys functions). + - Allow warp functions to position the pointer at the center + of windows (added the WarpCentered variable). + - Allow the 3D borders of titled windows to be unadorned (added + the NoBorderDecorations variable). + - Prohibit windows from being added to the WindowRing list + (added the NoWindowRing variable). + - Opened up icon managers and menus to user-specified images + (added the MenuIconPixmap and IconManagerPixmap keywords). + This gives the ShallowReliefWindowButton variable wider scope. + - Two new 3D built-in pixmaps, :xpm:box and :xpm:lines. + - Four new 3D built-in pixmaps for the titlebar highlight, + :xpm:raisedbox, :xpm:sunkenbox, :xpm:raisedlines, and + :xpm:sunkenlines. These obsolete the SunkFocusHighlightWindow + variable. + - The command line can specify that no startup file be used + (primarily for testing compiled-in defaults). + - Added support for Motif window manager hints (currently, honor + "noborder" and "notitle" hints). + - Allow sounds to be played "ad hoc" (added the f.playsound + function). + - Added PointerPlacement keyword. + Changed Features + - The UsePPosition variable accepts a list now. + - The f.warpto function accepts VTWM-style wildcards now. + - Refinements to the f.resize and f.move functions: Both are + now single rodent button operations from any context, and both + warp the pointer back to the virtual desktop when started from + there. The wireframe is drawn immediately, ignoring MoveDelta. + MoveDelta is otherwise used consistantly now. Constrain virtual + desktop resizes to multiples of PanDistance when SnapRealScreen + is set. + - Refinements to the titlebar: The title bevel can now frame the + entire titlebar when built-in 3D buttons are not full height. + Buttons can now "extend into" the title bevel and frame padding. + The highlight area (or absence of) is handled correctly now. + The built-in 3D highlight is now available with or without a + title bevel. The ButtonIndent, FramePadding, TitleBevelWidth, + and TitlePadding variables are changed. + - The TitleHighlight keyword accepts built-in pixmaps now, like + the LeftTitleButton and RightTitleButton bindings. + - The raise for moved and resized windows now occurs after the + movement (added the RaiseOnStart variable). + - Some shaping optimizations. + - Depreciated the motion event handler. + - Chmod 0600 $(HOME)/vtwm.pid. + - Let lexers track line numbers by default. + - Reduced the compiled-in defaults footprint. + Bug Fixes + - Fixed warp bugs when windows are borderless or shaped. + - Fixed some icon move and resize bugs. + - Fixed a vertical placement error in applet regions. + - Fixed most stacking order bugs when moving and resizing windows. + - Cancelled moves and resizes now work correctly, except one case. + - The pointer is adjusted back to the window as needed on resizes. + - Fixed some titlebar highlight exposure bugs. + - Fixed some off-by-clientborderwidth window placement bugs. + - Fixed an off-by-one malloc() and a null pointer reference. + - Checks for the number of rodent buttons and VTWM Windows entries. + - The f.warpring function has been fixed. Again. + - Fixed a race condition when f.squeeze* functions are invoked + from a window menu while Opaque* variables are set. + - Prevent f.squeeze* functions when the DontSqueezeTitle variable + is set. + - Removed the limitations of the f.startwm argument. + - Fixed the 3D borders of titled windows when the BeNiceToColormap + variable is set. + - Reduced server grabs. + - Better handling of missing or empty string resources. + - sound function referenced outside of ifdef. + Misc. + - Updated the man page, and the BUGS, INSTALL, SOUND, and WISHLIST + files. + - Updated the system and sample resource files. + - Updated contrib/support/sysrc_add_apps.sh. + +VTWM 5.4.6b (bugfix release) + + Fixed a bug causing sporadic restarts when realizing unmanaged + windows. + +VTWM 5.4.6a + + Support for borderless windows (added the NoBorder variable). + Better random placement of large windows. + Fixed bugs regarding icon managers and warp rings. + Doors are drawn during opaque interactive creation now. + MakeTitle now overrides NoTitle like it's supposed to. + Added creating and deleting a pid file. + Fixed a focus problem with transient windows. + Improved the list parser in contrib/support/sysrc_add_apps.sh. + +VTWM 5.4.6 + + New Features + - Added pre-processing of the resource file with m4. Parameters + can be passed on the command-line, too. + - Added support for regular expressions ("RE"s) in resource file + window lists. VTWM's own wildcarding is still honored. + - Sound effects are now supported, by way of the rplay library + and daemon (added the PauseOnExit, PauseOnQuit, SoundHost, + Sounds, SoundVolume, and f.sounds resources). + - Added applet regions. For all those handy little utilities we + use every day. + - Added "scrollability" to menus that would be taller than the + display (added the MenuScrollBorderWidth and MenuScrollJump + variables). + - Doors and the virtual desktop can now be rendered in 3D + (added the DoorBevelWidth and VirtualDesktopBevelWidth + variables). + - Non-nailed icons can now stay put at their locations on the + virtual desktop (added the StaticIconPositions and + f.staticiconpositions resources). + - Iconified transient windows of an iconified parent window can + now have their state preserved when that parent is + deiconified (added the DontDeiconifyTransients variable). + - Iconification of windows is now prevented when there is no + provision to deiconify or otherwise restore them. + - Icon managers can now list only iconified windows (added the + StrictIconManager and f.stricticonmgr resources). + - Added support for warping only to visible windows (added the + WarpVisible and f.warpvisible resources). + - Improved response to exposure events of transparent pixmaps + used for window buttons on pointer-driven focus changes. + - Added four built-in button images, two each of down and right + arrows. + Changed Features + - A small tweak in icon and applet regions to have the region + layout logic disregard grid spacing in determining whether a + window will fit. + - Relaxed the door geometry parser, allowing omission of the + position. + - Applied the XPM library's color closeness attribute to + external pixmap images. + - Doors, icon managers, and the virtual desktop have minimum + sizes imposed on them now. + - Doors now override real screen snapping on entry. + - Icon managers now honor the IconifyByUnmapping resource. + - Removed the UseRealScreenBorder variable. If it's non-zero, + why wouldn't you want to use it? + - Added compiled-in options to the build info in the version + window. + - The X database resource "*bitmapFilePath" is now searched for + pixmap image files. + - Random zooms during deiconification are controlled by a + resource now (added the ZoomZoom variable). + - The cursor stays with the titlebar on a squeeze operation, + like it does with zooms. + - All the f.*iconmgr warp functions honor the WarpSnug and + WarpWindows variables now (or absence of). The WarpSnug state + can now be toggled. + Bug Fixes + - Doors, icon managers, and the virtual desktop now respond to + zoom operations properly. + - Doors, icon managers, and the virtual desktop now get redrawn + during opaque resizes (redrawing doors during interactive + creation is still a problem). + - Fixed transposed virtual desktop default foreground and + background colors. + - Work on the bug where windows may be mapped in desktop (0,0) + regardless of the desktop's location in the virtual display. + - Fixed positioning errors for the icon manager and virtual + desktop windows. + - The virtual desktop's bevel and a door's text and bevel now + get redrawn after being resized. + - The virtual desktop now properly accomodates the real + screen's border. + - Skip re-mapping of the virtual desktop to clean up outline + droppings if the window moved or resized is itself. + - When moving an application window in the virtual desktop, the + border of the corresponding real screen window now highlights + as required. + - Windows can now be resized and moved from icon managers and + menus not of the root or window in question. + - Fixed window resizing via the virtual desktop and icon + managers. Fixed window moves (f.move) via the virtual desktop. + - Zooms know about icon managers now. + - Iconified icon managers now behave as one would expect when + removing the last entry in them. + - The f.delete and f.destroy functions now work properly on + doors, icon managers, and the virtual desktop. + - The f.hideiconmgr and f.showiconmgr functions now work + against icon managers defined with the IconManagers resource. + - Fixed bugs in getting icon names, window states, and pixel + atoms from the X server. + - Fixed where truncation of long titles messed up in titlebars + that don't have any left-side buttons. + - The titlebar height now adjusts to external button images. + - Sanity checks on door renames. Fixed two menu repaint bugs. + - Fixed a bug in the display of a renamed door. + - Tweaks to correct the painting of external images on multiple + screens. + - Fixed a bug where icon bitmaps were rendered with the wrong + color. + - Fixed the PanResistance resource's not recognizing when the + pointer has left the autopan windows. + - The icon manager's class is visible to resource list entries + now. + - The window's icon name now has it's own memory space. + Occasionally, VTWM would crash if an app changed it. + - Added a kludge to "fix" not getting the rodent button up + event when deleting doors. + - Fixed the "orphaning" of intermediate parent menu(s) when + skipping them for some superior parent menu. + - Fixed deferred execution on keyboard events when the root + window has focus. + Misc. + - Added support for the rplay library to the make files. + - Added support for regular expressions to the make files. + - Ensure the built-in resources and build info are current + (tweaks in the make files). + - The man page is now included on 'make install'. + - Also in the make files, moved the $(NO_XPM_SUPPORT) and + $(NO_M4_SUPPORT) defines into $(DEFINES), and removed some + SpecialObjectRule()s. Two new definitions and a different + directive make for more flexible installs. + - Renamed the lnf directory to contrib. Created subdirectories + therein for images, sounds, and misc. support stuff. Removed + the leading '.' from the resource file names. + - The system resource files are a bit more useful and appealing. + - A new script in contrib/support can add installed applications + to the system default resource file. + - Updated the sample resource files to demonstrate some of m4's + capabilities. + - Added some sample button image and sound files. + - Updated the BUGS, INSTALL, and WISHLIST files, and added the + HISTORY and SOUND files. + - Moved the man page into doc. + +VTWM 5.4.5a + + Fixed text display bug in the size and position windows. + +VTWM 5.4.5 + + New Features + - Added code to make it a little harder to accidentally pan to + an adjacent virtual screen (added the PanResistance + variable). + - Discovered that VTWM supports a subset of regex wildcards for + list variables! It's in the man page now. + - Added a signal handler for external restarts. + - Added code to restart using a specified window manager (added + the f.startwm function). + - Made the borders of windows without titlebars forward key + events events to the application, like titlebars do. + - Added and aliased the OldFashionedVtwmWindowsMenu variable to + OldFashionedTwmWindowsMenu. + - Added code to suppress entries in th VTWM Windows menu (added + the DontShowInVtwmWindows and DontShowInTwmWindows + variables). + - The window border of the virtual desktop now honors key + bindings to "virtual". + - Doors and their borders are now sensitive to key bindings. + - Added code to inhibit forwarding focus from icon manager + entries to the corresponding application windows (added the + NoIconManagerFocus variable). + - Established a directory, doc, for all the documentation that + has accumulated through time. + - Established a directory, lnf (look n' feel), for the + previously included sample resource and image files, added a + couple more, renamed some. + - Gave the icon manager and virtual desktop resource classes. + - The f.warpclassprev and f.warpclassnext functions now accept + an empty string, meaning the class of the window with focus. + - Added color (XPM) image support for the UnknownIcon variable + and application-specified icons (changed the UnknownIcon + variable). + - The three entries of the Pixmaps variable now fully support + color (XPM) images (changed the Pixmaps variable). + - The 3D rendition of icons is now governed by its own variable + (added the IconBevelWidth variable). + - The position window now reports during moves in the virtual + desktop. + - The position window now reports during constrained moves. + - Added code to support pasting a name into a door (added the + f.namedoor function). + - When windows are created, they now honor the opaque variables + when the RandomPlacement variable is not set. + - While moving and resizing windows on the real screen, the + virtual desktop now responds in kind, and visa-versa (added + the VirtualReceivesMotionEvents and VirtualSendsMotionEvents + variables). + - Added code for opaque resizing (added the OpaqueResize and + NoOpaqueResize variables). + - All opaque variables now support lists (added the + NoOpaqueMove variable, and changed the OpaqueMove variable). + - Added code to properly truncate, then add ellipses to, titles + that are longer than the space they're drawn on. + Changed Features + - Applied the MoveDelta variable to window resizing and initial + menu highlighting. + - Tweaks to suppress menu highlighting on mapping, relieve CPU + consumption on menus bound to rodent buttons, and allow a + second rodent button press to cancel menus. + - Tweaks for application-defined icon border widths. + - All references to and mention of the shadow contrast + variables have been changed to *BevelContrast (changed the + DarkShadowContrast variable to DarkBevelContrast, and the + LightShadowContrast variable to LightBevelContrast). + - All references to and mention of the shadow width variables + have been changed to *BevelWidth, and they are configurable + now (added the BorderBevelWidth, IconManagerBevelWidth, + InfoBevelWidth, MenuBevelWidth, TitleBevelWidth, and + ButtonBevelWidth variables; removed the UseThreeDBorders, + UseThreeDIcons, UseThreeDIconManagers, UseThreeDMenus, + UseThreeDTitles, and ThreeDBorderWidth variables). + - A few changes to grab the server during non-opaque moves and + resizes, regardless of the NoGrabServer variable. + - Changed the foreground color for the built-in "TwmWindows" + menu to that of the global variable (added and aliased "VTWM + Windows" to "TwmWindows"). + - Another tweak to the f.warpclass* functions, to properly + handle multiple icon managers. + - Had to make an exception for icon managers regarding warps, + that their window border isn't the destination. + - The f.warpclass* functions will now exhibit reasonable + behavior when an empty string is used on windows without + titlebars or on VTWM-specific windows. + - Tweaks made to the f.warpclass* variables and the f.warpring + function so the destination is a titlebar or border like the + other warp functions, and the latter now remembers the window + to warp to when invoked from the root window. + - All warping functions now honor the WarpUnmapped variable a + la the f.warpto function (changed the f.warpclassprev, + f.warpclassnext, f.warpnewest, f.warpring, and + f.warptoiconmgr functions). + Bug Fixes + - Fixed a bug with icon manager geometries that would blow VTWM + out of the water. + - Fixed a bug for the AutoPan variable, when the pan windows + are obscured by a newly-raised window. + - Plugged a memory leak, where transparent pixmap resources + weren't freed before re-use. + - Tweaks to streamline icon bitmap handling, and fixed the + painting of non-transparent titlebar highlight pixmaps. + - Tweaks to correct the painting of built-in images on multiple + screens. + - Window buttons can now be beveled when external images are + used. + - Fixed a bug where the titlebar highlight wasn't erased when + focus was unset and the BeNiceToColormap and + SunkFocusWindowTitle variables were used. + - A safer approach to the RaiseDelay variable's timeout. + - Fixed a bug I introduced where non-3D borders were always + rendered as highlighted! + - Fixed some bugs in colormap management. + - Added a few "prevents" when there isn't an icon manager + mapped. + - Made initial window placement adjust to client borderwidths, + depending on related variables. + - The virtual desktop is now re-mapped after non-opaque moves + and resizes to clean up any outline droppings left on it when + the Virtual*MotionEvents variables are set. + - Found and plugged the hole in the original menu handler that + would blow VTWM out of the water when the pointer scrolled + down past the last entry. + - Virtual window geometries now account for 3D borders. + - Virtual-to-real window scaling and positioning errors have + been reduced. + - Re-instated the effects of the RightHandSidePulldownMenus + variable! + - The snug variables now take border width into account. + - Fixed the rendition of a squeezed titlebar's right-side 3D + border (a silly gunkulation error). + - The NoGrabServer variable now sees to it the server is + actually not grabbed! + - The f.warpclassprev function actually goes backwards now! + - Many tweaks to make titlebar-related variables consistant + with respect to each other and 3D rendition of the various + elements. + Misc. + - Even more tweaks for portability, most notably, restoring + X11R4 compatability by not including the X11R5,6 headers + Xosdefs.h and Xfuncs.h! X11R5,6 don't seem to mind. + - Purged GNU-specific syntax from this new Imakefile, and + changed the NO_PUTENV definition to NEED_PUTENV_F, for + consistancy. + - Support for bison. + - Added a define supporting a 2D or 3D system default resource + file. + - Added the system Imake.tmpl macro for flex's library (should + be absent or an empty string on systems with lex). + - Renamed the HINTS file to INSTALL, and it's more + comprehensive now. + +VTWM 5.4.4c + + Added color image (XPM) support for window buttons. + +VTWM 5.4.4b + + Fixed a bug where the window buttons would get painted with the + border color when the background color should have been used. + Fixed warping to titlebars not flush left. + +VTWM 5.4.4a + + Fixed a fault causing a SIGSEGV in the info window. + Purged the use of a depreciated constant in the XPM library. + +VTWM 5.4.4 + + New Features + - Added a variable to tell the icon manager whether or not to + highlight its entries as an indication of pointer location, + regardless of the NoHighlight variable (added the + NoIconManagerHighlight variable). + - Enabled a variable to go easy on the colormap; it doesn't + render perfectly yet (added the BeNiceToColormap variable). + - Color image (XPM) support for icons. + - Added a bug workaround to try to make managed windows used as + transients behave (added the FixManagedVirtualGeometries + variable). + Changed Features + - Allow screen warps to honor the SnapRealScreen variable. + - Simplified the meaning of the SqueezeTitle variable list + parameters. + Bug Fixes + - A better effort at getting a name for the window. + - Added a kludge to "fix" screen warps to de-iconifying windows + not on the real screen (high degree of confidence it's not + the source of the problem). + - Rewrote most of the 3D border code, adding, among other + things, drawing the top border segment when 3D borders are + used with squeezed titles! + - Fixed a bug causing SIGFPEs when pan distances are set to + zero. + - Fixed an oversight where monochrome GCs weren't getting + intialized! + Misc. + - Added the HINTS file to the distribution. + - Moved and added many function declarations into header files + for quieter builds. + - Use the system Imake.tmpl macro for yacc and removed all + escaped characters from the lastmake.c rule in the + *akefile*s. + - On startup, VTWM now searches for user and system .vtwmrc + files, then user and system .twmrc files, in this order. + - Fixed and added many declarations and definitions. + - Updated the man page. + - Support for HTML and Postscript versions of the man page + added to the *akefile*s. + - Pruned the R4 Imakefile from the tree. + - Pruned the vtwmrc/ directory from the distribution tree. + +VTWM 5.4.3 + + Bug Fixes + - Fixed a bug where the wrong variable was being used to + highlight the window border that has focus. + - Fixed an omission where the window buttons would not follow + the border color when highlighted and the ButtonColorIsFrame + variable is true. + - Added a hack to trap corrupted/invalid window button names. + +VTWM 5.4.2 + + New Features + - Modifications for a 3D appearance, menu separators, a + position window, info window fonts, and resize/position + window locations (added the SunkFocusWindowTitle, + UseThreeDIconManagers, UseThreeDMenus, UseThreeDTitles, + UseThreeDBorders, ThreeDBorderWidth, ClearBevelContrast, + DarkBevelContrast, InfoFont, and ResizeRegion variables; + added the f.separator function). + - Added code to properly paint the window buttons in the same + color as their titlebar (added the ButtonColorIsFrame + variable). + - Now closes the display before spawning the new WM on a + restart operation - free alloc'd memory in the X server? + - Applied the backing store and NoBackingStore variables to the + Icon Manager and titlebars (defeats effects of RaiseDelay). + - Added code for Motif-ish "shallow" relief in 3D titlebars and + buttons to matches the others (added the + ShallowReliefWindowButton variable). + Changed Features + - Made a few variables un-alterable when 3D appearances are + used. + - Made the cursor warp to the titlebar on a zoom operation if + WarpCursor is set on. + - The function f.showdesktopdisplay now deiconifies as + required. + - Added build info to the version window by having the + *makefil*s create a temporary C module. + - Tweaked the 3D menu icons to look a little more like menus. + - Made the 3D Icon Manager iconified indicators "shallow" to + match the 3D menu icons. + - Tweaked the hard-coded geometries for a better 3D appearance + on icons (looks best with IconBorderWidth set to 0). + - Changed "Twm Door" to "VTWM Door", in the name of + Consistancy. + - Changed "Virtual Desktop" to "VTWM Desktop". + - Changed the code to center door window names in their + windows. + - Took liberties with the SunkFocusWindowTitle function. + - Changed as many as convenient boolean shorts to bits in a + Slim-Fast effort. + Bug Fixes + - Numerous changes to accomodate added buttons and squeezed + titlebars - I had previously overlooked these. + - Changed code to properly scale menus to the fonts used. + - Fixed a bug in zooms that I introduced! + - Added code preventing the virtual desktop window and door + windows from doing harm. + - Fixed a bug when trying to move the virtual desktop window + with the pointer. + Misc. + - A couple of changes for a cleaner compile (what were 'int' + functions are now 'void', etc.). + - Updated the man page. + +VTWM 5.4.0 - 5.4.1 + + No public release was made of versions before 5.4.2. + + diff --git a/doc/INSTALL b/doc/INSTALL new file mode 100644 index 0000000..bcdc103 --- /dev/null +++ b/doc/INSTALL @@ -0,0 +1,199 @@ + +BUILDING VTWM 5.4 +================= + + - Unpack the distribution. You've likely done that already, no? + + - Determine if you have the XPM library installed: + - The library is usually found in /usr/X11R6/lib, /usr/local/lib, + or some such directory. It's usually called "libxpm.a". + - The header file is usually found in /usr/X11R6/include, + /usr/local/include, or some such directory. It's "xpm.h". + + - Determine if you have regular expressions ("RE"s) support: + - On many systems, the routines are built into the standard + C library. If not, the library might be in /usr/local/lib, + /usr/lib, or some such directory, and would be called + something like "libregex.a". + - The header file is usually found in /usr/local/include, + /usr/include, or some such directory. It's "regex.h". + - Note that the routines must conform to the POSIX 1003.2 + specification. Older systems may have regex support that + predates this POSIX spec, and will not suffice. + + - Determine if you have the rplay library installed: + - The library is usually found in /usr/local/lib, /usr/lib, + or some such directory. It's usually called "librplay.a". + - The header file is usually found in /usr/local/include, + /usr/include, or some such directory. It's "rplay.h". + + - Determine if your system supports internationalization (I18N): + - On many systems, header files "locale.h" and "Xlocale.h" + are found in /usr/include and /usr/X11R6/include/X11, + respectively. + + - Determine if you have the m4 macro processor installed: + - Issuing 'whence m4' or 'which m4' ought to do it. + + - Look over Imakefile, and edit to taste. If you use a VNC client, or + Cygwin under MS-Windows, you may want to make changes as described + further down in this file. Or particular interest to some people + will be the installation path which can be changed by editing + VTWMBINDIR. See also VTWMLIBDIR and VTWMMANDIR. This will allow + installation to other than the system X11 directories where you don't + have root access. + + - Issue 'xmkmf'. If that doesn't work (you'll know it), you'll have + to copy Makefile.QNX to Makefile, and edit the latter to taste. + + - Issue 'make'. This shouldn't take very long at all; VTWM is small. + Should the build break, check further down in this file. If it still + breaks, ask a friend. If it _still_ breaks, you can write me. + + - The sysrc_add_apps.sh script in contrib/support/ may be of help in + customizing the default system resource file. It automagically adds + selected applications found on your system to system.vtwmrc. Issue + 'sh contrib/support/sysrc_add_apps.sh -h' for a brief help message. + + +INSTALLING VTWM 5.4 +=================== + +1) Installation. + If you haven't modified VTWMBINDIR, et al, to point to a non-system + area in which you have write access, you will need to perform the + following install steps as root. + - If you trust whoever set up your build environment: + - issue 'make install'. + If you don't: + - Issue 'make -n install' to see what it'll do, without actually + doing it. + - If you want (or have) to set it up manually: + - Copy vtwm to /usr/X11R6/bin, or to wherever other X + window managers and binaries are. + - Copy system.vtwmrc to wherever it's spec'd in the + Makefile (this path is built into the VTWM binary). + - Copy vtwm.man to wherever other X window manager + man pages are (usually /usr/X11R6/man/mann). + +2) Configuration. + - Set up user resource files: + - Copy system.vtwmrc to your home directory as .vtwmrc, and edit + it to suit your immediate needs (you'll be editing it a lot more, + I'm sure). + - If VTWM supports m4, you can copy the contrib/vtwmrc/ directory + into your home directory as vtwm/ or some such. Then, create a + symlink $(HOME)/.vtwmrc to one of the vtwmrc-*ish files in that + subdirectory, or specify one of those files on VTWM's invocation + (either will give you much more to work with). + - The sysrc_add_apps.sh script in contrib/support/ may also be + useful in customizing user resource files by playing with its + command-line switches. + + - Edit the script that starts your current X window manager to start + VTWM instead (mine is 'vtwm -d :0.0 -f vtwm/vtwmrc-MWMish -s -m -p' + in $(HOME)/.xinitrc). + + - Exit X, and restart it. + + +BUILD HINTS +=========== + + - If, during the build, you get complaints of an undefined "yylineno", + uncomment the "NEED_YYLINENO_V" definition in Imakefile (or the + Makefile) and try the build again. If it is still undefined, also + remove the "extern" keyword from its declaration in gram.y. Likewise, + if "yywrap" turns up as undefined, add a line "yywrap() {return(1)};" + to lex.l. Finally, if "yylex" turns up undefined, it can be fixed by + adding a line "#define YY_DECL int yylex YY_PROTO((void))" to lex.l. + These are all expected to be in the lexer's skeleton file, but there + are some without. + + - If, during the build, you get complaints of undefined data types and + functions "FontSet" and "Xmb" whatall, it's because you've built VTWM + with internationalization (I18N) support, and your system doesn't + support it. Read the comments in Imakefile and/or Makefile.QNX. + + - If, during the build, you get complaints of undefined data types and + functions "Xpm" whatall, it's because you've built VTWM with XPM image + support, and either you don't have the XPM library available, or it's + not a recent enough version (3.4h is the earliest I know of). Read the + comments in Imakefile and/or Makefile.QNX. + + - If, during the build, you get complaints of an undefined data type + "regex_t" or functions "reg" whatall, it's because you've built VTWM + with regular expressions ("RE"s) support, and either you don't have + regex support, or it's not POSIX 1003.2 compliant. Read the comments + in Imakefile and/or Makefile.QNX. + + - If, during the build, you get complaints of an undefined data type + "RPLAY" or functions "rplay" whatall, it's because you've built VTWM + with sound support and you don't have the rplay library available. + Read the comments in Imakefile and/or Makefile.QNX. + + - If, during the build, you get complaints of an unknown data type + "Pixel", add "EXTRA_DEFINES=-DNEED_PIXEL_T" to the make command. + + - If you expected HTML or Postscript man pages on build completion, + or VTWM doesn't fall back on system resource files on startup, read + the comments in Imakefile and/or Makefile.QNX. + + - VNC users: If you regularly use a remote X desktop, you may want to + add "EXTRA_DEFINES=-DORIGINAL_DRAWIT" to the make command. It seems + that VTWM's diagonal resize/move lines are more expensive than TWM's + horizontal and vertical lines. YMMV. + + - Windows users: VTWM is known to build and run under Cygwin with DLL + version 1.3.2. The Makefile may need a line "vtwm: vtwm.exe" added + beneath the "all:: vtwm" line for a successful build. The INSTALL + file and the /usr/X11R6/lib/X11/twm directory may have to be "moved + out of the way" for a successful installation. + + +RUNTIME HINTS +============= + + - Prior to version 5.4.7, key and button bindings were dependent on + various "shift states". Version 5.4.7 can ignore these; check out + the IgnoreModifiers variable. + + - As of version 5.4.7, all window moves and resizes initiated at the + virtual desktop will end there (previous behavior was to leave the + pointer at the window). Bind a function like + Function "move-or-warp" { f.move f.deltastop f.warp } + to a button and the desktop context with something like + Button2 = : desktop : f.function "move-or-warp" + to approximate previous behavior. + + - As of version 5.4.7, the raise that normally accompanies moves and + resizes occurs at operation end, to preserve window stacking order + on cancellation. Set the RaiseOnStart variable for previous behavior. + + - The SunkFocusHighlightWindow variable was depreciated in version + 5.4.7. Set the TitleHighlight argument of the Pixmaps variable to + an appropriate built-in pixmap. + + - If, on startup, things are coming up weird (if at all!), check the + resource file for m4 macros, and if found, see that VTWM is version + 5.4.6 or later, that it was built with m4 support, that "-m" is in + the line that starts VTWM, and that m4 is in $(PATH). + + - The UseRealScreenBorder variable was depreciated in version 5.4.6. + If the RealScreenBorderWidth variable is non-zero, why wouldn't you + want to use it? + + - As of version 5.4.6, random zooms during deiconification won't occur + unless the ZoomZoom variable is set. + + - If you use any of the 3D resources from versions before 5.4.5, you + will find that they generate errors on startup. They no longer exist! + See the man page or the CHANGELOG file for the new resources (look + for the word "Bevel"). + + - If you use a SqueezeTitle list from versions before 5.4.4, you may + want to check the man page to see if the new enterpretation of the + resource's list parameters fouls your setup. + + - See also the man page, and the SOUND and BUGS files in doc/. + diff --git a/doc/SOUND b/doc/SOUND new file mode 100644 index 0000000..eb0cfc3 --- /dev/null +++ b/doc/SOUND @@ -0,0 +1,94 @@ + +NOTES ON SOUND SUPPORT +====================== + +As of version 5.4.6, VTWM can be built to support sound effects, by way of +the rplay library and daemon. The following chart lists the identifiers for +the sounds resource, loosely organized into categories. Those in parentheses +are best described as "event identifiers" - cues that also trigger a sound. + +See the man page and sample resource file for usage and syntax. + + +CREATE DESKTOP START STOP + m ! m f.autopan m f.twmrc + m f.exec m f.panup m f.quit + m f.newdoor m f.pandown m f.restart + e (client map) m f.panleft m f.startwm + m (menu map) m f.panright t (vtwm start) + m f.movescreen t (vtwm stop) + m f.setrealscreen +BUFFER m f.resetdesktop + m ^ m f.enterdoor NAVIGATE + m f.cut m f.snap m f.backiconmgr + m f.cutfile m f.snugdesktop m f.downiconmgr + m f.file m f.snugwindow m f.forwiconmgr + e (autopan event) m f.lefticonmgr + m f.nexticonmgr +ARRANGE m f.previconmgr + m f.autoraise ZOOM RESIZE m f.upiconmgr + m f.circledown m f.bottomzoom m f.righticonmgr + m f.circleup m f.fullzoom m f.warp + m f.lower m f.hbzoom m f.warpclassnext + m f.raise m f.horizoom m f.warpclassprev + m f.raiselower m f.htzoom m f.warpring + m f.deiconify m f.hzoom m f.warpto + m f.iconify m f.leftzoom m f.warptoiconmgr + m f.hidedesktopdisplay m f.rightzoom m f.warptonewest + m f.hideiconmgr m f.topzoom m f.warptoscreen + m f.showdesktopdisplay m f.vlzoom + m f.showiconmgr m f.vrzoom + m f.forcemove m f.zoom MISC + m f.move m f.resize m f.beep + m f.nail m f.colormap + m f.stick m f.deltastop + m f.squeezecenter DELETE DESTROY m f.version + m f.squeezeleft m f.delete m f.identify + m f.squeezeright m f.deletedoor m f.menu + m f.namedoor m f.destroy m f.nailedabove + m f.sorticonmgr e (client unmap) m f.nop + m f.stricticonmgr e (info unmap) m f.saveyourself + m (menu unmap) f.separator + m f.stickyabove + m f.refresh + m f.winrefresh + m f.focus + m f.unfocus + m f.bindbuttons + m f.bindkeys + m f.unbindbuttons + m f.unbindkeys + m f.function + m f.ring + m f.snaprealscreen + m f.staticiconpositions + m f.stricticonmgr + m f.title + m f.virtualgeometries + m f.warpsnug + m f.warpvisible + m f.zoomzoom + f.playsound + f.sounds + m (bell event) + + +LEGEND: + m = handled in menus.c + e = handled in events.c + t = handled in twm.c + = no sound support + +NOTES: + - Where function identifiers overlap event identifiers, the function takes + precedence when both would otherwise play. These identifiers are: + f.beep > (bell event) f.exec > (client map) + f.delete > (client unmap) f.menu > (menu map) + f.deletedoor > (client unmap) f.quit > (vtwm stop) + f.destroy > (client unmap) f.version = f.identify + - f.exec will never know if the program is an X client, nor if it maps a + window if it is, so (client map) might be preferred. + - None should play if the function or event isn't possible, but they will. + - Two variables, PauseOnExit and PauseOnQuit, allow time for exit sounds + to play. + diff --git a/doc/WISHLIST b/doc/WISHLIST new file mode 100644 index 0000000..35fa1f8 --- /dev/null +++ b/doc/WISHLIST @@ -0,0 +1,59 @@ + +WISHES FOR THE FUTURE OF VTWM +============================= + + From vtwm-5.1 spawned two independent versions, vtwm-5.2 and vtwm-5.2b. + The features added to 5.2b are different from the ones added to 5.2, and + I based my version(s) on 5.2 rather than 5.2b since in 5.2 the features + were, in my humble opinion, more useful, while in 5.2b the new stuff was + mostly `chrome' (e.g., XPM support, etc.). I was seriously considering + adding the features from 5.2b into 5.3, but I didn't have enough time. + + I would like to see most of the features from 5.2b merged into the next + version, especially the color XPM support and m4 pre-processing of the + *twmrc file. See below for more info. --- DSE + + [From the CHANGES-5.2 file in the vtwm-5.2b archive] + ---------------------------------------------------------------- begin file + Summary feature list for version 5.2: + + * Added m4 pre-processing of the *twmrc file. courtesy of Dave Edmondson. + DONE - jg + * Added :random color specification, which generates colors on the fly. + * Color XPM support for icons. DONE - jg, djhjr + * Color XPM support for buttons. DONE (the titlebar highlight, the + virtual desktop and it's real screen window, too!) - djhjr + * 3D appearance on menus, titles, icons. DONE (the window's borders, the + virtual desktop, info windows, doors, and icon managers, too!) - djhjr + * Moving in and out of desktop. + * Opaque resizing available. DONE - djhjr + * Both OpaqueResize and OpaqueMove may specify lists of windows as + opposed to being "global". DONE - djhjr + * Can direct focus through desktop at real windows. When enabled, the + desktop windows also indicate the focus highlight by using the border. + * regexps can be used for lists in the vtwmrc. DONE - djhjr + * Size information is displayed during both move and resize. DONE - djhjr + * Size information can be centered in the screen. DONE (any of the + screen corners, too!) - djhjr + * Desktop size may be specified in multiples of real screen. IT'S THERE + (see contrib/vtwmrc-parms) - djhjr + * Can "paste" a new name into a door. DONE - djhjr + * Places property on root window giving virtual coordinates, in case + other programs want to use this info. (e.g. xpostit). + * Now uses a blank/icon startup screen while initialising. + * Many bugfixes, especially to do with desktop stacking order and + iconification/deiconification of the desktop windows. ALMOST ALL + DONE - djhjr + ------------------------------------------------------------------ end file + + * A better way of implementing StickyAbove and "VTWM Profile". + + Here's the list of stuff I would like to see added to VTWM. --- djhjr + + * Support for user-defined icons in menus and the icon manager. MOSTLY + DONE - djhjr + * More coherent/uniform handling of XPM images, particularly where + transparency is concerned. + * I18n support. This will break X11R4 compatability if not done right. + DONE - djhjr + diff --git a/doc/vtwm.man b/doc/vtwm.man new file mode 100644 index 0000000..c6a26b7 --- /dev/null +++ b/doc/vtwm.man @@ -0,0 +1,2668 @@ +.\" twm +.\" .de EX \"Begin example +.\" .ne 5 +.\" .if n .sp 1 +.\" .if t .sp .5 +.\" .nf +.\" .in +.5i +.\" .. +.\" .de EE +.\" .fi +.\" .in -.5i +.\" .if n .sp 1 +.\" .if t .sp .5 +.\" .. +.\" .ta .3i .6i .9i 1.2i 1.5i 1.8i +.TH VTWM 1 "Release 5.4.7" "X11R4-6" +.\"********************************************************************* +.\" Important note: At the time 5.4.4 was released, this manual page +.\" conformed to Sun's guidelines for manual page markup, passed +.\" checknr, had been spell checked and doubled-word checked, and was +.\" automatically translatable to HTML with man2html. Please be careful +.\" in subsequent edits to preserve these important invariants! +.\"********************************************************************* +.\"===================================================================== +.SH NAME +.PP +vtwm - Virtual Tab Window Manager for the X Window System +.PP +.\"===================================================================== +.SH SYNTAX +.PP +\&\fBvtwm\fP [\fB-d\fP \fIdisplay\fP] [\fB-f\fP [\fIinitfile\fP]] +[\fB-m\fP [\fIoptions\fP]] [\fB-p\fP] [\fB-s\fP] [\fB-v\fP] +.PP +.\"===================================================================== +.SH DESCRIPTION +.PP +\&\fBvtwm\fP is a window manager for the X Window System. It provides +titlebars, shaped windows, several forms of icon management, user-defined +macro functions, click-to-type and pointer-driven keyboard focus, and +user-specified key and pointer button bindings. +.PP +This program is usually started by the user's session manager or +startup script. When used from \fBxdm\fP(1) or \fBxinit\fP(1) without +a session manager, \fBvtwm\fP is frequently executed in the foreground +as the last client. When run this way, exiting \fBvtwm\fP causes the +session to be terminated (i.e., logged out). +.PP +By default, application windows are surrounded by a border with a +titlebar at the top. The titlebar contains the window's name, a rectangular +area that indicates when the window is receiving keyboard input, and three +function boxes known as "titlebar buttons". Pressing pointer Button1 (usually +the left-most button unless it has been changed with \fBxmodmap\fP(1)) on any +of these titlebar features will invoke the function associated with them. +.PP +With the default interface, windows are iconified by clicking (pressing and +then immediately releasing) the titlebar button that looks like a dot. +Conversely, windows are deiconified by clicking in the associated icon or +entry in the icon manager (see the descriptions of the variable +\&\fBShowIconManager\fP and the function \fBf.showiconmgr\fP in the +.B BINDINGS +section). +.PP +Windows are resized by pressing the titlebar button that resembles a group +of nested squares, dragging the pointer over the edge that is to be moved, +and releasing the pointer when the window is the desired size. +Similarly, windows are moved by pressing in the title or highlight area, +dragging it to the new location, and then releasing when the window is in +the desired position. Just clicking in the title or highlight area +raises the window without moving it. +.PP +Pressing the titlebar button with the down arrow in it brings up a menu +with many other functions that may be applied to the window. +.PP +When new windows are created, \fBvtwm\fP will honor any size and location +information requested by the user (usually through \fB\-geometry\fP +command line argument or X11 resources for the individual applications). +With the default configuration, Clicking pointer Button1 will position the +window at the current position and give it the default size. Pressing +pointer Button2 (usually the middle pointer button) and dragging the window +will give the window its current position but allow the sides to be resized +as described above. Clicking pointer Button3 (usually the right pointer +button) will give the window its current position but attempt to make it +long enough to touch the bottom of the screen. +.PP +The default behavior during these operations is to represent the window with +an outline of the client window and its titlebar, lines crossing within the +client window. Alternatively, \fBvtwm\fP may be configured to draw the +window completely, but it is not recommended unless yours is a fast system. +.\"===================================================================== +.SH THE VIRTUAL DESKTOP +\&\fBvtwm\fP is based upon the \fBtwm\fP(1) window manager, but adds extra +functionality in the form of a virtual desktop. The virtual desktop is an +area larger than the physical screen. The real screen is considered to be a +window onto portions of the virtual desktop showing whatever windows are +present in that area of the desktop. To help navigate around the desktop, +\&\fBvtwm\fP creates a new window, of the name \fIVTWM Desktop\fP, which shows +the entire desktop using a small scale. In the Virtual Desktop window, all +windows that exist are displayed and various options are provided to recognize +the identity of the different windows (see the descriptions of the variables +\&\fBDesktopDisplayBackground\fP, +\&\fBDesktopDisplayForeground\fP, \fBDesktopDisplayBorder\fP and +\&\fBVirtualDesktopFont\fP). +.PP +To provide a consistent workspace, the option is provided of \fInail\fPing +windows onto the real screen. When a window is nailed, it is considered +stuck to the real screen no matter what part of the desktop is currently +being displayed. +.PP +Normally, a few standard utilities are nailed down: the icon manager, +the desktop view, a load average chart, a clock, and a mail notifier. +The \fBf.nail\fP (or its alias, \fBf.stick\fP) function can be used to +change the nailed status of any window; see the +.B BINDINGS +section for details. +.PP +The root window of the display is unchanged by this program and utilities +such as \fBxsetroot\fP(1) will continue to work unmodified. +.\"===================================================================== +.SH OPTIONS +\&\fBvtwm\fP accepts the following command line options: +.PP +.TP 15 +.B \-d \fIdisplay\fP +This option specifies the X server to use. +.TP 15 +.B \-f \fP[\fIinitfile\fP] +This option specifies the name of the startup file to use. By default, +\&\fBvtwm\fP will look in the user's home directory for files named +\&\fI.vtwmrc.N\fP, \fI.vtwmrc\fP, \fI.twmrc.N\fP, or \fI.twmrc\fP (where +\&'\fIN\fP' is a screen number). It also looks for system-wide default +files; see the +.B CUSTOMIZATION +section below for details. If \fIinitfile\fP is not provided, this specifies +that \fBvtwm\fP should disregard any startup files it finds, and use only the +defaults that are compiled in (intended for testing compiled-in defaults). +.TP 15 +.B \-m \fP[\fIoptions\fP] +This option causes \fBvtwm\fP to preprocess the startup file using the +\&\fBm4\fP(1) macro processor. The \fIoptions\fP will be passed verbatim to +\&\fBm4\fP along with those symbols that \fBvtwm\fP declares. Note that +\&\fIoptions\fP itself should be quoted, to prevent unwanted processing that +may occur by the shell, etc. +.TP 15 +.B \-p +This option indicates that \fBvtwm\fP should attempt to write it's PID to +\&\fI$HOME/vtwm.pid\fP on startup, and delete that file on shutdown. +This file may be useful as a lock file, or for determining the correct +\&\fBvtwm\fP process for a particular user. If the file cannot be written +on startup, a bell will sound, but \fBvtwm\fP will continue. +.TP 15 +.B \-s +This option indicates that only the default screen (as specified by the +\&\fB\-d\fP option or by the \fBDISPLAY\fP environment variable) should be +managed. By default, \fBvtwm\fP will attempt to manage all screens on the +display. +.TP 15 +.B \-v +This option indicates that \fBvtwm\fP should print messages to the stderr +device when an unexpected event occurs. This can be be useful for debugging +applications, but may be distracting in regular use. +.\"===================================================================== +.SH CUSTOMIZATION +.PP +Much of \fBvtwm\fP's appearance and behavior can be controlled by providing +a startup file in one of the following locations (searched in order for +each screen being managed when \fBvtwm\fP begins): +.TP 8 +.I "$HOME/.vtwmrc.\fIscreennumber\fP" +The \fIscreennumber\fP is a small positive number (e.g., 0, 1, etc.) +representing the screen number (e.g., the last number in the DISPLAY environment +variable \fIhost:displaynum.screennum\fP) that would be used to contact that +screen of the display. This is intended for displays with multiple screens of +differing visual types. +.TP 8 +.I "$HOME/.vtwmrc" +This is the usual name for an individual user's startup file. +.TP 8 +.I "$VTWMDIR/twm/system.vtwmrc" +If neither of the preceding files are found, \fBvtwm\fP will look in this +file for a default configuration. +Note that the variable is defined \fIonly in the Makefile\fP, and is often +set and tailored by the site administrator to +provide convenient menus or familiar bindings for novice users. +.TP +.I "$HOME/.twmrc.\fIscreennumber\fP" +.TP +.I "$HOME/.twmrc" +.TP +.I "$VTWMDIR/twm/system.twmrc" +When none of the +.I .vtwmrc +files can be found, +.B vtwm +reverts to acting like +.BR twm (1), +and searches for these three +.I .twmrc +variants. +Note that the variable is defined \fIonly in the Makefile\fP. +.PP +This search algorithm allows both +.BR twm (1) +and +.B vtwm +to coexist peacefully at an installation. Since +.B vtwm +is a superset of +.BR twm (1), +it can even used to replace the latter, and users who have only a +.IR .twmrc -style +file should not notice much difference. +.PP +If no startup files are found, or if \fBvtwm\fP is told to ignore them, +\&\fBvtwm\fP will use built-in defaults as described in the +.B DESCRIPTION +section above, though the \fIsystem.vtwmrc\fP file, if re-configured before +the build, may intervene. The only X11 resource used by \fBvtwm\fP is +\&\fIbitmapFilePath\fP for a colon-separated list of directories to search +when looking for bitmap and pixmap files (for more information, see the +\&\fIAthena Widgets\fP manual and \fBxrdb\fP(1)). +.PP +\&\fBvtwm\fP startup files are logically broken up into three types of +specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. +.PP +The \&\fIVariables\fP section must come first and is used to describe +the fonts, colors, cursors, border widths, icon and window placement, +highlighting, autoraising, layout of titles, warping, and use of the +icon manager. +.PP +The \fIBindings\fP section usually comes second and is used to specify +the functions that should be to be invoked when keyboard and pointer +buttons are pressed in windows, icons, titles, and frames. +.PP +The \fIMenus\fP section gives any user-defined menus (containing +functions to be invoked or commands to be executed). +.PP +Variable names and keywords are case-insensitive. Strings must be surrounded +by double quote characters (e.g., \fI"blue"\fP) and are case-sensitive. +A sharp sign ('#') outside +of a string causes the remainder of the line in which the character appears to +be treated as a comment. +.\"===================================================================== +.SH M4 PREPROCESSING +.PP +A powerful feature of \fBvtwm\fP as of version 5.4.6 is that it can use +\&\fBm4\fP(1) to pre-process it's startup files. When \fBvtwm\fP is started +with \fB\-m\fP, it will open a file for input as described above, but will +process that file through \fBm4\fP before parsing it. So, you can use +\&\fBm4\fP macros to perform operations at runtime. This makes it very easy +to work when you use many different displays, etc. For example, if you want +to set the lower right section of the screen to be your \fBIconRegion\fP, +you can use \fBm4\fP directives and pre-defined symbols to calculate the +region you want: +.RS 4 +.nf +define(IRegion, translit(eval(WIDTH/3)*eval(HEIGHT/2)+eval(WIDTH-WIDTH/3)-0, *, x)) +IconRegion "IRegion" SOUTH EAST 75 25 +.fi +.RE +will define the lower half, and right-hand third of the screen. The symbols +\&\fIWIDTH\fP and \fIHEIGHT\fP are calculated by \fBvtwm\fP for \fBm4\fP to +use. The following symbols are pre-defined by \fBvtwm\fP: +.TP 15 +.B "SERVERHOST" +This variable is set to the name of the machine that is running the X +server. +.TP 15 +.B "CLIENTHOST" +The machine that is running the X clients (i.e., "vtwm", "xterm", etc.). +.TP 15 +.B "HOSTNAME" +The canonical hostname running the clients (i.e., a fully-qualified +version of \fBCLIENTHOST\fP). +.TP 15 +.B "USER" +The name of the user running the program. Gotten from the environment. +.TP 15 +.B "HOME" +The user's home directory. Gotten from the environment. +.TP 15 +.B "VERSION" +The X major protocol version. As seen by ProtocolVersion(). +.TP 15 +.B "REVISION" +The X minor protocol revision. As seen by ProtocolRevision(). +.TP 15 +.B "VENDOR" +The vendor of your X server (i.e., "MIT X Consortium"). +.TP 15 +.B "RELEASE" +The release number of your X server. For MIT X11R5, this is "5". +.TP 15 +.B "WIDTH" +The width of your display in pixels. +.TP 15 +.B "HEIGHT" +The height of your display in pixels. +.TP 15 +.B "X_RESOLUTION" +The X resolution of your display in pixels per meter. +.TP 15 +.B "Y_RESOLUTION" +The Y resolution of your display in pixels per meter. +.TP 15 +.B "PLANES" +The number of bit planes your display supports in the default root window. +.TP 15 +.B "BITS_PER_RGB" +The number of significant bits in an RGB color. (log base 2 of the number +of distinct colors that can be created. This is often different from the +number of colors that can be displayed at once.) +.TP 15 +.B "TWM_TYPE" +Tells which \fBtwm\fP derivative is running. It will always be set to "vtwm" +in this program. This is useful for protecting parts of your startup file +that \fBtwm\fP proper won't understand (like \fBVirtualDesktop\fP) so that it +is still usable with other \fBtwm\fP-based programs. +.TP 15 +.B "CLASS" +Your visual class. Will return one of "StaticGray", "GrayScale", +"StaticColor", "PseudoColor", "TrueColor", "DirectColor", or, if it cannot +determine what you have, "NonStandard". +.TP 15 +.B "COLOR" +This will be either "Yes" or "No". This is just a wrapper around the above +definition. Returns "Yes" on "*Color", and "No" on "StaticGray" and "GrayScale". +.TP 15 +.B "I18N" +This will be either "Yes" or "No" depending on whether support for +internationalization has been compiled in. +.TP 15 +.B "XPM" +This will be either "Yes" or "No" depending on whether support for pixmap +image files has been compiled in. +.TP 15 +.B "SOUND" +This will be either "Yes" or "No" depending on whether support for sound has +been compiled in. +.TP 15 +.B "REGEX" +This will be either "Yes" or "No" depending on whether support for regular +expressions ("RE"s) has been compiled in. +.PP +Note that any symbols passed to \fBm4\fP on the command line that conflict +with these will not be anticipated or dealt with by \fBvtwm\fP; you will be +at the mercy of your particular \fBm4\fP. +.PP +Note also that if \fBvtwm\fP's preparation for executing \fBm4\fP fails, the +startup file will be processed normally, and will choke on the first \fBm4\fP +macro encountered. +.PP +Finally, be aware that \fBm4\fP preprocessing can cause things often found in +startup files to break. For example, quotes and backquotes in shell commands +will be badly messed up by \fBm4\fP's own internal quoting mechanism. This +particular problem can be worked around by placing \fIchangequote(,)\fP at +the top of your startup file. +.PP +Invoking \fBvtwm\fP with both the \fB-m\fP and \fB-v\fP options will print +the \fBm4\fP command with all symbols expanded. +.\"===================================================================== +.SH VARIABLES +.PP +Many of the aspects of \fBvtwm\fP's user interface are controlled by variables +that may be set in the user's startup file. Some of the options are +enabled or disabled simply by the presence of a particular keyword. Other +options require keywords, numbers, strings, or lists of all of these. +.PP +Lists are surrounded by braces and are usually separated by +whitespace or a newline. For example: +.RS 4 +.nf +\&\fBAutoRaise\fP { "emacs" "VTWM*" "x*clock" "Xmh" "XTerm" } +.fi +.RE +or +.RS 4 +.nf +\&\fBAutoRaise\fP +{ + "emacs" + "VTWM*" + "x*clock" + "Xmh" + "XTerm" +} +.fi +.RE +.PP +When a variable containing a list of strings representing windows is searched +(e.g., to determine whether or not to enable autoraise as shown above), a +string must be a case-sensitive match to the window's name (given by the +WM_NAME window property), or the class name or class class (both given by the +WM_CLASS window property). The preceding example would enable autoraise on +windows named "emacs", all \fBvtwm\fP-specific windows, any clocks installed +whose name starts with an 'x' (\fBasclock\fP will not autoraise), and all +\&\fBxmh\fP and \fBxterm\fP windows (which are of class "XTerm" and "Xmh", +respectively). See the +.B WILDCARDS +section for details on what the asterisks ('*') mean. +.PP +String arguments that are interpreted as filenames (see the \fBPixmaps\fP, +\&\fBCursors\fP, and \fBIconDirectory\fP variables below) will +prepend the user's directory +(specified by the \fIHOME\fP environment variable) if the first character is +a tilde ('~'). If, instead, the first character is a colon (':'), the name is +assumed to refer to one of the internal bitmaps that are used to +create 2D titlebar buttons, the 2D icon manager button, and the 2D menu +pull-right icon. Finally, if the first five characters are ":xpm:", the name +is assumed to refer to one of the built-in pixmaps that can used to create 3D +titlebar buttons, the 3D icon manager button, and the 3D menu pull-right icon. +See the +.B IMAGE AND AUDIO FORMATS +section for further details. +.PP +The following variables may be specified in the \fBvtwm\fP startup file. +Lists of window names are indicated by \fIwin-list\fP, and optional arguments +are shown in square brackets. Any default values are based on the distributed +\fIsystem.vtwmrc\fP files, and if none is mentioned, the default setting is +"off", "disabled", or "none". +.PP +.IP "\fBAppletRegion\fP \fIgeomstr\fP \fIvgrav hgrav hgrid vgrid\fP { \fIwin-list\fP }" +This variable specifies an area on the root window in which the windows +listed in \fIwin-list\fP are placed. The \fIgeomstr\fP is a quoted string +containing a standard geometry specification for the region size and location. +If more than one \fBAppletRegion\fP is specified, windows will be put into +succeeding regions that have the window listed when the first is full. The +\&\fIvgrav\fP argument should be either \fBNorth\fP or \fBSouth\fP and is used +to control whether windows are first filled in from the top or bottom of the +region. Similarly, the \fIhgrav\fP argument should be either \fBEast\fP or +\&\fBWest\fP and is used to control whether windows should be filled in from +the left or right. Windows are laid out in a grid with cells \fIhgrid\fP +pixels wide and \fIvgrid\fP pixels high. Note that the smallest dimension of +the region must be at least the size of the largest window in it, including +frame and titlebar, in the same direction. This variable is intended to +simplify management of all those little tool applications like \fBxcb\fP(1), +\&\fBxbiff\fP(1), \fBxload\fP(1), etc. that are used regularly. +.IP "\fBAutoPan\fP \fIN\fP" 8 +This variable allows the screen to automatically pan by \fIN%\fP of a real +screen when the pointer approaches the edge of the screen. The pan will be in +the direction of the edge approached. The default is \fI100\fP, effectively +"paging" across the virtual desktop. +.IP "\fBAutoPanBorderWidth\fP \fIpixels\fP" 8 +If \fBAutoPan\fP is turned on, when the pointer goes within the specified +number of \fIpixels\fP of the real screen's border, the screen is panned. +The default value is \fI5\fP. +.IP "\fBAutoPanExtraWarp\fP \fIpixels\fP" 8 +If \fBAutoPan\fP is turned on and \fBNaturalAutopanBehavior\fP turned off, +this variable specifies how far, in pixels, you want the pointer to move away +from the inner edge of the autopan border +when autopanning. The default value is \fI2\fP pixels. +.IP "\fBAutoPanWarpWithRespectToRealScreen\fP \fIN\fP" 8 +With this option turned on, the pointer is warped by \fIN%\fP as many pixels +on the real screen as the screen is scrolled, or by +.RS 12 +.nf +(\fBAutoPanBorderWidth\fP + \fBAutoPanExtraWarp\fP) +.fi +.RE +.RS +pixels, whichever is greater. See \fBNaturalAutopanBehavior\fP for a more thorough +discussion of this and some recommended settings. +.RE +.IP "\fBAutoRaise\fP [{ \fIwin-list\fP }]" 8 +This variable specifies a list of windows (all windows if \fIwin-list\fP is +omitted) to be automatically raised whenever the pointer has come to rest in +a window for the amount of time specified by the \fBRaiseDelay\fP variable. +This action can be interactively enabled or disabled on individual windows +using the function \fBf.autoraise\fP. +.IP "\fBAutoRaiseDelay\fP \fImilliseconds\fP" 8 +A synonym for \fBRaiseDelay\fP. +.IP "\fBAutoRelativeResize\fP" 8 +This variable indicates that dragging out a window size (either when +initially sizing the window with pointer Button2 or when resizing it) +should not wait until the pointer has crossed the window edges. +Instead, moving +the pointer automatically causes the nearest edge or edges to move by the +same amount. This allows the resizing windows that extend off +the edge of the screen. +If the pointer is +in the center of the window, or if the resize is begun by pressing a +titlebar button, \fBvtwm\fP will still wait for the pointer to cross a window +edge (to prevent accidents). This option is +particularly useful for people who like the press-drag-release method of +sweeping out window sizes. +.IP "\fBBeNiceToColormap\fP" 8 +This variable specifies that stippled lines be used for the bevel colors +when any of the 3D variables are set, to conserve on colormap allocations. +.IP "\fBBorderBevelWidth\fP \fIpixels\fP" 8 +Tells \fBvtwm\fP to use 3D-looking window borders, and specifies the width in +pixels of the bevel. The color of the 3D border is \fBBorderTileBackground\fP, +and if \fBNoHighlight\fP is not selected, the border of the Focus window is +\&\fBBorderColor\fP. The default is \fI0\fP if \fBvtwm\fP is built with +2D features, or \fI2\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBBorderColor\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 +This variable specifies the default color of the border to be placed around +all +non-iconified windows, and may only be given within a \fBColor\fP or +\&\fBMonochrome\fP list. The optional \fIwincolorlist\fP specifies a list +of window and color name pairs for specifying particular border colors for +different types of windows. For example: +.RS 12 +.nf +\&\fBBorderColor\fP "gray50" +{ + "XTerm" "red" + "xmh" "green" +} +.fi +.RE +.IP +The default is \fI"gray70"\fP. +.IP "\fBBorderTileBackground\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 +This variable specifies the default background color in the gray pattern +used in unhighlighted borders (only if \fBNoHighlight\fP hasn't been set), +and may only be given within a \fBColor\fP or \fBMonochrome\fP list. The +optional \fIwincolorlist\fP allows per-window colors to be specified. +The default is \fI"gray60"\fP. +.IP "\fBBorderTileForeground\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 +This variable specifies the default foreground color in the gray pattern +used in unhighlighted borders (only +if \fBNoHighlight\fP hasn't been set), and may only be given within a +\&\fBColor\fP or \fBMonochrome\fP list. The optional \fIwincolorlist\fP allows +per-window colors to be specified. The default is \fI"gray60"\fP. +.IP "\fBBorderWidth\fP \fIpixels\fP" 8 +This variable specifies the width in pixels of the border surrounding +all client window frames if \fBClientBorderWidth\fP has not been specified. +This value is also used to set the border size of windows created by \fBvtwm\fP +(such as the icon manager). The default is \fI2\fP if \fBvtwm\fP is built +with 2D features, or \fI6\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBButtonBevelWidth\fP \fIpixels\fP" 8 +Tells \fBvtwm\fP to use 3D-looking window buttons. It specifies the width +in pixels of the bevel. The default is \fI0\fP if \fBvtwm\fP is built with +2D features, or \fI1\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBButtonIndent\fP \fIpixels\fP" 8 +This variable specifies the size of titlebar buttons, expressed as a difference +from the titlebar font height, and normally means that titlebar buttons will +shrink (built-in images) or be cropped (external images) accordingly. +A negative value is accepted, however, indicating that titlebar buttons should +be larger than the titlebar font. Setting this to a negated \fBFramePadding\fP +value, with \fBTitleButtonBorderWidth\fP set to 0, makes titlebar buttons as +tall and wide as possible. The default is \fI0\fP if \fBvtwm\fP is built with +with 2D features, or \fI-2\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBButtonColorIsFrame\fP" +This variable specifies that the titlebar buttons will be the same color +as the window frame. It is set by default if \fBvtwm\fP is built with 3D +features. +.IP "\fBClearBevelContrast\fP \fIcontrast\fP" 8 +Indicates to \fBvtwm\fP how to calculate the clear bevel color for 3D items. +The value is a compressed to the range 0 and 100. The formula used is: +.RS 12 +.nf +clear.{RGB} = (65535 - color.{RGB}) * (contrast / 100) +.fi +.RE +.IP +The default is \fI40\fP if \fBvtwm\fP is built with 3D features. +.IP "\fBClientBorderWidth\fP" 8 +This variable indicates that width of a window's frame should be set to +the border width as specified by the client, rather than to the value of +\&\fBBorderWidth\fP. If \fBBorderBevelWidth\fP is non-zero, however, this +variable is ignored. +.IP "\fBColor\fP { \fIcolors-list\fP }" 8 +This variable specifies a list of color assignments to be made if the default +display is capable of displaying more than simple black and white. The +\&\fIcolors-list\fP is made up of the following color variables and their values: +\&\fBDefaultBackground\fP, +\&\fBDefaultForeground\fP, +\&\fBMenuBackground\fP, +\&\fBMenuForeground\fP, +\&\fBMenuTitleBackground\fP, +\&\fBMenuTitleForeground\fP, and +\&\fBMenuShadowColor\fP. +The following +color variables may also be given a list of window and color name pairs to +allow per-window colors to be specified (see \fBBorderColor\fP for details): +\&\fBBorderColor\fP, +\&\fBDesktopDisplayForeground\fP, +\&\fBDesktopDisplayBackground\fP, +\&\fBRealScreenForeground\fP, +\&\fBRealScreenBackground\fP, +\&\fBVirtualForeground\fP, +\&\fBVirtualBackground\fP, +\&\fBDekstopDisplayBorder\fP, +\&\fBIconManagerHighlight\fP, +\&\fBBorderTitleBackground\fP, +\&\fBBorderTitleForeground\fP, +\&\fBTitleBackground\fP, +\&\fBTitleForeground\fP, +\&\fBIconBackground\fP, +\&\fBIconForeground\fP, +\&\fBIconBorderColor\fP, +\&\fBIconManagerBackground\fP, and +\&\fBIconManagerForeground\fP. +For example: +.RS 12 +.nf +\&\fBColor\fP +{ + \fBMenuBackground\fP "gray50" + \fBMenuForeground\fP "blue" + \fBBorderColor\fP "red" + { + "XTerm" "yellow" + } + \fBTitleForeground\fP "yellow" + \fBTitleBackground\fP "blue" +} +.fi +.RE +.IP +All of these color variables may also be specified for the \fBMonochrome\fP +variable, allowing the same initialization file to be used on both color and +monochrome displays. +.IP "\fBConstrainedMoveTime\fP \fImilliseconds\fP" 8 +This variable specifies the length of time between button clicks needed to +begin a constrained move operation. Double clicking within this amount +of time when invoking \fBf.move\fP will cause the window only to be moved +in a horizontal or vertical direction. Setting this value to 0 will disable +constrained moves. The default is \fI400\fP milliseconds. +.IP "\fBCursors\fP { \fIcursor-list\fP }" 8 +This variable specifies the glyphs that \fBvtwm\fP should use for various +pointer cursors. Each cursor +may be defined either from the \fBcursor\fP font or from two bitmap files. +Shapes from the \fBcursor\fP font may be specified directly as: +.RS 12 +.nf +\&\fIcursorname\fP "\fIstring\fP" +.fi +.RE +.RS +where \fIcursorname\fP is one of the cursor names listed below, and +\&\fIstring\fP is the name of a glyph as found in the file +/usr/include/X11/cursorfont.h (without the "XC_" prefix). +If the cursor is to be defined +from bitmap files, the following syntax is used instead: +.RE +.RS 12 +.nf +\&\fIcursorname\fP "\fIimage\fP" "\fImask\fP" +.fi +.RE +.RS +where \fIimage\fP and \fImask\fP specify the names of files containing +the glyph image and mask in \fIbitmap\fP(1) form. +The bitmap files are located in the same manner as icon bitmap files. +The following example shows the default cursor definitions: +.RE +.RS 12 +.nf +\&\fBCursors\fP +{ + Frame "top_left_arrow" + Title "top_left_arrow" + Icon "top_left_arrow" + IconMgr "top_left_arrow" + Move "fleur" + Resize "fleur" + Menu "sb_left_arrow" + Button "hand2" + Wait "watch" + Select "dot" + Destroy "pirate" + Door "exchange" + Virtual "rtl_logo" + Desktop "dotbox" +} +.fi +.RE +.IP "\fBDarkBevelContrast\fP \fIcontrast\fP" 8 +Indicates to \fBvtwm\fP has to calculate the dark bevel color for 3D items. +The value is a comprised between 0 and 100. The formula used is: +.RS 12 +.nf +dark.{RGB} = color.{RGB} * ((100 - contrast) / 100) +.fi +.RE +.IP +The default is \fI40\fP if \fBvtwm\fP is built with 3D features. +.IP "\fBDecorateTransients\fP" 8 +This variable indicates that transient windows (those containing a +WM_TRANSIENT_FOR property) should have titlebars. By default, transients +are not reparented. +.IP "\fBDefaultBackground\fP \fIstring\fP" 8 +This variable specifies the background color to be used for sizing and +information windows. The default is \fI"maroon"\fP for color displays or +\fI"gray50"\fP for monochrome displays. +.IP "\fBDefaultForeground\fP \fIstring\fP" 8 +This variable specifies the foreground color to be used for sizing and +information windows. The default is \fI"gray85"\fP. +.IP "\fBDeiconifyToScreen\fP" 8 +When deiconifying a window, by default, the window will be placed +at its previous geometry in the virtual desktop. With this variable +set, +.B vtwm +ensures that the window will be placed somewhere on the real +screen. +.IP "\fBDesktopDisplayBackground\fP \fIcolor\fP [{ \fIwin-list\fP }]" 8 +This variable sets the backgrounds of the little windows inside the +Virtual Desktop window, +AND it sets the backgrounds of menu entries in the \fBVTWM Windows\fP +menu -- unless you specify \fBOldFashionedVtwmWindowsMenu\fP. +The default \fIcolor\fP is used for the default background of +windows not named in the list. The optional +\&\fIwin-list\fP is a list of window names and colors, for example: +.RS 12 +.nf +\&\fBDesktopDisplayBackground\fP "purple" +{ + "zwgc" "green" +} +.fi +.RE +.IP +The default is \fI"gray60"\fP. +.IP "\fBDesktopDisplayBorder\fP \fIcolor\fP [{ \fIwin-list\fP }]" 8 +This variable sets the border color in the +virtual desktop representation window to \fIcolor\fP. +The \fIwin-list\fP is in the same format as \fBTitleForeground\fP and other +similar variables. +.RS 12 +.nf +\&\fBDesktopDisplayBorder\fP "black" +{ + "zwgc" "green" +} +.fi +.RE +.IP +The default is \fI"black"\fP. +.IP "\fBDesktopDisplayForeground\fP \fIcolor\fP [{ \fIwin-list\fP }]" 8 +If both this and the \fBVirtualDesktopFont\fP variable are set, +then the names of the windows will be +written in the window representations shown in the desktop. +This entry also sets foreground colors for entries in the +\&\fBVTWM Windows\fP menu. +The format of this variable is +the same as that used for \fBDesktopDisplayBackground\fP. +The default is \fI"gray85"\fP. +.IP "\fBDontDeiconifyTransients\fP" 8 +This variable sees that iconified transient windows of an iconified parent +window aren't deiconified when that parent is, thus preserving their state. +Default behavior is to deiconify all transient subwindows of the ancestor +window when it is deiconified. +.IP "\fBDontIconifyByUnmapping\fP { \fIwin-list\fP }" 8 +This variable specifies a list of windows that should not be iconified by +simply unmapping the window (as would be the case if \fBIconifyByUnmapping\fP +had been set). This is frequently used to force some windows to be treated +as icons while other windows are handled by the icon manager. +.IP "\fBDontInterpolateTitles\fP" 8 +This variable specifies a modification to the \fBInterpolateMenuColors\fP +behavior. It will cause \fBvtwm\fP to not apply color interpolation to any +titles in the middle of the menu. So, \fBf.title\fP strings that appear in +the middle of the menu (ie, without a specific color defined for them) will +inherit the default MenuTitle foreground and background colors. +.IP "\fBDontMoveOff\fP" 8 +This variable indicates that windows should not be allowed to be moved off the +screen. It can be overridden by the \fBf.forcemove\fP function. +.IP "\fBDontShowInDisplay\fP { \fIlist\fP }" 8 +This variable specifies a list of clients that should not appear in +the desktop display. The default is: +.RS 12 +.nf +\&\fBDontShowInDisplay\fP +{ + "VTWM *" + "xclock" + "xload" +} +.fi +.RE +.IP "\fBDontShowInTwmWindows\fP { \fIlist\fP }" 8 +.IP "\fBDontShowInVtwmWindows\fP { \fIlist\fP }" 8 +These variables specify a list of clients that should not appear in +the \fBVTWM Windows\fP menu. +.IP "\fBDontSqueezeTitle\fP [{ \fIwin-list\fP }] " 8 +This variable indicates that titlebars should not be squeezed to their +minimum size as described under \fBSqueezeTitle\fP below. +If the optional window list is supplied, only those windows will be +prevented from being squeezed. +.IP "\fBDoorBackground\fP \fIcolor\fP [{ \fIdoor-list\fP }]" 8 +Specifies background colors of doors. The default is \fI"maroon"\fP for +color displays or \fI"gray50"\fP for monochrome displays. +.IP "\fBDoorBevelWidth\fP \fIpixels\fP" 8 +Tells \fBvtwm\fP to use 3D-looking doors, and specifies the width in pixels +of the bevel. The default is \fI0\fP if \fBvtwm\fP is built with 2D features, +or \fI1\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBDoorFont\fP \fIstring\fP" +This variable specifies the font to be used for text in doors. This must +be set in order to see the doors. +The default is \fI"-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"\fP. +.IP "\fBDoorForeground\fP \fIcolor\fP [{ \fIdoor-list\fP }]" 8 +Specifies foreground colors of doors. The default is \fI"gray85"\fP. +.IP "\fBDoors\fP { \fIdoor-list\fP }" 8 +This variable is used to create doors, which are teleports. Each item +in the door-list has the following format: +.RS 12 +.nf +"\fIwinname\fP" "\fIlocation\fP" "\fIjumpTo\fP" +.fi +.RE +.IP +Windows with the name \fIwinname\fP appear with geometry and position +as defined in \fIlocation\fP, and warp the user to \fIjumpTo\fP when +\&\fBf.enterdoor\fP is executed inside them. Doors have a class of "VTWM Door". +.IP "\fBEnhancedExecResources\fP" 8 +By default, \fBf.exec\fP variables behaved as they always did in \fBvtwm\fP. You +would have to append " &" to all of your variables in order to execute them +without blocking the window manager. With this option turned on, you don't +have to; \fBvtwm\fP will automatically append " &" to the \fBf.exec\fP variable +.I unless +the last non-space character is either '&' or (in case you still want a +command to block the window manager) ';'. For example, in a variable such as: +.RS 12 +.nf +f.exec "foo; bar; baz" +.fi +.RE +.RS +the window manager will be blocked so that "foo" and "bar" can be executed; +"baz" is the only command which will NOT block the window manager. If you +want all these commands to be backgrounded, try the following: +.RE +.RS 12 +.nf +f.exec "{ foo; bar; baz }" # note that "{" and "}" + # are shell keywords; they + # MUST be separated by + # spaces. +.fi +.RE +.IP +If you still want a command to block the window manager, you would use: +.RS 12 +.nf +f.exec "xset fp rehash;" # vtwm will not append " &" + # because ';' is the last + # non-space character. +.fi +.RE +.IP +This behavior was inspired by that of \fBvuewm\fP(1), Hewlett-Packard's +workspace implementation of \fBmwm\fP(1). +.IP "\fBFixManagedVirtualGeometries\fP" 8 +.IP "\fBFixTransientVirtualGeometries\fP" 8 +These are bug workarounds that *should* fix the way most windows' +virtual geometries are handled, i.e., they should be on the real screen if +the parent windows are on the real screen, no matter where the virtual +desktop is (\fBxv\fP(1) is one example of how these \fIdon't\fP work). +They are both set by default. +.IP "\fBForceIcons\fP" 8 +This variable indicates that icon image files specified in the \fBIcons\fP +variable should override any client-supplied images. +.IP "\fBFramePadding\fP \fIpixels\fP" 8 +This variable specifies the distance between the titlebar font or the +titlebar button height, whichever is greater, and the window frame, enlarging +the titlebar as required. See also \fBButtonIndent\fP, for how it influences +the titlebar. The default is \fI2\fP pixels. +.IP "\fBIconBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 +This variable specifies the background color of icons, and may +only be specified inside of a \fBColor\fP or \fBMonochrome\fP list. +The optional \fIwin-list\fP is a list of window names and colors so that +per-window colors may be specified. See the \fBBorderColor\fP +variable for a complete description of the \fIwin-list\fP. +The default is \fI"maroon"\fP for color displays or \fI"gray50"\fP for +monochrome displays. +.IP "\fBIconBevelWidth\fP \fIpixels\fP" 8 +Tells \fBvtwm\fP to use 3D-looking icons, and specifies the width in pixels +of the bevel. The default is \fI0\fP if \fBvtwm\fP is built with 2D features, +or \fI2\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBIconBorderColor\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 +This variable specifies the color of the border used for icon windows, and +may only be specified inside of a \fBColor\fP or \fBMonochrome\fP list. +The optional \fIwin-list\fP is a list of window names and colors so that +per-window colors may be specified. See the \fBBorderColor\fP +variable for a complete description of the \fIwin-list\fP. +The default is \fI"gray85"\fP. +.IP "\fBIconBorderWidth\fP \fIpixels\fP" 8 +This variable specifies the width in pixels of the border surrounding icon +windows. The default is \fI2\fP if \fBvtwm\fP is built with 2D features, or +\fI0\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBIconDirectory\fP \fIstring\fP" 8 +This variable specifies the directory that should be searched if +an image file cannot be found in any of the directories +in the \fBbitmapFilePath\fP variable. +.IP "\fBIconFont\fP \fIstring\fP" 8 +This variable specifies the font to be used to display icon names within +icons. +The default is \fI"-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"\fP. +.IP "\fBIconForeground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 +This variable specifies the foreground color to be used when displaying icons, +and may only be specified inside of a +\&\fBColor\fP or \fBMonochrome\fP list. +The optional \fIwin-list\fP is a list of window names and colors so that +per-window colors may be specified. See the \fBBorderColor\fP +variable for a complete description of the \fIwin-list\fP. +The default is \fI"gray85"\fP. +.IP "\fBIconifyByUnmapping\fP [{ \fIwin-list\fP }]" 8 +This variable indicates that windows should be iconified by being unmapped +without trying to map any icons. If the optional \fIwin-list\fP is provided, +only those windows will be iconified by simply unmapping. Windows that have +both this and the \fBIconManagerDontShow\fP options set may not be accessible +unless the user has provided bindings to the warp functions (\fBf.warp\fP and +the like) while \fBWarpUnmapped\fP is set, or by the \fBVTWM Windows\fP menu. +It is set by default. +.IP "\fBIconManagerBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 +This variable specifies the background color to use for icon manager entries, +and may only be specified inside of a +\&\fBColor\fP or \fBMonochrome\fP list. +The optional \fIwin-list\fP is a list of window names and colors so that +per-window colors may be specified. See the \fBBorderColor\fP +variable for a complete description of the \fIwin-list\fP. +The default is \fI"maroon"\fP for color displays or \fI"gray50"\fP for +monochrome displays. +.IP "\fBIconManagerBevelWidth\fP \fIpixels\fP" 8 +Tells \fBvtwm\fP to use 3D-looking icon manager entries, and specifies the +width in pixels of their bevels. The default is \fI0\fP if \fBvtwm\fP is +built with 2D features, or \fI1\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBIconManagerDontShow\fP [{ \fIwin-list\fP }]" 8 +This variable indicates that the icon manager should not display any +windows. If the optional \fIwin-list\fP is given, only those windows will +not be displayed. This variable is used to prevent windows that are rarely +iconified (such as \fIxclock\fP or \fIxload\fP) from taking up space in +the icon manager. The default is: +.RS 12 +.nf +\&\fBIconManagerDontShow\fP +{ + "VTWM *" + "xclock" + "xload" +} +.fi +.RE +.IP "\fBIconManagerFont\fP \fIstring\fP" 8 +This variable specifies the font to be used when displaying icon manager +entries. +The default is \fI"-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"\fP. +.IP "\fBIconManagerForeground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 +This variable specifies the foreground color to be used when displaying +icon manager entries, and may only be specified inside of a +\&\fBColor\fP or \fBMonochrome\fP list. +The optional \fIwin-list\fP is a list of window names and colors so that +per-window colors may be specified. See the \fBBorderColor\fP +variable for a complete description of the \fIwin-list\fP. +The default is \fI"gray85"\fP. +.IP "\fBIconManagerGeometry\fP \fIstring\fP [ \fIcolumns\fP ]" 8 +This variable indicates that a default icon manager is to be created, with +the geometry specified with \fIstring\fP. The \fIstring\fP argument should +be a standard X geometry specification, specifying the initial size and/or +location. The icon manager window is then broken into \fIcolumns\fP pieces +and scaled according to the number of entries in the icon manager. Extra +entries are wrapped to form additional rows. +The default \fIstring\fP is \fI"+0+0"\fP, and the default \fIcolumns\fP +is \fI1\fP. +.IP "\fBIconManagerHighlight\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 +This variable specifies the border color to be used when highlighting +the icon manager entry that currently has the focus, +and can only be specified inside of a +\&\fBColor\fP or \fBMonochrome\fP list. +The optional \fIwin-list\fP is a list of window names and colors so that +per-window colors may be specified. See the \fBBorderColor\fP +variable for a complete description of the \fIwin-list\fP. +The default is \fI"black"\fP. +.IP "\fBIconManagers\fP { \fIiconmgr-list\fP }" 8 +This variable specifies a list of icon managers to create, in addition to +the default icon manager if \fBIconManagerGeometry\fP is used. Each item +in the \fIiconmgr-list\fP has the following format: +.RS 12 +.nf +"\fIwinname\fP" ["\fIiconname\fP"] "\fIgeometry\fP" \fIcolumns\fP +.fi +.RE +.RS +where \fIwinname\fP is the name of the windows that should be put into this +icon manager, \fIiconname\fP is the name of that icon manager window's icon, +\&\fIgeometry\fP is a standard geometry specification, and \fIcolumns\fP is +the number of columns in this icon manager as described in +\&\fBIconManagerGeometry\fP. For example: +.RE +.RS 12 +.nf +\&\fBIconManagers\fP +{ + "XTerm" "300x5+800+5" 5 + "myhost" "400x5+100+5" 2 +} +.fi +.RE +.IP +Clients whose name or class is "XTerm" will have an entry created +in the "XTerm" icon manager. Clients whose name was "myhost" would +be put into the "myhost" icon manager. +.IP "\fBIconManagerShow\fP { \fIwin-list\fP }" 8 +This variable specifies a list of windows that should appear in the icon +manager. When used in conjunction with the \fBIconManagerDontShow\fP +variable, only the windows in this list will be shown in the icon manager. +By default, all windows are shown except those in \fBIconManagerDontShow\fP. +.IP "\fBIconRegion\fP \fIgeomstr\fP \fIvgrav hgrav hgrid vgrid\fP" +This variable specifies an area on the root window in which icons are placed +if no specific icon location is provided by the client. The \fIgeomstr\fP +is a quoted string containing a standard geometry specification for the +region size and location. If more than one \fBIconRegion\fP line is given, +icons will be put into the succeeding regions when the first is full. The +\&\fIvgrav\fP argument should be either \fBNorth\fP or \fBSouth\fP and is used +to control whether icons are first filled in from the top or bottom of the +region. Similarly, the \fIhgrav\fP argument should be either \fBEast\fP or +\&\fBWest\fP and is used to control whether icons should be filled in from the +left or right. Icons are laid out in a grid with cells \fIhgrid\fP pixels +wide and \fIvgrid\fP pixels high. Note that the smallest dimension of the +region must be at least the size of the largest icon in it in the same +direction. Note also that many applications change their icon name as they +run, and no provision is made to reformat the icon regions if any icon +changes size accordingly. +.IP "\fBIcons\fP { \fIwin-list\fP }" 8 +This variable specifies a list of window names and the image filenames that +should be used as their icons. For example: +.RS 12 +.nf +\&\fBIcons\fP +{ + "XTerm" "xterm.icon" + "xfd" "xfd_icon" +} +.fi +.RE +.IP +Windows that match "XTerm" and would not be iconified by unmapping, and +would try to use +the icon image in the file "xterm.icon". If \fBForceIcons\fP is +specified, this image will be used even if the client has requested its +own icon image. +.IP "\fBIgnoreModifiers\fP \fImodlist\fP" 8 +This variable specifies the "shift states" to ignore when determining if +an event is bound by \fBvtwm\fP. In this example: +.RS 12 +.nf +\&\fBIgnoreModifiers\fP l | m2 +.fi +.RE +.RS +the CapsLock and NumLock states will be ignored. Note that the use of +this variable can generate quite a bit of X protocol network traffic; +\&\fImodlist\fP should be kept as small as possible. See also the +.B BINDINGS +section. +.RE +.IP "\fBInfoBevelWidth\fP \fIpixels\fP" 8 +Tells \fBvtwm\fP to use 3D-looking identify, move and resize windows, and +specifies the width in pixels of the bevel. The default is \fI0\fP if +\&\fBvtwm\fP is built with 2D features, or \fI2\fP when \fBvtwm\fP is built +with 3D features. +.IP "\fBInfoFont\fP \fIstring\fP" 8 +This variable specifies the font to be used for in the identify window. +The default is \fI"-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"\fP. +.IP "\fBInterpolateMenuColors\fP" 8 +This variable indicates that menu entry colors should be interpolated between +entry specified colors. In this example: +.RS 12 +.nf +\&\fBMenu\fP "mymenu" +{ + "Title" ("black":"red") f.title + "entry1" f.nop + "entry2" f.nop + "entry3" ("white":"green") f.nop + "entry4" f.nop + "entry5" ("red":"white") f.nop +} +.fi +.RE +.RS +the foreground colors for "entry1" and "entry2" will be interpolated +between black and white, and the background colors between red and green. +Similarly, the foreground for "entry4" will be half-way between white and +red, and the background will be half-way between green and white. +.RE +.IP "\fBLessRandomZoomZoom\fP" 8 +With this option turned on, this makes random zooms a bit less "random" and +a bit more visible. This might make a better visual bell, depending on your +personal taste. +.IP "\fBMakeTitle\fP { \fIwin-list\fP }" 8 +This variable specifies a list of windows on which a titlebar should be placed +and is used to request titles on specific windows when \fBNoTitle\fP has been +set. +.IP "\fBMaxWindowSize\fP \fIstring\fP" 8 +This variable specifies a geometry in which the width and height +give the maximum size for a given window. This is typically used to +restrict windows to the size of the screen. The default is \fI"30000x30000"\fP. +.IP "\fBMenuBackground\fP \fIstring\fP" 8 +This variable specifies the background color used for menus, +and can only be specified inside of a \fBColor\fP or \fBMonochrome\fP list. +The default is \fI"maroon"\fP for color displays or \fI"gray50"\fP for +monochrome displays. +.IP "\fBMenuBevelWidth\fP \fIpixels\fP" 8 +Tells \fBvtwm\fP to use 3D-looking menus, and specifies the width in +pixels of the bevel. The default is \fI0\fP if \fBvtwm\fP is built with 2D +features, or \fI2\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBMenuFont\fP \fIstring\fP" 8 +This variable specifies the font to use when displaying menus. +The default is \fI"-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"\fP. +.IP "\fBMenuForeground\fP \fIstring\fP" 8 +This variable specifies the foreground color used for menus, and can only be +specified inside of a \fBColor\fP or \fBMonochrome\fP list. The default is +\&\fI"gray85"\fP. +.IP "\fBMenuScrollBorderWidth\fP \fIpixels\fP" 8 +When the contents of a menu would make it taller than the display, moving +the pointer within \fIpixels\fP of the top or bottom of the menu causes it +to scroll the entries. The default value is \fI2\fP. +.IP "\fBMenuScrollJump\fP \fIentries\fP" 8 +This variable specifies the number of entries to scroll when the pointer +is moved within the area defined by \fBMenuScrollBorderWidth\fP. The +default is \fI3\fP entries. +.IP "\fBMenuShadowColor\fP \fIstring\fP" 8 +This variable specifies the color of the shadow behind pull-down menus +and can only be specified inside of a +\&\fBColor\fP or \fBMonochrome\fP list. The default is \fI"black"\fP. +.IP "\fBMenuTitleBackground\fP \fIstring\fP" 8 +This variable specifies the background color for \fBf.title\fP entries in +menus, and can only be specified inside of a \fBColor\fP or \fBMonochrome\fP +list. The default is \fI"gray70"\fP. +.IP "\fBMenuTitleFont\fP \fIstring\fP" 8 +This variable specifies the font to be used in menu titles. +The default is \fI"-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"\fP. +.IP "\fBMenuTitleForeground\fP \fIstring\fP" 8 +This variable specifies the foreground color for \fBf.title\fP entries in +menus and can only be specified inside of a \fBColor\fP or \fBMonochrome\fP +list. The default is \fI"maroon"\fP for color displays or \fI"gray50"\fP for +monochrome displays. +.IP "\fBMonochrome\fP { \fIcolors\fP }" 8 +This variable specifies a list of color assignments that should be made if +the screen has a depth of 1. See the description of \fBColors\fP. +.IP "\fBMoveDelta\fP \fIpixels\fP" 8 +This variable specifies the number of pixels the pointer must move before +the \fBf.move\fP and \fBf.resize\fP functions and initial menu highlighting +starts working. See also the \fBf.deltastop\fP function. +The default is \fI3\fP pixels. +.IP "\fBNailedAbove\fP" 8 +This variable causes nailed windows to be physically above non-nailed +windows. The \fBf.nailedabove\fP function can be used to toggle this setting. +.IP "\fBNailedDown\fP { \fIlist\fP }" 8 +This variable gives a \fIlist\fP of clients that are nailed initially. +The default is: +.RS 12 +.nf +\&\fBNailedDown\fP +{ + "VTWM *" + "xclock" + "xload" +} +.fi +.RE +.IP "\fBNaturalAutopanBehavior\fP" 8 +By default, when autopanning, the pointer is warped by only +.RS 12 +.nf +(\fBAutoPanBorderWidth\fP + \fBAutoPanExtraWarp\fP) +.fi +.RE +.RS +pixels on the real screen. With this option turned on, the pointer is warped +on the real screen by as many pixels as the screen is scrolled, or the above +value, whichever is greater. Thus, the pointer does not normally move very +much (only by \fBAutoPanExtraWarp\fP) in relation to the virtual desktop. +.RE +.IP +This works really well on faster X terminals and workstations, although for +slower ones, you may want to use the following: +.RS 12 +.nf +\&\fBAutoPanWarpWithRespectToRealScreen\fP 50 +.fi +.RE +.RS +to achieve a similar effect. +Setting \fBNaturalAutopanBehavior\fP has the exact same effect as using the +variable +.RE +.RS 12 +.nf +\&\fBAutoPanWarpWithRespectToRealScreen\fP 100 +.fi +.RE +.IP "\fBNoBackingStore\fP" 8 +This variable indicates that \fBvtwm\fP's windows should not request backing +store to minimize repainting. This is typically +used with servers that can repaint faster than they can handle backing store. +.IP "\fBNoBorder\fP [{ \fIwin-list\fP }] " 8 +This variable indicates that windows should not have borders. If the +optional \fIwin-list\fP is given, only those windows will not have borders. +.IP "\fBNoBorderDecorations\fP" 8 +This variable indicates that the 3D borders of titled windows should not have +the little divots adorning the corners. +.IP "\fBNoCaseSensitive\fP" 8 +This variable indicates that case should be ignored when sorting icon names +in an icon manager. This option is typically used with applications that +capitalize the first letter of their icon name. +.IP "\fBNoDefaultMouseOrKeyboardBindings\fP" 8 +This variable indicates that \fBvtwm\fP should not supply the default pointer +and keyboard bindings. This option should only be used if the startup file +contains a completely new set of pointer and keyboard bindings and definitions. +See also \fBNoDefaults\fP. +.IP "\fBNoDefaults\fP" 8 +This variable indicates that \fBvtwm\fP should not supply the default +titlebar buttons and bindings. This option should only be used if the startup +file contains a completely new set of bindings and definitions. This +function has the effect of setting both \fBNoDefaultMouseOrKeyboardBindings\fP +and \fBNoDefaultTitleButtons\fP. +.IP "\fBNoDefaultTitleButtons\fP" 8 +This variable indicates that \fBvtwm\fP should not supply the default +titlebar buttons. This option should only be used if the startup file +contains a completely new set of titlebar button definitions. See also +\&\fBNoDefaults\fP. +.IP "\fBNoGrabServer\fP" 8 +This variable indicates that \fBvtwm\fP should minimize server grabs when +popping up menus and moving or resizing windows. +.IP "\fBNoHighlight\fP [{ \fIwin-list\fP }]" 8 +This variable indicates that borders should not be highlighted to track the +location of the pointer. If the optional \fIwin-list\fP is given, highlighting +will only be disabled for those windows. When the border is highlighted, it +will be drawn in the current \fBBorderColor\fP. When the border is not +highlighted, it will be stippled with an gray pattern using the +current \fBBorderTileForeground\fP and \fBBorderTileBackground\fP colors. +It is set by default if \fBvtwm\fP is built with 3D features. +.IP "\fBNoIconManagerFocus\fP" 8 +This variable indicates that \fBvtwm\fP should not set focus to windows +corresponding to their entries in an icon manager. Normally, \fBvtwm\fP +sets the focus so that events from an icon manager are delivered to the +application. Typically, this is set to facilitate icon manager bindings +that would otherwise be delivered to the application. +.IP "\fBNoIconManagerHighlight\fP" 8 +This variable indicates that icon manager entries will not be highlighted +to track the location of the pointer. This is independant of the +\&\fBNoHighlight\fP variable. +.IP "\fBNoIconManagers\fP" 8 +This variable indicates that no icon manager should be created. +.IP "\fBNoIconifyIconManagers\fP" 8 +This variable indicates that no icon manager should be iconified. +.IP "\fBNoMenuShadows\fP" 8 +This variable indicates that menus should not have drop shadows drawn behind +them. This is typically used with slower servers since it speeds up menu +drawing at the expense of making the menu slightly harder to read. +.IP "\fBNoOpaqueMove\fP [{ \fIwin-list\fP }]" 8 +.IP "\fBNoOpaqueResize\fP [{ \fIwin-list\fP }]" 8 +These variables indicate that the \fBf.move\fP and \fBf.resize\fP functions +should change just a window's outline. If the optional \fIwin-list\fP is +given, only those windows will be affected. These are usually used to narrow +the scope of "global" \fBOpaqueMove\fP and \fBOpaqueResize\fP variables. +.IP "\fBNoPrettyTitles\fP" 8 +If you don't mind long titles butting up against the right edge of short +titlebars and icon managers. Disables the default behavior of using ellipses +to indicate a truncated title. +.IP "\fBNoRaiseOnDeiconify\fP" 8 +.IP "\fBNoRaiseOnMove\fP" 8 +.IP "\fBNoRaiseOnResize\fP" 8 +.IP "\fBNoRaiseOnWarp\fP" 8 +These variables indicate that windows should not be raised after a deiconify, +move, resize, or warp operation, and are typically used to preserve the window +stacking order. Note that the pointer may end up in an occluding window when +these variables are used. +.IP "\fBNoSaveUnders\fP" 8 +This variable indicates that menus should not request save-unders to minimize +window repainting following menu selection. It is typically used with displays +that can repaint faster than they can handle save-unders. +.IP "\fBNoStackMode\fP [{ \fIwin-list\fP }]" 8 +This variable indicates that client window requests to change stacking order +should be ignored. If the optional \fIwin-list\fP is given, only requests on +those windows will be ignored. This is typically used to prevent applications +from relentlessly popping themselves to the front of the window stack. +.IP "\fBNoTitle\fP [{ \fIwin-list\fP }] " 8 +This variable indicates that windows should not have titlebars. If the +optional \fIwin-list\fP is given, only those windows will not have titlebars. +\&\fBMakeTitle\fP may be used with this option to force titlebars to be put +on specific windows. The default is: +.RS 12 +.nf +\&\fBNoTitle\fP +{ + "VTWM *" + "xclock" + "xload" +} +.fi +.RE +.IP "\fBNoTitleFocus\fP" 8 +This variable indicates that \fBvtwm\fP should not set keyboard input focus to +each window as it is entered. Normally, \fBvtwm\fP sets the focus +so that focus and key events from the titlebar and +icon managers are delivered to the application. If the pointer is moved +quickly and \fBvtwm\fP is slow to respond, input can be directed to the old +window instead of the new. This option is typically +used to prevent this "input lag" and to +work around bugs in older applications that have problems with focus events. +.IP "\fBNoTitleHighlight\fP [{ \fIwin-list\fP }]" 8 +This variable indicates that the highlight area of the titlebar, which is +used to indicate the window that currently has the input focus, should not +be displayed. If the optional \fIwin-list\fP is given, only those windows +will not have highlight areas. This and the \fBSqueezeTitle\fP options +can be set to substantially reduce the amount of screen space required by +titlebars. +.IP "\fBNotVirtualGeometries\fP" 8 +This variable indicates that \fBvtwm\fP should assume that user geometries +should be relative to the current virtual window, as opposed to absolute. +If you set this, then "xterm -geometry +20+20" specifies a position in the +current view; otherwise, it would specify a position in the top-left view. +It is set by default. +.IP "\fBNoWindowRing\fP { \fIwin-list\fP }" 8 +This variable specifies a list of windows that will not be added to the +list along which the \fBf.warpring\fP function cycles. +See also \fBWindowRing\fP. +.IP "\fBOldFashionedTwmWindowsMenu\fP" 8 +.IP "\fBOldFashionedVtwmWindowsMenu\fP" 8 +By default, the \fBVTWM Windows\fP menu will use the same colors +that you see in the panner. This variable disables that behavior. +.IP "\fBOpaqueMove\fP [{ \fIwin-list\fP }]" 8 +.IP "\fBOpaqueResize\fP [{ \fIwin-list\fP }]" 8 +These variables indicate that the \fBf.move\fP and \fBf.resize\fP functions +should actually change the window instead of just an outline so that the user +can immediately see what the window will look like. If the optional +\&\fIwin-list\fP is given, only those windows will be affected "opaquely". +These options are typically used on fast systems (particularly when +\&\fBNoGrabServer\fP is set). +.IP "\fBPanDistanceX\fP \fIN\fP" 8 +.IP "\fBPanDistanceY\fP \fIN\fP" 8 +These variables define a grid of screens for the virtual desktop, expressed +as \fIN%\fP of a real screen. When the \fBf.snap\fP function is called, the +real screen will be moved to the closest grid location. The (mis)naming of +these variables is for historical reasons. The default value is \fI100\fP, +effectively setting up "pages" in the virtual desktop. +.IP "\fBPanResistance\fP \fImilliseconds\fP" 8 +This variable indicates how hard it should be to pan to an adjacent virtual +screen. It specifies how long the pointer must be within \fBAutoPanBorderWidth\fP +pixels of the real screen's edge. Values equal to \fI0\fP or greater than +\&\fI10000\fP disables this feature. The default is \fI750\fP milliseconds. +.IP "\fBPauseOnExit\fP \fIN\fP" 8 +.IP "\fBPauseOnQuit\fP \fIN\fP" 8 +These variables define a delay on exit, expressed in seconds. They allow the +\&\fB(vtwm stop)\fP and \fBf.quit\fP sounds time to play before the connection +to \fBrplayd\fP(8) is closed. +.IP "\fBPixmaps\fP { \fIpixmaps\fP }" 8 +This variable specifies a list of images that define the appearance +of various windows. Each entry is a keyword indicating the window to set, +followed by a string giving the name of the image. Built-in and external +images may be freely mixed, given the constraints described in the +.B IMAGE AND AUDIO FORMATS +section. +The following windows may be specified thus: +.RS 12 +.nf +\&\fBPixmaps\fP +{ + TitleHighlight ":xpm:sunkenbox" + RealScreenPixmap "scaledbackground.xpm" + VirtualBackgroundPixmap "gray1" + MenuIconPixmap ":xpm:rarrow" + IconManagerPixmap ":xpm:zoom" +} +.fi +.RE +.IP +By default, the \fBTitleHighlight\fP is an even, stippled pattern if \fBvtwm\fP +is built with 2D features, or "sunken" lines when \fBvtwm\fP is built with 3D +features. The \fBMenuIconPixmap\fP is a right arrow by default (rendered 3D as +appropriate), and the default \fBIconManagerPixmap\fP is either the X logo or +a "raised" box, for 2D or 3D features, respectively. +.IP "\fBPointerPlacement\fP" 8 +This variable indicates that windows with no specified geometry should +be placed with the window origin at the location of the mouse pointer or, +if \fBWarpSnug\fP is specified, as close as possible to that location such +that the window fits onto the real screen. If \fBRandomPlacement\fP is also +set then it takes precedence. +.IP "\fBPrettyZoom\fP" 8 +If \fBZoom\fP is turned on, this makes the associated animation look just a little +nicer, depending on your personal taste. This makes the zoom slower, +however, so you may have to decrease the value of the \fBZoom\fP variable. +.IP "\fBRaiseDelay\fP \fImilliseconds\fP" 8 +For windows that are to be automatically raised when the pointer enters +(see the \fBAutoRaise\fP variable and the \fBf.autoraise\fP function) +this variable specifies the length of time the pointer should rest in +the window before it is raised. The default is \fI0\fP milliseconds. +.IP "\fBRaiseOnStart\fP" 8 +This variable specifies that the raise which would normally occur at the end +of a move or resize operation (subject to \fBMoveDelta\fP, \fBNoRaiseOnMove\fP, +and \fBNoRaiseOnResize\fP) will occur at the start of the operation. This may +be useful when \fBOpaqueMove\fP and/or \fBOpaqueResize\fP are specified. Note +that cancelling a move or resize operation with this variable set will not +preserve the window stacking order. +.IP "\fBRandomPlacement\fP" 8 +This variable indicates that windows with no specified geometry should +be placed in a pseudo-random location instead of having the user drag an +outline (or the window itself if the \fBOpaqueMove\fP variable is set) to +the preferred location. +.IP "\fBRealScreenBackground\fP \fIstring\fP" 8 +See \fBRealScreenForeground\fP. +.IP "\fBRealScreenBorderWidth\fP \fIpixels\fP" 8 +This value specifies the border width of the \fBRealScreen\fP window +(see \fBRealScreenForeground\fP). The default value is \fI0\fP pixels. +.IP "\fBRealScreenForeground\fP \fIstring\fP" 8 +Inside what \fBvtwm\fP calls the virtual desktop window, but which we might +call the "panner", is a little window that shows where the physical screen +is located in virtual space. The \fBvtwm\fP source code calls this little +window the RealScreen. By default, it has no border, and can be distinguished +from the normal backdrop of the panner only by its color or image. +Its foreground color has no meaning unless you give it an image. +(It can be given a border with \fBRealScreenBorderWidth\fP.) +.IP "\fBRealScreenPixmap\fP \fIstring\fP" 8 +Names an image file used to decorate the RealScreen window. +A sample is provided, \fInestedsqu.xbm\fP, but your mileage may vary as the +size of your screen varies! +It is easy to find out the size of this window and to create any image file +of type \fBbitmap\fP(1) or \fBpixmap\fP(1) for it; that is the recommended +procedure. +.IP "\fBResizeFont\fP \fIstring\fP" 8 +This variable specifies the font to be used for in the dimensions window when +resizing windows. +The default is \fI"-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"\fP. +.IP "\fBResizeRegion\fP \fIlocation\fP" 8 +This variable specifies the area on the screen to display the resize window. +The \fIlocation\fP should be one of \fBNorthWest\fP, \fBNorthEast\fP, +\&\fBSouthWest\fP, \fBSouthEast\fP, or \fBCentered\fP. +.IP "\fBRestartPreviousState\fP" 8 +This variable indicates that +\&\fBvtwm\fP should attempt to use the WM_STATE property on client windows +to tell which windows should be iconified and which should be left visible. +This is typically used to try to regenerate the state that the screen +was in before the previous window manager was shutdown. It is set by default. +.IP "\fBRightHandSidePulldownMenus\fP" 8 +Pull-down menus can appear when the pointer is to the right of the center of +their parent menu, or they can appear when the pointer is closer to the right +edge of their parent menu. This option enables the latter behavior, and is +the default. +.IP "\fBSaveColor\fP { \fIcolors-list\fP }" 8 +This variable indicates a list of color assignments to be stored as pixel +values in the root window property _MIT_PRIORITY_COLORS. Clients may elect +to preserve these values when installing their own colormap. Note that +use of this mechanism is a way an for application to avoid the "technicolor" +problem, whereby useful screen objects such as window borders and titlebars +disappear when a programs custom colors are installed by the window +manager. +For example: +.RS 12 +.nf +\&\fBSaveColor\fP +{ + BorderColor + TitleBackground + TitleForeground + "red" + "green" + "blue" +} +.fi +.RE +.IP +This would place on the root window 3 pixel values for borders and titlebars, +as well as the three color strings, all taken from the default colormap. +.IP "\fBShallowReliefWindowButton\fP" 8 +This indicates that the features of built-in 3D titlebar buttons, the 3D +icon manager button the 3D menu pull-right icon, and the 3D titlebar highlight +area should be rendered with a "flatter" appearance. It is set by default if +\&\fBvtwm\fP is built with 3D features. +.IP "\fBShowIconManager\fP" 8 +This variable indicates that the icon manager window should be displayed when +\&\fBvtwm\fP is started. It can always be brought up using the +\&\fBf.showiconmgr\fP function. +.IP "\fBSnapRealScreen\fP" 8 +This variable causes the real screen to snap to a grid defined in +\&\fBPanDistanceX\fP and \fBPanDistanceY\fP increments whenever the representation +moves. The \fBf.snaprealscreen\fP function can be used to toggle this setting. +.IP "\fBSortIconManager\fP" 8 +This variable indicates that entries in the icon manager should be +sorted alphabetically rather than by simply appending new windows to +the end. It is set by default. +.IP "\fBSoundHost\fP \fIstring\fP" 8 +This variable specifies what machine (by its \fITCP/IP hostname\fP) is +running the \fBrplayd\fP(8) daemon. If not specified, the local machine +is tried. If \fBrplayd\fP(8) cannot be accessed, sound will be toggled off. +.IP "\fBSounds\fP { \fIsound-list\fP }" 8 +This variable is a list of identifiers and associated sound files. It +contains entries of the form: +.RS 12 +.nf +"\fIidentifier\fP" "\fIsoundfile\fP" [\fIvolume\fP] +.fi +.RE +.RS +where \fIidentifier\fP is any function described in the +.B BINDINGS +section except \fBf.playsound\fP, \fBf.sounds\fP, and \fBf.separator\fP, +as well as these event identifiers: \fB(vtwm start)\fP, \fB(vtwm stop)\fP, +\&\fB(client map)\fP, \fB(client unmap)\fP, \fB(menu map)\fP, +\&\fB(menu unmap)\fP, \fB(info unmap)\fP, \fB(autopan event)\fP, +and \fB(bell event)\fP. The \fIsoundfile\fP is the full pathname of +the sound file to play for the associated \fIidentifier\fP, and +\&\fIvolume\fP sets the volume for which to play that sound (see also +\&\fBSoundVolume\fP). Note that the list entries must be quoted: +.RE +.RS 12 +.nf +\&\fBSounds\fP +{ + "(vtwm start)" "/usr/share/sounds/wowee.wav" + "(vtwm stop)" "/usr/share/sounds/seeya.wav" + "f.exec" "/usr/share/sounds/click.au" 50 + "(client map)" "/usr/share/sounds/ping.au" 50 + "f.delete" "/usr/share/sounds/doh1.wav" + "f.deletedoor" "/usr/share/sounds/doh2.wav" + "f.destroy" "/usr/share/sounds/doh3.wav" + "(client unmap)" "/usr/share/sounds/ping.au" +} +.fi +.RE +.IP +This example points out that some \fIidentifier\fPs "overlap": +.RS 12 +.nf +f.beep > (bell event) f.exec > (client map) +f.delete > (client unmap) f.menu > (menu map) +f.deletedoor > (client unmap) f.quit > (vtwm stop) +f.destroy > (client unmap) f.version = f.identify +.fi +.RE +.IP +In these cases, the function takes precedence over the event when both +would otherwise play. +.IP "\fBSoundVolume\fP \fIN\fP" 8 +This variable sets the overall volume for which to play sounds, expressed +as \fIN%\fP of maximum. Default is \fI25\fP (1/4 attenuation). +.IP "\fBSqueezeTitle\fP [{ \fIsqueeze-list\fP }] " 8 +This variable indicates that \fBvtwm\fP should attempt to use the SHAPE +extension to make titlebars occupy only as much screen space as they need, +rather than extending all the way across the top of the window. +The optional \fIsqueeze-list\fP +may be used to control the location of the squeezed titlebar along the +top of the window. It contains entries of the form: +.RS 12 +.nf +"\fIname\fP" \fIjustification\fP \fInum\fP \fIdenom\fP +.fi +.RE +.RS +where \fIname\fP is a window name, \fIjustification\fP is either +\&\fBleft\fP, \&\fBcenter\fP, or \fBright\fP, and \fInum\fP and +\&\fIdenom\fP are numbers specifying a ratio for the relative position +about which the titlebar is located, measured from left to right. +A ratio of 0/0 indicates that the \fIjustification\fP is absolute, +A non-zero numerator with a zero denominator indicates a pixel count, +and the \fIjustification\fP is ignored entirely for any other ratio. +For example: +.RE +.RS 12 +.nf +\&\fBSqueezeTitle\fP +{ + "XTerm" left 0 0 + "xterm1" left 1 3 + "xterm2" right 2 3 + "oclock" center 0 0 + "emacs" right 0 0 +} +.fi +.RE +.IP +The \fBDontSqueezeTitle\fP list can be used to turn off squeezing on +certain titles. It is set by default. +.IP "\fBStartIconified\fP [{ \fIwin-list\fP }] " 8 +This variable indicates that client windows should initially be left as +icons until explicitly deiconified by the user. If the optional \fIwin-list\fP +is given, only those windows will be started iconic. This is useful for +programs that do not support an \fI-iconic\fP command line option or +resource. +.IP "\fBStaticIconPositions\fP" 8 +This variable alters icon placement such that they will maintain their +positions on the virtual desktop when not nailed and \fBDeiconifyToScreen\fP +is not used. This is most applicable when \fBSnapRealScreen\fP and +\&\fBAutoPan\fP is used with \fBPanDistanceX\fP and \fBPanDistanceY\fP values +to simulate \fBctwm\fP(1) workspaces. +.IP "\fBStayUpMenus\fP" 8 +This variable alters menu interaction. By default, a menu item is selected +when a pointer button is released over it. This variable causes menu items to +be selected on the next button press event. +.IP "\fBStayUpOptionalMenus\fP" 8 +This variable is similar to \fBStayUpMenus\fP, except that if any menu items +are selected, the menu interaction reverts to the old behavior. For example, +suppose you have the right pointer button bound to bring up a menu with a title +bar. Clicking the right button and releasing it (over the title bar) will +bring up the menu and have it stay up until you click on a menu item. +Clicking the right button, moving the pointer to a menu item, and releasing +the right button will activate that menu item and dismiss the menu. +.IP "\fBSticky\fP { \fIlist\fP }" 8 +A synonym for \fBNailedDown\fP. +.IP "\fBStickyAbove\fP" 8 +A synonym for \fBNailedAbove\fP. +.IP "\fBStrictIconManager\fP" 8 +This variable causes icon managers to list only those windows that are in +an iconified state. +.IP "\fBTitleBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 +This variable specifies the background color used in titlebars, and may only +be specified inside of a \fBColor\fP or \fBMonochrome\fP list. The optional +\&\fIwin-list\fP is a list of window names and colors so that per-window +colors may be specified. The default is \fI"maroon"\fP for color displays +or \fI"gray50"\fP for monochrome displays. +.IP "\fBTitleBevelWidth\fP \fIpixels\fP" 8 +Tells \fBvtwm\fP to use 3D-looking titlebars, and specifies the width in +pixels of the bevel that surrounds the titlebar. If the value of +\&\fBButtonIndent\fP added to \fBFramePadding\fP equals zero, the bevel +will be bound to the text and highlight area. The default is \fI0\fP +if \fBvtwm\fP is built with 2D features, or \fI1\fP when \fBvtwm\fP is +built with 3D features.. +.IP "\fBTitleButtonBorderWidth\fP \fIpixels\fP" 8 +This variable specifies the width in pixels of the border surrounding +titlebar buttons, drawn in the \fBTitleForeground\fP color. The default is +\fI1\fP if \fBvtwm\fP is built with 2D bitmaps, or \fI0\fP when \fBvtwm\fP +is built with 3D pixmaps. +.IP "\fBTitleFont\fP \fIstring\fP" 8 +This variable specifies the font to used for displaying window names in +titlebars. +The default is \fI"-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"\fP. +.IP "\fBTitleForeground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 +This variable specifies the foreground color used in titlebars, and +may only be specified inside of a \fBColor\fP or \fBMonochrome\fP list. +The optional \fIwin-list\fP is a list of window names and colors so that +per-window colors may be specified. The default is \fI"maroon"\fP for color +displays or \fI"gray50"\fP for monochrome displays. +.IP "\fBTitlePadding\fP \fIpixels\fP" 8 +This variable specifies the distance between titlebar buttons in the titlebar. +Note that distances between buttons and the title, the title and the highlight +area, and the highlight area and buttons, are all set to a hard-coded value. +The default is \fI5\fP if \fBvtwm\fP is built with 2D features, or \fI0\fP +when \fBvtwm\fP is built with 3D features. +.IP "\fBUnknownIcon\fP \fIstring\fP" 8 +This variable specifies the filename of an image file to be +used as the default icon. This image will be used as the icon of all +clients which do not provide an icon image and are not listed +in the \fBIcons\fP list. +.IP "\fBUsePPosition\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 +This variable specifies whether or not \fBvtwm\fP should honor +program-requested locations (given by the \fBPPosition\fP flag in the +WM_NORMAL_HINTS property), in the absence of a user-specified position. +The argument \fIstring\fP may have one of three values: \fI"off"\fP +(the default) indicating that \fBvtwm\fP should ignore the program-supplied +position, \fI"on"\fP indicating that the position should be used, and +\&\fI"non-zero"\fP indicating that the position should used if it is other +than (0,0) (for working around a bug in older toolkits). +The optional \fIwin-list\fP is a list of window names and arguments that +will override the global \fIstring\fP argument. For example: +.RS 12 +.nf +\&\fBUsePPosition\fP "off" +{ + "MPlayer" "on" +} +.fi +.RE +.IP "\fBVirtualBackground\fP \fIstring\fP" 8 +This is the background color for the panner, a.k.a. the Virtual Desktop +window. The default is \fI"maroon"\fP for color displays or \fI"gray50"\fP +for monochrome displays. +.IP "\fBVirtualBackgroundPixmap\fP \fIstring\fP" 8 +Names an image file to decorate the panner. +.IP "\fBVirtualForeground\fP \fIstring\fP" 8 +Foreground for the panner; has no use unless you specify a panner +image of type \fBbitmap\fP(1). +.IP "\fBVirtualDesktop\fP \fIgeometry\fP \fIscale\fP" 8 +This variable must be set to enable the virtual desktop features of +\&\fBvtwm\fP. If this variable is not set, \fBvtwm\fP will behave in +the same manner as \fBtwm\fP. This variable specifies where to place +the virtual desktop window and its size. The \fIgeometry\fP is a +standard X geometry specification and defines the size and location +of the window containing the desktop representation. +.IP +The \fIscale\fP parameter specifies the scaling of the virtual +desktop window compared to the desktop. The size specification can +be given in three ways: If size is larger than the screen size, it +represents the size of the whole desktop, and the virtual window desktop +size will then be size divided by \fIscale\fP. When size times +\&\fIscale\fP is smaller than the screen size, size represents the +number of screens that should fit in the desktop. Otherwise size +represents the size of the virtual desktop window, and the currently +accessible virtual desktop is then \fIscale\fP times the size of the +desktop window. Using the default as an example: +.RS 12 +.nf +\&\fBVirtualDesktop\fP "5x2-0-0" 16 +.fi +.RE +.RS +With \&\fIscale\fP set to \fI16\fP, and a physical screen size of 1024x768, +the desktop area is 1/16 the size of the screen times the number of screens +specified: +.RE +.RS 12 +.nf +(5 * (1024 / 16)) x (2 * (768 / 16)) = 320 x 96 +.fi +.RE +.IP +The size of the desktop can be changed dynamically, by simply resizing the +virtual desktop window. +.IP "\fBVirtualDesktopBevelWidth\fP \fIpixels\fP" 8 +Tells \fBvtwm\fP to use a 3D-looking virtual desktop, and specifies the width +in pixels of the bevel. The default is \fI0\fP if \fBvtwm\fP is built with 2D +features, or \fI1\fP when \fBvtwm\fP is built with 3D features. +.IP "\fBVirtualDesktopFont\fP \fIfont\fP" 8 +This variable causes \fIfont\fP to be used when displaying the names +of windows in the virtual desktop display. If this variable is not +set, then names will not be displayed. The \fBDesktopDisplayForeground\fP +should also be set for this feature to be useful. +The default is \fI"-adobe-helvetica-medium-r-normal--*-75-*-*-*-*-*-*"\fP. +.IP "\fBVirtualReceivesMotionEvents\fP" 8 +.IP "\fBVirtualSendsMotionEvents\fP" 8 +These variables indicate that changes to the position and dimension of +windows on the real screen will be reflected in the virtual desktop as +they occur, and visa-versa. +.IP "\fBWarpCentered\fP \fIstring\fP" 8 +By default, on warps to windows, the pointer goes to either the center of +the titlebar, or in the absence of, the center of the top border member. +This variable specifies that the pointer should warp to the center of the +window depending on the \fIstring\fP argument: \fI"on"\fP indicates all +windows, \fI"titled"\fP indicates titled windows only, \fI"untitled"\fP +indicates untitled windows only, and \fI"off"\fP (the default) indicating +the default behavior. Note that warps to icon managers are exceptional: +The pointer always goes to either the active entry, or in the absence of, +the top entry. +.IP "\fBWarpCursor\fP [{ \fIwin-list\fP }]" 8 +This variable indicates that the pointer should be warped into windows when +they are deiconified. If the optional \fIwin-list\fP is given, the pointer +will only be warped when those windows are deiconified. It is set by default. +.IP "\fBWarpSnug\fP" 8 +With this variable set, the warp functions (\fBf.warp\fP and the like) will +fit the entire window on the screen, i.e., they'll be snugged on the real +screen. +.IP "\fBWarpToTransients\fP" 8 +This variable indicates that the pointer should be warped into transient +windows when they are created. +.IP "\fBWarpUnmapped\fP" 8 +This variable indicates that the warp functions (\fBf.warp\fP and the like) +should deiconify any iconified windows they encounter. This is typically +used to make a key binding that will pop a particular window (such as +\&\fIxmh\fP), no matter where it is. The default is for the functions to +ignore iconified windows. +.IP "\fBWarpVisible\fP" 8 +This variable indicates that the warp functions \fBf.warpclassnext\fP, +\&\fBf.warpclassprev\fP, \fBf.warpring\fP, and \fBf.warpto\fP should restrict +themselves to windows that are on the screen. The default is for the +functions to traverse the entire virtual desktop. +.IP "\fBWarpWindows\fP" 8 +When warping to a window, by default the real screen will be moved +to find the window on the virtual desktop. With this set, the window +itself will be warped to the real screen, moving the window in the virtual +desktop. +.IP "\fBWindowRing\fP [{ \fIwin-list\fP }]" 8 +This variable specifies that when windows are created, they should be added +to the list that the \fBf.warpring\fP function operates on. If the optional +\&\fIwin-list\fP is given, then only those windows will be included in the +window ring. See also \fBNoWindowRing\fP and \fBf.ring\fP. +.IP "\fBXorValue\fP \fInumber\fP" 8 +This variable specifies the value to use when drawing window outlines for +moving and resizing. This should be set to a value that will result in a +variety +of distinguishable colors when exclusive-or'ed with the contents of the +user's typical screen. Setting this variable to 1 often gives nice results +if adjacent colors in the default colormap are distinct. By default, +\&\fBvtwm\fP will attempt to cause temporary lines to appear at the opposite +end of the colormap from the graphics. +.IP "\fBZoom\fP [ \fIcount\fP ]" 8 +This variable indicates that outlines suggesting movement of a window +to and from its iconified state should be displayed whenever a window is +iconified or deiconified. The optional \fIcount\fP argument specifies the +number of outlines to be drawn. The default count is \fI8\fP. +.IP "\fBZoomZoom\fP" 8 +This variable modifies zooms such that a random place will be used for the +source or destination when there isn't an appropriate window (e.g., an icon, +icon manager entry, or client window). Default behavior inhibits zooms when +there aren't appropriate windows, except for the \fBf.zoomzoom\fP function. +.\"===================================================================== +.SH SPECIAL VARIABLES +.PP +The following variables must be set after the fonts have been +assigned, so it is usually best to put them at the end of the variables +or beginning of the bindings sections: +.IP "\fBDefaultFunction\fP \fIfunction\fP" 8 +This variable specifies the function to be executed when a key or button +event is received for which no binding is provided. This is typically +bound to \fBf.nop\fP, \fBf.beep\fP, or a menu containing window operations. +.IP "\fBWindowFunction\fP \fIfunction\fP" 8 +This variable specifies the function to execute when a window is selected +from the \fBVTWM Windows\fP menu. If this variable is not set (default), +the window will be deiconified and raised. It is strongly recommended that +if this is set, the function includes provision for deiconifying windows. +.\"===================================================================== +.SH BINDINGS +.PP +After the desired variables have been set, functions may be attached +titlebar buttons and key and pointer buttons. Titlebar buttons may be added +from the left or right side and appear in the titlebar from left-to-right +according to the +order in which they are specified. Key and pointer button +bindings may be given in any order. +.PP +Titlebuttons specifications must include the name of the image to use in +the button box and the function to be invoked when a pointer button is +pressed within them: +.RS 4 +.nf +\&\fBLeftTitleButton\fP "\fIimage\fP" = \fIfunction\fP +.fi +.RE +or +.RS 4 +.nf +\&\fBRightTitleButton\fP "\fIimage\fP" = \fIfunction\fP +.fi +.RE +.PP +See the \fBButtonIndent\fP and \fBFramePadding\fP variables and the +.B IMAGE AND AUDIO FORMATS +section for details on the \fIimage\fP specification. +.PP +Key and pointer button specifications must give the modifiers that must +be pressed, over which parts of the screen the pointer must be, and what +function is to be invoked. Keys are given as strings containing the +appropriate +keysym name; buttons are given as the keywords \fBButton1\fP-\fBButton5\fP: +.RS 4 +.nf +"FP1" = \fImodlist\fP : \fIcontext\fP : \fIfunction\fP +\&\fBButton1\fP = \fImodlist\fP : \fIcontext\fP : \fIfunction\fP +.fi +.RE +.PP +The \fImodlist\fP is any combination of the modifier names \fBshift\fP, +\&\fBcontrol\fP, \fBlock\fP, \fBmeta\fP, \fBmod1\fP, \fBmod2\fP, \fBmod3\fP, +\&\fBmod4\fP, or \fBmod5\fP (which may be abbreviated as +\&\fBs\fP, \fBc\fP, \fBl\fP, \fBm\fP, \fBm1\fP, \fBm2\fP, \fBm3\fP, \fBm4\fP, +\&\fBm5\fP, respectively) separated by a vertical bar (\(or). +Similarly, the \fIcontext\fP is any combination of +\&\fBwindow\fP, +\&\fBtitle\fP, +\&\fBicon\fP, +\&\fBroot\fP, +\&\fBframe\fP, +\&\fBvirtual\fP, +\&\fBdesktop\fP, +\&\fBdoor\fP, +\&\fBiconmgr\fP, their first letters (\fBiconmgr\fP abbreviation is +\&\fBm\fP, \fBdoor\fP has no abbreviation), +or \fBall\fP, separated by a vertical bar. It is rumored that window class +names will also work. The \fIfunction\fP is any of the \fBf.\fP keywords +described below. For example, the default startup file contains the following +bindings: +.RS 4 +.nf +Button1 = : root : f.menu "VTWM Windows" +Button1 = m : window | icon : f.function "move-or-lower" +Button2 = m : window | icon : f.iconify +Button3 = m : window | icon : f.move +Button1 = : title : f.move +Button2 = : title : f.raiselower +Button1 = : icon : f.function "move-or-iconify" +Button2 = : icon : f.iconify +Button1 = : iconmgr : f.iconify +Button2 = : iconmgr : f.iconify +.fi +.RE +.PP +A user who wanted to be able to manipulate windows from the keyboard could +use the following bindings: +.RS 4 +.nf +"F1" = : all : f.iconify +"F2" = : all : f.raiselower +"F3" = : all : f.warpring "next" +"F4" = : all : f.warpto "xmh" +"F5" = : all : f.warpto "emacs" +"F6" = : all : f.colormap "next" +"F7" = : all : f.colormap "default" +"F20" = : all : f.warptoscreen "next" +"Left" = m : all : f.backiconmgr +"Right" = m | s : all : f.forwiconmgr +"Up" = m : all : f.upiconmgr +"Down" = m | s : all : f.downiconmgr +.fi +.RE +.PP +Note, however, that using \fIall\fP for button or key bindings is +almost always a bad idea, since it prevents all applications from +receiving those events; this can cripple text and graphics editors +that otherwise expect to see those buttons or keys (see also the +\&\fBIgnoreModifiers\fP variable, and the \fBf.bindbuttons\fP, +\&\fBf.bindkeys\fP, \fBf.unbindbuttons\fP, and \fBf.unbindkeys\fP +functions). +.PP +\&\fBvtwm\fP provides many more window manipulation primitives than can be +conveniently stored in a titlebar, menu, or set of key bindings. Although +a small set of defaults are supplied (unless either \fBNoDefaults\fP, +\&\fBNoDefaultMouseOrKeyboardBindings\fP, or \fBNoDefaultTitleButtons\fP is +specified), most users will want to have their most common operations +bound to key and button strokes. To do this, \fBvtwm\fP associates names +with each of the primitives and provides \fIuser-defined functions\fP for +building higher level primitives and \fImenus\fP for interactively selecting +among groups of functions. +.PP +User-defined functions contain the name by which they are referenced in +calls to \fBf.function\fP and a list of other functions to execute. For +example: +.RS 4 +.nf +Function "move-or-lower" { f.move f.deltastop f.lower } +Function "move-or-iconify" { f.move f.deltastop f.iconify } +Function "restore-colormap" { f.colormap "default" f.lower } +.fi +.RE +.PP +The function name must be used in \fBf.function\fP exactly as it appears in +the function specification. +.PP +\&\fBVTWM PROFILE\fP. If a function called "VTWM Profile" +is defined within the startup file, that function will be executed +upon startup or restarting of the window manager. For example: +.RS 4 +.nf +AutoPan 25 +Function "VTWM Profile" +{ + f.autopan +} +.fi +.RE +gives \fBAutoPan\fP a value but turns autopanning off initially (it won't +have a value unless \fBAutoPan\fP is set in the startup file; see +\&\fBf.autopan\fP below), in case you want to turn it on sometime later. +.PP +In the descriptions below, if the function is said to operate on the selected +window, but is invoked from a root menu, the cursor will be changed to +the \fBSelect\fP cursor and the next window to receive a button press will +be chosen: +.IP "\fB!\fP \fIstring\fP" 8 +This is an abbreviation for \fBf.exec\fP \fIstring\fP. +.IP "\fB^\fP \fIstring\fP (OBSOLETE --- use a clipboard client)" 8 +This is an abbreviation for \fBf.cut\fP \fIstring\fP. +.IP "\fBf.autopan\fP" 8 +If autopan wasn't configured in your .vtwmrc file, this does +nothing. If, however, it was configured, this toggles the current +autopan state. The reason for this command is that autopan is +sometimes nice to have, but it interferes with using sticky windows +that are near the edge of the screen. With this command, you get the +best of both worlds. +.IP "\fBf.autoraise\fP" 8 +This function toggles whether or not the selected window is raised whenever +entered by the pointer. See the description of the variable \fBAutoRaise\fP. +.IP "\fBf.backiconmgr\fP" 8 +This function warps the pointer to the previous column in the +current icon manager, wrapping back to the previous row if necessary. +.IP "\fBf.beep\fP" 8 +This function sounds the keyboard bell. +.IP "\fBf.bindbuttons\fP" 8 +.IP "\fBf.bindkeys\fP" 8 +These functions enable \fBvtwm\fP's pointer or keyboard bindings for the +selected window. These are only needed if the bindings have been disabled +with the \fBf.unbindbuttons\fP or \fBf.unbindkeys\fP functions. Be careful +what you bind these functions to; \fBf.bindkeys\fP bound to a window context +key will not be accessable after \fBf.unbindkeys\fP is invoked for the window! +.IP "\fBf.bottomzoom\fP" 8 +This function is similar to the \fBf.fullzoom\fP function, but +resizes the window to fill only the bottom half of the screen. +.IP "\fBf.circledown\fP" 8 +This function lowers the top-most window that occludes another window. +.IP "\fBf.circleup\fP" 8 +This function raises the bottom-most window that is occluded by another window. +.IP "\fBf.colormap\fP \fIstring\fP" 8 +This function rotates the colormaps (obtained from the WM_COLORMAP_WINDOWS +property on the window) that \fBvtwm\fP will display when the pointer +is in this window. The argument \fIstring\fP may have one of the following +values: \fI"next"\fP, \fI"prev"\fP, and \fI"default"\fP. It should be noted +here that in general, the installed colormap is determined by keyboard focus. +A pointer driven keyboard focus will install a private colormap upon entry +of the window owning the colormap. Using the click to type model, private +colormaps will not be installed until the user presses a pointer button on +the target window. +.IP "\fBf.cut\fP \fIstring\fP (OBSOLETE --- use a clipboard client)" 8 +This function places the specified \fIstring\fP (followed by a newline +character) into the root window property CUT_BUFFER0. +.IP "\fBf.cutfile\fP (OBSOLETE --- use a clipboard client)" 8 +This function reads the file indicated by the contents of the CUT_BUFFER0 +window property and replaces the cut buffer. +.IP "\fBf.deiconify\fP" 8 +This function deiconifies the selected window. If the window is not an icon, +this function does nothing. +.IP "\fBf.delete\fP" 8 +This function sends the WM_DELETE_WINDOW message to the selected window if +the client application has requested it through the WM_PROTOCOLS window +property. The application is supposed to respond to the message by removing +the window. If the window has not requested +WM_DELETE_WINDOW messages, the keyboard bell will be rung indicating that +the user should choose an alternative method. Note this is very different +from \fBf.destroy\fP. The intent here is to delete a single window, not +necessarily the entire application. +.IP "\fBf.deletedoor\fP" 8 +This function deletes a door. +.IP "\fBf.deltastop\fP" 8 +This function allows a user-defined function to be aborted if the pointer has +been moved more than \fPMoveDelta\fP pixels. See the example definition +given for \fBFunction "move-or-lower"\fP at the beginning of the section. +.IP "\fBf.destroy\fP" 8 +This function instructs the X server to close the display connection of the +client that created the selected window. This should only be used as a last +resort for shutting down runaway clients. See also \fBf.delete\fP. +.IP +This action sometimes leaves a runaway process that consumes CPU +cycles; you should always try to use the applications own quit +function, rather than this one. +.IP "\fBf.downiconmgr\fP" 8 +This function warps the pointer to the next row in the current icon manger, +wrapping to the beginning of the next column if necessary. +.IP "\fBf.enterdoor\fP" 8 +This function activates this door. Typically one binds: +.RS 12 +.nf +Button1 = : door : f.enterdoor +Button2 = : door : f.enterdoor +Button3 = : door : f.enterdoor +.fi +.RE +.IP "\fBf.exec\fP \fIstring\fP" 8 +This function passes the argument \fIstring\fP to /bin/sh for execution. +In multiscreen mode, if \fIstring\fP starts a new X client without +giving a display argument, the client will appear on the screen from +which this function was invoked. +.IP "\fBf.file\fP \fIstring\fP (OBSOLETE --- use a clipboard client)" 8 +This function assumes \fIstring\fP is a file name. This file is read into +the window server's cut buffer. +.IP "\fBf.focus\fP" 8 +This function toggles the keyboard focus of the server to the +selected window, changing the focus rule from pointer-driven if necessary. +If the selected window already was focused, this function executes an +\&\fBf.unfocus\fP. +.IP "\fBf.forcemove\fP" 8 +This function is like \fBf.move\fP except that it ignores the \fBDontMoveOff\fP +variable. +.IP "\fBf.forwiconmgr\fP" 8 +This function warps the pointer to the next column in the current icon +manager, wrapping to the beginning of the next row if necessary. +.IP "\fBf.fullzoom\fP" 8 +This function resizes the selected window to the full size of the display or +else restores the original size if the window was already zoomed. +.IP "\fBf.function\fP \fIstring\fP" 8 +This function executes the user-defined function whose name is specified +by the argument \fIstring\fP. +.IP "\fBf.hbzoom\fP" 8 +This function is a synonym for \fBf.bottomzoom\fP. +.IP "\fBf.hidedesktopdisplay\fP" 8 +This function unmaps the desktop display. +.IP "\fBf.hideiconmgr\fP" 8 +This function unmaps the current icon manager when selected from a client +window, and unmaps all icon managers when selected from the root window. +.IP "\fBf.horizoom\fP" 8 +This variable is similar to the \fBf.zoom\fP function except that the +selected window is resized to the full width of the display. +.IP "\fBf.htzoom\fP" 8 +This function is a synonym for \fBf.topzoom\fP. +.IP "\fBf.hzoom\fP" 8 +This function is a synonym for \fBf.horizoom\fP. +.IP "\fBf.iconify\fP" 8 +This function iconifies or deiconifies the selected window or icon, +respectively. +.IP "\fBf.identify\fP" 8 +This function displays a summary of the name and geometry of the +selected window. Clicking the pointer or pressing a key in the window +will dismiss it. If the function is invoked on a desktop representation of +a window, the real window which is represented will be identified. +.IP "\fBf.lefticonmgr\fP" 8 +This function similar to \fBf.backiconmgr\fP except that wrapping does not +change rows. +.IP "\fBf.leftzoom\fP" 8 +This variable is similar to the \fBf.bottomzoom\fP function but causes +the selected window is only resized to the left half of the display. +.IP "\fBf.lower\fP" 8 +This function lowers the selected window. +.IP "\fBf.menu\fP \fIstring\fP" 8 +This function invokes the menu specified by the argument \fIstring\fP. +Cascaded menus may be built by nesting calls to \fBf.menu\fP. +.IP "\fBf.move\fP" 8 +This function drags an outline of the selected window (or the window itself +if the \fBOpaqueMove\fP variable is set) until the invoking pointer button +is released, at which time the window is raised (subject to +\&\fBRaiseOnStart\fP, \fBMoveDelta\fP, and \fBNoRaiseOnMove\fP). Double +clicking within the number of milliseconds given by \fBConstrainedMoveTime\fP +warps the pointer to the center of the window and constrains the move +horizontally or vertically, depending on pointer movement. To abort the move, +press another button before releasing the invoking button. +.IP "\fBf.movescreen\fP" 8 +Moves a window (or possibly the real screen) inside the desktop display. To +abort the move, press another button before releasing the invoking button. +By default, the bindings using the \fBdesktop\fP context are defined as: +.RS 12 +.nf +Button1 = : desktop : f.movescreen +Button2 = : desktop : f.movescreen +.fi +.RE +.IP +This is useful if you want to reset the default keyboard and pointer bindings +via \fBNoDefaultMouseOrKeyboardBindings\fP and use some of your own for the +virtual desktop, e.g.: +.RS 12 +.nf +NoDefaultMouseOrKeyboardBindings +Button1 = : desktop : f.movescreen +Button2 = : desktop : f.warp +Button3 = : desktop : f.iconify +.fi +.RE +.IP +This function is not useful under any context other than "desktop". +.IP "\fBf.nail\fP" 8 +This function nails or unnails the selected window onto the real screen; the +current value of this property is toggled on the window. +.IP "\fBf.nailedabove\fP" 8 +This function toggles the setting of the \fBNailedAbove\fP variable. +.IP "\fBf.namedoor\fP" 8 +This function, bound to the door context, pastes a name from CUT_BUFFER0 +into the selected door (see the +.B BINDINGS +section for details). +.IP "\fBf.newdoor\fP" 8 +This function creates a new door with it's destination and name set to the real +screen's current position in the virtual desktop. +.IP "\fBf.nexticonmgr\fP" 8 +This function warps the pointer to the next icon manager containing any windows +on the current or any succeeding screen. +.IP "\fBf.nop\fP" 8 +This function does nothing and is typically used with the \fBDefaultFunction\fP +or \fBWindowFunction\fP variables or to introduce blank lines in menus. +.IP "\fBf.panup\fP \fIN\fP" 8 +.IP "\fBf.pandown\fP \fIN\fP" 8 +.IP "\fBf.panleft\fP \fIN\fP" 8 +.IP "\fBf.panright\fP \fIN\fP" 8 +These functions move the real screen by \fIN%\fP of the screen dimension in the +indicated direction. These are ideally bound to the cursor keys: +.RS 12 +.nf +"Up" = : root : f.panup "100" +"Down" = : root : f.pandown "100" +"Left" = : root : f.panleft "100" +"Right" = : root : f.panright "100" +.fi +.RE +.IP "\fBf.playsound\fP \fIsoundfile\fP" 8 +This function plays the specified sound at \fBSoundVolume\fP volume. The +\&\fIsoundfile\fP must be the full pathname of the sound file. This is a +rather "expensive" function compared to that provided by the \fBSounds\fP +variable, and should be avoided. +.IP "\fBf.previconmgr\fP" 8 +This function warps the pointer to the previous icon manager containing any +windows on the current or preceding screens. +.IP "\fBf.quit\fP" 8 +This function causes \fBvtwm\fP to restore the window's borders and exit. If +\&\fBvtwm\fP is the last client invoked from \fIxdm\fP, this will result in a +server reset, and the user's session will be logged out. +.IP +Users who stay logged in for long periods (days or weeks), or who like +to change window managers, or experiment with them, may find it +desirable to use a relatively simple application, such as +.BR xbiff (1), +as the last application in their +.IR .xinitrc +or +.IR .xsession +file, letting the window manager start earlier, and run in the +background. This allows changing window managers without logging out, +and also makes it much less likely that a session will be abruptly +terminated by a bug in a complex program like a window manager. The +one drawback to this approach is that \fBf.quit\fP then no longer +terminates the session: you need to use \fBf.delete\fP or \fBf.destroy\fP +on that last application to logout. +.IP "\fBf.raise\fP" 8 +This function raises the selected window. +.IP "\fBf.raiselower\fP" 8 +This function raises the selected window to the top of the stacking order if +it is occluded by any windows, otherwise the window will be lowered. +.IP "\fBf.refresh\fP" 8 +This function causes all windows to be refreshed. +.IP "\fBf.resetdesktop\fP" 8 +This function moves the real display to (0,0) +.IP "\fBf.resize\fP" 8 +This function drags an outline of the selected window (or the window itself +if the \fBOpaqueResize\fP variable is set) after crossing a border (or by +setting \fBAutoRelativeResize\fP) until the invoking pointer button is +released, at which time the window is raised (subject to +\&\fBRaiseOnStart\fP, \fBMoveDelta\fP, and \fBNoRaiseOnResize\fP). To abort +the resize, press another button before releasing the invoking button. +.IP "\fBf.restart\fP" 8 +This function kills and restarts \fBvtwm\fP. See also \fBf.startwm\fP. +.IP "\fBf.righticonmgr\fP" 8 +This function is similar to \fBf.nexticonmgr\fP except that wrapping does +not change rows. +.IP "\fBf.rightzoom\fP" 8 +This variable is similar to the \fBf.bottomzoom\fP function except that +the selected window is only resized to the right half of the display. +.IP "\fBf.ring\fP" 8 +Selects a window and adds it to the \fBWindowRing\fP list, or removes it if +it was already in the ring. This command makes \fBf.warpring\fP much more +useful, by making its configuration dynamic. +.IP "\fBf.saveyourself\fP" 8 +This function sends a WM_SAVEYOURSELF message to the selected window if it +has requested the message in its WM_PROTOCOLS window property. Clients that +accept this message are supposed to checkpoint all state associated with the +window and update the WM_COMMAND property as specified in the ICCCM. If +the window has not requested this message, the keyboard bell will be rung. +.IP "\fBf.separator\fP" 8 +Valid only in menus. The effect is to add a line separator between the +previous and the following entry. The name selector part in the menu is not +used (but must be present). +.IP "\fBf.setrealscreen\fP \fIgeomstr\fP" 8 +This function sets the real screen to the virtual coordinates specified. +The \fIgeomstr\fP is a quoted string containing a standard geometry +specification. +.IP "\fBf.showdesktopdisplay\fP" 8 +This function maps the desktop display. +.IP "\fBf.showiconmgr\fP" 8 +This function maps the current icon manager when selected from a client +window, and maps all icon managers when selected from the root window. +.IP "\fBf.snap\fP" 8 +This function snaps the real screen to a grid defined on virtual space with +\&\fBPanDistanceX\fP and \fBPanDistanceY\fP increments. +.IP "\fBf.snaprealscreen\fP" 8 +This function toggles the setting of \fBSnapRealScreen\fP. +.IP "\fBf.snugdesktop\fP" 8 +moves the display to try to fit all partially visible windows +completely on the screen. +.IP "\fBf.snugwindow\fP" 8 +moves the display to try to fit the selected window completely +on the screen +.IP "\fBf.sorticonmgr\fP" 8 +This function sorts the entries in the current icon manager alphabetically. +See the variable \fBSortIconManager\fP. +.IP "\fBf.sounds\fP" 8 +This function toggles the playing of sounds. It's a "mute" function. +.\".IP "\fBf.source\fP \fIstring\fP (DOES NOT WORK!!!)" 8 +.\"This function assumes \fIstring\fP is a file name. The file is read +.\"and parsed as a \fBvtwm\fP startup file. +.\"This function is intended to be used only to re-build pull-down menus. None +.\"of the \fBvtwm\fP variables are changed. +.IP "\fBf.squeezecenter\fP" 8 +.IP "\fBf.squeezeleft\fP" 8 +.IP "\fBf.squeezeright\fP" 8 +Selects a window and makes its title appear as though you had +configured it as +.RS 12 +.nf +\&\fBSqueezeTitle\fP center 0 0 +.fi +.RE +.RS +or +.RE +.RS 12 +.nf +\&\fBSqueezeTitle\fP left 0 0 +.fi +.RE +.RS +or +.RE +.RS 12 +.nf +\&\fBSqueezeTitle\fP right 0 0 +.fi +.RE +.RS +respectively. These make squeezed titles much more useful because their +configuration is dynamic. +.RE +.IP "\fBf.startwm\fP \fIcommandline\fP" 8 +This function kills \fBvtwm\fP, and starts up the window manager as specified +by \fIcommandline\fP. A trailing ampersand and/or environment variables should +not be used. See also \fBf.restart\fP. +.IP "\fBf.staticiconpositions\fP" 8 +This function toggles the setting of \fBStaticIconPositions\fP. +.IP "\fBf.stick\fP" 8 +This function is a synonym for \fBf.nail\fP. +.IP "\fBf.stickyabove\fP" 8 +This function is synonymous with the \fBf.nailedabove\fP function. +.IP "\fBf.stricticonmgr\fP" 8 +This function toggles the setting of \fBStrictIconManager\fP. +.IP "\fBf.title\fP" 8 +This function provides a centered, unselectable item in a menu definition. It +should not be used in any other context. +.IP "\fBf.topzoom\fP" 8 +This variable is similar to the \fBf.bottomzoom\fP function except that +the selected window is only resized to the top half of the display. +.IP "\fBf.twmrc\fP" 8 +Synonymous with \fBf.restart\fP. Historically, this function was intended +to cause the startup customization file to be re-read. +.IP "\fBf.unbindbuttons\fP" 8 +.IP "\fBf.unbindkeys\fP" 8 +These functions disable \fBvtwm\fP's pointer or keyboard bindings for the +selected window, allowing events to pass directly to the application. These +are useful, for example, when running another window manager within \fBXnest\fP +or \fBXvnc\fP. +.IP "\fBf.unfocus\fP" 8 +This function resets the focus back to pointer-driven. This should be used +when a focused window is no longer desired. +.IP "\fBf.upiconmgr\fP" 8 +This function warps the pointer to the previous row in the current icon +manager, wrapping to the last row in the same column if necessary. +.IP "\fBf.version\fP" 8 +This function causes the \fBvtwm\fP version window to be displayed. This +window will be displayed until a pointer button is pressed or the +pointer is moved from one window to another. +.IP "\fBf.virtualgeometries\fP" 8 +This function toggles the setting of \fBNotVirtualGeometries\fP. +.IP "\fBf.vlzoom\fP" 8 +This function is a synonym for \fBf.leftzoom\fP. +.IP "\fBf.vrzoom\fP" 8 +This function is a synonym for \fBf.rightzoom\fP. +.IP "\fBf.warp\fP" 8 +Warp the cursor to the selected window. This is only useful if the window +is selected via the icon manager. +.IP "\fBf.warpclassnext\fP \fIstring\fP" 8 +.IP "\fBf.warpclassprev\fP \fIstring\fP" 8 +These functions warp the pointer to the next or previous window in the +specified class indicated by the argument \fIstring\fP. If \fIstring\fP is +\&\fI"VTWM"\fP, only icon managers, doors, and the Virtual Desktop window are +considered. If \fIstring\fP empty (i.e., \fI""\fP), the class of the window +with focus is used. If the window is iconified, it will be deiconified if +the variable \fBWarpUnmapped\fP is set or else ignored. +.IP "\fBf.warpring\fP \fIstring\fP" 8 +This function warps the pointer to the next or previous window (as indicated +by the argument \fIstring\fP, which may be \fI"next"\fP or \fI"prev"\fP) +specified in the \fBWindowRing\fP variable. If the window is iconified, it +will be deiconified if the variable \fBWarpUnmapped\fP is set or else ignored. +.IP "\fBf.warpsnug\fP" 8 +This function toggles the setting of \fBWarpSnug\fP. +.IP "\fBf.warpto\fP \fIstring\fP" 8 +This function warps the pointer to the window which has a name or class +that matches \fIstring\fP. The \fIstring\fP may be a VTWM-style wildcard, but +not a \fIregular expression\fP (see the +.B WILDCARDS +section for details). +If the window is iconified, it will be deiconified if the \fBWarpUnmapped\fP +variable is set, or else ignored. +.IP "\fBf.warptoiconmgr\fP \fIstring\fP" 8 +This function warps the pointer to the icon manager entry associated with +the window containing the pointer in the icon manager specified by the +argument \fIstring\fP. If \fIstring\fP is empty (i.e., \fI""\fP), the +current icon manager is chosen. If the window is iconified, it will be +deiconified if the variable \fBWarpUnmapped\fP is set or else ignored. +.IP "\fBf.warptonewest\fP" 8 +This function warps the pointer to the most recently created window. +If the window is iconified, it will be deiconified if the variable +\&\fBWarpUnmapped\fP is set or else ignored. +.IP "\fBf.warptoscreen\fP \fIstring\fP" 8 +This function warps the pointer to the screen specified by the +argument \fIstring\fP. \fIString\fP may be a number (e.g., \fI"0"\fP or +\&\fI"1"\fP), the word \fI"next"\fP (indicating the current screen plus 1, +skipping over any unmanaged screens), +the word \fI"back"\fP (indicating the current screen minus 1, skipping over +any unmanaged screens), or the word +\&\fI"prev"\fP (indicating the last screen visited. +.IP "\fBf.warpvisible\fP" 8 +This function toggles the setting of \fBWarpVisible\fP. +.IP "\fBf.winrefresh\fP" 8 +This function is similar to the \fBf.refresh\fP function except that only the +selected window is refreshed. +.IP "\fBf.zoom\fP" 8 +This function is similar to the \fBf.fullzoom\fP function, except that +the only the height of the selected window is changed. +.IP "\fBf.zoomzoom\fP" 8 +This function makes a zoom outline from a random place to another random +place (see the \fBZoom\fP and \fBZoomZoom\fP variables). It's silly, but +can be used as a visual bell in place of \fBf.beep\fP. See also the +\&\fBLessRandomZoomZoom\fP variable. +.\"===================================================================== +.SH MENUS +.PP +Functions may be grouped and interactively selected using pop-up +(when bound to a pointer button) or pull-down (when associated +with a titlebar button) menus. Each menu specification contains the name of +the menu as it will be referred to by \fBf.menu\fP, optional default +foreground and background colors, the list of item names and the functions +they should invoke, and optional foreground and background colors for +individual items: +.RS 4 +.nf +\&\fBMenu\fP "\fImenuname\fP" [ ("\fIdeffore\fP":"\fIdefback\fP") ] +{ + \fIstring1\fP [ ("\fIfore1\fP":"\fIback1\fP")] \fIfunction1\fP + \fIstring2\fP [ ("\fIfore2\fP":"\fIback2\fP")] \fIfunction2\fP + ... + \fIstringN\fP [ ("\fIforeN\fP":"\fIbackN\fP")] \fIfunctionN\fP +} +.fi +.RE +.PP +The \fImenuname\fP is case-sensitive. +The optional \fIdeffore\fP and \fIdefback\fP arguments specify the foreground +and background colors used on a color display +to highlight menu entries. +The \fIstring\fP portion +of each menu entry will be the text which will appear in the menu. +The optional \fIfore\fP and \fIback\fP arguments specify the foreground +and background colors of the menu entry when the pointer is not in +the entry. These colors will only be used on a color display. The +default is to use the colors specified by the +\&\fBMenuForeground\fP and \fBMenuBackground\fP variables. +The \fIfunction\fP portion of the menu entry is one of the functions, +including any user-defined functions, or additional menus. +.PP +There is a special menu named \fBVTWM Windows\fP which contains the names of +all of the client and \fBvtwm\fP-supplied windows. Selecting an entry will +cause the \fBWindowFunction\fP to be executed on that window. +If \fBWindowFunction\fP hasn't been set, the window will be deiconified and +raised. This menu uses the same colors as the little windows in the panner. +This feature still honors the traditional \fBTwmWindows\fP menu name of yore. +.\"===================================================================== +.SH ICONS +\&\fBvtwm\fP supports several different ways of manipulating iconified windows. +The common image-and-text style may be laid out by hand or automatically +arranged as described by the \fBIconRegion\fP variable. In addition, a +terse grid of icon names, called an icon manager, provides a more efficient +use of screen space as well as the ability to navigate among windows from +the keyboard. +.PP +An icon manager is a window that contains names of selected or all +windows currently on the display. In addition to the window name, +a small button using the default iconify symbol will be displayed to the +left of the name when the window is iconified. By default, clicking on an +entry in the icon manager performs \fBf.iconify\fP. +To change the actions taken in the icon manager, use +the \fBiconmgr\fP context when specifying button and keyboard bindings. +.PP +Moving the pointer into the icon manager also directs keyboard focus to +the indicated window when \fBNoIconManagerFocus\fP is not set (setting the +focus explicitly or else sending synthetic events if \fBNoTitleFocus\fP is +set). +Using the \fBf.upiconmgr\fP, \fBf.downiconmgr\fP +\&\fBf.lefticonmgr\fP, and +\&\fBf.righticonmgr\fP functions, +the input focus can be changed between windows directly from the keyboard. +.\"===================================================================== +.SH IMAGE AND AUDIO FORMATS +\&\fBvtwm\fP supports many images on its own (referred to as "internal" or +"built-in" in this document), divided into two types, \fIbitmaps\fP and +\&\fIpixmaps\fP. They are differentiated from file images by either a colon +(':') or the string ":xpm:" as the first character(s) of the name, +respectively: +.RS 4 +.nf +\&\fB:darrow\fP scaled in any, n/a for highlight +\&\fB:delete\fP / \fB:xlogo\fP centered in any drawable +\&\fB:dot\fP / \fB:iconify\fP centered in any drawable +\&\fB:menu\fP scaled in any drawable +\&\fB:rarrow\fP scaled in any, n/a for highlight +\&\fB:resize\fP scaled in any drawable +.fi +.RE +.PP +.RS 4 +.nf +\&\fB:xpm:bar\fP scaled in any drawable +\&\fB:xpm:box\fP scaled in any drawable +\&\fB:xpm:darrow\fP scaled in any, n/a for highlight +\&\fB:xpm:dot\fP centered in any drawable +\&\fB:xpm:lines\fP scaled in any drawable +\&\fB:xpm:menu\fP scaled in any drawable +\&\fB:xpm:raisedbox\fP scaled, for highlight only +\&\fB:xpm:raisedlines\fP scaled, for highlight only +\&\fB:xpm:rarrow\fP scaled in any, n/a for highlight +\&\fB:xpm:resize\fP scaled in any drawable +\&\fB:xpm:sunkenbox\fP scaled, for highlight only +\&\fB:xpm:sunkenlines\fP scaled, for highlight only +\&\fB:xpm:zoom\fP scaled in any drawable +.fi +.RE +.PP +\&\fBvtwm\fP also supports a single image file format by default, the X Window +System bitmap (files typically carrying an extension of \fI".xbm"\fP), for +two-color images. However, when built with the XPM library, \fBvtwm\fP will +also support the X Window System pixmap (files typically carrying an extension +of \fI".xpm"\fP), for full-color images. +.PP +All image types and sources can be freely mixed within the variables that use +them, given the behavior listed above, and with the following additional +exceptions: The \fBIcons\fP and \fBUnknownIcon\fP variables don't recognize +the built-in images, the \fBRealScreenPixmap\fP, \fBTitleHighlight\fP, and +\&\fBVirtualBackgroundPixmap\fP entries of the \fBPixmaps\fP variable don't +recognize the built-in images, only titlebar buttons can accomodate external +images that would be larger than the default space allocated for them (in any +other case, the image will be cropped to fit), and only the \fBRealScreenPixmap\fP, +\&\fBTitleHighlight\fP, and \fBVirtualBackgroundPixmap\fP entries of the +\&\fBPixmaps\fP variable will tile small images into the space allocated for +them. +.PP +The icon manager drawable is hard-coded to 11x11 pixels, the menu drawable +is \fBMenuFont\fP pixels square, and titlebar buttons are +.RS 4 +.nf +(\fBTitleFont\fP - (2 * \fBButtonIndent\fP)) +.fi +.RE +pixels square. The titlebar highlight area is +.RS 4 +.nf +(\fItitlebar height\fP - (2 * \fBFramePadding\fP) - 2) +.fi +.RE +pixels high, where \fItitlebar height\fP is determined by \fBTitleFont\fP +or the titlebar button height, whichever is greater, and \fBFramePadding\fP. +.PP +The root window can be decorated with whatever image files that are +supported by X Window System utilities and applications (\fBxloadimage\fP(1), +\&\fBxsetroot\fP(1), \fBxv\fP(1), etc.). +.PP +If \fBvtwm\fP is built with sound support, several audio file formats +are supported, not by \fBvtwm\fP per se, but by the \fBrplayd\fP(8) daemon. +Currently, the AU, AIFF, WAV, and VOC formats are natively supported, but +see also \fBrplay.helpers\fP(5). +.\"===================================================================== +.SH WILDCARDS +\&\fBvtwm\fP supports "wildcarding" when matching windows against a +variable's \fIwin-list\fP. By default, the question mark ('?') represents +any single character, the asterisk ('*') represents any zero or more +characters, and brackets ('[' and ']') represent any characters listed +within them. The backslash ('\\') "escapes" any one character, allowing +these reserved characters to be used literally. +.PP +\&\fBvtwm\fP can support a richer method of character substitution, called +\&\fIregular expressions\fP, or \fI"RE"\fPs. If \fBvtwm\fP is built with REs, +many more "wildcard" rules are added. A description of REs is beyond the +scope of this document; see the \fBre_format\fP(7) or \fBegrep\fP(1) man +pages. +.PP +\&\fBvtwm\fP distinguishes REs from strings by enclosing them in forward +slashes ('/'). The two may be freely mixed; changing the example in the +.B VARIABLES +section to: +.RS 4 +.nf +\&\fBAutoRaise\fP +{ + "emacs" + "VTWM*" + /x.*clock/ # was "x*clock" + "Xmh" + "XTerm" +} +.fi +.RE +accomplishes the same thing. This is but a simple example of RE usage, +and as such doesn't demonstrate or leverage their capabilities. +.\"===================================================================== +.SH SIGNALS +It is possible to issue a \fBf.restart\fP via a UNIX signal, to ease +debugging of \fBvtwm\fP resource files. To do this, send a SIGUSR1 to the +\&\fBvtwm\fP process ID (written to \fI$HOME/vtwm.pid\fP). +See \fBkill\fP(1) or \fBslay\fP(1). +.\"===================================================================== +.SH BUGS +There are precious few safeguards against binding functions to objects +inappropriately, especially where the virtual desktop is concerned. +.PP +Double clicking very fast to get the constrained move function will sometimes +cause the window to move, even though the pointer is not moved. +.PP +It is possible to "lose" windows in the virtual desktop by placing them +in a large desktop area, then shrinking the desktop so as to remove them +from view. They are still there, of course, but are unreachable until the +desktop is grown sufficiently large again. +.PP +See the \fIBUGS\fP file in the distribution for others. +.\"===================================================================== +.SH FILES +.PP +Searched for in the order shown: +.RS 4 +.nf +\&\fI$HOME/.vtwmrc.\fP +\&\fI$HOME/.vtwmrc\fP +\&\fI$VTWMDIR/twm/system.vtwmrc\fP +\&\fI$HOME/.twmrc.\fP +\&\fI$HOME/.twmrc\fP +\&\fI$VTWMDIR/twm/system.twmrc\fP +.fi +.RE +.PP +.nf +\&\fI$HOME/vtwm.pid\fP +.fi +.\"===================================================================== +.SH "ENVIRONMENT VARIABLES" +.IP "\fBDISPLAY\fP" 8 +This variable is used to determine which X server to use. It is also set +during \fBf.exec\fP so that programs come up on the proper screen. +.IP "\fBHOME\fP" 8 +This variable is used as the prefix for files that begin with a tilde and +for locating the \fBvtwm\fP startup file. +.\"===================================================================== +.SH "SEE ALSO" +\&\fBbitmap\fP(5), +\&\fBctwm\fP(1), +\&\fBm4\fP(1), +\&\fBmwm\fP(1), +\&\fBpixmap\fP(5), +\&\fBre_format\fP(7) or \fBegrep\fP(1), +\&\fBrplayd\fP(8) and \fBrplay.helpers\fP(5), +\&\fBtvtwm\fP(1), +\&\fBtwm\fP(1), +\&\fBvuewm\fP(1), +\&\fBX\fP(1), +\&\fBxdm\fP(1), +\&\fBxinit\fP(1), +\&\fBxmodmap\fP(1), +\&\fBxrdb\fP(1), +\&\fBXserver\fP(1) +.\"===================================================================== +.SH COPYRIGHT +Portions copyright 1988 Evans & Sutherland Computer Corporation; portions +copyright 1989 Hewlett-Packard Company and the Massachusetts Institute of +Technology; portions copyright 2001 D. J. Hawkey Jr.. +.PP +See \fBX\fP(1) for a full statement of rights and permissions. +.\"===================================================================== +.SH AUTHORS AND CONTRIBUTORS +Tom LaStrange, Solbourne Computer; Jim Fulton, MIT X Consortium; +Steve Pitschke, Stardent Computer; Keith Packard, MIT X Consortium; +Dave Payne, Apple Computer; Nick Williams ; +Dave Edmondson, Santa Cruz Operation, ; +Dana Chee, Bellcore (R5 conversion), ; +Warren Jessop, University of Washington, ; +Gilligan ; +Tim Ramsey ; +Ralph Betza ; +Michael Kutzner ; +Stig Ostholm ; +M. Eyckmans ; +Tony Brannigan ; +Alec Wolman ; +; +Marcel Mol ; +Darren S. Embry ; +Chris P. Ross ; +Paul Falstad ; +D. J. Hawkey Jr., (version 5.4), , +with +Erik Agsjo , +Ugen Antsilevitch , +Nelson H. F. Beebe , +Michael Dales , +Jennifer Elaan , +Michel Eyckmans , +Callum Gibson , +Jason Gloudon , +Nicholas Jacobs , +Caveh Frank Jalali +Takeharu Kato , +Goran Larsson , +Rolf Neugebauer , +Jonathan Paisley , +Steve Ratcliffe , +Seth Robertson , +Mehul N. Sanghvi , +Tim Wiess , +acknowledging +Claude Lecommandeur, (ctwm), +.\"==============================[The End]============================== diff --git a/doors.c b/doors.c new file mode 100644 index 0000000..79f1d73 --- /dev/null +++ b/doors.c @@ -0,0 +1,458 @@ +/* + * $Id: doors.c,v 3.0 90/11/20 16:13:17 dme Exp Locker: dme $ + * + * Copyright (c) 1990 Dave Edmondson. + * Copyright (c) 1990 Imperial College of Science, Technoology & Medicine + * All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Dave Edmondson or Imperial College + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Dave Edmondson and + * Imperial College make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#include +#include +#include "doors.h" +#include "screen.h" +#include "desktop.h" +#include "add_window.h" + +#define strdup Strdup /* avoid conflict with system header files */ +char *strdup(s1) +char * s1; +{ + char *s2; + + s2 = malloc((unsigned) strlen(s1)+1); + return (s2 == NULL ? NULL : strcpy(s2,s1)); +} + +extern void SetMapStateProp(); +extern TwmDoor *door_add_internal(); +extern void twmrc_error_prefix(); + +/* djhjr - 4/20/98 */ +extern void HandleExpose(); +extern void SetupWindow(); + +/* djhjr - 4/27/99 */ +extern void AppletDown(); + +TwmDoor *door_add(name, position, destination) +char *name, *position, *destination; +{ + int px, py, pw, ph, dx, dy; + + /* djhjr - 4/26/96 */ +/* djhjr - 8/11/98 + * was 'Scr->use3Dborders' - djhjr - 8/11/98 * + int bw = (Scr->BorderBevelWidth > 0) ? Scr->ThreeDBorderWidth : Scr->BorderWidth; +*/ + int bw = Scr->BorderWidth; + + JunkMask = XParseGeometry (position, &JunkX, &JunkY, + &JunkWidth, &JunkHeight); + + /* we have some checking for negative (x,y) to do + sorta taken from desktop.c by DSE */ + if ((JunkMask & XNegative) == XNegative) { + JunkX += Scr->MyDisplayWidth - JunkWidth - (2 * bw); + } + if ((JunkMask & YNegative) == YNegative) { + JunkY += Scr->MyDisplayHeight - JunkHeight - (2 * bw); + } + +/* allow position to be omitted - djhjr - 5/10/99 + if ((JunkMask & (XValue | YValue)) != + (XValue | YValue)) { + twmrc_error_prefix(); + fprintf (stderr, "bad Door position \"%s\"\n", position); + return NULL; + } +*/ + + /* added this 'if (...) else' - djhjr - 5/10/99 */ + if ((JunkMask & (XValue | YValue)) != (XValue | YValue)) + { + /* allow AddWindow() to position it - djhjr - 5/10/99 */ + JunkX = JunkY = -1; + } + else + { +/* if (JunkX <= 0 || JunkY <= 0) { */ + if (JunkX < 0 || JunkY < 0) { /* 0,0 accepted now -- DSE */ + twmrc_error_prefix(); + fprintf (stderr, "silly Door position \"%s\"\n", position); + return NULL; + } + } + + /* they seemed ok */ + px = JunkX; + py = JunkY; + + if (JunkMask & WidthValue) + pw = JunkWidth; + else + /* means figure it out when you create the window */ + pw = -1; + if (JunkMask & HeightValue) + ph = JunkHeight; + else + ph = -1; + + JunkMask = XParseGeometry (destination, &JunkX, &JunkY, + &JunkWidth, &JunkHeight); + if ((JunkMask & (XValue | YValue)) != + (XValue | YValue)) { + twmrc_error_prefix(); + fprintf (stderr, "bad Door destination \"%s\"\n", destination); + return NULL; + } + if (JunkX < 0 || JunkY < 0) { + twmrc_error_prefix(); + fprintf (stderr, "silly Door destination \"%s\"\n", + destination); + return NULL; + } + dx = JunkX; + dy = JunkY; + + return (door_add_internal(name, px, py, pw, ph, dx, dy)); +} + +TwmDoor *door_add_internal(name, px, py, pw, ph, dx, dy) +char *name; +int px, py, pw, ph, dx, dy; +{ + TwmDoor *new; + + new = (TwmDoor *)malloc(sizeof(TwmDoor)); + new->name = strdup(name); + + /* this for getting colors */ + new->class = XAllocClassHint(); + new->class->res_name = new->name; + new->class->res_class = strdup(VTWM_DOOR_CLASS); + + new->x = px; + new->y = py; + new->width = pw; + new->height = ph; + new->goto_x = dx; + new->goto_y = dy; + + /* link into the list */ + new->prev = NULL; + new->next = Scr->Doors; + if (Scr->Doors) + Scr->Doors->prev = new; + Scr->Doors = new; + + return (new); +} + +void door_open(tmp_door) +TwmDoor *tmp_door; +{ + Window w; + + /* djhjr - 4/26/96 */ +/* djhjr - 8/11/98 + * was 'Scr->use3Dborders' - djhjr - 8/11/98 * + int bw = (Scr->BorderBevelWidth > 0) ? Scr->ThreeDBorderWidth : Scr->BorderWidth; +*/ + int bw = Scr->BorderWidth; + + /* look up colours */ + if (!GetColorFromList(Scr->DoorForegroundL, + tmp_door->name, + tmp_door->class, &tmp_door->colors.fore)) + tmp_door->colors.fore = Scr->DoorC.fore; + if (!GetColorFromList(Scr->DoorBackgroundL, + tmp_door->name, + tmp_door->class, &tmp_door->colors.back)) + tmp_door->colors.back = Scr->DoorC.back; + + if (tmp_door->width < 0) +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + tmp_door->width = MyFont_TextWidth(&Scr->DoorFont, +#else + tmp_door->width = XTextWidth(Scr->DoorFont.font, +#endif + tmp_door->name, + strlen(tmp_door->name)) + + /* djhjr - 2/7/99 */ + + (Scr->DoorBevelWidth * 2) + + + SIZE_HINDENT; + + if (tmp_door->height < 0) + tmp_door->height = Scr->DoorFont.height + + /* djhjr - 2/7/99 */ + + (Scr->DoorBevelWidth * 2) + + + SIZE_VINDENT; + + /* create the window */ + w = XCreateSimpleWindow(dpy, Scr->Root, + tmp_door->x, tmp_door->y, + tmp_door->width, tmp_door->height, + bw, + tmp_door->colors.fore, + tmp_door->colors.back); + tmp_door->w = XCreateSimpleWindow(dpy, w, + 0, 0, + tmp_door->width, tmp_door->height, + 0, + tmp_door->colors.fore, + tmp_door->colors.back); + +/* reworked to limit the minimum size of a door - djhjr - 3/1/99 + if ((tmp_door->x < 0) || (tmp_door->y < 0)) { + XSizeHints *hints = NULL; + long ret; + + * + * set the wmhints so that add_window() will allow + * the user to place the window + * + if (XGetWMNormalHints(dpy, w, hints, &ret) > 0) { + hints->flags = hints->flags & + (!USPosition & !PPosition); + XSetStandardProperties(dpy, w, + tmp_door->class->res_name, + tmp_door->class->res_name, + None, NULL, 0, hints); + } + } else { + XSetStandardProperties(dpy, w, + tmp_door->class->res_name, + tmp_door->class->res_name, + None, NULL, 0, NULL); + } +*/ + { + XSizeHints *hints = NULL; + + if (tmp_door->x < 0 || tmp_door->y < 0) + { + long ret; + + /* + * set the wmhints so that add_window() will allow + * the user to place the window + */ + if (XGetWMNormalHints(dpy, w, hints, &ret) != 0) + hints->flags &= (!USPosition & !PPosition); + } + + if (!hints) hints = XAllocSizeHints(); + + hints->flags |= PMinSize; + hints->min_width = tmp_door->width; + hints->min_height = tmp_door->height; + + XSetStandardProperties(dpy, w, + tmp_door->class->res_name, + tmp_door->class->res_name, + None, NULL, 0, hints); + } + + XSetClassHint(dpy, w, tmp_door->class); + + /* set the name on both */ + XStoreName(dpy, tmp_door->w, tmp_door->name); + XStoreName(dpy, w, tmp_door->name); + + XDefineCursor( dpy, w, Scr->FrameCursor );/*RFB*/ + XDefineCursor( dpy, tmp_door->w, Scr->DoorCursor );/*RFBCURSOR*/ + + /* moved these 'cuz AddWindow() will need 'em - djhjr - 11/15/01 */ + /* store the address of the door on the window */ + XSaveContext(dpy, + tmp_door->w, DoorContext, (caddr_t) tmp_door); + XSaveContext(dpy, + w, DoorContext, (caddr_t) tmp_door); + + /* give to twm */ + tmp_door->twin = AddWindow(w, FALSE, NULL); + + SetMapStateProp(tmp_door->twin, NormalState); + + /* interested in... */ + XSelectInput(dpy, tmp_door->w, ExposureMask | + ButtonPressMask | ButtonReleaseMask); + + /* store the address of the door on the window */ + XSaveContext(dpy, + tmp_door->w, + TwmContext, (caddr_t) tmp_door->twin); + + /* map it */ + XMapWindow(dpy, tmp_door->w); + XMapWindow(dpy, w); +} + +void door_open_all() +{ + TwmDoor *tmp_door; + + for (tmp_door = Scr->Doors; tmp_door; tmp_door = tmp_door->next) + door_open(tmp_door); +} + +/* + * go into a door + */ +void door_enter(w, d) +Window w; +TwmDoor *d; +{ + int snapon; /* doors override real screen snapping - djhjr - 2/5/99 */ + + if (!d) + /* find the door */ + if (XFindContext(dpy, w, DoorContext, (caddr_t *)&d) + == XCNOENT) + /* not a door ! */ + return; + + /* go to it */ + snapon = (int)Scr->snapRealScreen; + Scr->snapRealScreen = FALSE; + SetRealScreen(d->goto_x, d->goto_y); + Scr->snapRealScreen = (snapon) ? TRUE : FALSE; +} + +/* + * delete a door + */ +void door_delete(w, d) +Window w; +TwmDoor *d; +{ /*marcel@duteca.et.tudelft.nl*/ + if (!d) + /* find the door */ + if (XFindContext(dpy, w, DoorContext, (caddr_t *)&d) + == XCNOENT) + /* not a door ! */ + return; + + /* unlink it: */ + if (Scr->Doors == d) + Scr->Doors = d->next; + if (d->prev != NULL) + d->prev->next = d->next; + if (d->next != NULL) + d->next->prev = d->prev; + + /* djhjr - 4/27/99 */ + AppletDown(d->twin); + +/* + * Must this be done here ? Is it do by XDestroyWindow(), + * or by HandleDestroyNotify() in events.c, or should it + * it be done there ? M.J.E. Mol. + * + * It looks as though the contexts, at least, should be + * deleted here, maybe more, I dunno. - djhjr 2/25/99 + */ + XDeleteContext(dpy, d->w, DoorContext); + XDeleteContext(dpy, d->w, TwmContext); + XDeleteContext(dpy, d->twin->w, DoorContext); /* ??? */ + XUnmapWindow(dpy, d->w); + XUnmapWindow(dpy, w); + XDestroyWindow(dpy, w); + free(d->class->res_class); /* djhjr - 2/25/99 */ + XFree(d->class); + free(d->name); /* djhjr - 2/25/99 */ + free(d); +} + +/* + * create a new door on the fly + */ +void door_new() +{ + TwmDoor *d; + char name[256]; + + sprintf(name, "+%d+%d", Scr->VirtualDesktopX, Scr->VirtualDesktopY); + + d = door_add_internal(name, -1, -1, -1, -1, + Scr->VirtualDesktopX, Scr->VirtualDesktopY); + + door_open(d); +} + +/* + * rename a door from cut buffer 0 + * + * adapted from VTWM-5.2b - djhjr - 4/20/98 + */ +void +door_paste_name(w, d) +Window w; +TwmDoor* d; +{ + int width, height, count; + char *ptr; +/* djhjr - 8/11/98 + * was 'Scr->use3Dborders' - djhjr - 8/11/98 * + int bw = (Scr->BorderBevelWidth > 0) ? Scr->ThreeDBorderWidth : Scr->BorderWidth; +*/ + /* added initialization and test - djhjr - 3/1/99 */ + int bw = 0; + if (Scr->BorderBevelWidth) bw = Scr->BorderWidth; + + if (!d) + if (XFindContext(dpy, w, DoorContext, (caddr_t *)&d) == XCNOENT) + return; + + /* sanity check - djhjr - 10/31/00 */ + if (!(ptr = XFetchBytes(dpy, &count)) || count == 0) return; + if (count > 128) count = 128; + + if (d->name) + d->name = realloc(d->name, count + 1); + else + d->name = malloc(count + 1); + + sprintf(d->name, "%*s", count, ptr); + XFree(ptr); + + /* djhjr - 1/14/99 */ + XClearWindow(dpy, d->w); + + /* added 'Scr->DoorBevelWidth * 2' - djhjr - 2/7/99 */ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + width = MyFont_TextWidth(&Scr->DoorFont, d->name, count) + +#else + width = XTextWidth(Scr->DoorFont.font, d->name, count) + +#endif + SIZE_HINDENT + (Scr->DoorBevelWidth * 2); + height = Scr->DoorFont.height + SIZE_VINDENT + (Scr->DoorBevelWidth * 2); + + /* limit the size of a door - djhjr - 3/1/99 */ + d->twin->hints.flags |= PMinSize; + d->twin->hints.min_width = width; + d->twin->hints.min_height = height; + + SetupWindow(d->twin, d->twin->frame_x, d->twin->frame_y, + width + 2 * bw, height + d->twin->title_height + 2 * bw, -1); + + HandleExpose(); +} + diff --git a/doors.h b/doors.h new file mode 100644 index 0000000..63c53fe --- /dev/null +++ b/doors.h @@ -0,0 +1,62 @@ +/* + * $Id: doors.h,v 3.0 90/11/20 16:13:19 dme Exp Locker: dme $ + * + * Copyright (c) 1990 Dave Edmondson. + * Copyright (c) 1990 Imperial College of Science, Technoology & Medicine + * All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Dave Edmondson or Imperial College + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Dave Edmondson and + * Imperial College make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifndef DOORS_H_INCLUDED +#define DOORS_H_INCLUDED + +#include "twm.h" + +/* the class of twm doors */ +/* djhjr - 4/27/96 +#define TWM_DOOR_CLASS "Twm Door" +*/ +#define VTWM_DOOR_CLASS "VTWM Door" + +/* + * the door structure + */ +typedef struct TwmDoor { + struct TwmDoor *next; /* next in the linked list */ + struct TwmDoor *prev; /* prev in the linked list */ + + char *name; /* name of this door */ + int x, y; /* position */ + int width, height; /* size */ + + int goto_x, goto_y; /* destination */ + + XClassHint *class; /* name and class of this door */ + + ColorPair colors; /* fore and back */ + + Window w; /* the x window for this */ + TwmWindow *twin; /* the twmwindow for this */ +} TwmDoor; + +extern TwmDoor *door_add(); +extern void door_open(); +extern void door_open_all(); +extern void door_enter(); +extern void door_new(); +extern void door_delete(); + +/* djhjr - 4/20/98 */ +extern void door_paste_name(); + +#endif /* DOORS_H_INCLUDED */ diff --git a/events.c b/events.c new file mode 100644 index 0000000..28e1e29 --- /dev/null +++ b/events.c @@ -0,0 +1,4171 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/*********************************************************************** + * + * $XConsortium: events.c,v 1.182 91/07/17 13:59:14 dave Exp $ + * + * twm event handling + * + * 17-Nov-87 Thomas E. LaStrange File created + * + ***********************************************************************/ + +#include +#include +#include "twm.h" +#include +#include "add_window.h" +#include "menus.h" +#include "events.h" +#include "resize.h" +#include "parse.h" +#include "gram.h" +#include "util.h" +#include "screen.h" +#include "iconmgr.h" +#include "version.h" +#include "desktop.h" +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +#include "sound.h" +#endif +/* Submitted by Takeharu Kato */ +#ifdef NEED_SELECT_H +#include /* RAISEDELAY */ +#else +#include /* RAISEDELAY */ +#include /* RAISEDELAY */ +#include +#endif + +extern void IconDown(); +/* djhjr - 4/26/99 */ +extern void AppletDown(); + +static void do_menu (); +void RedoIconName(); + +extern int iconifybox_width, iconifybox_height; +extern unsigned int mods_used; +extern int menuFromFrameOrWindowOrTitlebar; +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +extern int createSoundFromFunction; +extern int destroySoundFromFunction; +#endif + +#define MAX_X_EVENT 256 +event_proc EventHandler[MAX_X_EVENT]; /* event handler jump table */ +char *Action; +int Context = C_NO_CONTEXT; /* current button press context */ +TwmWindow *ButtonWindow; /* button press window structure */ +XEvent ButtonEvent; /* button press event */ +XEvent Event; /* the current event */ +TwmWindow *Tmp_win; /* the current twm window */ + +/* Used in HandleEnterNotify to remove border highlight from a window + * that has not recieved a LeaveNotify event because of a pointer grab + */ +TwmWindow *UnHighLight_win = NULL; + +Window DragWindow; /* variables used in moving windows */ +int origDragX; +int origDragY; +int DragX; +int DragY; +int DragWidth; +int DragHeight; +int CurrentDragX; +int CurrentDragY; + +/* Vars to tell if the resize has moved. */ +extern int ResizeOrigX; +extern int ResizeOrigY; + +static int enter_flag; +static int ColortableThrashing; +static TwmWindow *enter_win, *raise_win; + +ScreenInfo *FindScreenInfo(); +int ButtonPressed = -1; +int Cancel = FALSE; +int GlobalFirstTime = True; +int GlobalMenuButton = False; + +void HandleCreateNotify(); + +void HandleShapeNotify (); +extern int ShapeEventBase, ShapeErrorBase; + +void AutoRaiseWindow (tmp) + TwmWindow *tmp; +{ + XRaiseWindow (dpy, tmp->frame); + XRaiseWindow (dpy, tmp->VirtualDesktopDisplayWindow); + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + XSync (dpy, 0); + enter_win = NULL; + enter_flag = TRUE; + raise_win = tmp; +} + +void SetRaiseWindow (tmp) + TwmWindow *tmp; +{ + enter_flag = TRUE; + enter_win = NULL; + raise_win = tmp; + XSync (dpy, 0); +} + + + +/*********************************************************************** + * + * Procedure: + * InitEvents - initialize the event jump table + * + *********************************************************************** + */ + +void +InitEvents() +{ + int i; + + + ResizeWindow = 0; + DragWindow = 0; + enter_flag = FALSE; + enter_win = raise_win = NULL; + + for (i = 0; i < MAX_X_EVENT; i++) + EventHandler[i] = HandleUnknown; + + EventHandler[Expose] = HandleExpose; + EventHandler[CreateNotify] = HandleCreateNotify; + EventHandler[DestroyNotify] = HandleDestroyNotify; + EventHandler[MapRequest] = HandleMapRequest; + EventHandler[MapNotify] = HandleMapNotify; + EventHandler[UnmapNotify] = HandleUnmapNotify; +#if 0 /* functionality moved to menus.c:ExecuteFunction() - djhjr - 11/7/03 */ + EventHandler[MotionNotify] = HandleMotionNotify; +#endif + EventHandler[ButtonRelease] = HandleButtonRelease; + EventHandler[ButtonPress] = HandleButtonPress; + EventHandler[EnterNotify] = HandleEnterNotify; + EventHandler[LeaveNotify] = HandleLeaveNotify; + EventHandler[ConfigureRequest] = HandleConfigureRequest; + EventHandler[ClientMessage] = HandleClientMessage; + EventHandler[PropertyNotify] = HandlePropertyNotify; + EventHandler[KeyPress] = HandleKeyPress; + EventHandler[ColormapNotify] = HandleColormapNotify; + EventHandler[VisibilityNotify] = HandleVisibilityNotify; + if (HasShape) + EventHandler[ShapeEventBase+ShapeNotify] = HandleShapeNotify; +} + + + + +Time lastTimestamp = CurrentTime; /* until Xlib does this for us */ + +Bool StashEventTime (ev) + register XEvent *ev; +{ + switch (ev->type) { + case KeyPress: + case KeyRelease: + lastTimestamp = ev->xkey.time; + return True; + case ButtonPress: + case ButtonRelease: + lastTimestamp = ev->xbutton.time; + return True; + case MotionNotify: + lastTimestamp = ev->xmotion.time; + return True; + case EnterNotify: + case LeaveNotify: + lastTimestamp = ev->xcrossing.time; + return True; + case PropertyNotify: + lastTimestamp = ev->xproperty.time; + return True; + case SelectionClear: + lastTimestamp = ev->xselectionclear.time; + return True; + case SelectionRequest: + lastTimestamp = ev->xselectionrequest.time; + return True; + case SelectionNotify: + lastTimestamp = ev->xselection.time; + return True; + } + return False; +} + + + +/* + * WindowOfEvent - return the window about which this event is concerned; this + * window may not be the same as XEvent.xany.window (the first window listed + * in the structure). + */ +Window WindowOfEvent (e) + XEvent *e; +{ + /* + * Each window subfield is marked with whether or not it is the same as + * XEvent.xany.window or is different (which is the case for some of the + * notify events). + */ + switch (e->type) { + case KeyPress: + case KeyRelease: return e->xkey.window; /* same */ + case ButtonPress: + case ButtonRelease: return e->xbutton.window; /* same */ + case MotionNotify: return e->xmotion.window; /* same */ + case EnterNotify: + case LeaveNotify: return e->xcrossing.window; /* same */ + case FocusIn: + case FocusOut: return e->xfocus.window; /* same */ + case KeymapNotify: return e->xkeymap.window; /* same */ + case Expose: return e->xexpose.window; /* same */ + case GraphicsExpose: return e->xgraphicsexpose.drawable; /* same */ + case NoExpose: return e->xnoexpose.drawable; /* same */ + case VisibilityNotify: return e->xvisibility.window; /* same */ + case CreateNotify: return e->xcreatewindow.window; /* DIFF */ + case DestroyNotify: return e->xdestroywindow.window; /* DIFF */ + case UnmapNotify: return e->xunmap.window; /* DIFF */ + case MapNotify: return e->xmap.window; /* DIFF */ + case MapRequest: return e->xmaprequest.window; /* DIFF */ + case ReparentNotify: return e->xreparent.window; /* DIFF */ + case ConfigureNotify: return e->xconfigure.window; /* DIFF */ + case ConfigureRequest: return e->xconfigurerequest.window; /* DIFF */ + case GravityNotify: return e->xgravity.window; /* DIFF */ + case ResizeRequest: return e->xresizerequest.window; /* same */ + case CirculateNotify: return e->xcirculate.window; /* DIFF */ + case CirculateRequest: return e->xcirculaterequest.window; /* DIFF */ + case PropertyNotify: return e->xproperty.window; /* same */ + case SelectionClear: return e->xselectionclear.window; /* same */ + case SelectionRequest: return e->xselectionrequest.requestor; /* DIFF */ + case SelectionNotify: return e->xselection.requestor; /* same */ + case ColormapNotify: return e->xcolormap.window; /* same */ + case ClientMessage: return e->xclient.window; /* same */ + case MappingNotify: return None; + } + return None; +} + + + +/*********************************************************************** + * + * Procedure: + * DispatchEvent2 - + * handle a single X event stored in global var Event + * this routine for is for a call during an f.move + * + **********************************************************************/ +/* + * Merged into DispatchEvent() + * djhjr - 10/6/02 + */ +#if 0 +Bool DispatchEvent2 () +{ + Window w = Event.xany.window; + StashEventTime (&Event); + + if (XFindContext (dpy, w, TwmContext, (caddr_t *) &Tmp_win) == XCNOENT) + Tmp_win = NULL; + + if (XFindContext (dpy, w, ScreenContext, (caddr_t *)&Scr) == XCNOENT) { + Scr = FindScreenInfo (WindowOfEvent (&Event)); + } + + if (!Scr) return False; + + if (menuFromFrameOrWindowOrTitlebar && Event.type == Expose) + HandleExpose(); + + if (!menuFromFrameOrWindowOrTitlebar && Event.type>= 0 && Event.type < MAX_X_EVENT) { + (*EventHandler[Event.type])(); + } + + return True; +} +#endif + +/*********************************************************************** + * + * Procedure: + * DispatchEvent - handle a single X event stored in global var Event + * + *********************************************************************** + */ +Bool DispatchEvent () +{ + Window w = Event.xany.window; + StashEventTime (&Event); + + if (XFindContext (dpy, w, TwmContext, (caddr_t *) &Tmp_win) == XCNOENT) + Tmp_win = NULL; + + if (XFindContext (dpy, w, ScreenContext, (caddr_t *)&Scr) == XCNOENT) + Scr = FindScreenInfo (WindowOfEvent (&Event)); + + if (!Scr) return False; + + if (MoveFunction != F_NOFUNCTION && menuFromFrameOrWindowOrTitlebar) + { + if (Event.type == Expose) + HandleExpose(); + } + else if (Event.type >= 0 && Event.type < MAX_X_EVENT) + (*EventHandler[Event.type])(); + + return True; +} + + + +/*********************************************************************** + * + * Procedure: + * HandleEvents - handle X events + * + *********************************************************************** + */ + +void +HandleEvents() +{ + while (TRUE) + { + if (enter_flag && !QLength(dpy)) { + if (enter_win && enter_win != raise_win) { + AutoRaiseWindow (enter_win); /* sets enter_flag T */ + } else { + enter_flag = FALSE; + } + } + if (ColortableThrashing && !QLength(dpy) && Scr) { + InstallWindowColormaps(ColormapNotify, (TwmWindow *) NULL); + } + WindowMoved = FALSE; + XNextEvent(dpy, &Event); + (void) DispatchEvent (); + } +} + + + +/*********************************************************************** + * + * Procedure: + * HandleColormapNotify - colormap notify event handler + * + * This procedure handles both a client changing its own colormap, and + * a client explicitly installing its colormap itself (only the window + * manager should do that, so we must set it correctly). + * + *********************************************************************** + */ + +void +HandleColormapNotify() +{ + XColormapEvent *cevent = (XColormapEvent *) &Event; + ColormapWindow *cwin, **cwins; + TwmColormap *cmap; + int lost, won, n, number_cwins; + extern TwmColormap *CreateTwmColormap(); + + if (XFindContext(dpy, cevent->window, ColormapContext, (caddr_t *)&cwin) == XCNOENT) + return; + cmap = cwin->colormap; + + if (cevent->new) + { + if (XFindContext(dpy, cevent->colormap, ColormapContext, + (caddr_t *)&cwin->colormap) == XCNOENT) + cwin->colormap = CreateTwmColormap(cevent->colormap); + else + cwin->colormap->refcnt++; + + cmap->refcnt--; + + if (cevent->state == ColormapUninstalled) + cmap->state &= ~CM_INSTALLED; + else + cmap->state |= CM_INSTALLED; + + if (cmap->state & CM_INSTALLABLE) + InstallWindowColormaps(ColormapNotify, (TwmWindow *) NULL); + + if (cmap->refcnt == 0) + { + XDeleteContext(dpy, cmap->c, ColormapContext); + free((char *) cmap); + } + + return; + } + + if (cevent->state == ColormapUninstalled && + (cmap->state & CM_INSTALLABLE)) + { + if (!(cmap->state & CM_INSTALLED)) + return; + cmap->state &= ~CM_INSTALLED; + + if (!ColortableThrashing) + { + ColortableThrashing = TRUE; + XSync(dpy, 0); + } + + if (cevent->serial >= Scr->cmapInfo.first_req) + { + number_cwins = Scr->cmapInfo.cmaps->number_cwins; + + /* + * Find out which colortables collided. + */ + + cwins = Scr->cmapInfo.cmaps->cwins; + for (lost = won = -1, n = 0; + (lost == -1 || won == -1) && n < number_cwins; + n++) + { + if (lost == -1 && cwins[n] == cwin) + { + lost = n; /* This is the window which lost its colormap */ + continue; + } + + if (won == -1 && + cwins[n]->colormap->install_req == cevent->serial) + { + won = n; /* This is the window whose colormap caused */ + continue; /* the de-install of the previous colormap */ + } + } + + /* + ** Cases are: + ** Both the request and the window were found: + ** One of the installs made honoring the WM_COLORMAP + ** property caused another of the colormaps to be + ** de-installed, just mark the scoreboard. + ** + ** Only the request was found: + ** One of the installs made honoring the WM_COLORMAP + ** property caused a window not in the WM_COLORMAP + ** list to lose its map. This happens when the map + ** it is losing is one which is trying to be installed, + ** but is getting getting de-installed by another map + ** in this case, we'll get a scoreable event later, + ** this one is meaningless. + ** + ** Neither the request nor the window was found: + ** Somebody called installcolormap, but it doesn't + ** affect the WM_COLORMAP windows. This case will + ** probably never occur. + ** + ** Only the window was found: + ** One of the WM_COLORMAP windows lost its colormap + ** but it wasn't one of the requests known. This is + ** probably because someone did an "InstallColormap". + ** The colormap policy is "enforced" by re-installing + ** the colormaps which are believed to be correct. + */ + + if (won != -1) + if (lost != -1) + { + /* lower diagonal index calculation */ + if (lost > won) + n = lost*(lost-1)/2 + won; + else + n = won*(won-1)/2 + lost; + Scr->cmapInfo.cmaps->scoreboard[n] = 1; + } else + { + /* + ** One of the cwin installs caused one of the cwin + ** colormaps to be de-installed, so I'm sure to get an + ** UninstallNotify for the cwin I know about later. + ** I haven't got it yet, or the test of CM_INSTALLED + ** above would have failed. Turning the CM_INSTALLED + ** bit back on makes sure we get back here to score + ** the collision. + */ + cmap->state |= CM_INSTALLED; + } + else if (lost != -1) + InstallWindowColormaps(ColormapNotify, (TwmWindow *) NULL); + } + } + + else if (cevent->state == ColormapUninstalled) + cmap->state &= ~CM_INSTALLED; + + else if (cevent->state == ColormapInstalled) + cmap->state |= CM_INSTALLED; +} + + + +/*********************************************************************** + * + * Procedure: + * HandleVisibilityNotify - visibility notify event handler + * + * This routine keeps track of visibility events so that colormap + * installation can keep the maximum number of useful colormaps + * installed at one time. + * + *********************************************************************** + */ + +void +HandleVisibilityNotify() +{ + XVisibilityEvent *vevent = (XVisibilityEvent *) &Event; + ColormapWindow *cwin; + TwmColormap *cmap; + + if (XFindContext(dpy, vevent->window, ColormapContext, (caddr_t *)&cwin) == XCNOENT) + return; + + /* + * when Saber complains about retreiving an from an + * just type "touch vevent->state" and "cont" + */ + cmap = cwin->colormap; + if ((cmap->state & CM_INSTALLABLE) && + vevent->state != cwin->visibility && + (vevent->state == VisibilityFullyObscured || + cwin->visibility == VisibilityFullyObscured) && + cmap->w == cwin->w) { + cwin->visibility = vevent->state; + InstallWindowColormaps(VisibilityNotify, (TwmWindow *) NULL); + } else + cwin->visibility = vevent->state; +} + + + +/*********************************************************************** + * + * Procedure: + * HandleKeyPress - key press event handler + * + *********************************************************************** + */ + +int MovedFromKeyPress = False; + +void +HandleKeyPress() +{ + FuncKey *key; + int len; + unsigned int modifier; + TwmWindow *tmp_win; + + /* djhjr - 6/5/98 */ + int have_ScrFocus = 0; + +#if 0 + if (InfoLines) + { XUnmapWindow(dpy, Scr->InfoWindow); +RFB july 28 1993 this code was wrong anyway because +InfoLines should have been set to 0. +Simply remove it... + } +#endif + Context = C_NO_CONTEXT; + + if (Event.xany.window == Scr->Root) + Context = C_ROOT; + if ((Event.xany.window == Scr->VirtualDesktopDisplay) || + (Event.xany.window == Scr->VirtualDesktopDisplayOuter)) + { + if (Event.xkey.subwindow && + (XFindContext(dpy, Event.xkey.subwindow, VirtualContext, (caddr_t *) &tmp_win) + != XCNOENT)) { + Tmp_win = tmp_win; + Context = C_VIRTUAL_WIN; + } else { + Context = C_VIRTUAL; + Tmp_win = Scr->VirtualDesktopDisplayTwin; + } + } + if (Tmp_win) + { + if (Event.xany.window == Tmp_win->title_w) + Context = C_TITLE; + if (Event.xany.window == Tmp_win->w) + Context = C_WINDOW; + if (Event.xany.window == Tmp_win->icon_w) + Context = C_ICON; + if (Event.xany.window == Tmp_win->frame) + Context = C_FRAME; + if (Tmp_win->list && Event.xany.window == Tmp_win->list->w) + Context = C_ICONMGR; + if (Tmp_win->list && Event.xany.window == Tmp_win->list->icon) + Context = C_ICONMGR; + } + + /* + * Now HERE'S a fine little kludge: Make an icon manager's frame or + * the virtual desktop's frame or a door and it's frame context- + * sensitive to key bindings, and make the frames of windows without + * titlebars forward key events. + * + * djhjr - 6/5/98 7/2/98 7/14/98 + */ + if (Scr->Focus && (Context == C_NO_CONTEXT || Context == C_ROOT)) + { + /* ugly, but it works! see also iconmgr.c:RemoveIconManager() */ + if (Scr->Focus->iconmgr) + { +#ifdef NEVER /* warps to icon managers uniquely handled in menus.c:WarpToWindow() */ + if (!Scr->Focus->iconmgrp->active) + { + ActiveIconManager(Scr->Focus->iconmgrp->last); + Tmp_win = Scr->Focus; + } + else + Tmp_win = Scr->Focus->iconmgrp->active->twm; +#endif + + have_ScrFocus = 1; + } + else if (Scr->VirtualDesktopDisplayTwin == Scr->Focus) + { + Tmp_win = Scr->Focus; + Context = C_VIRTUAL; + } + /* XFindContext() doesn't seem to work here!?! */ + else if (Scr->Doors) + { + TwmDoor *door_win; + + for (door_win = Scr->Doors; door_win != NULL; + door_win = door_win->next) + if (door_win->twin == Scr->Focus) + { + Tmp_win = Scr->Focus; + Context = C_DOOR; + + break; + } + } + else if (Scr->Focus->frame && !Scr->Focus->title_w) + { + Tmp_win = Scr->Focus; + Event.xany.window = Tmp_win->frame; + Context = C_FRAME; + } + } + + modifier = (Event.xkey.state & mods_used); + for (key = Scr->FuncKeyRoot.next; key != NULL; key = key->next) + { + if (key->keycode == Event.xkey.keycode && + key->mods == modifier && + (key->cont == Context || key->cont == C_NAME)) + { + /* it doesn't make sense to resize from a key press? */ + if (key->func == F_RESIZE) + return; + + /* + * Exceptions for warps from icon managers (see the above kludge) + * + * djhjr - 6/5/98 7/2/98 7/14/98 + */ + switch (key->func) + { + case F_WARP: + if (have_ScrFocus && Context == C_ROOT) + return; + + break; + case F_WARPCLASSNEXT: + case F_WARPCLASSPREV: + case F_WARPRING: + if (Context == C_ICONMGR) + Scr->Focus = Tmp_win = Tmp_win->list->iconmgr->twm_win; + + if (have_ScrFocus) + { + Tmp_win = Scr->Focus; + Context = C_ICONMGR; + } + + break; +/* case F_WARPTO:*/ +/* case F_WARPTOICONMGR:*/ +/* case F_WARPTONEWEST:*/ + default: + break; + } + + /* special case for moves */ + if (key->func == F_MOVE || key->func == F_FORCEMOVE) + MovedFromKeyPress = True; + + if (key->cont != C_NAME) + { + ExecuteFunction(key->func, key->action, Event.xany.window, + Tmp_win, &Event, Context, FALSE); + + /* + * Added this 'if ()' for deferred keyboard events (see also menus.c) + * Submitted by Michel Eyckmans + */ + if (!(Context = C_ROOT && RootFunction != F_NOFUNCTION)) + XUngrabPointer(dpy, CurrentTime); + + return; + } + else + { + int matched = FALSE; + len = strlen(key->win_name); + + /* try and match the name first */ + for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL; + Tmp_win = Tmp_win->next) + { + if (!strncmp(key->win_name, Tmp_win->name, len)) + { + matched = TRUE; + ExecuteFunction(key->func, key->action, Tmp_win->frame, + Tmp_win, &Event, C_FRAME, FALSE); + XUngrabPointer(dpy, CurrentTime); + } + } + + /* now try the res_name */ + if (!matched) + for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL; + Tmp_win = Tmp_win->next) + { + if (!strncmp(key->win_name, Tmp_win->class.res_name, len)) + { + matched = TRUE; + ExecuteFunction(key->func, key->action, Tmp_win->frame, + Tmp_win, &Event, C_FRAME, FALSE); + XUngrabPointer(dpy, CurrentTime); + } + } + + /* now try the res_class */ + if (!matched) + for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL; + Tmp_win = Tmp_win->next) + { + if (!strncmp(key->win_name, Tmp_win->class.res_class, len)) + { + matched = TRUE; + ExecuteFunction(key->func, key->action, Tmp_win->frame, + Tmp_win, &Event, C_FRAME, FALSE); + XUngrabPointer(dpy, CurrentTime); + } + } + if (matched) + return; + } + } + } + + /* + * If we get here, no function was bound to the key. Send it + * to the client if it was in a window we know about. + */ + if (Tmp_win) + { + if (Event.xany.window == Tmp_win->icon_w || + Event.xany.window == Tmp_win->frame || + Event.xany.window == Tmp_win->title_w || + (Tmp_win->list && (Event.xany.window == Tmp_win->list->w))) + { + Event.xkey.window = Tmp_win->w; + XSendEvent(dpy, Tmp_win->w, False, KeyPressMask, &Event); + } + } + +} + + + +static void free_window_names (tmp, nukefull, nukename, nukeicon) + TwmWindow *tmp; + Bool nukefull, nukename, nukeicon; +{ + /* the other two "free()"s were "XFree()"s - djhjr - 9/14/03 */ +/* + + * XXX - are we sure that nobody ever sets these to another constant (check + * twm windows)? + */ + if (tmp->name == tmp->full_name) nukefull = False; + +/* this test is never true anymore... - djhjr - 2/20/99 + if (tmp->name == tmp->icon_name) nukename = False; +*/ + +#define isokay(v) ((v) && (v) != NoName) + + if (nukefull && isokay(tmp->full_name)) free (tmp->full_name); + if (nukename && isokay(tmp->name)) free (tmp->name); + +/* ...because the icon name is now alloc()'d locally - djhjr - 2/20/99 + if (nukeicon && isokay(tmp->icon_name)) XFree (tmp->icon_name); +*/ + if (nukeicon && tmp->icon_name) free(tmp->icon_name); + +#undef isokay + return; +} + + + +void free_cwins (tmp) + TwmWindow *tmp; +{ + int i; + TwmColormap *cmap; + + if (tmp->cmaps.number_cwins) { + for (i = 0; i < tmp->cmaps.number_cwins; i++) { + if (--tmp->cmaps.cwins[i]->refcnt == 0) { + cmap = tmp->cmaps.cwins[i]->colormap; + if (--cmap->refcnt == 0) { + XDeleteContext(dpy, cmap->c, ColormapContext); + free((char *) cmap); + } + XDeleteContext(dpy, tmp->cmaps.cwins[i]->w, ColormapContext); + free((char *) tmp->cmaps.cwins[i]); + } + } + free((char *) tmp->cmaps.cwins); + if (tmp->cmaps.number_cwins > 1) { + free(tmp->cmaps.scoreboard); + tmp->cmaps.scoreboard = NULL; + } + tmp->cmaps.number_cwins = 0; + } +} + + + +/*********************************************************************** + * + * Procedure: + * HandlePropertyNotify - property notify event handler + * + *********************************************************************** + */ + +void +HandlePropertyNotify() +{ + char *prop = NULL; +#ifdef NO_I18N_SUPPORT + Atom actual = None; + int actual_format; + unsigned long nitems, bytesafter; +#endif + unsigned long valuemask; /* mask for create windows */ + XSetWindowAttributes attributes; /* attributes for create windows */ + Pixmap pm; + + /* watch for standard colormap changes */ + if (Event.xproperty.window == Scr->Root) { + XStandardColormap *maps = NULL; + int nmaps; + + switch (Event.xproperty.state) { + case PropertyNewValue: + if (XGetRGBColormaps (dpy, Scr->Root, &maps, &nmaps, + Event.xproperty.atom)) { + /* if got one, then replace any existing entry */ + InsertRGBColormap (Event.xproperty.atom, maps, nmaps, True); + } + return; + + case PropertyDelete: + RemoveRGBColormap (Event.xproperty.atom); + return; + } + } + + if (!Tmp_win) return; /* unknown window */ + +#define MAX_NAME_LEN 200L /* truncate to this many */ +#define MAX_ICON_NAME_LEN 200L /* ditto */ + + switch (Event.xproperty.atom) { + case XA_WM_NAME: +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (!I18N_FetchName(dpy, Tmp_win->w, &prop)) +#else + if (XGetWindowProperty (dpy, Tmp_win->w, Event.xproperty.atom, 0L, + MAX_NAME_LEN, False, XA_STRING, &actual, + &actual_format, &nitems, &bytesafter, + (unsigned char **) &prop) != Success || actual == None) +#endif + return; + + free_window_names (Tmp_win, True, True, False); + Tmp_win->full_name = (prop) ? strdup(prop) : NoName; + Tmp_win->name = (prop) ? strdup(prop) : NoName; +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (prop) free(prop); +#else + if (prop) XFree(prop); +#endif + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + Tmp_win->name_width = MyFont_TextWidth (&Scr->TitleBarFont, +#else + Tmp_win->name_width = XTextWidth (Scr->TitleBarFont.font, +#endif + Tmp_win->name, + strlen (Tmp_win->name)); + + SetupWindow (Tmp_win, Tmp_win->frame_x, Tmp_win->frame_y, + Tmp_win->frame_width, Tmp_win->frame_height, -1); + + if (Tmp_win->title_w) XClearArea(dpy, Tmp_win->title_w, 0,0,0,0, True); + + /* + * if the icon name is NoName, set the name of the icon to be + * the same as the window + */ +/* see that the icon name is it's own memory - djhjr - 2/20/99 + if (Tmp_win->icon_name == NoName) { + Tmp_win->icon_name = Tmp_win->name; +*/ + if (!strcmp(Tmp_win->icon_name, NoName)) { + free(Tmp_win->icon_name); + Tmp_win->icon_name = strdup(Tmp_win->name); + + RedoIconName(); + } + break; + + case XA_WM_ICON_NAME: +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (!I18N_GetIconName(dpy, Tmp_win->w, &prop)) +#else + if (XGetWindowProperty (dpy, Tmp_win->w, Event.xproperty.atom, 0, + MAX_ICON_NAME_LEN, False, XA_STRING, &actual, + &actual_format, &nitems, &bytesafter, + (unsigned char **) &prop) != Success || actual == None) +#endif + return; + +/* see that the icon name is it's own memory - djhjr - 2/20/99 + if (!prop) prop = NoName; + free_window_names (Tmp_win, False, False, True); + Tmp_win->icon_name = prop; +*/ + free_window_names (Tmp_win, False, False, True); + Tmp_win->icon_name = (prop) ? strdup(prop) : NoName; +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (prop) free(prop); +#else + if (prop) XFree(prop); +#endif + + RedoIconName(); + + break; + + case XA_WM_HINTS: + if (Tmp_win->wmhints) XFree ((char *) Tmp_win->wmhints); + Tmp_win->wmhints = XGetWMHints(dpy, Event.xany.window); + + if (Tmp_win->wmhints && (Tmp_win->wmhints->flags & WindowGroupHint)) + Tmp_win->group = Tmp_win->wmhints->window_group; + + if (!Tmp_win->forced && Tmp_win->wmhints && + Tmp_win->wmhints->flags & IconWindowHint) { + if (Tmp_win->icon_w) { + int icon_x, icon_y; + + /* + * There's already an icon window. + * Try to find out where it is; if we succeed, move the new + * window to where the old one is. + */ + if (XGetGeometry (dpy, Tmp_win->icon_w, &JunkRoot, &icon_x, + &icon_y, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth)) { + /* + * Move the new icon window to where the old one was. + */ + XMoveWindow(dpy, Tmp_win->wmhints->icon_window, icon_x, + icon_y); + } + + /* + * If the window is iconic, map the new icon window. + */ + if (Tmp_win->icon) + XMapWindow(dpy, Tmp_win->wmhints->icon_window); + + /* + * Now, if the old window isn't ours, unmap it, otherwise + * just get rid of it completely. + */ + if (Tmp_win->icon_not_ours) { + if (Tmp_win->icon_w != Tmp_win->wmhints->icon_window) + XUnmapWindow(dpy, Tmp_win->icon_w); + } else + XDestroyWindow(dpy, Tmp_win->icon_w); + + /* + * The new icon window isn't our window, so note that fact + * so that we don't treat it as ours. + */ + Tmp_win->icon_not_ours = TRUE; + + /* + * Now make the new window the icon window for this window, + * and set it up to work as such (select for key presses + * and button presses/releases, set up the contexts for it, + * and define the cursor for it). + */ + Tmp_win->icon_w = Tmp_win->wmhints->icon_window; + XSelectInput (dpy, Tmp_win->icon_w, + KeyPressMask | ButtonPressMask | ButtonReleaseMask); + XSaveContext(dpy, Tmp_win->icon_w, TwmContext, (caddr_t)Tmp_win); + XSaveContext(dpy, Tmp_win->icon_w, ScreenContext, (caddr_t)Scr); + XDefineCursor(dpy, Tmp_win->icon_w, Scr->IconCursor); + } + } + + if (Tmp_win->icon_w && !Tmp_win->forced && Tmp_win->wmhints && + (Tmp_win->wmhints->flags & IconPixmapHint)) { + if (!XGetGeometry (dpy, Tmp_win->wmhints->icon_pixmap, &JunkRoot, + &JunkX, &JunkY, (unsigned int *)&Tmp_win->icon_width, + (unsigned int *)&Tmp_win->icon_height, &JunkBW, &JunkDepth)) { + return; + } + + pm = XCreatePixmap (dpy, Scr->Root, Tmp_win->icon_width, + Tmp_win->icon_height, Scr->d_depth); + if (!pm) return; + + FB(Tmp_win->iconc.fore, Tmp_win->iconc.back); + +/* + * adapted from CTWM-3.5 - djhjr - 9/4/98 + */ +#ifdef ORIGINAL_PIXMAPS + XCopyPlane(dpy, Tmp_win->wmhints->icon_pixmap, pm, + Scr->NormalGC, + 0,0, Tmp_win->icon_width, Tmp_win->icon_height, 0, 0, 1 ); +#else + if (JunkDepth == Scr->d_depth) + XCopyArea (dpy, Tmp_win->wmhints->icon_pixmap, pm, Scr->NormalGC, + 0,0, Tmp_win->icon_width, Tmp_win->icon_height, 0, 0); + else + XCopyPlane(dpy, Tmp_win->wmhints->icon_pixmap, pm, Scr->NormalGC, + 0,0, Tmp_win->icon_width, Tmp_win->icon_height, 0, 0, 1 ); +#endif + + valuemask = CWBackPixmap; + attributes.background_pixmap = pm; + + if (Tmp_win->icon_bm_w) + XDestroyWindow(dpy, Tmp_win->icon_bm_w); + + Tmp_win->icon_bm_w = + XCreateWindow (dpy, Tmp_win->icon_w, 0, 0, + (unsigned int) Tmp_win->icon_width, + (unsigned int) Tmp_win->icon_height, + (unsigned int) 0, Scr->d_depth, + (unsigned int) CopyFromParent, Scr->d_visual, + valuemask, &attributes); + +/* + * adapted from CTWM-3.5 - djhjr - 9/4/98 + */ +#ifndef ORIGINAL_PIXMAPS + if (! (Tmp_win->wmhints->flags & IconMaskHint)) { + XRectangle rect; + + rect.x = rect.y = 0; + rect.width = Tmp_win->icon_width; + rect.height = Tmp_win->icon_height; + XShapeCombineRectangles (dpy, Tmp_win->icon_w, ShapeBounding, + 0, 0, &rect, 1, ShapeUnion, 0); + } +#endif + + XFreePixmap (dpy, pm); + RedoIconName(); + } + +/* + * adapted from CTWM-3.5 - djhjr - 9/4/98 + */ +#ifndef ORIGINAL_PIXMAPS + if (Tmp_win->icon_w && !Tmp_win->forced && Tmp_win->wmhints && + (Tmp_win->wmhints->flags & IconMaskHint)) { + GC gc; + + if (!XGetGeometry (dpy, Tmp_win->wmhints->icon_mask, &JunkRoot, + &JunkX, &JunkY, &JunkWidth, &JunkHeight, &JunkBW, + &JunkDepth)) { + return; + } + if (JunkDepth != 1) return; + + pm = XCreatePixmap (dpy, Scr->Root, JunkWidth, JunkHeight, 1); + if (!pm) return; + + gc = XCreateGC (dpy, pm, 0, NULL); + if (!gc) return; + + XCopyArea (dpy, Tmp_win->wmhints->icon_mask, pm, gc, + 0, 0, JunkWidth, JunkHeight, 0, 0); + XFreeGC (dpy, gc); + + XFreePixmap (dpy, pm); + RedoIconName(); + } +#endif + + break; + + case XA_WM_NORMAL_HINTS: + GetWindowSizeHints (Tmp_win); + break; + + default: + if (Event.xproperty.atom == _XA_WM_COLORMAP_WINDOWS) { + FetchWmColormapWindows (Tmp_win); /* frees old data */ + break; + } else if (Event.xproperty.atom == _XA_WM_PROTOCOLS) { + FetchWmProtocols (Tmp_win); + break; + } + break; + } +} + + + +/*********************************************************************** + * + * Procedure: + * RedoIconName - procedure to re-position the icon window and name + * + *********************************************************************** + */ + +void RedoIconName() +{ + int x, y; + + if (Tmp_win->list) + { + /* let the expose event cause the repaint */ + XClearArea(dpy, Tmp_win->list->w, 0,0,0,0, True); + + if (Scr->SortIconMgr) + SortIconManager(Tmp_win->list->iconmgr); + } + + if (Scr->Virtual && + Scr->NamesInVirtualDesktop && + Tmp_win->VirtualDesktopDisplayWindow) + XClearArea(dpy, Tmp_win->VirtualDesktopDisplayWindow, + 0, 0, 0, 0, True); + + if ( ! Tmp_win->icon_w ) return; + + if (Tmp_win->icon_not_ours) + return; + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + Tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont, +#else + Tmp_win->icon_w_width = XTextWidth(Scr->IconFont.font, +#endif + Tmp_win->icon_name, strlen(Tmp_win->icon_name)); + +/* djhjr - 6/11/96 + Tmp_win->icon_w_width += 6; + if (Tmp_win->icon_w_width < Tmp_win->icon_width) + { + Tmp_win->icon_x = (Tmp_win->icon_width - Tmp_win->icon_w_width)/2; + Tmp_win->icon_x += 3; + Tmp_win->icon_w_width = Tmp_win->icon_width; + } + else + { + Tmp_win->icon_x = 3; + } +*/ + Tmp_win->icon_w_width += 8; + if (Tmp_win->icon_w_width < Tmp_win->icon_width + 8) + { + Tmp_win->icon_x = (((Tmp_win->icon_width + 8) - Tmp_win->icon_w_width)/2) + 4; + Tmp_win->icon_w_width = Tmp_win->icon_width + 8; + } + else + Tmp_win->icon_x = 4; + + if (Tmp_win->icon_w_width == Tmp_win->icon_width) + x = 0; + else + x = (Tmp_win->icon_w_width - Tmp_win->icon_width)/2; + +/* djhjr - 6/11/96 + y = 0; +*/ + y = 4; + +/* djhjr - 6/11/96 + Tmp_win->icon_w_height = Tmp_win->icon_height + Scr->IconFont.height + 4; + Tmp_win->icon_y = Tmp_win->icon_height + Scr->IconFont.height; +*/ + Tmp_win->icon_w_height = Tmp_win->icon_height + Scr->IconFont.height + 8; + Tmp_win->icon_y = Tmp_win->icon_height + Scr->IconFont.height + 2; + + XResizeWindow(dpy, Tmp_win->icon_w, Tmp_win->icon_w_width, + Tmp_win->icon_w_height); + if (Tmp_win->icon_bm_w) + { + XMoveWindow(dpy, Tmp_win->icon_bm_w, x, y); + XMapWindow(dpy, Tmp_win->icon_bm_w); + } + if (Tmp_win->icon) + { + XClearArea(dpy, Tmp_win->icon_w, 0, 0, 0, 0, True); + } +} + +/* + * RedoDoorName - Redraw the contents of a door's window + * + * djhjr - 2/10/99 2/28/99 + */ +void +RedoDoorName(twin, door) +TwmWindow *twin; +TwmDoor *door; +{ + TwmWindow *tmp_win; + + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(door->colors.fore, door->colors.back, Scr->DoorFont); + + /* find it's twm window to get the current width, etc. */ +/* + * The TWM window is passed from Do*Resize(), + * as it may be undeterminable in HandleExpose()!? + * + * djhjr - 2/28/99 + * + if (XFindContext(dpy, Event.xany.window, TwmContext, + (caddr_t *)&tmp_win) != XCNOENT) +*/ + if (twin) + tmp_win = twin; + else + XFindContext(dpy, Event.xany.window, TwmContext, (caddr_t *)&tmp_win); + + if (tmp_win) + { + int tw, bw; + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + tw = MyFont_TextWidth(&Scr->DoorFont, +#else + tw = XTextWidth(Scr->DoorFont.font, +#endif + door->name, strlen(door->name)); + + /* djhjr - 4/26/96 */ +/* djhjr - 8/11/98 + * was 'Scr->use3Dborders' - djhjr - 8/11/98 * + bw = (Scr->BorderBevelWidth > 0) ? Scr->ThreeDBorderWidth : 0; +*/ + bw = (Scr->BorderBevelWidth > 0) ? Scr->BorderWidth : 0; + + /* change the little internal one to fit the external */ + XResizeWindow(dpy, door->w, + tmp_win->frame_width, + tmp_win->frame_height); + + /* draw the text in the right place */ +/* And it IS the right place. +** If your font has its characters starting 20 pixels +** over to the right, it just looks wrong! +** For example grog-9 from ISC's X11R3 distribution. +*/ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString(dpy, door->w, &Scr->DoorFont, +#else + XDrawString(dpy, door->w, +#endif + Scr->NormalGC, +/* gets 'SIZE_VINDENT' out of here... djhjr - 5/14/96 + (tmp_win->frame_width - tw)/2, + tmp_win->frame_height - SIZE_VINDENT - + (tmp_win->frame_height - Scr->DoorFont.height)/2, +** ...and NOW it's in the right place! */ + (tmp_win->frame_width - tw - 2 * bw) / 2, + (tmp_win->frame_height - tmp_win->title_height - + Scr->DoorFont.height - 2 * bw) / 2 + +/* djhjr - 9/14/03 + Scr->DoorFont.font->ascent, +*/ + Scr->DoorFont.ascent, + door->name, strlen(door->name)); + + /* djhjr - 2/7/99 */ + if (Scr->DoorBevelWidth > 0) + Draw3DBorder(door->w, 0, 0, tmp_win->frame_width - (bw * 2), + tmp_win->frame_height - (bw * 2), + Scr->DoorBevelWidth, Scr->DoorC, off, False, False); + } else { +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString(dpy, door->w, &Scr->DoorFont, +#else + XDrawString(dpy, door->w, +#endif + Scr->NormalGC, + SIZE_HINDENT/2, 0/*Scr->DoorFont.height*/, + door->name, strlen(door->name)); + } +} + +/* + * RedoListWindow - Redraw the contents of an icon manager's entry + * + * djhjr - 3/1/99 + */ +void +RedoListWindow(twin) +TwmWindow *twin; +{ +/* djhjr - 4/19/96 + * font was font.font->fid - djhjr - 9/14/03 * + FBF(twin->list->fore, twin->list->back, Scr->IconManagerFont); +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + MyFont_DrawString (dpy, Event.xany.window, &Scr->IconManagerFont, +#else + XDrawString (dpy, Event.xany.window, +#endif + Scr->NormalGC, + iconmgr_textx, Scr->IconManagerFont.y+4, + twin->icon_name, strlen(twin->icon_name)); + DrawIconManagerBorder(twin->list); +*/ + /* made static - djhjr - 6/18/99 */ + static int en = 0, dots = 0; + + /* djhjr - 3/29/98 */ + int i, j, slen = strlen(twin->icon_name); + char *a = NULL; + + /* djhjr - 10/2/01 */ + if (!twin->list) return; + + /* + * clip the title a couple of characters less than the width of the + * icon window plus padding, and tack on ellipses - this is a little + * different than the titlebar's... + * + * djhjr - 3/29/98 + */ + if (Scr->NoPrettyTitles == FALSE) /* for rader - djhjr - 2/9/99 */ + { +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + i = MyFont_TextWidth(&Scr->IconManagerFont, +#else + i = XTextWidth(Scr->IconManagerFont.font, +#endif + twin->icon_name, slen); + +/* DUH! - djhjr - 6/18/99 + j = twin->list->width - iconmgr_textx - en; +*/ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (!en) en = MyFont_TextWidth(&Scr->IconManagerFont, "n", 1); + if (!dots) dots = MyFont_TextWidth(&Scr->IconManagerFont, "...", 3); +#else + if (!en) en = XTextWidth(Scr->IconManagerFont.font, "n", 1); + if (!dots) dots = XTextWidth(Scr->IconManagerFont.font, "...", 3); +#endif + j = twin->list->width - iconmgr_textx - dots; + + /* djhjr - 5/5/98 */ + /* was 'Scr->use3Diconmanagers' - djhjr - 8/11/98 */ + if (Scr->IconMgrBevelWidth > 0) + j -= Scr->IconMgrBevelWidth; + else + j -= Scr->BorderWidth; + +/* djhjr - 6/18/99 + if (2 * en >= j) +*/ + if (en >= j) + slen = 0; + else if (i >= j) + { + for (i = slen; i >= 0; i--) + +/* djhjr - 6/18/99 + if (XTextWidth(Scr->IconManagerFont.font, twin->icon_name, i) + 2 * en < j) +*/ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (MyFont_TextWidth(&Scr->IconManagerFont, +#else + if (XTextWidth(Scr->IconManagerFont.font, +#endif + twin->icon_name, i) + en < j) + { + slen = i; + break; + } + + a = (char *)malloc(slen + 4); + memcpy(a, twin->icon_name, slen); + strcpy(a + slen, "..."); + slen += 3; + } + } + + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(twin->list->cp.fore, twin->list->cp.back, Scr->IconManagerFont); + +/* what's the point of this? - djhjr - 5/2/98 + if (Scr->use3Diconmanagers && (Scr->Monochrome != COLOR)) +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString (dpy, twin->list->w, + &Scr->IconManagerFont, +#else + XDrawImageString (dpy, twin->list->w, +#endif + Scr->NormalGC, iconmgr_textx, + +* djhjr - 5/2/98 + Scr->IconManagerFont.y+4, +* + (twin->list->height - Scr->IconManagerFont.height) / 2 + + Scr->IconManagerFont.y, + + (a) ? a : twin->icon_name, slen); + else +*/ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString (dpy, twin->list->w, + &Scr->IconManagerFont, +#else + XDrawString (dpy, twin->list->w, +#endif + Scr->NormalGC, iconmgr_textx, + +/* djhjr - 5/2/98 + Scr->IconManagerFont.y+4, +*/ + (twin->list->height - Scr->IconManagerFont.height) / 2 + + Scr->IconManagerFont.y, + + (a) ? a : twin->icon_name, slen); + + /* free the clipped title - djhjr - 3/29/98 */ + if (a) free(a); + + DrawIconManagerBorder(twin->list, False); +} + + +/*********************************************************************** + * + * Procedure: + * HandleClientMessage - client message event handler + * + *********************************************************************** + */ + +void +HandleClientMessage() +{ + extern void RestartVtwm(); + + if (Event.xclient.message_type == _XA_WM_CHANGE_STATE) + { + if (Tmp_win != NULL) + { + if (Event.xclient.data.l[0] == IconicState && !Tmp_win->icon) + { + XEvent button; + + XQueryPointer( dpy, Scr->Root, &JunkRoot, &JunkChild, + &(button.xmotion.x_root), + &(button.xmotion.y_root), + &JunkX, &JunkY, &JunkMask); + + ExecuteFunction(F_ICONIFY, NULLSTR, Event.xany.window, + Tmp_win, &button, FRAME, FALSE); + XUngrabPointer(dpy, CurrentTime); + } + } + } + /* djhjr - 7/31/98 */ + else if (Event.xclient.message_type == _XA_TWM_RESTART) + RestartVtwm(CurrentTime); +} + + + +/*********************************************************************** + * + * Procedure: + * HandleExpose - expose event handler + * + *********************************************************************** + */ + +static void flush_expose(); + +void +HandleExpose() +{ + MenuRoot *tmp; + TwmDoor *door = NULL; + int j; + + if (XFindContext(dpy, Event.xany.window, MenuContext, (caddr_t *)&tmp) == 0) + { + PaintMenu(tmp, &Event); + return; + } + + if (XFindContext(dpy, Event.xany.window, DoorContext, (caddr_t *)&door) != XCNOENT) + { + /* see also resize.c - djhjr - 2/28/99 */ + RedoDoorName(NULL, door); + flush_expose(Event.xany.window); + return; + } + + if (Event.xexpose.count != 0) + return; + + if (Event.xany.window == Scr->InfoWindow && InfoLines) + { + int i, k; + int height; + + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(Scr->DefaultC.fore, Scr->DefaultC.back, Scr->InfoFont); + + /* djhjr - 5/10/96 */ + XGetGeometry (dpy, Scr->InfoWindow, &JunkRoot, &JunkX, &JunkY, + &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth); + + height = Scr->InfoFont.height+2; + for (i = 0; i < InfoLines; i++) + { + /* djhjr - 5/10/96 */ + j = strlen(Info[i]); + + /* djhjr - 4/29/98 */ + k = 5; + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (!i && Scr->BorderBevelWidth > 0) k += Scr->InfoBevelWidth; + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString(dpy, Scr->InfoWindow, &Scr->InfoFont, +#else + XDrawString(dpy, Scr->InfoWindow, +#endif + Scr->NormalGC, +/* centers the lines... djhjr - 5/10/96 + 10, +*/ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + (JunkWidth - MyFont_TextWidth(&Scr->InfoFont, Info[i], j)) / 2, +#else + (JunkWidth - XTextWidth(Scr->InfoFont.font, Info[i], j)) / 2, +#endif + + /* 'k' was a hard-coded '5' - djhjr - 4/29/98 */ + (i*height) + Scr->InfoFont.y + k, Info[i], j); + } + + /* djhjr - 5/9/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (Scr->InfoBevelWidth > 0) + Draw3DBorder(Scr->InfoWindow, 0, 0, JunkWidth, JunkHeight, +/* djhjr - 4/29/98 + BW, Scr->DefaultC, off, False, False); +*/ + Scr->InfoBevelWidth, Scr->DefaultC, off, False, False); + + flush_expose (Event.xany.window); + } + + /* see that the desktop's bevel gets redrawn - djhjr - 2/10/99 */ + else if (Event.xany.window == Scr->VirtualDesktopDisplay) + { + Draw3DBorder(Scr->VirtualDesktopDisplayOuter, 0, 0, + Scr->VirtualDesktopMaxWidth + (Scr->VirtualDesktopBevelWidth * 2), + Scr->VirtualDesktopMaxHeight + (Scr->VirtualDesktopBevelWidth * 2), + Scr->VirtualDesktopBevelWidth, Scr->VirtualC, off, False, False); + flush_expose (Event.xany.window); + return; + } + + else if (Tmp_win != NULL) + { + /* djhjr - 4/20/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (Scr->BorderBevelWidth > 0 && (Event.xany.window == Tmp_win->frame)) { + PaintBorders (Tmp_win, ((Tmp_win == Scr->Focus) ? True : False)); + flush_expose (Event.xany.window); + return; + } + else + + if (Event.xany.window == Tmp_win->title_w) + { +/* djhjr - 4/20/96 + * font was font.font->fid - djhjr - 9/14/03 * + FBF(Tmp_win->title.fore, Tmp_win->title.back, Scr->TitleBarFont); + +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + MyFont_DrawString (dpy, Tmp_win->title_w, &Scr->TitleBarFont, +#else + XDrawString (dpy, Tmp_win->title_w, +#endif + Scr->NormalGC, + Scr->TBInfo.titlex, Scr->TitleBarFont.y, + Tmp_win->name, strlen(Tmp_win->name)); +*/ + PaintTitle (Tmp_win); + + /* djhjr - 10/25/02 */ + PaintTitleHighlight(Tmp_win, (Tmp_win == Scr->Focus) ? on : off); + + flush_expose (Event.xany.window); + return; + } + else if (Event.xany.window == Tmp_win->icon_w) + { + +/* djhjr - 4/21/96 + * font was font.font->fid - djhjr - 9/14/03 * + FBF(Tmp_win->iconc.fore, Tmp_win->iconc.back, Scr->IconFont); + +* djhjr - 9/14/03 * +#ifndef NO_I18N_SUPPORT + MyFont_DrawString (dpy, Tmp_win->icon_w, &Scr->IconManagerFont, +#else + XDrawString (dpy, Tmp_win->icon_w, +#endif + Scr->NormalGC, + Tmp_win->icon_x, Tmp_win->icon_y, + Tmp_win->icon_name, strlen(Tmp_win->icon_name)); +*/ + PaintIcon(Tmp_win); + + flush_expose (Event.xany.window); + return; + } else if (Tmp_win->titlebuttons) { + int i; + Window w = Event.xany.window; + TBWindow *tbw; + int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + + for (i = 0, tbw = Tmp_win->titlebuttons; i < nb; i++, tbw++) { + if (w == tbw->window) { +/* djhjr - 4/19/96 + register TitleButton *tb = tbw->info; + + FB(Tmp_win->title.fore, Tmp_win->title.back); + XCopyPlane (dpy, tb->bitmap, w, Scr->NormalGC, + tb->srcx, tb->srcy, tb->width, tb->height, + tb->dstx, tb->dsty, 1); +*/ + /* djhjr - 11/17/97 8/10/98 */ + /* added the test for window highlighting - djhjr - 3/14/98 */ + /* collapsed two functions - djhjr - 8/10/98 */ + if (Scr->ButtonColorIsFrame && Tmp_win->highlight) + PaintTitleButton(Tmp_win, tbw, (Scr->Focus == Tmp_win) ? 2 : 1); + else + PaintTitleButton(Tmp_win, tbw, 0); + + flush_expose (w); + return; + } + } + } + if (Tmp_win->list) { + if (Event.xany.window == Tmp_win->list->w) + { + /* see also resize.c - djhjr - 3/1/99 */ + RedoListWindow(Tmp_win); + flush_expose (Event.xany.window); + return; + } + if (Event.xany.window == Tmp_win->list->icon) + { +/* djhjr - 4/19/96 + FB(Tmp_win->list->fore, Tmp_win->list->back); + XCopyPlane(dpy, Scr->siconifyPm, Tmp_win->list->icon, + Scr->NormalGC, + 0,0, iconifybox_width, iconifybox_height, 0, 0, 1); +*/ +/* djhjr - 10/30/02 + * was 'Scr->use3Diconmanagers' - djhjr - 8/11/98 * + if (Scr->IconMgrBevelWidth > 0 && Tmp_win->list->iconifypm) + XCopyArea (dpy, Tmp_win->list->iconifypm, Tmp_win->list->icon, + Scr->NormalGC, 0, 0, + iconifybox_width, iconifybox_height, 0, 0); + else { + FB(Tmp_win->list->cp.fore, Tmp_win->list->cp.back); + XCopyPlane(dpy, Scr->siconifyPm->pixmap, Tmp_win->list->icon, Scr->NormalGC, + 0,0, iconifybox_width, iconifybox_height, 0, 0, 1); + } +*/ + XCopyArea(dpy, Tmp_win->list->iconifypm->pixmap, + Tmp_win->list->icon, Scr->NormalGC, 0, 0, + iconifybox_width, iconifybox_height, 0, 0); + + flush_expose (Event.xany.window); + return; + } + } + } + + /* update the virtual desktop display names */ + if (Scr->Virtual && Scr->NamesInVirtualDesktop) { + TwmWindow *tmp_win; + char *name = NULL; + + if (XFindContext(dpy, Event.xany.window, VirtualContext, + (caddr_t *)&tmp_win) != XCNOENT) { + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(tmp_win->virtual.fore, tmp_win->virtual.back, + Scr->VirtualFont); + if (tmp_win->icon_name) + name = tmp_win->icon_name; + else if (tmp_win->name) + name = tmp_win->name; + if (name) +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString(dpy, Event.xany.window, + &Scr->VirtualFont, +#else + XDrawImageString(dpy, Event.xany.window, +#endif + Scr->NormalGC, + 0, Scr->VirtualFont.height, + name, strlen(name)); + } + } +} + + + +/*********************************************************************** + * + * Procedure: + * HandleDestroyNotify - DestroyNotify event handler + * + *********************************************************************** + */ + +void +HandleDestroyNotify() +{ + int i; + + /* + * Warning, this is also called by HandleUnmapNotify; if it ever needs to + * look at the event, HandleUnmapNotify will have to mash the UnmapNotify + * into a DestroyNotify. + */ + + if (Tmp_win == NULL) + return; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + if (destroySoundFromFunction == FALSE) + PlaySound(S_CUNMAP); + else + destroySoundFromFunction = FALSE; +#endif + + if (Tmp_win == Scr->Focus) + { + FocusOnRoot(); + } + + if (Tmp_win == Scr->Newest) /* PF */ + Scr->Newest = NULL; /* PF */ + + /* djhjr - 5/16/98 */ + if (Tmp_win == UnHighLight_win) UnHighLight_win = NULL; + + XDeleteContext(dpy, Tmp_win->w, TwmContext); + XDeleteContext(dpy, Tmp_win->w, ScreenContext); + XDeleteContext(dpy, Tmp_win->frame, TwmContext); + XDeleteContext(dpy, Tmp_win->frame, ScreenContext); + XDeleteContext(dpy, Tmp_win->VirtualDesktopDisplayWindow, VirtualContext); + if (Tmp_win->icon_w) + { + XDeleteContext(dpy, Tmp_win->icon_w, TwmContext); + XDeleteContext(dpy, Tmp_win->icon_w, ScreenContext); + } + if (Tmp_win->title_height) + { + int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + XDeleteContext(dpy, Tmp_win->title_w, TwmContext); + XDeleteContext(dpy, Tmp_win->title_w, ScreenContext); + if (Tmp_win->hilite_w) + { + XDeleteContext(dpy, Tmp_win->hilite_w, TwmContext); + XDeleteContext(dpy, Tmp_win->hilite_w, ScreenContext); + } + if (Tmp_win->titlebuttons) { + for (i = 0; i < nb; i++) { + XDeleteContext (dpy, Tmp_win->titlebuttons[i].window, + TwmContext); + XDeleteContext (dpy, Tmp_win->titlebuttons[i].window, + ScreenContext); + } + } + } + + if (Scr->cmapInfo.cmaps == &Tmp_win->cmaps) + InstallWindowColormaps(DestroyNotify, &Scr->TwmRoot); + + /* + * TwmWindows contain the following pointers + * + * 1. full_name + * 2. name + * 3. icon_name + * 4. wmhints + * 5. class.res_name + * 6. class.res_class + * 7. list + * 8. iconmgrp + * 9. cwins + * 10. titlebuttons + * 11. window ring + * 12. virtual desktop display window + */ + if (Tmp_win->gray) XFreePixmap (dpy, Tmp_win->gray); + + /* djhjr - 4/26/99 */ + AppletDown(Tmp_win); + + XDestroyWindow(dpy, Tmp_win->frame); + if (Tmp_win->icon_w && !Tmp_win->icon_not_ours) { + XDestroyWindow(dpy, Tmp_win->icon_w); + IconDown (Tmp_win); + } + XDestroyWindow(dpy, Tmp_win->VirtualDesktopDisplayWindow); /* 12 */ + RemoveIconManager(Tmp_win); /* 7 */ + Tmp_win->prev->next = Tmp_win->next; + if (Tmp_win->next != NULL) + Tmp_win->next->prev = Tmp_win->prev; + if (Tmp_win->auto_raise) Scr->NumAutoRaises--; + + free_window_names (Tmp_win, True, True, True); /* 1, 2, 3 */ + if (Tmp_win->wmhints) /* 4 */ + XFree ((char *)Tmp_win->wmhints); + if (Tmp_win->class.res_name && Tmp_win->class.res_name != NoName) /* 5 */ + XFree ((char *)Tmp_win->class.res_name); + if (Tmp_win->class.res_class && Tmp_win->class.res_class != NoName) /* 6 */ + XFree ((char *)Tmp_win->class.res_class); + free_cwins (Tmp_win); /* 9 */ + if (Tmp_win->titlebuttons) /* 10 */ + free ((char *) Tmp_win->titlebuttons); + /* + * 11a through 11c was handled in a local function, but + * is now broken out (11a & 11b), and uses a public function + * in menus.c (11c) - djhjr - 10/27/02 + */ + if (enter_win == Tmp_win) { /* 11a */ + enter_flag = FALSE; + enter_win = NULL; + } + if (raise_win == Tmp_win) raise_win = NULL; /* 11b */ + RemoveWindowFromRing(Tmp_win); /* 11c */ + + free((char *)Tmp_win); +} + + + +void +HandleCreateNotify() +{ +#ifdef DEBUG_EVENTS + fprintf(stderr, "CreateNotify w = 0x%x\n", Event.xcreatewindow.window); + fflush(stderr); + XBell(dpy, 0); + XSync(dpy, 0); +#endif +} + + + +/*********************************************************************** + * + * Procedure: + * HandleMapRequest - MapRequest event handler + * + *********************************************************************** + */ + +void +HandleMapRequest() +{ + + int stat; + int zoom_save; + + Event.xany.window = Event.xmaprequest.window; + stat = XFindContext(dpy, Event.xany.window, TwmContext, (caddr_t *)&Tmp_win); + if (stat == XCNOENT) + Tmp_win = NULL; + + /* If the window has never been mapped before ... */ + if (Tmp_win == NULL) + { + /* Add decorations. */ + Tmp_win = AddWindow(Event.xany.window, FALSE, (IconMgr *) NULL); + if (Tmp_win == NULL) + return; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + if (createSoundFromFunction == FALSE) + PlaySound(S_CMAP); + else + createSoundFromFunction = FALSE; +#endif + + } + else + { + /* + * If the window has been unmapped by the client, it won't be listed + * in the icon manager. Add it again, if requested. + */ + if (Tmp_win->list == NULL) + (void) AddIconManager (Tmp_win); + } + + /* If it's not merely iconified, and we have hints, use them. */ + if ((! Tmp_win->icon) && + Tmp_win->wmhints && (Tmp_win->wmhints->flags & StateHint)) + { + int state; + Window icon; + + /* use WM_STATE if enabled */ + if (!(RestartPreviousState && GetWMState(Tmp_win->w, &state, &icon) && + (state == NormalState || state == IconicState))) + state = Tmp_win->wmhints->initial_state; + + switch (state) + { + case DontCareState: + case NormalState: + case ZoomState: + case InactiveState: + XMapWindow(dpy, Tmp_win->w); + XMapWindow(dpy, Tmp_win->frame); + SetMapStateProp(Tmp_win, NormalState); + SetRaiseWindow (Tmp_win); + + /* djhjr - 10/2/01 */ + if (Scr->StrictIconManager) + if (Tmp_win->list) + RemoveIconManager(Tmp_win); + + break; + + case IconicState: + zoom_save = Scr->DoZoom; + Scr->DoZoom = FALSE; + Iconify(Tmp_win, 0, 0); + Scr->DoZoom = zoom_save; + break; + } + } + /* If no hints, or currently an icon, just "deiconify" */ + else + { + DeIconify(Tmp_win); + SetRaiseWindow (Tmp_win); + } + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); /* DSE */ + +} + + + +void SimulateMapRequest (w) + Window w; +{ + Event.xmaprequest.window = w; + HandleMapRequest (); +} + + + +/*********************************************************************** + * + * Procedure: + * HandleMapNotify - MapNotify event handler + * + *********************************************************************** + */ + +void +HandleMapNotify() +{ + if (Tmp_win == NULL) + return; + + /* + * Need to do the grab to avoid race condition of having server send + * MapNotify to client before the frame gets mapped; this is bad because + * the client would think that the window has a chance of being viewable + * when it really isn't. + */ + XGrabServer (dpy); + if (Tmp_win->icon_w) + XUnmapWindow(dpy, Tmp_win->icon_w); + if (Tmp_win->title_w) + XMapSubwindows(dpy, Tmp_win->title_w); + XMapSubwindows(dpy, Tmp_win->frame); + +/* djhjr - 4/25/96 + if (Scr->Focus != Tmp_win && Tmp_win->hilite_w) + XUnmapWindow(dpy, Tmp_win->hilite_w); +*/ + if (Scr->Focus != Tmp_win) + PaintTitleHighlight(Tmp_win, off); + + XMapWindow(dpy, Tmp_win->frame); + XUngrabServer (dpy); + XFlush (dpy); + Tmp_win->mapped = TRUE; + Tmp_win->icon = FALSE; + Tmp_win->icon_on = FALSE; + + /* Race condition if in menus.c:DeIconify() - djhjr - 10/2/01 */ + if (Scr->StrictIconManager) + if (Tmp_win->list) + RemoveIconManager(Tmp_win); +} + + + +/*********************************************************************** + * + * Procedure: + * HandleUnmapNotify - UnmapNotify event handler + * + *********************************************************************** + */ + +void +HandleUnmapNotify() +{ + int dstx, dsty; + Window dumwin; + + /* + * The July 27, 1988 ICCCM spec states that a client wishing to switch + * to WithdrawnState should send a synthetic UnmapNotify with the + * event field set to (pseudo-)root, in case the window is already + * unmapped (which is the case for twm for IconicState). Unfortunately, + * we looked for the TwmContext using that field, so try the window + * field also. + */ + if (Tmp_win == NULL) + { + Event.xany.window = Event.xunmap.window; + if (XFindContext(dpy, Event.xany.window, + TwmContext, (caddr_t *)&Tmp_win) == XCNOENT) + Tmp_win = NULL; + } + + if (Tmp_win == NULL || (!Tmp_win->mapped && !Tmp_win->icon)) + return; + + /* + * The program may have unmapped the client window, from either + * NormalState or IconicState. Handle the transition to WithdrawnState. + * + * We need to reparent the window back to the root (so that twm exiting + * won't cause it to get mapped) and then throw away all state (pretend + * that we've received a DestroyNotify). + */ + + XGrabServer (dpy); + if (XTranslateCoordinates (dpy, Event.xunmap.window, Tmp_win->attr.root, + 0, 0, &dstx, &dsty, &dumwin)) { + XEvent ev; + Bool reparented = XCheckTypedWindowEvent (dpy, Event.xunmap.window, + ReparentNotify, &ev); + SetMapStateProp (Tmp_win, WithdrawnState); + if (reparented) { + if (Tmp_win->old_bw) XSetWindowBorderWidth (dpy, + Event.xunmap.window, + Tmp_win->old_bw); + if (Tmp_win->wmhints && (Tmp_win->wmhints->flags & IconWindowHint)) + XUnmapWindow (dpy, Tmp_win->wmhints->icon_window); + } else { + XReparentWindow (dpy, Event.xunmap.window, Tmp_win->attr.root, + dstx, dsty); + RestoreWithdrawnLocation (Tmp_win); + } + XRemoveFromSaveSet (dpy, Event.xunmap.window); + XSelectInput (dpy, Event.xunmap.window, NoEventMask); + HandleDestroyNotify (); /* do not need to mash event before */ + } /* else window no longer exists and we'll get a destroy notify */ + XUngrabServer (dpy); + XFlush (dpy); +} + + + +/*********************************************************************** + * + * Procedure: + * HandleMotionNotify - MotionNotify event handler + * + *********************************************************************** + */ + +#if 0 /* functionality moved to menus.c:ExecuteFunction() - djhjr - 11/7/03 */ +void +HandleMotionNotify() +{ +#if 0 /* done in menus.c:ExecuteFunction() now - djhjr - 11/4/03 */ + if (moving_window) { + DoMoveWindowOnDesktop(Event.xmotion.x, Event.xmotion.y); + } +#endif + +#if 0 /* done in menus.c:ExecuteFunction() now - djhjr - 5/27/03 */ + if ( ResizeWindow ) + { + XQueryPointer( dpy, Event.xany.window, + &(Event.xmotion.root), &JunkChild, + &(Event.xmotion.x_root), &(Event.xmotion.y_root), + &(Event.xmotion.x), &(Event.xmotion.y), + &JunkMask); + + /* Set WindowMoved appropriately so that f.deltastop will + work with resize as well as move. */ + if (abs (Event.xmotion.x - ResizeOrigX) >= Scr->MoveDelta + || abs (Event.xmotion.y - ResizeOrigY) >= Scr->MoveDelta) + { + /* djhjr - 9/5/98 */ + resizing_window = 1; + + WindowMoved = TRUE; + } + + /* added this 'if ()' for applying MoveDelta - djhjr - 9/5/98 */ + if (resizing_window) + { + XFindContext(dpy, ResizeWindow, TwmContext, (caddr_t *)&Tmp_win); + DoResize(Event.xmotion.x_root, Event.xmotion.y_root, Tmp_win); + } + } +#endif +} +#endif + + + +/*********************************************************************** + * + * Procedure: + * HandleButtonRelease - ButtonRelease event handler + * + *********************************************************************** + */ +void +HandleButtonRelease() +{ +/* djhjr - 10/6/02 + int xl, xr, yt, yb, w, h; +*/ + unsigned mask; + + if (Scr->StayUpMenus) + { + if (GlobalFirstTime == True && GlobalMenuButton == True ) + { + ButtonPressed = -1; + GlobalFirstTime = False; + return; + } /* end if */ + + GlobalFirstTime = True; + } /* end if */ + +#if 0 +0 For StayUpMenus, delete infobox after buttonpress! +0 if (InfoLines) /* delete info box on 2nd button release */ +0 /* if (Context == C_IDENTIFY) */ +0 /* This would force you to click on the box itself */ +0 { +0fprintf( stderr, "Kill info B\n" ); +0 XUnmapWindow(dpy, Scr->InfoWindow); +0 InfoLines = 0; +0 Context = C_NO_CONTEXT; +0 } +#endif + +#if 0 /* done in menus.c:ExecuteFunction() now - djhjr - 11/4/03 */ + if (moving_window) + { EndMoveWindowOnDesktop(); + } +#endif + + if (DragWindow != None) + { +/* + * Most all of this is redundant (see menus.c:ExecuteFunction()), + * and I don't see why. Everything except local functionality is + * '#if 0'd out, with just a few lines moved (copied) to menus.c. + * djhjr - 10/6/02 + */ +#if 0 + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + + XFindContext(dpy, DragWindow, TwmContext, (caddr_t *)&Tmp_win); + if (DragWindow == Tmp_win->frame) + { + xl = Event.xbutton.x_root - DragX - Tmp_win->frame_bw; + yt = Event.xbutton.y_root - DragY - Tmp_win->frame_bw; + w = DragWidth + 2 * Tmp_win->frame_bw; + h = DragHeight + 2 * Tmp_win->frame_bw; + } + else + { +/* + * Deskset/Openwin apps change the icon's border width attribute. + * Submitted by Caveh Frank Jalali + * + xl = Event.xbutton.x_root - DragX - Scr->IconBorderWidth; + yt = Event.xbutton.y_root - DragY - Scr->IconBorderWidth; + w = DragWidth + 2 * Scr->IconBorderWidth; + h = DragHeight + 2 * Scr->IconBorderWidth; +*/ + XWindowAttributes wat; + + XGetWindowAttributes(dpy, DragWindow, &wat); + xl = Event.xbutton.x_root - DragX - wat.border_width; + yt = Event.xbutton.y_root - DragY - wat.border_width; + w = DragWidth + 2 * wat.border_width; + h = DragHeight + 2 * wat.border_width; + } + + if (ConstMove) + { + if (ConstMoveDir == MOVE_HORIZ) + yt = ConstMoveY; + + if (ConstMoveDir == MOVE_VERT) + xl = ConstMoveX; + + if (ConstMoveDir == MOVE_NONE) + { + yt = ConstMoveY; + xl = ConstMoveX; + } + } + + if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE) + { + xr = xl + w; + yb = yt + h; + + if (xl < 0) + xl = 0; + if (xr > Scr->MyDisplayWidth) + xl = Scr->MyDisplayWidth - w; + + if (yt < 0) + yt = 0; + if (yb > Scr->MyDisplayHeight) + yt = Scr->MyDisplayHeight - h; + } + + CurrentDragX = xl; + CurrentDragY = yt; + if (DragWindow == Tmp_win->frame) + SetupWindow (Tmp_win, xl, yt, + Tmp_win->frame_width, Tmp_win->frame_height, -1); + else + XMoveWindow (dpy, DragWindow, xl, yt); + +/* djhjr - 4/7/98 + if (!Scr->NoRaiseMove && !Scr->OpaqueMove) * opaque already did * + XRaiseWindow(dpy, DragWindow); +*/ + if (!Scr->NoRaiseMove) + /* opaque already did, so test the individual window, methinks */ + if (DragWindow == Tmp_win->frame) + { + if (!Tmp_win->opaque_move) + XRaiseWindow(dpy, DragWindow); + } + else if (!Scr->OpaqueMove) + XRaiseWindow(dpy, DragWindow); + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + if (!Scr->OpaqueMove) + UninstallRootColormap(); + else + XSync(dpy, 0); + + if (Scr->NumAutoRaises) { + enter_flag = TRUE; + enter_win = NULL; + raise_win = ((DragWindow == Tmp_win->frame && !Scr->NoRaiseMove) + ? Tmp_win : NULL); + } +#endif + + DragWindow = None; + ConstMove = FALSE; + } + +#ifdef NEVER /* djhjr - 5/27/03 */ + if ( ResizeWindow ) + { + EndResize(); + } +#endif + + if ( ActiveMenu && RootFunction == F_NOFUNCTION ) + { + if ( ActiveItem ) + { + int func = ActiveItem->func; + Action = ActiveItem->action; + switch (func) + { case F_MOVE: + case F_FORCEMOVE: + ButtonPressed = -1; + break; +#if (0) +0 case F_IDENTIFY: +0 case F_CIRCLEUP: +0 case F_CIRCLEDOWN: +0 case F_REFRESH: +0 case F_WARPTOSCREEN: +0 case F_AUTOPAN: /*RFB */ +0 case F_SNAPREALSCREEN:/*RFB*/ +0 PopDownMenu(); +0 break; +#endif + default: + break; + } + ExecuteFunction(func, Action, + ButtonWindow ? ButtonWindow->frame : None, + ButtonWindow, &Event/*&ButtonEvent*/, Context, TRUE); + Context = C_NO_CONTEXT; + ButtonWindow = NULL; + +/* djhjr - 9/15/99 + * if we are not executing a defered command, then take down the + * menu + * + if (RootFunction == F_NOFUNCTION) + { + PopDownMenu(); + } +*/ + } +/* djhjr - 9/15/99 + else +*/ + PopDownMenu(); + } + + mask = (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask); + switch (Event.xbutton.button) + { + case Button1: mask &= ~Button1Mask; break; + case Button2: mask &= ~Button2Mask; break; + case Button3: mask &= ~Button3Mask; break; + case Button4: mask &= ~Button4Mask; break; + case Button5: mask &= ~Button5Mask; break; + } + + if (RootFunction != F_NOFUNCTION || + ResizeWindow != None || + moving_window != None || + DragWindow != None) + { ButtonPressed = -1; + } + + if (RootFunction == F_NOFUNCTION && + (Event.xbutton.state & mask) == 0 && + DragWindow == None && + moving_window == None && + ResizeWindow == None) + { + XUngrabPointer(dpy, CurrentTime); + XUngrabServer(dpy); + XFlush(dpy); + EventHandler[EnterNotify] = HandleEnterNotify; + EventHandler[LeaveNotify] = HandleLeaveNotify; + menuFromFrameOrWindowOrTitlebar = FALSE; + ButtonPressed = -1; + if (DownIconManager) + { + DownIconManager->down = FALSE; + +/* djhjr - 4/19/96 + if (Scr->Highlight) DrawIconManagerBorder(DownIconManager); +*/ + if (Scr->Highlight) DrawIconManagerBorder(DownIconManager, False); + + DownIconManager = NULL; + } + Cancel = FALSE; + } +} + + + +static void do_menu (menu, wnd) + MenuRoot *menu; /* menu to pop up */ + Window wnd; /* invoking window or None */ +{ + int x = Event.xbutton.x_root; + int y = Event.xbutton.y_root; + Bool center = True; + + if (Scr->StayUpMenus) + { GlobalMenuButton = True; + } + + if (!Scr->NoGrabServer) + XGrabServer(dpy); + if (wnd) { + Window child; + /* djhjr - 1/20/98 */ + int w = Scr->TBInfo.width / 2; +/* djhjr - 1/20/98 + int h = Scr->TBInfo.width - Scr->TBInfo.border; +*/ + int h = Scr->TBInfo.width; + +/* djhjr - 1/20/98 + (void) XTranslateCoordinates (dpy, w, Scr->Root, 0, h, &x, &y, &child); +*/ + (void) XTranslateCoordinates (dpy, wnd, Scr->Root, w, h, &x, &y, &child); + +/* djhjr - 1/20/98 + * djhjr - 3/12/97 * + y -= Scr->TitleHeight; +*/ + y -= Scr->TitleHeight / 2; + +/* djhjr - 1/20/98 + center = False; +*/ + } + if (PopUpMenu (menu, x, y, center)) { + UpdateMenu(); + } else { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + } +} + + + +/*********************************************************************** + * + * Procedure: + * HandleButtonPress - ButtonPress event handler + * + *********************************************************************** + */ +void +HandleButtonPress() +{ + unsigned int modifier; + Cursor cur; + TwmDoor *door = NULL; + + /* Submitted by Jennifer Elaan */ + if (Event.xbutton.button > MAX_BUTTONS) + return; + + if (Scr->StayUpMenus) + { + /* added '&& ButtonPressed == -1' - Submitted by Steve Ratcliffe */ + if (GlobalFirstTime == False && GlobalMenuButton == True + && ButtonPressed == -1) + { + return; + } + } + else + { /* pop down the menu, if any */ + if (ActiveMenu != NULL) PopDownMenu(); + } + + if ( InfoLines ) /* StayUpMenus */ + { +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(S_IUNMAP); +#endif + + XUnmapWindow(dpy, Scr->InfoWindow); + InfoLines = 0; + } + + XSync(dpy, 0); /* XXX - remove? */ + + if (ButtonPressed != -1 + && !InfoLines /* want menus if we have info box */ + ) + { /* we got another butt press in addition to one still held + * down, we need to cancel the operation we were doing + */ + Cancel = TRUE; + if (DragWindow != None) + { + CurrentDragX = origDragX; + CurrentDragY = origDragY; + if (!menuFromFrameOrWindowOrTitlebar) + { + /* added this 'if ... else' - djhjr - 4/7/98 */ + if (Tmp_win && DragWindow == Tmp_win->frame && Tmp_win->opaque_move) + XMoveWindow (dpy, DragWindow, origDragX, origDragY); + else + if (Scr->OpaqueMove && DragWindow != None) + XMoveWindow (dpy, DragWindow, origDragX, origDragY); + else + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + } + if (!Scr->OpaqueMove) UninstallRootColormap(); + } + +#if 0 /* done in menus.c:ExecuteFunction() now - djhjr - 11/4/03 */ + /* this 'else if ...' - djhjr - 11/3/03 */ + else if (moving_window) + EndMoveWindowOnDesktop(); +#endif + + XUnmapWindow(dpy, Scr->SizeWindow); + ResizeWindow = None; + DragWindow = None; + cur = LeftButt; + if (Event.xbutton.button == Button2) cur = MiddleButt; + else if (Event.xbutton.button >= Button3) cur = RightButt; + + XGrabPointer(dpy, Scr->Root, True, + ButtonReleaseMask | ButtonPressMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, cur, CurrentTime); + return; + } + else + { ButtonPressed = Event.xbutton.button; + } + + if ( ResizeWindow != None + || DragWindow != None + || moving_window != None + /* ||ActiveMenu != NULL ** tvtwm StayUpMenus */ + ) + { + return; + } + + if ( ButtonPressed == Button1 && Tmp_win && Tmp_win->title_height && Tmp_win->titlebuttons ) + { /* check the title bar buttons */ + register int i; + register TBWindow *tbw; + int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + + for (i = 0, tbw = Tmp_win->titlebuttons; i < nb; i++, tbw++) + { + if (Event.xany.window == tbw->window) + { + if (tbw->info->func == F_MENU) + { + Context = C_TITLE; + ButtonEvent = Event; + ButtonWindow = Tmp_win; + do_menu (tbw->info->menuroot, tbw->window); + } + else + { + /* djhjr - 9/15/99 */ + Context = C_TITLE; + + ExecuteFunction (tbw->info->func, tbw->info->action, + Event.xany.window, Tmp_win, &Event, C_TITLE, FALSE); + + /* + * For some reason, we don't get the button up event. + * Submitted by Caveh Frank Jalali + */ + ButtonPressed = -1; + } + + return; + } + } + } + + Context = C_NO_CONTEXT; + if ( Event.xany.window == Scr->InfoWindow ) Context = C_IDENTIFY; + if ( Event.xany.window == Scr->Root ) Context = C_ROOT; + +/* djhjr - 9/12/96 - moved to the bottom of this context decision chain... + if + ( Context == C_NO_CONTEXT + && + ( Tmp_win == Scr->VirtualDesktopDisplayTwin + || + Event.xany.window == Scr->VirtualDesktopDisplayOuter + || + Event.xany.window == Scr->VirtualDesktopDisplay + ) + ) + { TwmWindow *tmp_win; + + if ( Event.xbutton.subwindow + && XFindContext( dpy, Event.xbutton.subwindow, VirtualContext, + (caddr_t *) &tmp_win ) + != XCNOENT + ) + { * Click in a little window in the panner. * + Tmp_win = tmp_win; + Context = C_VIRTUAL_WIN; + } + else + { * Click in the panner. * + Tmp_win = Scr->VirtualDesktopDisplayTwin; + Context = C_VIRTUAL; + } + } +*/ + + if (XFindContext(dpy, Event.xany.window, + DoorContext, (caddr_t *)&door) != XCNOENT) + Context = C_DOOR; + + if ( Tmp_win && Context == C_NO_CONTEXT ) + { +/* have I really determined that this isn't needed? - djhjr - 9/15/99 + if + ( Tmp_win->list + && + RootFunction != F_NOFUNCTION + && + ( Event.xany.window == Tmp_win->list->w + || + Event.xany.window == Tmp_win->list->icon + ) + ) + { + Tmp_win = Tmp_win->list->iconmgr->twm_win; + XTranslateCoordinates(dpy, Event.xany.window, Tmp_win->w, + Event.xbutton.x, Event.xbutton.y, + &JunkX, &JunkY, &JunkChild); + +* djhjr - 4/21/96 + Event.xbutton.x = JunkX; + Event.xbutton.y = JunkY - Tmp_win->title_height; +* + Event.xbutton.x = JunkX - Tmp_win->frame_bw3D; + Event.xbutton.y = JunkY - Tmp_win->title_height - Tmp_win->frame_bw3D; + + Event.xany.window = Tmp_win->w; + Context = C_WINDOW; + } + else +*/ + if ( Event.xany.window == Tmp_win->title_w ) + { + Context = C_TITLE; + } + else if (Event.xany.window == Tmp_win->w) + { + printf("ERROR! ERROR! ERROR! YOU SHOULD NOT BE HERE!!!\n"); + Context = C_WINDOW; + } + else if (Event.xany.window == Tmp_win->icon_w) + { + Context = C_ICON; + } + else if (Event.xany.window == Tmp_win->frame) + { /* since we now place a button grab on the frame instead + * of the window, (see GrabButtons() in add_window.c), we + * need to figure out where the pointer exactly is before + * assigning Context. If the pointer is on the application + * window we will change the event structure to look as if + * it came from the application window. + */ + if (Event.xbutton.subwindow == Tmp_win->w) + { Event.xbutton.window = Tmp_win->w; + +/* djhjr - 4/21/96 + Event.xbutton.y -= Tmp_win->title_height; +*/ + Event.xbutton.x -= Tmp_win->frame_bw3D; + Event.xbutton.y -= (Tmp_win->title_height + Tmp_win->frame_bw3D); + + /***** + Event.xbutton.x -= Tmp_win->frame_bw; + *****/ + Context = C_WINDOW; + } + +/* not needed after all - djhjr - 9/10/99 + * djhjr - 5/13/99 * + else if (Scr->Doors) + { + for (door = Scr->Doors; door != NULL; door = door->next) + if (door->twin->frame == Tmp_win->frame) + { + Context = C_DOOR; + + break; + } + + if (!door) Context = C_FRAME; + } +*/ + + else Context = C_FRAME; + } + else if + ( Tmp_win->list + && + ( Event.xany.window == Tmp_win->list->w + || + Event.xany.window == Tmp_win->list->icon + ) + ) + { + Tmp_win->list->down = TRUE; + +/* djhjr - 4/19/96 + if (Scr->Highlight) DrawIconManagerBorder(Tmp_win->list); +*/ + if (Scr->Highlight) DrawIconManagerBorder(Tmp_win->list, False); + + DownIconManager = Tmp_win->list; + Context = C_ICONMGR; + } + } + +/* djhjr - 9/12/96 - moved from the top of this context decision chain...*/ + if + ( Context == C_NO_CONTEXT + && + ( Tmp_win == Scr->VirtualDesktopDisplayTwin + || + Event.xany.window == Scr->VirtualDesktopDisplayOuter + || + Event.xany.window == Scr->VirtualDesktopDisplay + ) + ) + { TwmWindow *tmp_win; + + if ( Event.xbutton.subwindow + && XFindContext( dpy, Event.xbutton.subwindow, VirtualContext, + (caddr_t *) &tmp_win ) + != XCNOENT + ) + { /* Click in a little window in the panner. */ + Tmp_win = tmp_win; + Context = C_VIRTUAL_WIN; + } + else + { /* Click in the panner. */ + Tmp_win = Scr->VirtualDesktopDisplayTwin; + Context = C_VIRTUAL; + } + } + + /* this section of code checks to see if we were in the middle of + * a command executed from a menu + */ + if (RootFunction != F_NOFUNCTION) + { + if (Event.xany.window == Scr->Root) + { + /* if the window was the Root, we don't know for sure it + * it was the root. We must check to see if it happened to be + * inside of a client that was getting button press events. + */ + XTranslateCoordinates(dpy, Scr->Root, Scr->Root, + Event.xbutton.x, + Event.xbutton.y, + &JunkX, &JunkY, &Event.xany.window); + + if (Event.xany.window == 0 || + XFindContext(dpy, Event.xany.window, TwmContext, + (caddr_t *)&Tmp_win) == XCNOENT) + { + RootFunction = F_NOFUNCTION; + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + + /* + * If stay up menus is set, then the menu may still be active + * and should be popped down - Submitted by Steve Ratcliffe + */ + if (ActiveMenu != NULL) + PopDownMenu(); + + return; + } + + XTranslateCoordinates(dpy, Scr->Root, Event.xany.window, + Event.xbutton.x, + Event.xbutton.y, + &JunkX, &JunkY, &JunkChild); + + Event.xbutton.x = JunkX; + Event.xbutton.y = JunkY; + Context = C_WINDOW; + } + + /* make sure we are not trying to move an identify window */ + if (Scr->InfoWindow && Event.xany.window != Scr->InfoWindow) + { + ExecuteFunction(RootFunction, Action, Event.xany.window, + Tmp_win, &Event, Context, FALSE); + if (Scr->StayUpMenus) + { /* pop down the menu, if any */ + if (ActiveMenu != NULL) PopDownMenu(); + } + } + + RootFunction = F_NOFUNCTION; + return; + } + + ButtonEvent = Event; + ButtonWindow = Tmp_win; + + /* if we get to here, we have to execute a function or pop up a + * menu + */ + modifier = (Event.xbutton.state & mods_used); + + if (Context == C_NO_CONTEXT) return; + + RootFunction = F_NOFUNCTION; + if (Scr->Mouse[Event.xbutton.button][Context][modifier].func == F_MENU) + { + do_menu (Scr->Mouse[Event.xbutton.button][Context][modifier].menu, + (Window) None); + if (Scr->StayUpMenus) + { + GlobalMenuButton = False; + } + } + else if (Scr->Mouse[Event.xbutton.button][Context][modifier].func != F_NOFUNCTION) + { + Action = Scr->Mouse + [Event.xbutton.button][Context][modifier].item + ? Scr->Mouse + [Event.xbutton.button][Context][modifier] + .item->action + : NULL; + ExecuteFunction( Scr->Mouse + [Event.xbutton.button][Context][modifier].func, + Action, Event.xany.window, Tmp_win, &Event, Context, FALSE); + } + else if (Scr->DefaultFunction.func != F_NOFUNCTION) + { + if (Scr->DefaultFunction.func == F_MENU) + { + do_menu (Scr->DefaultFunction.menu, (Window) None); + } + else + { + Action = Scr->DefaultFunction.item + ? Scr->DefaultFunction.item->action + : NULL; + ExecuteFunction(Scr->DefaultFunction.func, Action, + Event.xany.window, Tmp_win, &Event, Context, FALSE); + } + } +} + + + +/*********************************************************************** + * + * Procedure: + * HENQueueScanner - EnterNotify event q scanner + * + * Looks at the queued events and determines if any matching + * LeaveNotify events or EnterEvents deriving from the + * termination of a grab are behind this event to allow + * skipping of unnecessary processing. + * + *********************************************************************** + */ + +typedef struct HENScanArgs { + Window w; /* Window we are currently entering */ + Bool leaves; /* Any LeaveNotifies found for this window */ + Bool inferior; /* Was NotifyInferior the mode for LeaveNotify */ + Bool enters; /* Any EnterNotify events with NotifyUngrab */ +} HENScanArgs; + +/* ARGSUSED*/ +static Bool +HENQueueScanner(dpy, ev, args) + Display *dpy; + XEvent *ev; + char *args; +{ + if (ev->type == LeaveNotify) { + if (ev->xcrossing.window == ((HENScanArgs *) args)->w && + ev->xcrossing.mode == NotifyNormal) { + ((HENScanArgs *) args)->leaves = True; + /* + * Only the last event found matters for the Inferior field. + */ + ((HENScanArgs *) args)->inferior = + (ev->xcrossing.detail == NotifyInferior); + } + } else if (ev->type == EnterNotify) { + if (ev->xcrossing.mode == NotifyUngrab) + ((HENScanArgs *) args)->enters = True; + } + + return (False); +} + + + +/*********************************************************************** + * + * Procedure: + * HandleEnterNotify - EnterNotify event handler + * + *********************************************************************** + */ + +void +HandleEnterNotify() +{ + MenuRoot *mr; + XEnterWindowEvent *ewp = &Event.xcrossing; + HENScanArgs scanArgs; + XEvent dummy; + short l; + extern int RaiseDelay;/*RAISEDELAY*/ + + /* + * Save the id of the window entered. This will be used to remove + * border highlight on entering the next application window. + */ + if (UnHighLight_win && ewp->window != UnHighLight_win->w) { + SetBorder (UnHighLight_win, False); /* application window */ + if (UnHighLight_win->list) /* in the icon box */ + NotActiveIconManager(UnHighLight_win->list); + } + if (ewp->window == Scr->Root) + UnHighLight_win = NULL; + else if (Tmp_win) + UnHighLight_win = Tmp_win; + + /* + * if we aren't in the middle of menu processing + */ + if (!ActiveMenu) { + /* + * We're not interested in pseudo Enter/Leave events generated + * from grab initiations. + */ + if (ewp->mode == NotifyGrab) + return; + + /* + * Scan for Leave and Enter Notify events to see if we can avoid some + * unnecessary processing. + */ + scanArgs.w = ewp->window; + scanArgs.leaves = scanArgs.enters = False; + (void) XCheckIfEvent(dpy, &dummy, HENQueueScanner, (char *) &scanArgs); + + /* + * if it is one of the autopan windows, do the pan + */ + if ( Scr->AutoPanX )/*RFB F_AUTOPAN*/ + for (l = 0; l <= 3; l++) + if (ewp->window == Scr->VirtualDesktopAutoPan[l]) + { + int xdiff, ydiff, xwarp, ywarp; + + /* + * Code from FVWM-1.23b, modified to reflect "real time" + * values of the resource. + * + * djhjr - 9/8/98 + */ + if (Scr->VirtualDesktopPanResistance > 0 && + Scr->VirtualDesktopPanResistance < 10000) + { + int x, y, i; + static struct timeval timeoutval = {0, 12500}; + struct timeval timeout; + + /* The granularity of PanResistance is about 25 ms. + * The timeout variable is set to 12.5 ms since we + * pass this way twice each time an autopan window + * is entered. + */ + for (i = 25; i < Scr->VirtualDesktopPanResistance; i += 25) + { + timeout = timeoutval; + select(0, 0, 0, 0, &timeout); + + scanArgs.w = ewp->window; + scanArgs.leaves = scanArgs.enters = False; + (void)XCheckIfEvent(dpy, &dummy, HENQueueScanner, + (char *)&scanArgs); + + if (scanArgs.leaves) + return; + } + + XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, + &x, &y, &JunkX, &JunkY, &JunkMask); + + if (x < Scr->AutoPanBorderWidth) + l = 0; + else if (x >= Scr->MyDisplayWidth - Scr->AutoPanBorderWidth) + l = 1; + else if (y < Scr->AutoPanBorderWidth) + l = 2; + else if (y >= Scr->MyDisplayHeight - Scr->AutoPanBorderWidth) + l = 3; + else + l = 4; /* oops */ + } + + /* figure out which one it is */ + switch (l) + { + case 0: /* left */ + xdiff = -(Scr->AutoPanX); + ydiff = 0; + /* xwarp = AP_SIZE + 2; */ + xwarp = AP_SIZE + Scr->AutoPanExtraWarp; /* DSE */ + ywarp = 0; + break; + case 1: /* right */ + xdiff = Scr->AutoPanX; + ydiff = 0; + /* xwarp = -(AP_SIZE + 2); */ + xwarp = -(AP_SIZE + Scr->AutoPanExtraWarp); /* DSE */ + ywarp = 0; + break; + case 2: /* up */ + xdiff = 0; + ydiff = -(Scr->AutoPanY); + xwarp = 0; + /* ywarp = AP_SIZE + 2; */ + ywarp = AP_SIZE + Scr->AutoPanExtraWarp; /* DSE */ + break; + case 3: /* down */ + xdiff = 0; + ydiff = Scr->AutoPanY; + xwarp = 0; + /* ywarp = -(AP_SIZE + 2); */ + ywarp = -(AP_SIZE + Scr->AutoPanExtraWarp); /* DSE */ + break; + default: /* oops */ + /* this is to stop the compiler complaining */ + xdiff = ydiff = xwarp = ywarp = 0; +/* not with the PanResistance resource! - djhjr - 9/8/98 + fprintf(stderr, "vtwm: major problems with autopan\n"); +*/ + } + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(S_APAN); +#endif + + /* do the pan */ + PanRealScreen(xdiff, ydiff, &xwarp, &ywarp); /* DSE */ + + /* + * warp the pointer out of the window so that they can keep + * moving the mouse + */ + XWarpPointer(dpy, None, None, 0, 0, 0, 0, xwarp, ywarp); + + return; + } /* end if ewp->window = autopan */ + + /* + * if entering root window, restore twm default colormap so that + * titlebars are legible + */ + if (ewp->window == Scr->Root) { + if (!scanArgs.leaves && !scanArgs.enters) + InstallWindowColormaps(EnterNotify, &Scr->TwmRoot); + return; + } + +/*RAISEDELAY*/ /* Handle RaiseDelay, if any..... */ +/*RAISEDELAY*/ if (RaiseDelay > 0) { +/*RAISEDELAY*/ if (Tmp_win && Tmp_win->auto_raise +/*RAISEDELAY*/ && (!Tmp_win->list || Tmp_win->list->w != ewp->window)) { +/*RAISEDELAY*/ ColormapWindow *cwin; + +#ifdef NEVER +/*RAISEDELAY*/ static struct timeval timeout = {0,12500}; +#else +/* + * Submitted by Steve Ratcliffe + */ +/*RAISEDELAY*/ static struct timeval timeoutval = {0,12500}; +/*RAISEDELAY*/ struct timeval timeout; +#endif + +/*RAISEDELAY*/ +/*RAISEDELAY*/ if (XFindContext(dpy, Tmp_win->w, ColormapContext, +/*RAISEDELAY*/ (caddr_t *)&cwin) == XCNOENT) { +/*RAISEDELAY*/ cwin = (ColormapWindow *)NULL; +/*RAISEDELAY*/ } +/*RAISEDELAY*/ +/*RAISEDELAY*/ if ((ewp->detail != NotifyInferior +/*RAISEDELAY*/ || Tmp_win->frame == ewp->window) +/*RAISEDELAY*/ && (!cwin || cwin->visibility != VisibilityUnobscured)) { +/*RAISEDELAY*/ int x, y, px, py, d, i; +/*RAISEDELAY*/ Window w; +/*RAISEDELAY*/ +/*RAISEDELAY*/ XQueryPointer(dpy, Scr->Root, &w, &w, &px, &py, +/*RAISEDELAY*/ &d, &d, (unsigned int *)&d); +/*RAISEDELAY*/ +/*RAISEDELAY*/ /* The granularity of RaiseDelay is about 25 ms. + * The timeout variable is set to 12.5 ms since we + * pass this way twice each time a twm window is + * entered. + */ +/*RAISEDELAY*/ for (i = 25; i < RaiseDelay; i += 25) { + +/* + * Submitted by Steve Ratcliffe + */ +/*RAISEDELAY*/ /* The timeout needs initialising each time on Linux */ +/*RAISEDELAY*/ timeout = timeoutval; + +/*RAISEDELAY*/ select(0, 0, 0, 0, &timeout); +/*RAISEDELAY*/ /* Did we leave this window already? */ +/*RAISEDELAY*/ scanArgs.w = ewp->window; +/*RAISEDELAY*/ scanArgs.leaves = scanArgs.enters = False; +/*RAISEDELAY*/ (void) XCheckIfEvent(dpy, &dummy, HENQueueScanner, +/*RAISEDELAY*/ (char *) &scanArgs); +/*RAISEDELAY*/ if (scanArgs.leaves && !scanArgs.inferior) return; +/*RAISEDELAY*/ +/*RAISEDELAY*/ XQueryPointer(dpy, Scr->Root, &w, &w, &x, &y, +/*RAISEDELAY*/ &d, &d, (unsigned int *)&d); +/*RAISEDELAY*/ +/*RAISEDELAY*/ /* Has the pointer moved? If so reset the loop cnt. + * We want the pointer to be still for RaiseDelay + * milliseconds before terminating the loop + */ +/*RAISEDELAY*/ if (x != px || y != py) { +/*RAISEDELAY*/ i = 0; px = x; py = y; +/*RAISEDELAY*/ } +/*RAISEDELAY*/ } +/*RAISEDELAY*/ } +/*RAISEDELAY*/ } +/*RAISEDELAY*/ +/*RAISEDELAY*/ /* + * Scan for Leave and Enter Notify events to see if we can avoid some + * unnecessary processing. + */ +/*RAISEDELAY*/ scanArgs.w = ewp->window; +/*RAISEDELAY*/ scanArgs.leaves = scanArgs.enters = False; +/*RAISEDELAY*/ (void) XCheckIfEvent(dpy, &dummy, HENQueueScanner, (char *) &scanArgs); +/*RAISEDELAY*/ +/*RAISEDELAY*/ /* + * if entering root window, restore twm default colormap so that + * titlebars are legible + */ +/*RAISEDELAY*/ if (ewp->window == Scr->Root) { +/*RAISEDELAY*/ if (!scanArgs.leaves && !scanArgs.enters) +/*RAISEDELAY*/ InstallWindowColormaps(EnterNotify, &Scr->TwmRoot); +/*RAISEDELAY*/ return; +/*RAISEDELAY*/ } +/*RAISEDELAY*/ } +/*RAISEDELAY*/ /* End of RaiseDelay modification. */ + + /* + * if we have an event for a specific one of our windows + */ + if (Tmp_win) { + /* + * If currently in PointerRoot mode (indicated by FocusRoot), then + * focus on this window + */ + if (Scr->FocusRoot && (!scanArgs.leaves || scanArgs.inferior)) { + if (Tmp_win->list) ActiveIconManager(Tmp_win->list); + + if (Tmp_win->mapped) { + /* + * unhighlight old focus window + */ + +/* djhjr - 4/25/96 + if (Scr->Focus && Scr->Focus != Tmp_win && Tmp_win->hilite_w) + XUnmapWindow(dpy, Scr->Focus->hilite_w); +*/ + if (Scr->Focus && Scr->Focus != Tmp_win) + PaintTitleHighlight(Scr->Focus, off); + + /* + * If entering the frame or the icon manager, then do + * "window activation things": + * + * 1. turn on highlight window (if any) + * 2. install frame colormap + * 3. set frame and highlight window (if any) border + * 3a. set titlebutton highlight (if button color is frame) + * if IconManagerFocus is set or not in icon mgr + * 4. focus on client window to forward typing + * 4a. same as 4 but for icon mgr and/or NoTitlebar set + * 5. send WM_TAKE_FOCUS if requested + */ + if (ewp->window == Tmp_win->frame || + (Tmp_win->list && ewp->window == Tmp_win->list->w)) { + +/* djhjr - 4/25/96 + if (Tmp_win->hilite_w) * 1 * + XMapWindow (dpy, Tmp_win->hilite_w); +*/ + PaintTitleHighlight(Tmp_win, on); /* 1 */ + + if (!scanArgs.leaves && !scanArgs.enters) /* 2 */ + InstallWindowColormaps (EnterNotify, + &Scr->TwmRoot); + SetBorder (Tmp_win, True); /* 3, 3a */ + + /* added this 'if()' - djhjr - 5/27/98 */ + /* added hack for StrictIconManager - djhjr - 10/2/01 */ + /* added test for transients - djhjr - 4/9/02 */ + if (Scr->IconManagerFocus || + (Scr->FocusRoot && + Scr->StrictIconManager && + !Tmp_win->list) || + (Tmp_win->list && Tmp_win->list->w && + Tmp_win->list->w != ewp->window) || + Tmp_win->transient) + { + /* added test for transients - djhjr - 4/9/02 */ + if ((((Tmp_win->title_w || Scr->NoTitlebar) && /* 4, 4a */ + Scr->TitleFocus) || + Tmp_win->transient) && + Tmp_win->wmhints && + Tmp_win->wmhints->input) + SetFocus (Tmp_win, ewp->time); + } + + if (Tmp_win->protocols & DoesWmTakeFocus) /* 5 */ + SendTakeFocusMessage (Tmp_win, ewp->time); + Scr->Focus = Tmp_win; + } else if (ewp->window == Tmp_win->w) { + /* + * If we are entering the application window, install + * its colormap(s). + */ + if (!scanArgs.leaves || scanArgs.inferior) + InstallWindowColormaps(EnterNotify, Tmp_win); + } + } /* end if Tmp_win->mapped */ + if (Tmp_win->wmhints != NULL && + ewp->window == Tmp_win->wmhints->icon_window && + (!scanArgs.leaves || scanArgs.inferior)) + InstallWindowColormaps(EnterNotify, Tmp_win); + } /* end if FocusRoot */ + /* + * If this window is to be autoraised, mark it so + */ + if (Tmp_win->auto_raise) { + enter_win = Tmp_win; + if (enter_flag == FALSE) AutoRaiseWindow (Tmp_win); + } else if (enter_flag && raise_win == Tmp_win) + enter_win = Tmp_win; + /* + * set ring leader + */ + if (Tmp_win->ring.next && (!enter_flag || raise_win == enter_win)) + { + /* + * If this window is an icon manager window, make + * the ring leader the icon manager - djhjr - 11/8/01 + * + * Is the icon manager in the ring? - djhjr - 10/27/02 + */ + if (Tmp_win->list && ewp->window == Tmp_win->list->w && + Tmp_win->list->iconmgr->twm_win->ring.next) + { + Scr->RingLeader = Tmp_win->list->iconmgr->twm_win; + } + else + Scr->RingLeader = Tmp_win; + } + XSync (dpy, 0); + return; + } /* end if Tmp_win */ + } /* end if !ActiveMenu */ + + /* + * Find the menu that we are dealing with now; punt if unknown + */ + if (XFindContext (dpy, ewp->window, MenuContext, (caddr_t *)&mr) != XCSUCCESS) return; + + mr->entered = TRUE; +/* djhjr - 4/23/96 + if (ActiveMenu && mr == ActiveMenu->prev && RootFunction == F_NOFUNCTION) { + if (Scr->Shadow) XUnmapWindow (dpy, ActiveMenu->shadow); + XUnmapWindow (dpy, ActiveMenu->w); + ActiveMenu->mapped = UNMAPPED; + UninstallRootColormap (); + if (ActiveItem) { + ActiveItem->state = 0; + PaintEntry (ActiveMenu, ActiveItem, False); + } + ActiveItem = NULL; + ActiveMenu = mr; + MenuDepth--; + } +*/ + if (RootFunction == F_NOFUNCTION) { + MenuRoot *tmp; + for (tmp = ActiveMenu; tmp; tmp = tmp->prev) { + if (tmp == mr) break; + } + if (! tmp) return; + for (tmp = ActiveMenu; tmp != mr; tmp = tmp->prev) { + /* all 'tmp' were 'ActiveMenu'... DUH! - djhjr - 11/16/98 */ + if (Scr->Shadow) XUnmapWindow (dpy, tmp->shadow); + XUnmapWindow (dpy, tmp->w); + tmp->mapped = UNMAPPED; + MenuDepth--; + } + UninstallRootColormap (); + if (ActiveItem) { + ActiveItem->state = 0; + PaintEntry (ActiveMenu, ActiveItem, False); + } + ActiveItem = NULL; + ActiveMenu = mr; + } + + return; +} + + + +/*********************************************************************** + * + * Procedure: + * HLNQueueScanner - LeaveNotify event q scanner + * + * Looks at the queued events and determines if any + * EnterNotify events are behind this event to allow + * skipping of unnecessary processing. + * + *********************************************************************** + */ + +typedef struct HLNScanArgs { + Window w; /* The window getting the LeaveNotify */ + Bool enters; /* Any EnterNotify event at all */ + Bool matches; /* Any matching EnterNotify events */ +} HLNScanArgs; + +/* ARGSUSED*/ +static Bool +HLNQueueScanner(dpy, ev, args) + Display *dpy; + XEvent *ev; + char *args; +{ + if (ev->type == EnterNotify && ev->xcrossing.mode != NotifyGrab) { + ((HLNScanArgs *) args)->enters = True; + if (ev->xcrossing.window == ((HLNScanArgs *) args)->w) + ((HLNScanArgs *) args)->matches = True; + } + + return (False); +} + + + +/*********************************************************************** + * + * Procedure: + * HandleLeaveNotify - LeaveNotify event handler + * + *********************************************************************** + */ + +void +HandleLeaveNotify() +{ + HLNScanArgs scanArgs; + XEvent dummy; + + if (Tmp_win != NULL) + { + Bool inicon; + + /* + * We're not interested in pseudo Enter/Leave events generated + * from grab initiations and terminations. + */ + if (Event.xcrossing.mode != NotifyNormal) + return; + + inicon = (Tmp_win->list && + Tmp_win->list->w == Event.xcrossing.window); + +/* + * rem'ing this allows the window crossed out of onto the root window + * to be remembered, so an f.warpring event occuring on the root window + * will return to that window (see WarpAlongRing() in menus.c). + * + * no, I don't fully understand... djhjr - 5/11/98 + * + if (Scr->RingLeader && Scr->RingLeader == Tmp_win && + (Event.xcrossing.detail != NotifyInferior && + Event.xcrossing.window != Tmp_win->w)) { + +#ifdef ORIGINAL_WARPRINGCOORDINATES * djhjr - 5/11/98 * + if (!inicon) { + if (Tmp_win->mapped) { + Tmp_win->ring.cursor_valid = False; + } else { + Tmp_win->ring.cursor_valid = True; + Tmp_win->ring.curs_x = (Event.xcrossing.x_root - + Tmp_win->frame_x); + Tmp_win->ring.curs_y = (Event.xcrossing.y_root - + Tmp_win->frame_y); + } + } +#endif + + Scr->RingLeader = (TwmWindow *) NULL; + } +*/ + + if (Scr->FocusRoot) { + + if (Event.xcrossing.detail != NotifyInferior) { + + /* + * Scan for EnterNotify events to see if we can avoid some + * unnecessary processing. + */ + scanArgs.w = Event.xcrossing.window; + scanArgs.enters = scanArgs.matches = False; + (void) XCheckIfEvent(dpy, &dummy, HLNQueueScanner, + (char *) &scanArgs); + + if ((Event.xcrossing.window == Tmp_win->frame && + !scanArgs.matches) || inicon) { + if (Tmp_win->list) NotActiveIconManager(Tmp_win->list); + +/* djhjr - 4/25/96 + if (Tmp_win->hilite_w) + XUnmapWindow (dpy, Tmp_win->hilite_w); +*/ + PaintTitleHighlight(Tmp_win, off); + + SetBorder (Tmp_win, False); + if (Scr->TitleFocus || + Tmp_win->protocols & DoesWmTakeFocus) + SetFocus ((TwmWindow *) NULL, Event.xcrossing.time); + Scr->Focus = NULL; + } else if (Event.xcrossing.window == Tmp_win->w && + !scanArgs.enters) { + InstallWindowColormaps (LeaveNotify, &Scr->TwmRoot); + } + } + } + XSync (dpy, 0); + return; + } +} + + + +/*********************************************************************** + * + * Procedure: + * HandleConfigureRequest - ConfigureRequest event handler + * + *********************************************************************** + */ + +void +HandleConfigureRequest() +{ + XWindowChanges xwc; + unsigned long xwcm; + int x, y, width, height, bw; + int gravx, gravy; + XConfigureRequestEvent *cre = &Event.xconfigurerequest; + +#ifdef DEBUG_EVENTS + fprintf(stderr, "ConfigureRequest\n"); + if (cre->value_mask & CWX) + fprintf(stderr, " x = %d\n", cre->x); + if (cre->value_mask & CWY) + fprintf(stderr, " y = %d\n", cre->y); + if (cre->value_mask & CWWidth) + fprintf(stderr, " width = %d\n", cre->width); + if (cre->value_mask & CWHeight) + fprintf(stderr, " height = %d\n", cre->height); + if (cre->value_mask & CWSibling) + fprintf(stderr, " above = 0x%x\n", cre->above); + if (cre->value_mask & CWStackMode) + fprintf(stderr, " stack = %d\n", cre->detail); +#endif + + /* + * Event.xany.window is Event.xconfigurerequest.parent, so Tmp_win will + * be wrong + */ + Event.xany.window = cre->window; /* mash parent field */ + if (XFindContext (dpy, cre->window, TwmContext, (caddr_t *) &Tmp_win) == + XCNOENT) + Tmp_win = NULL; + + + /* + * According to the July 27, 1988 ICCCM draft, we should ignore size and + * position fields in the WM_NORMAL_HINTS property when we map a window. + * Instead, we'll read the current geometry. Therefore, we should respond + * to configuration requests for windows which have never been mapped. + */ + if (!Tmp_win || Tmp_win->icon_w == cre->window) { + xwcm = cre->value_mask & + (CWX | CWY | CWWidth | CWHeight | CWBorderWidth); + xwc.x = cre->x; + xwc.y = cre->y; + xwc.width = cre->width; + xwc.height = cre->height; + xwc.border_width = cre->border_width; + XConfigureWindow(dpy, Event.xany.window, xwcm, &xwc); + return; + } + + if ((cre->value_mask & CWStackMode) && Tmp_win->stackmode) { + TwmWindow *otherwin; + + xwc.sibling = (((cre->value_mask & CWSibling) && + (XFindContext (dpy, cre->above, TwmContext, + (caddr_t *) &otherwin) == XCSUCCESS)) + ? otherwin->frame : cre->above); + xwc.stack_mode = cre->detail; + XConfigureWindow (dpy, Tmp_win->frame, + cre->value_mask & (CWSibling | CWStackMode), &xwc); + } + + + /* Don't modify frame_XXX fields before calling SetupWindow! */ + x = Tmp_win->frame_x; + y = Tmp_win->frame_y; + width = Tmp_win->frame_width; + height = Tmp_win->frame_height; + bw = Tmp_win->frame_bw; + + /* + * Section 4.1.5 of the ICCCM states that the (x,y) coordinates in the + * configure request are for the upper-left outer corner of the window. + * This means that we need to adjust for the additional title height as + * well as for any border width changes that we decide to allow. The + * current window gravity is to be used in computing the adjustments, just + * as when initially locating the window. Note that if we do decide to + * allow border width changes, we will need to send the synthetic + * ConfigureNotify event. + */ + GetGravityOffsets (Tmp_win, &gravx, &gravy); + + if (cre->value_mask & CWBorderWidth) { + int bwdelta = cre->border_width - Tmp_win->old_bw; /* posit growth */ + if (bwdelta && Scr->ClientBorderWidth) { /* if change allowed */ + x += gravx * bwdelta; /* change default values only */ + y += gravy * bwdelta; /* ditto */ + bw = cre->border_width; + if (Tmp_win->title_height) height += bwdelta; + x += (gravx < 0) ? bwdelta : -bwdelta; + y += (gravy < 0) ? bwdelta : -bwdelta; + } + Tmp_win->old_bw = cre->border_width; /* for restoring */ + } + + if (cre->value_mask & CWX) { /* override even if border change */ + x = cre->x - bw; + + /* djhjr - 4/21/96 */ + x -= ((gravx < 0) ? 0 : Tmp_win->frame_bw3D); + + } + if (cre->value_mask & CWY) { + y = cre->y - ((gravy < 0) ? 0 : Tmp_win->title_height) - bw; + + /* djhjr - 4/21/96 */ + y -= ((gravy < 0) ? 0 : Tmp_win->frame_bw3D); + + } + + if (cre->value_mask & CWWidth) { + +/* djhjr - 4/21/96 + width = cre->width; +*/ + width = cre->width + 2 * Tmp_win->frame_bw3D; + + } + if (cre->value_mask & CWHeight) { + +/* djhjr - 4/21/96 + height = cre->height + Tmp_win->title_height; +*/ + height = cre->height + Tmp_win->title_height + 2 * Tmp_win->frame_bw3D; + + } + + if (width != Tmp_win->frame_width || height != Tmp_win->frame_height) + Tmp_win->zoomed = ZOOM_NONE; + + /* + * SetupWindow (x,y) are the location of the upper-left outer corner and + * are passed directly to XMoveResizeWindow (frame). The (width,height) + * are the inner size of the frame. The inner width is the same as the + * requested client window width; the inner height is the same as the + * requested client window height plus any title bar slop. + */ +/* propogate ConfigureNotify events - submitted by Jonathan Paisley - 11/11/02 + SetupWindow (Tmp_win, x, y, width, height, bw); +*/ + SetupFrame(Tmp_win, x, y, width, height, bw, True); + + /* Change the size of the desktop representation */ + MoveResizeDesktop (Tmp_win, TRUE); + + /* + * Raise the autopan windows in case the current window covers them. + * Submitted by Steve Ratcliffe + */ + RaiseAutoPan(); +} + + + +/*********************************************************************** + * + * Procedure: + * HandleShapeNotify - shape notification event handler + * + *********************************************************************** + */ +void +HandleShapeNotify () +{ + XShapeEvent *sev = (XShapeEvent *) &Event; + + if (Tmp_win == NULL) + return; + if (sev->kind != ShapeBounding) + return; + if (!Tmp_win->wShaped && sev->shaped) { + XShapeCombineMask (dpy, Tmp_win->frame, ShapeClip, 0, 0, None, + ShapeSet); + } + Tmp_win->wShaped = sev->shaped; + SetFrameShape (Tmp_win); +} + + + +/*********************************************************************** + * + * Procedure: + * HandleUnknown - unknown event handler + * + *********************************************************************** + */ + +void +HandleUnknown() +{ +#ifdef DEBUG_EVENTS + fprintf(stderr, "type = %d\n", Event.type); +#endif +} + + + +/*********************************************************************** + * + * Procedure: + * Transient - checks to see if the window is a transient + * + * Returned Value: + * TRUE - window is a transient + * FALSE - window is not a transient + * + * Inputs: + * w - the window to check + * + *********************************************************************** + */ + +int +Transient(w, propw) + Window w, *propw; +{ + return (XGetTransientForHint(dpy, w, propw)); +} + + + +/*********************************************************************** + * + * Procedure: + * FindScreenInfo - get ScreenInfo struct associated with a given window + * + * Returned Value: + * ScreenInfo struct + * + * Inputs: + * w - the window + * + *********************************************************************** + */ + +ScreenInfo * +FindScreenInfo(w) + Window w; +{ + XWindowAttributes attr; + int scrnum; + + attr.screen = NULL; + if (XGetWindowAttributes(dpy, w, &attr)) { + for (scrnum = 0; scrnum < NumScreens; scrnum++) { + if (ScreenList[scrnum] != NULL && + (ScreenOfDisplay(dpy, ScreenList[scrnum]->screen) == + attr.screen)) + return ScreenList[scrnum]; + } + } + + return NULL; +} + + + +static void flush_expose (w) + Window w; +{ + XEvent dummy; + + /* SUPPRESS 530 */ + while (XCheckTypedWindowEvent (dpy, w, Expose, &dummy)) ; +} + + + +/*********************************************************************** + * + * Procedure: + * InstallWindowColormaps - install the colormaps for one twm window + * + * Inputs: + * type - type of event that caused the installation + * tmp - for a subset of event types, the address of the + * window structure, whose colormaps are to be installed. + * + *********************************************************************** + */ + +void InstallWindowColormaps (type, tmp) + int type; + TwmWindow *tmp; +{ + int i, j, n, number_cwins, state; + ColormapWindow **cwins, *cwin, **maxcwin = NULL; + TwmColormap *cmap; + char *row, *scoreboard; + + switch (type) { + case EnterNotify: + case LeaveNotify: + case DestroyNotify: + default: + /* Save the colormap to be loaded for when force loading of + * root colormap(s) ends. + */ + Scr->cmapInfo.pushed_window = tmp; + /* Don't load any new colormap if root colormap(s) has been + * force loaded. + */ + if (Scr->cmapInfo.root_pushes) + return; + /* Don't reload the currend window colormap list. + */ + if (Scr->cmapInfo.cmaps == &tmp->cmaps) + return; + if (Scr->cmapInfo.cmaps) + for (i = Scr->cmapInfo.cmaps->number_cwins, + cwins = Scr->cmapInfo.cmaps->cwins; i-- > 0; cwins++) + (*cwins)->colormap->state &= ~CM_INSTALLABLE; + Scr->cmapInfo.cmaps = &tmp->cmaps; + break; + + case PropertyNotify: + case VisibilityNotify: + case ColormapNotify: + break; + } + + number_cwins = Scr->cmapInfo.cmaps->number_cwins; + cwins = Scr->cmapInfo.cmaps->cwins; + scoreboard = Scr->cmapInfo.cmaps->scoreboard; + + ColortableThrashing = FALSE; /* in case installation aborted */ + + state = CM_INSTALLED; + +/* + * Submitted by Caveh Frank Jalali + * + for (i = n = 0; i < number_cwins + && n < Scr->cmapInfo.maxCmaps +*/ + for (i = 0; i < number_cwins + + /* comp.windows.x + ** Article <21sn92INNbiv@sirius.isi.com> Mon 18:06 + ** Path: ..!news.isi.com!not-for-mail (Mark Kent @ + ** Integrated Systems, Inc.) + */ + ; i++) { + cwin = cwins[i]; + cmap = cwin->colormap; + cmap->state |= CM_INSTALLABLE; + cmap->state &= ~CM_INSTALL; + cmap->w = cwin->w; + } + for (i = n = 0; i < number_cwins; i++) { + cwin = cwins[i]; + cmap = cwin->colormap; + if (cwin->visibility != VisibilityFullyObscured + /* && n < Scr->cmapInfo.maxCmaps + ** <21sn92INNbiv@sirius.isi.com> + */ + ) { + row = scoreboard + (i*(i-1)/2); + for (j = 0; j < i; j++) + if (row[j] && (cwins[j]->colormap->state & CM_INSTALL)) + break; + if (j != i) + continue; + n++; + maxcwin = &cwins[i]; + state &= (cmap->state & CM_INSTALLED); + cmap->state |= CM_INSTALL; + } + } + + Scr->cmapInfo.first_req = NextRequest(dpy); + +/* + * Submitted by Caveh Frank Jalali + * + for ( ; n > 0; maxcwin--) { +*/ + for ( ; n > 0; n--, maxcwin--) { + + cmap = (*maxcwin)->colormap; + if (cmap->state & CM_INSTALL) { + cmap->state &= ~CM_INSTALL; + if (!(state & CM_INSTALLED)) { + cmap->install_req = NextRequest(dpy); + XInstallColormap(dpy, cmap->c); + } + cmap->state |= CM_INSTALLED; +/* see above 'for (...)' + n--; +*/ + } + } +} + + + +/*********************************************************************** + * + * Procedures: + * nstallRootColormap - Force (un)loads root colormap(s) + * + * These matching routines provide a mechanism to insure that + * the root colormap(s) is installed during operations like + * rubber banding or menu display that require colors from + * that colormap. Calls may be nested arbitrarily deeply, + * as long as there is one UninstallRootColormap call per + * InstallRootColormap call. + * + * The final UninstallRootColormap will cause the colormap list + * which would otherwise have be loaded to be loaded, unless + * Enter or Leave Notify events are queued, indicating some + * other colormap list would potentially be loaded anyway. + *********************************************************************** + */ + +void InstallRootColormap() +{ + TwmWindow *tmp; + if (Scr->cmapInfo.root_pushes == 0) { + /* + * The saving and restoring of cmapInfo.pushed_window here + * is a slimy way to remember the actual pushed list and + * not that of the root window. + */ + tmp = Scr->cmapInfo.pushed_window; + InstallWindowColormaps(0, &Scr->TwmRoot); + Scr->cmapInfo.pushed_window = tmp; + } + Scr->cmapInfo.root_pushes++; +} + + + +/* ARGSUSED*/ +static Bool +UninstallRootColormapQScanner(dpy, ev, args) + Display *dpy; + XEvent *ev; + char *args; +{ + if (!*args) + { + if (ev->type == EnterNotify) { + if (ev->xcrossing.mode != NotifyGrab) + *args = 1; + } else if (ev->type == LeaveNotify) { + if (ev->xcrossing.mode == NotifyNormal) + *args = 1; + } + } + + return (False); +} + + + +void UninstallRootColormap() +{ + char args; + XEvent dummy; + + if (Scr->cmapInfo.root_pushes) + Scr->cmapInfo.root_pushes--; + + if (!Scr->cmapInfo.root_pushes) { + /* + * If we have subsequent Enter or Leave Notify events, + * we can skip the reload of pushed colormaps. + */ + XSync (dpy, 0); + args = 0; + (void) XCheckIfEvent(dpy, &dummy, UninstallRootColormapQScanner, &args); + + if (!args) + InstallWindowColormaps(0, Scr->cmapInfo.pushed_window); + } +} + +void SendConfigureNotify(tmp_win, x, y) +TwmWindow *tmp_win; +int x, y; +{ + XEvent client_event; + + client_event.type = ConfigureNotify; + client_event.xconfigure.display = dpy; + client_event.xconfigure.event = tmp_win->w; + client_event.xconfigure.window = tmp_win->w; + +/* djhjr - 4/24/96 + client_event.xconfigure.x = (x + tmp_win->frame_bw - tmp_win->old_bw); + client_event.xconfigure.y = (y + tmp_win->frame_bw + + tmp_win->title_height - tmp_win->old_bw); + client_event.xconfigure.width = tmp_win->frame_width; + client_event.xconfigure.height = tmp_win->frame_height - + tmp_win->title_height; +*/ + client_event.xconfigure.x = (x + tmp_win->frame_bw - tmp_win->old_bw + + tmp_win->frame_bw3D); + client_event.xconfigure.y = (y + tmp_win->frame_bw + + tmp_win->title_height - tmp_win->old_bw + + tmp_win->frame_bw3D); + client_event.xconfigure.width = tmp_win->attr.width; + client_event.xconfigure.height = tmp_win->attr.height; + + client_event.xconfigure.border_width = tmp_win->old_bw; + /* Real ConfigureNotify events say we're above title window, so ... */ + /* what if we don't have a title ????? */ + client_event.xconfigure.above = tmp_win->frame; + client_event.xconfigure.override_redirect = False; + + XSendEvent(dpy, tmp_win->w, False, StructureNotifyMask, &client_event); +} + +#ifdef TRACE +dumpevent (e) + XEvent *e; +{ + char *name = NULL; + + switch (e->type) { + case KeyPress: name = "KeyPress"; break; + case KeyRelease: name = "KeyRelease"; break; + case ButtonPress: name = "ButtonPress"; break; + case ButtonRelease: name = "ButtonRelease"; break; + case MotionNotify: name = "MotionNotify"; break; + case EnterNotify: name = "EnterNotify"; break; + case LeaveNotify: name = "LeaveNotify"; break; + case FocusIn: name = "FocusIn"; break; + case FocusOut: name = "FocusOut"; break; + case KeymapNotify: name = "KeymapNotify"; break; + case Expose: name = "Expose"; break; + case GraphicsExpose: name = "GraphicsExpose"; break; + case NoExpose: name = "NoExpose"; break; + case VisibilityNotify: name = "VisibilityNotify"; break; + case CreateNotify: name = "CreateNotify"; break; + case DestroyNotify: name = "DestroyNotify"; break; + case UnmapNotify: name = "UnmapNotify"; break; + case MapNotify: name = "MapNotify"; break; + case MapRequest: name = "MapRequest"; break; + case ReparentNotify: name = "ReparentNotify"; break; + case ConfigureNotify: name = "ConfigureNotify"; break; + case ConfigureRequest: name = "ConfigureRequest"; break; + case GravityNotify: name = "GravityNotify"; break; + case ResizeRequest: name = "ResizeRequest"; break; + case CirculateNotify: name = "CirculateNotify"; break; + case CirculateRequest: name = "CirculateRequest"; break; + case PropertyNotify: name = "PropertyNotify"; break; + case SelectionClear: name = "SelectionClear"; break; + case SelectionRequest: name = "SelectionRequest"; break; + case SelectionNotify: name = "SelectionNotify"; break; + case ColormapNotify: name = "ColormapNotify"; break; + case ClientMessage: name = "ClientMessage"; break; + case MappingNotify: name = "MappingNotify"; break; + } + + if (name) { + printf ("event: %s, %d remaining\n", name, QLength(dpy)); + } else { + printf ("unknown event %d, %d remaining\n", e->type, QLength(dpy)); + } +} +#endif /* TRACE */ + diff --git a/events.h b/events.h new file mode 100644 index 0000000..8d42304 --- /dev/null +++ b/events.h @@ -0,0 +1,96 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/*********************************************************************** + * + * $XConsortium: events.h,v 1.14 91/05/10 17:53:58 dave Exp $ + * + * twm event handler include file + * + * 17-Nov-87 Thomas E. LaStrange File created + * + ***********************************************************************/ + +#ifndef _EVENTS_ +#define _EVENTS_ + +typedef void (*event_proc)(); + +extern void InitEvents(); +extern Bool StashEventTime(); +extern Time lastTimestamp; +extern void SimulateMapRequest(); +extern void AutoRaiseWindow(); +#define LastTimestamp() lastTimestamp +extern Bool DispatchEvent(); +/* depreciated - djhjr - 10/6/02 +extern Bool DispatchEvent2(); +*/ +extern void HandleEvents(); +extern void HandleExpose(); +extern void HandleDestroyNotify(); +extern void HandleMapRequest(); +extern void HandleMapNotify(); +extern void HandleUnmapNotify(); +extern void HandleMotionNotify(); +extern void HandleButtonRelease(); +extern void HandleButtonPress(); +extern void HandleEnterNotify(); +extern void HandleLeaveNotify(); +extern void HandleConfigureRequest(); +extern void HandleClientMessage(); +extern void HandlePropertyNotify(); +extern void HandleKeyPress(); +extern void HandleColormapNotify(); +extern void HandleVisibilityNotify(); +extern void HandleUnknown(); +extern void SendConfigureNotify(); +extern void InstallRootColormap(); +extern int Transient(); +extern void UninstallRootColormap(); +extern void InstallWindowColormaps(); +extern void RedoDoorName(); /* djhjr - 2/28/99 */ +extern void RedoListWindow(); /* djhjr - 3/1/99 */ + +extern event_proc EventHandler[]; +extern Window DragWindow; +extern int origDragX; +extern int origDragY; +extern int DragX; +extern int DragY; +extern int DragWidth; +extern int DragHeight; +extern int CurrentDragX; +extern int CurrentDragY; + +extern int ButtonPressed; +extern int Cancel; + +extern XEvent Event; + +#endif /* _EVENTS_ */ diff --git a/gc.c b/gc.c new file mode 100644 index 0000000..4363b78 --- /dev/null +++ b/gc.c @@ -0,0 +1,129 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/********************************************************************** + * + * $XConsortium: gc.c,v 1.22 91/01/09 17:13:12 rws Exp $ + * + * Open the fonts and create the GCs + * + * 31-Mar-88 Tom LaStrange Initial Version. + * + * Do the necessary modification to be integrated in ctwm. + * Can no longer be used for the standard twm. + * + * 22-April-92 Claude Lecommandeur. + * + * + **********************************************************************/ + +#include +#include "twm.h" +#include "util.h" +#include "screen.h" + +/*********************************************************************** + * + * Procedure: + * CreateGCs - open fonts and create all the needed GC's. I only + * want to do this once, hence the first_time flag. + * + *********************************************************************** + */ + +void +CreateGCs() +{ + static ScreenInfo *prevScr = NULL; + XGCValues gcv; + unsigned long gcm; + static unsigned char greypattern [] = {0x0f, 0x05, 0x0f, 0x0a}; + Pixmap greypixmap; + static char dashlist [2] = {1, 1}; + + if (!Scr->FirstTime || prevScr == Scr) + return; + + prevScr = Scr; + + /* create GC's */ + + gcm = 0; + gcm |= GCFunction; gcv.function = GXxor; + gcm |= GCLineWidth; gcv.line_width = 0; + gcm |= GCForeground; gcv.foreground = Scr->XORvalue; + gcm |= GCSubwindowMode; gcv.subwindow_mode = IncludeInferiors; + + Scr->DrawGC = XCreateGC(dpy, Scr->Root, gcm, &gcv); + + gcm = 0; + gcm |= GCForeground; gcv.foreground = Scr->MenuC.fore; + gcm |= GCBackground; gcv.background = Scr->MenuC.back; +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (!use_fontset) + { + gcm |= GCFont; gcv.font = Scr->MenuFont.font->fid; + } +#else + gcm |= GCFont; gcv.font = Scr->MenuFont.font->fid; +#endif + + Scr->MenuGC = XCreateGC(dpy, Scr->Root, gcm, &gcv); + + gcm = 0; + gcm |= GCPlaneMask; gcv.plane_mask = AllPlanes; + /* + * Prevent GraphicsExpose and NoExpose events. We'd only get NoExpose + * events anyway; they cause BadWindow errors from XGetWindowAttributes + * call in FindScreenInfo (events.c) (since drawable is a pixmap). + */ + gcm |= GCGraphicsExposures; gcv.graphics_exposures = False; + gcm |= GCLineWidth; gcv.line_width = 0; + + Scr->NormalGC = XCreateGC(dpy, Scr->Root, gcm, &gcv); + + greypixmap = XCreatePixmapFromBitmapData(dpy, Scr->Root, + (char *) greypattern, 4, 4, 1, 0, 1); + + gcm = 0; + gcm |= GCStipple; gcv.stipple = greypixmap; + gcm |= GCFillStyle; gcv.fill_style = FillOpaqueStippled; + gcm |= GCForeground; gcv.foreground = Scr->Black; + gcm |= GCBackground; gcv.background = Scr->White; + Scr->GreyGC = XCreateGC (dpy, Scr->Root, gcm, &gcv); + XSetDashes (dpy, Scr->GreyGC, 1, dashlist, 2); + + if (Scr->BeNiceToColormap) { + gcm = 0; + gcm |= GCLineStyle; + gcv.line_style = LineDoubleDash; + Scr->ShadGC = XCreateGC (dpy, Scr->Root, gcm, &gcv); + XSetDashes (dpy, Scr->ShadGC, 0, dashlist, 2); + } +} diff --git a/gc.h b/gc.h new file mode 100644 index 0000000..f603201 --- /dev/null +++ b/gc.h @@ -0,0 +1,44 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/********************************************************************** + * + * $XConsortium: gc.h,v 1.5 89/10/27 14:01:17 jim Exp $ + * + * GC related externs + * + * 8-Apr-88 Tom LaStrange Initial Version. + * + **********************************************************************/ + +#ifndef _GC_ +#define _GC_ + +extern void CreateGCs(); + +#endif /* _GC_ */ diff --git a/gram.y b/gram.y new file mode 100644 index 0000000..ac41412 --- /dev/null +++ b/gram.y @@ -0,0 +1,1248 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/*********************************************************************** + * + * $XConsortium: gram.y,v 1.91 91/02/08 18:21:56 dave Exp $ + * + * .twmrc command grammer + * + * 07-Jan-86 Thomas E. LaStrange File created + * 11-Nov-90 Dave Sternlicht Adding SaveColors + * 10-Oct-90 David M. Sternlicht Storing saved colors on root + * + ***********************************************************************/ + +%{ +#include +#include +#include +#include "twm.h" +#include "menus.h" +#include "list.h" +#include "util.h" +#include "screen.h" +#include "parse.h" +#include "doors.h" +/* djhjr - 10/30/02 */ +#include "iconmgr.h" +/* djhjr - 4/26/99 */ +#include "regions.h" +#include +#include + +/* Submitted by Nelson H. F. Beebe */ +#ifdef __NeXT__ +#undef isascii +#define isascii(c) ((0 <= (int)(c)) && ((int)(c) <= 127)) +#endif + +static char *Action = ""; +static char *Name = ""; +static MenuRoot *root, *pull = NULL; + +static MenuRoot *GetRoot(); +/* was type 'void' - djhjr - 10/20/01 */ +static char *RemoveDQuote(); +/* djhjr - 10/20/01 */ +static char *RemoveRESlash(); +/* djhjr - 10/16/02 */ +static int ParseWarpCentered(); +/* djhjr - 9/24/02 */ +static int ParseUsePPosition(); +void twmrc_error_prefix(); + +/* djhjr - 4/30/96 */ +static MenuItem *lastmenuitem = (MenuItem*) 0; + +static Bool CheckWarpScreenArg(), CheckWarpRingArg(); +static Bool CheckColormapArg(); +static void GotButton(), GotKey(), GotTitleButton(); +static void yyerror(); +static name_list **list; +/* djhjr - 4/26/99 */ +static RootRegion *ARlist; +static int cont = 0; +static int color; +int mods = 0; +unsigned int mods_used = (ShiftMask | ControlMask | Mod1Mask); +/* djhjr - 9/24/02 */ +static int ppos; +/* djhjr - 10/16/02 */ +static int warpc; + +extern void SetHighlightPixmap(); +extern void SetVirtualPixmap(), SetVirtualDesktop(), SetRealScreenPixmap(); +extern void NewBitmapCursor(); +extern void AddIconRegion(); +/* next two - djhjr - 4/26/99 */ +extern RootRegion *AddAppletRegion(); +extern int AddToAppletList(); +extern int do_single_keyword(), do_string_keyword(), do_number_keyword(); +extern name_list **do_colorlist_keyword(); +extern int do_color_keyword(); +extern void do_string_savecolor(), do_var_savecolor(), do_squeeze_entry(); +/* djhjr - 6/22/01 */ +extern int SetSound(); + +/* + * this used to be the definition - now making the assumption it's + * defined in lex's skeleton file (submitted by Nelson H. F. Beebe) + * + * djhjr - 1/16/98 + */ +extern int yylineno; + +%} + +%union +{ + int num; + char *ptr; + /* djhjr - 10/20/01 */ + struct + { + short ltype; + char *lval; + } match; +}; + +%token LP RP MENUS MENU BUTTON DEFAULT_FUNCTION PLUS MINUS +%token ALL OR CURSORS PIXMAPS ICONS COLOR MONOCHROME FUNCTION +%token ICONMGR_SHOW ICONMGR WINDOW_FUNCTION ZOOM ICONMGRS +%token ICONMGR_GEOMETRY ICONMGR_NOSHOW MAKE_TITLE +%token ICONIFY_BY_UNMAPPING DONT_ICONIFY_BY_UNMAPPING +%token NO_TITLE AUTO_RAISE NO_HILITE NO_ICONMGR_HILITE ICON_REGION +/* djhjr - 10/16/02 */ +%token WARP_CENTERED +/* djhjr - 9/24/02 */ +%token USE_PPOSITION +/* submitted by Tim Wiess - 8/23/02 */ +%token NO_BORDER +/* djhjr - 4/26/99 */ +%token APPLET_REGION +%token META SHIFT LOCK CONTROL WINDOW TITLE ICON ROOT FRAME VIRTUAL VIRTUAL_WIN +/* TILDE - djhjr - 10/20/01 */ +%token COLON EQUALS TILDE SQUEEZE_TITLE DONT_SQUEEZE_TITLE +/* opaque stuff - djhjr - 4/7/98 */ +%token OPAQUE_MOVE NO_OPAQUE_MOVE OPAQUE_RESIZE NO_OPAQUE_RESIZE +%token START_ICONIFIED NO_TITLE_HILITE TITLE_HILITE +%token MOVE RESIZE WAIT SELECT KILL LEFT_TITLEBUTTON RIGHT_TITLEBUTTON +/* MKEYWORD - djhjr - 10/20/01 */ +%token NUMBER KEYWORD MKEYWORD NKEYWORD CKEYWORD CLKEYWORD FKEYWORD FSKEYWORD +/* SNKEYWORD - djhjr - 10/18/02 */ +/* NO_WINDOW_RING submitted by Jonathan Paisley - 10/27/02 */ +%token SNKEYWORD SKEYWORD DKEYWORD JKEYWORD WINDOW_RING NO_WINDOW_RING WARP_CURSOR +%token ERRORTOKEN NO_STACKMODE NAILEDDOWN VIRTUALDESKTOP NO_SHOW_IN_DISPLAY +/* Submitted by Erik Agsjo */ +%token NO_SHOW_IN_TWMWINDOWS +%token DOORS DOOR +/*RFB PIXMAP:*/ +%token VIRTUALMAP +%token REALSCREENMAP +/* two pixmaps - djhjr - 10/30/02 */ +%token ICONMGRICONMAP +%token MENUICONMAP +/* STRING REGEXP +/* djhjr - 9/10/03 */ +%token IGNORE_MODS +%token SAVECOLOR +%token LB +%token RB + +/* regex stuff - djhjr - 10/20/01 */ +%type matcher +%type string regexp +%type action button number signed_number full fullkey + +%start twmrc + +%% +twmrc : stmts + ; + +stmts : /* Empty */ + | stmts stmt + ; + +stmt : error + | noarg + | sarg + | narg + | snarg + | squeeze + | doors + | ICON_REGION string DKEYWORD DKEYWORD number number + { AddIconRegion($2, $3, $4, $5, $6); } + | APPLET_REGION string DKEYWORD DKEYWORD number number + { ARlist = AddAppletRegion($2, $3, $4, $5, $6); } + applet_list + | ICONMGR_GEOMETRY string number { if (Scr->FirstTime) + { + Scr->iconmgr.geometry=$2; + Scr->iconmgr.columns=$3; + } + } + | ICONMGR_GEOMETRY string { if (Scr->FirstTime) + Scr->iconmgr.geometry = $2; + } + | ZOOM number { if (Scr->FirstTime) + { + Scr->DoZoom = TRUE; + Scr->ZoomCount = $2; + } + } + | ZOOM { if (Scr->FirstTime) + Scr->DoZoom = TRUE; } + | PIXMAPS pixmap_list {} + | CURSORS cursor_list {} + | ICONIFY_BY_UNMAPPING { list = &Scr->IconifyByUn; } + win_list + | ICONIFY_BY_UNMAPPING { if (Scr->FirstTime) + Scr->IconifyByUnmapping = TRUE; } + + | OPAQUE_MOVE { list = &Scr->OpaqueMoveL; } + win_list + | OPAQUE_MOVE { if (Scr->FirstTime) Scr->OpaqueMove = TRUE; } + | NO_OPAQUE_MOVE { list = &Scr->NoOpaqueMoveL; } + win_list + | NO_OPAQUE_MOVE { if (Scr->FirstTime) Scr->OpaqueMove = FALSE; } + | OPAQUE_RESIZE { list = &Scr->OpaqueResizeL; } + win_list + | OPAQUE_RESIZE { if (Scr->FirstTime) Scr->OpaqueResize = TRUE; } + | NO_OPAQUE_RESIZE { list = &Scr->NoOpaqueResizeL; } + win_list + | NO_OPAQUE_RESIZE { if (Scr->FirstTime) Scr->OpaqueResize = FALSE; } + + | LEFT_TITLEBUTTON string EQUALS action { + GotTitleButton ($2, $4, False); + } + | RIGHT_TITLEBUTTON string EQUALS action { + GotTitleButton ($2, $4, True); + } + | button string { root = GetRoot($2, NULLSTR, NULLSTR); + Scr->Mouse[$1][C_ROOT][0].func = F_MENU; + Scr->Mouse[$1][C_ROOT][0].menu = root; + } + | button action { Scr->Mouse[$1][C_ROOT][0].func = $2; + if ($2 == F_MENU) + { + pull->prev = NULL; + Scr->Mouse[$1][C_ROOT][0].menu = pull; + } + else + { + root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); + Scr->Mouse[$1][C_ROOT][0].item = + AddToMenu(root,"x",Action, + NULLSTR,$2,NULLSTR,NULLSTR); + } + Action = ""; + pull = NULL; + } + | string fullkey { GotKey($1, $2); } + | button full { GotButton($1, $2); } + | IGNORE_MODS keys { Scr->IgnoreModifiers = mods; + mods = 0; + } + | DONT_ICONIFY_BY_UNMAPPING { list = &Scr->DontIconify; } + win_list + | ICONMGR_NOSHOW { list = &Scr->IconMgrNoShow; } + win_list + | ICONMGR_NOSHOW { Scr->IconManagerDontShow = TRUE; } + | ICONMGRS { list = &Scr->IconMgrs; } + iconm_list + | ICONMGR_SHOW { list = &Scr->IconMgrShow; } + win_list + | NO_TITLE_HILITE { list = &Scr->NoTitleHighlight; } + win_list + | NO_TITLE_HILITE { if (Scr->FirstTime) + Scr->TitleHighlight = FALSE; } + | NO_ICONMGR_HILITE { Scr->IconMgrHighlight = FALSE; } + | NO_HILITE { list = &Scr->NoHighlight; } + win_list + | NO_HILITE { if (Scr->FirstTime) + Scr->Highlight = FALSE; } + | NO_STACKMODE { list = &Scr->NoStackModeL; } + win_list + | NO_STACKMODE { if (Scr->FirstTime) + Scr->StackMode = FALSE; } + | NO_TITLE { list = &Scr->NoTitle; } + win_list + | NO_TITLE { if (Scr->FirstTime) + Scr->NoTitlebar = TRUE; } + | NO_BORDER { list = &Scr->NoBorder; } + win_list + | NO_BORDER { if (Scr->FirstTime) + Scr->NoBorders = TRUE; } + | MAKE_TITLE { list = &Scr->MakeTitle; } + win_list + | START_ICONIFIED { list = &Scr->StartIconified; } + win_list + | AUTO_RAISE { list = &Scr->AutoRaise; } + win_list + | AUTO_RAISE { Scr->AutoRaiseDefault = TRUE; } + | WARP_CENTERED string { if (Scr->FirstTime) { + if ((warpc = ParseWarpCentered($2)) != -1) + Scr->WarpCentered = warpc; + } + } + | USE_PPOSITION string { if (Scr->FirstTime) { + if ((ppos = ParseUsePPosition($2)) != -1) + Scr->UsePPosition = ppos; + } + } + | USE_PPOSITION { list = &Scr->UsePPositionL; } + ppos_list + | USE_PPOSITION string { if (Scr->FirstTime) { + if ((ppos = ParseUsePPosition($2)) != -1) + Scr->UsePPosition = ppos; + } + list = &Scr->UsePPositionL; + } + ppos_list + | MENU string LP string COLON string RP { + root = GetRoot($2, $4, $6); } + menu { root->real_menu = TRUE;} + | MENU string { root = GetRoot($2, NULLSTR, NULLSTR); } + menu { root->real_menu = TRUE; } + | FUNCTION string { root = GetRoot($2, NULLSTR, NULLSTR); } + function + | ICONS { list = &Scr->IconNames; } + icon_list + | SOUNDS + sound_list + | COLOR { color = COLOR; } + color_list + | SAVECOLOR + save_color_list + | MONOCHROME { color = MONOCHROME; } + color_list + | DEFAULT_FUNCTION action { Scr->DefaultFunction.func = $2; + if ($2 == F_MENU) + { + pull->prev = NULL; + Scr->DefaultFunction.menu = pull; + } + else + { + root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); + Scr->DefaultFunction.item = + AddToMenu(root,"x",Action, + NULLSTR,$2, NULLSTR, NULLSTR); + } + Action = ""; + pull = NULL; + } + | WINDOW_FUNCTION action { Scr->WindowFunction.func = $2; + root = GetRoot(TWM_ROOT,NULLSTR,NULLSTR); + Scr->WindowFunction.item = + AddToMenu(root,"x",Action, + NULLSTR,$2, NULLSTR, NULLSTR); + Action = ""; + pull = NULL; + } + | WARP_CURSOR { list = &Scr->WarpCursorL; } + win_list + | WARP_CURSOR { if (Scr->FirstTime) + Scr->WarpCursor = TRUE; } + | WINDOW_RING { list = &Scr->WindowRingL; } + win_list + | WINDOW_RING { if (Scr->FirstTime) + Scr->UseWindowRing = TRUE; } + | NO_WINDOW_RING { list = &Scr->NoWindowRingL; } + win_list + | NAILEDDOWN { list = &Scr->NailedDown; } + win_list + | VIRTUALDESKTOP string number + { SetVirtualDesktop($2, $3); } + | NO_SHOW_IN_DISPLAY { list = &Scr->DontShowInDisplay; } + win_list + | NO_SHOW_IN_TWMWINDOWS { list = &Scr->DontShowInTWMWindows; } + win_list + ; + + +noarg : KEYWORD { if (!do_single_keyword ($1)) { + twmrc_error_prefix(); + fprintf (stderr, + "unknown singleton keyword %d\n", + $1); + ParseError = 1; + } + } + ; + +sarg : SKEYWORD string { if (!do_string_keyword ($1, $2)) { + twmrc_error_prefix(); + fprintf (stderr, + "unknown string keyword %d (value \"%s\")\n", + $1, $2); + ParseError = 1; + } + } + ; + +narg : NKEYWORD number { if (!do_number_keyword ($1, $2)) { + twmrc_error_prefix(); + fprintf (stderr, + "unknown numeric keyword %d (value %d)\n", + $1, $2); + ParseError = 1; + } + } + ; + +/* djhjr - 10/18/02 */ +snarg : SNKEYWORD signed_number { if (!do_number_keyword ($1, $2)) { + twmrc_error_prefix(); + fprintf (stderr, + "unknown signed keyword %d (value %d)\n", + $1, $2); + ParseError = 1; + } + } + ; + + + +full : EQUALS keys COLON contexts COLON action { $$ = $6; } + ; + +fullkey : EQUALS keys COLON contextkeys COLON action { $$ = $6; } + ; + +keys : /* Empty */ + | keys key + ; + +key : META { mods |= Mod1Mask; } + | SHIFT { mods |= ShiftMask; } + | LOCK { mods |= LockMask; } + | CONTROL { mods |= ControlMask; } + | META number { if ($2 < 1 || $2 > 5) { + twmrc_error_prefix(); + fprintf (stderr, + "bad modifier number (%d), must be 1-5\n", + $2); + ParseError = 1; + } else { + mods |= (Mod1Mask << ($2 - 1)); + } + } + | OR { } + ; + +contexts : /* Empty */ + | contexts context + ; + +context : WINDOW { cont |= C_WINDOW_BIT; } + | TITLE { cont |= C_TITLE_BIT; } + | ICON { cont |= C_ICON_BIT; } + | ROOT { cont |= C_ROOT_BIT; } + | FRAME { cont |= C_FRAME_BIT; } + | ICONMGR { cont |= C_ICONMGR_BIT; } + | META { cont |= C_ICONMGR_BIT; } + | VIRTUAL { cont |= C_VIRTUAL_BIT; } + | VIRTUAL_WIN { cont |= C_VIRTUAL_WIN_BIT; } + | DOOR { cont |= C_DOOR_BIT; } + | ALL { cont |= C_ALL_BITS; } + | OR { } + ; + +contextkeys : /* Empty */ + | contextkeys contextkey + ; + +contextkey : WINDOW { cont |= C_WINDOW_BIT; } + | TITLE { cont |= C_TITLE_BIT; } + | ICON { cont |= C_ICON_BIT; } + | ROOT { cont |= C_ROOT_BIT; } + | FRAME { cont |= C_FRAME_BIT; } + | ICONMGR { cont |= C_ICONMGR_BIT; } + | META { cont |= C_ICONMGR_BIT; } + | VIRTUAL { cont |= C_VIRTUAL_BIT; } + | VIRTUAL_WIN { cont |= C_VIRTUAL_WIN_BIT; } + | DOOR { cont |= C_DOOR_BIT; } + | ALL { cont |= C_ALL_BITS; } + | OR { } + | string { Name = $1; cont |= C_NAME_BIT; } + ; + + +pixmap_list : LB pixmap_entries RB + ; + +pixmap_entries : /* Empty */ + | pixmap_entries pixmap_entry + ; + +pixmap_entry : TITLE_HILITE string { SetHighlightPixmap ($2); } + | VIRTUALMAP string { SetVirtualPixmap ($2); }/*RFB PIXMAP*/ + | REALSCREENMAP string { SetRealScreenPixmap ($2); }/*RFB PIXMAP*/ + | ICONMGRICONMAP string { SetIconMgrPixmap($2); } /* djhjr - 10/30/02 */ + | MENUICONMAP string { SetMenuIconPixmap($2); } /* djhjr - 10/30/02 */ + ; + + +cursor_list : LB cursor_entries RB + ; + +cursor_entries : /* Empty */ + | cursor_entries cursor_entry + ; + +cursor_entry : FRAME string string { + NewBitmapCursor(&Scr->FrameCursor, $2, $3); } + | FRAME string { + NewFontCursor(&Scr->FrameCursor, $2); } + | TITLE string string { + NewBitmapCursor(&Scr->TitleCursor, $2, $3); } + | TITLE string { + NewFontCursor(&Scr->TitleCursor, $2); } + | ICON string string { + NewBitmapCursor(&Scr->IconCursor, $2, $3); } + | ICON string { + NewFontCursor(&Scr->IconCursor, $2); } + | ICONMGR string string { + NewBitmapCursor(&Scr->IconMgrCursor, $2, $3); } + | ICONMGR string { + NewFontCursor(&Scr->IconMgrCursor, $2); } + | BUTTON string string { + NewBitmapCursor(&Scr->ButtonCursor, $2, $3); } + | BUTTON string { + NewFontCursor(&Scr->ButtonCursor, $2); } + | MOVE string string { + NewBitmapCursor(&Scr->MoveCursor, $2, $3); } + | MOVE string { + NewFontCursor(&Scr->MoveCursor, $2); } + | RESIZE string string { + NewBitmapCursor(&Scr->ResizeCursor, $2, $3); } + | RESIZE string { + NewFontCursor(&Scr->ResizeCursor, $2); } + | WAIT string string { + NewBitmapCursor(&Scr->WaitCursor, $2, $3); } + | WAIT string { + NewFontCursor(&Scr->WaitCursor, $2); } + | MENU string string { + NewBitmapCursor(&Scr->MenuCursor, $2, $3); } + | MENU string { + NewFontCursor(&Scr->MenuCursor, $2); } + | SELECT string string { + NewBitmapCursor(&Scr->SelectCursor, $2, $3); } + | SELECT string { + NewFontCursor(&Scr->SelectCursor, $2); } + | KILL string string { + NewBitmapCursor(&Scr->DestroyCursor, $2, $3); } + | KILL string { + NewFontCursor(&Scr->DestroyCursor, $2); } + | DOOR string string {/*RFBCURSOR*/ + NewBitmapCursor(&Scr->DoorCursor, $2, $3); }/*RFBCURSOR*/ + | DOOR string {/*RFBCURSOR*/ + NewFontCursor(&Scr->DoorCursor, $2); }/*RFBCURSOR*/ + | VIRTUAL string string {/*RFBCURSOR*/ + NewBitmapCursor(&Scr->VirtualCursor, $2, $3); }/*RFBCURSOR*/ + | VIRTUAL string {/*RFBCURSOR*/ + NewFontCursor(&Scr->VirtualCursor, $2); }/*RFBCURSOR*/ + | VIRTUAL_WIN string string {/*RFBCURSOR*/ + NewBitmapCursor(&Scr->DesktopCursor, $2, $3); }/*RFBCURSOR*/ + | VIRTUAL_WIN string {/*RFBCURSOR*/ + NewFontCursor(&Scr->DesktopCursor, $2); }/*RFBCURSOR*/ + ; + +color_list : LB color_entries RB + ; + + +color_entries : /* Empty */ + | color_entries color_entry + ; + +color_entry : CLKEYWORD string { if (!do_colorlist_keyword ($1, color, + $2)) { + twmrc_error_prefix(); + fprintf (stderr, + "unhandled list color keyword %d (string \"%s\")\n", + $1, $2); + ParseError = 1; + } + } + | CLKEYWORD string { list = do_colorlist_keyword($1,color, + $2); + if (!list) { + twmrc_error_prefix(); + fprintf (stderr, + "unhandled color list keyword %d (string \"%s\")\n", + $1, $2); + ParseError = 1; + } + } + win_color_list + | CKEYWORD string { if (!do_color_keyword ($1, color, + $2)) { + twmrc_error_prefix(); + fprintf (stderr, + "unhandled color keyword %d (string \"%s\")\n", + $1, $2); + ParseError = 1; + } + } + ; + +save_color_list : LB s_color_entries RB + ; + +s_color_entries : /* Empty */ + | s_color_entries s_color_entry + ; + +s_color_entry : string { do_string_savecolor(color, $1); } + | CLKEYWORD { do_var_savecolor($1); } + ; + +win_color_list : LB win_color_entries RB + ; + +win_color_entries : /* Empty */ + | win_color_entries win_color_entry + ; + +/* 'matcher', mods to 'AddToList()' - djhjr - 10/20/01 */ +win_color_entry : matcher string { if (Scr->FirstTime && + color == Scr->Monochrome) + AddToList(list, $1.lval, $1.ltype, + $2); } + ; + +squeeze : SQUEEZE_TITLE { + if (HasShape) Scr->SqueezeTitle = TRUE; + } + | SQUEEZE_TITLE { list = &Scr->SqueezeTitleL; + if (HasShape && Scr->SqueezeTitle == -1) + Scr->SqueezeTitle = TRUE; + } + LB win_sqz_entries RB + | DONT_SQUEEZE_TITLE { Scr->SqueezeTitle = FALSE; } + | DONT_SQUEEZE_TITLE { list = &Scr->DontSqueezeTitleL; } + win_list + ; + +/* 'matcher', mods to 'do_sqeeze_entry()' - djhjr - 10/20/01 */ +win_sqz_entries : /* Empty */ + | win_sqz_entries matcher JKEYWORD signed_number signed_number { + if (Scr->FirstTime) { + do_squeeze_entry (list, $2.lval, $2.ltype, + $3, $4, $5); + } + } + ; + +doors : DOORS LB door_list RB + ; + +door_list : /* Empty */ + | door_list door_entry + ; + +door_entry : string string string + { + (void) door_add($1, $2, $3); + } + ; + +iconm_list : LB iconm_entries RB + ; + +iconm_entries : /* Empty */ + | iconm_entries iconm_entry + ; + +/* 'matcher', mods to 'AddToList()', 'AllocateIconManager()' - djhjr - 10/20/01 */ +iconm_entry : matcher string number { if (Scr->FirstTime) + AddToList(list, $1.lval, $1.ltype, (char *) + AllocateIconManager($1.lval, + NULLSTR, $2, $3)); + } + | matcher string string number + { if (Scr->FirstTime) + AddToList(list, $1.lval, $1.ltype, (char *) + AllocateIconManager($1.lval, + $2, $3, $4)); + } + ; + +win_list : LB win_entries RB + ; + +win_entries : /* Empty */ + | win_entries win_entry + ; + +/* 'matcher', mods to 'AddToList()' - djhjr - 10/20/01 */ +win_entry : matcher { if (Scr->FirstTime) + AddToList(list, $1.lval, $1.ltype, 0); + } + ; + +icon_list : LB icon_entries RB + ; + +icon_entries : /* Empty */ + | icon_entries icon_entry + ; + +/* 'matcher', mods to 'AddToList()' - djhjr - 10/20/01 */ +icon_entry : matcher string { if (Scr->FirstTime) + AddToList(list, $1.lval, $1.ltype, $2); + } + ; + +/* djhjr - 9/24/02 */ +ppos_list : LB ppos_entries RB + ; + +ppos_entries : /* Empty */ + | ppos_entries ppos_entry + ; + +/* 'matcher', mods to 'AddToList()' - djhjr - 10/20/01 */ +ppos_entry : matcher string { if (Scr->FirstTime) { + if ((ppos = ParseUsePPosition($2)) != -1) + AddToList(list, $1.lval, $1.ltype, (char *)&ppos); + } + } + ; + +/* djhjr - 6/22/01 */ +sound_list : LB sound_entries RB + ; + +/* djhjr - 6/22/01 */ +sound_entries : /* Empty */ + | sound_entries sound_entry + ; + +/* djhjr - 8/16/01 */ +sound_entry : string string { if (Scr->FirstTime) SetSound($1, $2, -1); } + | string string number { if (Scr->FirstTime) SetSound($1, $2, $3); } + ; + +/* djhjr - 4/26/99 */ +applet_list : LB applet_entries RB + ; + +/* djhjr - 4/26/99 */ +applet_entries : /* Empty */ + | applet_entries applet_entry + ; + +/* djhjr - 4/26/99 */ +/* 'matcher', mods to 'AddToAppletList()' - djhjr - 10/20/01 */ +applet_entry : matcher { if (Scr->FirstTime) + AddToAppletList(ARlist, + $1.lval, $1.ltype); + } + ; + +function : LB function_entries RB + ; + +function_entries: /* Empty */ + | function_entries function_entry + ; + +function_entry : action { AddToMenu(root, "", Action, NULLSTR, $1, + NULLSTR, NULLSTR); + Action = ""; + } + ; + +/* djhjr - 4/30/96 +menu : LB menu_entries RB +*/ +menu : LB menu_entries RB {lastmenuitem = (MenuItem*) 0;} + ; + +menu_entries : /* Empty */ + | menu_entries menu_entry + ; + +/* djhjr - 4/30/96 +menu_entry : string action { AddToMenu(root, $1, Action, pull, $2, + NULLSTR, NULLSTR); + Action = ""; + pull = NULL; + } + | string LP string COLON string RP action { + AddToMenu(root, $1, Action, pull, $7, + $3, $5); + Action = ""; + pull = NULL; + } + ; +*/ +menu_entry : string action { + if ($2 == F_SEPARATOR) { + if (lastmenuitem) lastmenuitem->separated = 1; + } + else { + lastmenuitem = AddToMenu(root, $1, Action, pull, $2, NULLSTR, NULLSTR); + Action = ""; + pull = NULL; + } + } + | string LP string COLON string RP action { + if ($7 == F_SEPARATOR) { + if (lastmenuitem) lastmenuitem->separated = 1; + } + else { + lastmenuitem = AddToMenu(root, $1, Action, pull, $7, $3, $5); + Action = ""; + pull = NULL; + } + } + ; + +action : FKEYWORD { $$ = $1; } + | FSKEYWORD string { + $$ = $1; + Action = $2; + switch ($1) { + case F_MENU: + pull = GetRoot ($2, NULLSTR,NULLSTR); + pull->prev = root; + break; + case F_WARPRING: + if (!CheckWarpRingArg (Action)) { + twmrc_error_prefix(); + fprintf (stderr, + "ignoring invalid f.warptoring argument \"%s\"\n", + Action); + $$ = F_NOP; + } + case F_WARPTOSCREEN: + if (!CheckWarpScreenArg (Action)) { + twmrc_error_prefix(); + fprintf (stderr, + "ignoring invalid f.warptoscreen argument \"%s\"\n", + Action); + $$ = F_NOP; + } + break; + case F_COLORMAP: + if (CheckColormapArg (Action)) { + $$ = F_COLORMAP; + } else { + twmrc_error_prefix(); + fprintf (stderr, + "ignoring invalid f.colormap argument \"%s\"\n", + Action); + $$ = F_NOP; + } + break; + } /* end switch */ + } + ; + + +button : BUTTON number { $$ = $2; + if ($2 == 0) + yyerror("bad button 0"); + + if ($2 > MAX_BUTTONS) + { + $$ = 0; + yyerror("button number too large"); + } + } + ; + +/* djhjr - 10/20/01 */ +matcher : string { $$.ltype = LTYPE_ANY_STRING; + $$.lval = $1; + } + | regexp { $$.ltype = LTYPE_ANY_REGEXP; + $$.lval = $1; + } + | MKEYWORD EQUALS string { $$.ltype = $1 | LTYPE_STRING; + $$.lval = $3; + } + | MKEYWORD TILDE regexp { $$.ltype = $1 | LTYPE_REGEXP; + $$.lval = $3; + } + ; + +string : STRING { $$ = RemoveDQuote($1); } + ; + +/* djhjr - 10/20/01 */ +regexp : REGEXP { $$ = RemoveRESlash($1); } + ; + +signed_number : number { $$ = $1; } + | PLUS number { $$ = $2; } + | MINUS number { $$ = -($2); } + ; + +number : NUMBER { $$ = $1; } + ; + +%% +static void +yyerror(s) char *s; +{ + twmrc_error_prefix(); + fprintf (stderr, "error in input file: %s\n", s ? s : ""); + ParseError = 1; +} + +/* do manipulations in place, then copy it - djhjr - 10/20/01 */ +static char *RemoveDQuote(str) +char *str; +{ + register char *i, *o; + register int n, count; + int length = 0; + char *ptr = ""; + + for (i = str + 1, o = str; *i && *i != '\"'; o++) + { + if (*i == '\\') + { + switch (*++i) + { + case 'n': + *o = '\n'; + i++; + break; + case 'b': + *o = '\b'; + i++; + break; + case 'r': + *o = '\r'; + i++; + break; + case 't': + *o = '\t'; + i++; + break; + case 'f': + *o = '\f'; + i++; + break; + case '0': + if (*++i == 'x') + goto hex; + else + --i; + case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + n = 0; + count = 0; + while (*i >= '0' && *i <= '7' && count < 3) + { + n = (n << 3) + (*i++ - '0'); + count++; + } + *o = n; + break; + hex: + case 'x': + n = 0; + count = 0; + while (i++, count++ < 2) + { + if (*i >= '0' && *i <= '9') + n = (n << 4) + (*i - '0'); + else if (*i >= 'a' && *i <= 'f') + n = (n << 4) + (*i - 'a') + 10; + else if (*i >= 'A' && *i <= 'F') + n = (n << 4) + (*i - 'A') + 10; + else + { + length--; /* account for length++ at loop end */ + break; + } + } + *o = n; + break; + case '\n': + i++; /* punt */ + o--; /* to account for o++ at end of loop */ + length--; /* account for length++ at loop end */ + break; + case '\"': + case '\'': + case '\\': + default: + *o = *i++; + break; + } + } + else + *o = *i++; + + length++; + } + *o = '\0'; + + if (length > 0) + { + ptr = (char *)malloc(length + 1); + memcpy(ptr, str, length); + ptr[length] = '\0'; + +#ifdef DEBUG + fprintf(stderr, "RemoveDQuote(): '"); + for (n = 0; n < length; n++) + fprintf(stderr, "%c", ptr[n]); + fprintf(stderr, "'\n", ptr); +#endif + } + + return (ptr); +} + +/* djhjr - 10/20/01 */ +static char *RemoveRESlash(str) +char *str; +{ + char *ptr = ""; +#ifndef NO_REGEX_SUPPORT + int length = strlen(str); + + if (length > 2) + { + ptr = (char *)malloc(length - 1); + memcpy(ptr, str + 1, length - 2); + ptr[length - 2] = '\0'; + +#ifdef DEBUG + fprintf(stderr, "RemoveRESlash(): '%s'\n", ptr); +#endif + } +#else + twmrc_error_prefix(); + fprintf(stderr, "no regex support for %s\n", str); + ParseError = 1; +#endif + + return (ptr); +} + +/* was in parse.c - djhjr - 9/24/02 */ +static int ParseUsePPosition(s) +char *s; +{ + XmuCopyISOLatin1Lowered (s, s); + + if (strcmp(s, "off") == 0) + return PPOS_OFF; + else if (strcmp(s, "on") == 0) + return PPOS_ON; + else if (strcmp(s, "non-zero") == 0 || strcmp(s, "nonzero") == 0) + return PPOS_NON_ZERO; + + twmrc_error_prefix(); + fprintf(stderr, "ignoring invalid UsePPosition argument \"%s\"\n", s); + return -1; +} + +/* djhjr - 10/16/02 */ +static int ParseWarpCentered(s) +char *s; +{ + XmuCopyISOLatin1Lowered (s, s); + + if (strcmp(s, "off") == 0) + return WARPC_OFF; + else if (strcmp(s, "on") == 0) + return WARPC_ON; + else if (strcmp(s, "titled") == 0) + return WARPC_TITLED; + else if (strcmp(s, "untitled") == 0) + return WARPC_UNTITLED; + + twmrc_error_prefix(); + fprintf(stderr, "ignoring invalid WarpCentered argument \"%s\"\n", s); + return -1; +} + +static MenuRoot *GetRoot(name, fore, back) +char *name; +char *fore, *back; +{ + MenuRoot *tmp; + + tmp = FindMenuRoot(name); + if (tmp == NULL) + tmp = NewMenuRoot(name); + + if (fore) + { + int save; + + save = Scr->FirstTime; + Scr->FirstTime = TRUE; + +/* djhjr - 4/22/96 + GetColor(COLOR, &tmp->hi_fore, fore); + GetColor(COLOR, &tmp->hi_back, back); +*/ + GetColor(COLOR, &tmp->highlight.fore, fore); + GetColor(COLOR, &tmp->highlight.back, back); + + Scr->FirstTime = save; + } + + return tmp; +} + +static void GotButton(butt, func) +int butt, func; +{ + int i; + + for (i = 0; i < NUM_CONTEXTS; i++) + { + if ((cont & (1 << i)) == 0) + continue; + + Scr->Mouse[butt][i][mods].func = func; + + if (func == F_MENU) + { + pull->prev = NULL; + + Scr->Mouse[butt][i][mods].menu = pull; + } + else + { + root = GetRoot(TWM_ROOT, NULLSTR, NULLSTR); + + Scr->Mouse[butt][i][mods].item = AddToMenu(root,"x",Action, + NULLSTR, func, NULLSTR, NULLSTR); + + } + } + Action = ""; + pull = NULL; + cont = 0; + mods_used |= mods; + mods = 0; +} + +static void GotKey(key, func) +char *key; +int func; +{ + int i; + + for (i = 0; i < NUM_CONTEXTS; i++) + { + if ((cont & (1 << i)) == 0) + continue; + if (!AddFuncKey(key, i, mods, func, Name, Action)) + break; + } + + Action = ""; + pull = NULL; + cont = 0; + mods_used |= mods; + mods = 0; +} + + +static void GotTitleButton (bitmapname, func, rightside) + char *bitmapname; + int func; + Bool rightside; +{ + if (!CreateTitleButton (bitmapname, func, Action, pull, rightside, True)) { + twmrc_error_prefix(); + fprintf (stderr, + "unable to create %s titlebutton \"%s\"\n", + rightside ? "right" : "left", bitmapname); + } + Action = ""; + pull = NULL; +} + +static Bool CheckWarpScreenArg (s) + register char *s; +{ + XmuCopyISOLatin1Lowered (s, s); + + if (strcmp (s, WARPSCREEN_NEXT) == 0 || + strcmp (s, WARPSCREEN_PREV) == 0 || + strcmp (s, WARPSCREEN_BACK) == 0) + return True; + + for (; *s && isascii(*s) && isdigit(*s); s++) ; /* SUPPRESS 530 */ + return (*s ? False : True); +} + + +static Bool CheckWarpRingArg (s) + register char *s; +{ + XmuCopyISOLatin1Lowered (s, s); + + if (strcmp (s, WARPSCREEN_NEXT) == 0 || + strcmp (s, WARPSCREEN_PREV) == 0) + return True; + + return False; +} + + +static Bool CheckColormapArg (s) + register char *s; +{ + XmuCopyISOLatin1Lowered (s, s); + + if (strcmp (s, COLORMAP_NEXT) == 0 || + strcmp (s, COLORMAP_PREV) == 0 || + strcmp (s, COLORMAP_DEFAULT) == 0) + return True; + + return False; +} + + +void twmrc_error_prefix () +{ + fprintf (stderr, "%s: line %d: ", ProgramName, yylineno); +} diff --git a/iconmgr.c b/iconmgr.c new file mode 100644 index 0000000..55f1abb --- /dev/null +++ b/iconmgr.c @@ -0,0 +1,1098 @@ +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/*********************************************************************** + * + * $XConsortium: iconmgr.c,v 1.48 91/09/10 15:27:07 dave Exp $ + * + * Icon Manager routines + * + * 09-Mar-89 Tom LaStrange File Created + * + ***********************************************************************/ + +#include +#include "twm.h" +#include "util.h" +#include "menus.h" +#include "desktop.h" +#include "parse.h" +#include "screen.h" +#include "resize.h" +#include "add_window.h" +#include +#include + +#ifdef macII +int strcmp(); /* missing from string.h in AUX 2.0 */ +#endif + +#define strdup Strdup /* avoid conflict with system header files */ +extern char *strdup(char *); + +/* djhjr - 5/2/98 */ +static int ComputeIconMgrWindowHeight(); + +/* see AddIconManager() - djhjr - 5/5/98 +int iconmgr_textx = siconify_width+11; +*/ +int iconmgr_iconx = 0, iconmgr_textx = 0; + +WList *Active = NULL; +WList *DownIconManager = NULL; + +/* was an external file - djhjr - 10/30/02 */ +#define siconify_width 11 +#define siconify_height 11 +/* +static unsigned char siconify_bits[] = { + 0xff, 0x07, 0x01, 0x04, 0x0d, 0x05, 0x9d, 0x05, 0xb9, 0x04, 0x51, 0x04, + 0xe9, 0x04, 0xcd, 0x05, 0x85, 0x05, 0x01, 0x04, 0xff, 0x07}; +*/ + +int iconifybox_width = siconify_width; +int iconifybox_height = siconify_height; + +/* djhjr - 10/30/02 */ +void SetIconMgrPixmap(filename) +char *filename; +{ + Scr->iconMgrIconName = filename; +} + +/*********************************************************************** + * + * Procedure: + * CreateIconManagers - creat all the icon manager windows + * for this screen. + * + * Returned Value: + * none + * + * Inputs: + * none + * + *********************************************************************** + */ + +struct Colori { + Pixel color; + Pixmap pix; + struct Colori *next; +}; + +#if 0 +Pixmap Create3DIconManagerIcon (cp) +ColorPair cp; +{ + unsigned int w, h; + struct Colori *col; + static struct Colori *colori = NULL; + + w = (unsigned int) siconify_width; + h = (unsigned int) siconify_height; + + for (col = colori; col; col = col->next) { + if (col->color == cp.back) break; + } + if (col != NULL) return (col->pix); + col = (struct Colori*) malloc (sizeof (struct Colori)); + col->color = cp.back; + col->pix = XCreatePixmap (dpy, Scr->Root, w, h, Scr->d_depth); +#ifdef ORIGINAL_ICONMGRPIXMAP + Draw3DBorder (col->pix, 0, 0, w, h, 4, cp, off, True, False); +#else + Draw3DBorder (col->pix, 0, 0, w, h, 1, cp, off, True, False); +#ifdef DO_DOT + Draw3DBorder (col->pix, (w / 2) - 1, (h / 2) - 1, 3, 3, 1, cp, off, True, False); +#endif +#endif + col->next = colori; + colori = col; + + return (colori->pix); +} +#endif + +void CreateIconManagers() +{ + XClassHint *class; /* djhjr - 2/28/99 */ + IconMgr *p; + int mask; + char str[100]; + char str1[100]; + Pixel background; + char *icon_name; + + if (Scr->NoIconManagers) + return; + +/* djhjr - 10/30/02 + if (Scr->siconifyPm == None) + { + Scr->siconifyPm->pixmap = XCreatePixmapFromBitmapData(dpy, Scr->Root, + (char *)siconify_bits, siconify_width, siconify_height, 1, 0, 1); + } +*/ + + for (p = &Scr->iconmgr; p != NULL; p = p->next) + { + mask = XParseGeometry(p->geometry, &JunkX, &JunkY, + (unsigned int *) &p->width, (unsigned int *)&p->height); + + /* djhjr - 3/1/99 */ + if (p->width > Scr->MyDisplayWidth) p->width = Scr->MyDisplayWidth; + + if (mask & XNegative) +/* djhjr - 4/19/96 + JunkX = Scr->MyDisplayWidth - p->width - + (2 * Scr->BorderWidth) + JunkX; +*/ +/* djhjr - 8/11/98 + JunkX += Scr->MyDisplayWidth - p->width - + (2 * (Scr->ThreeDBorderWidth ? Scr->ThreeDBorderWidth : Scr->BorderWidth)); +*/ + JunkX += Scr->MyDisplayWidth - p->width - + (2 * Scr->BorderWidth); + + if (mask & YNegative) +/* djhjr - 4/19/96 + JunkY = Scr->MyDisplayHeight - p->height - + (2 * Scr->BorderWidth) + JunkY; +*/ +/* djhjr - 8/11/98 + JunkY += Scr->MyDisplayHeight - p->height - + (2 * (Scr->ThreeDBorderWidth ? Scr->ThreeDBorderWidth : Scr->BorderWidth)); +*/ + JunkY += Scr->MyDisplayHeight - p->height - + (2 * Scr->BorderWidth); + + /* djhjr - 9/10/98 */ + if (p->width < 1) p->width = 1; + if (p->height < 1) p->height = 1; + + background = Scr->IconManagerC.back; + GetColorFromList(Scr->IconManagerBL, p->name, (XClassHint *)NULL, + &background); + + p->w = XCreateSimpleWindow(dpy, Scr->Root, + JunkX, JunkY, p->width, p->height, + + 0, /* was '1' - submitted by Rolf Neugebauer */ + + Scr->Black, background); + + sprintf(str, "%s Icon Manager", p->name); + sprintf(str1, "%s Icons", p->name); + if (p->icon_name) + icon_name = p->icon_name; + else + icon_name = str1; + + /* djhjr - 5/19/98 */ + /* was setting for the TwmWindow after AddWindow() - djhjr - 2/28/99 */ + class = XAllocClassHint(); + class->res_name = strdup(str); + class->res_class = strdup(VTWM_ICONMGR_CLASS); + XSetClassHint(dpy, p->w, class); + + XSetStandardProperties(dpy, p->w, str, icon_name, None, NULL, 0, NULL); + + p->twm_win = AddWindow(p->w, TRUE, p); + + SetMapStateProp (p->twm_win, WithdrawnState); + } + for (p = &Scr->iconmgr; p != NULL; p = p->next) + { + GrabButtons(p->twm_win); + GrabKeys(p->twm_win); + } +} + +/*********************************************************************** + * + * Procedure: + * AllocateIconManager - allocate a new icon manager + * + * Inputs: + * name - the name of this icon manager + * icon_name - the name of the associated icon + * geom - a geometry string to eventually parse + * columns - the number of columns this icon manager has + * + *********************************************************************** + */ + +IconMgr *AllocateIconManager(name, icon_name, geom, columns) + char *name; + char *geom; + char *icon_name; + int columns; +{ + IconMgr *p; + +#ifdef DEBUG_ICONMGR + fprintf(stderr, "AllocateIconManager\n"); + fprintf(stderr, " name=\"%s\" icon_name=\"%s\", geom=\"%s\", col=%d\n", + name, icon_name, geom, columns); +#endif + + if (Scr->NoIconManagers) + return NULL; + + p = (IconMgr *)malloc(sizeof(IconMgr)); + p->name = name; + p->icon_name = icon_name; + p->geometry = geom; + p->columns = columns; + p->first = NULL; + p->last = NULL; + p->active = NULL; + p->scr = Scr; + p->count = 0; + p->x = 0; + p->y = 0; + p->width = 150; + p->height = 10; + + Scr->iconmgr.lasti->next = p; + p->prev = Scr->iconmgr.lasti; + Scr->iconmgr.lasti = p; + p->next = NULL; + + return(p); +} + +/*********************************************************************** + * + * Procedure: + * MoveIconManager - move the pointer around in an icon manager + * + * Inputs: + * dir - one of the following: + * F_FORWICONMGR - forward in the window list + * F_BACKICONMGR - backward in the window list + * F_UPICONMGR - up one row + * F_DOWNICONMGR - down one row + * F_LEFTICONMGR - left one column + * F_RIGHTICONMGR - right one column + * + * Special Considerations: + * none + * + *********************************************************************** + */ + +void MoveIconManager(dir) + int dir; +{ + IconMgr *ip; + WList *tmp = NULL; + int cur_row, cur_col, new_row, new_col; + int row_inc, col_inc; + int got_it; + + if (!Active) return; + + cur_row = Active->row; + cur_col = Active->col; + ip = Active->iconmgr; + + row_inc = 0; + col_inc = 0; + got_it = FALSE; + + switch (dir) + { + case F_FORWICONMGR: + if ((tmp = Active->next) == NULL) + tmp = ip->first; + got_it = TRUE; + break; + + case F_BACKICONMGR: + if ((tmp = Active->prev) == NULL) + tmp = ip->last; + got_it = TRUE; + break; + + case F_UPICONMGR: + row_inc = -1; + break; + + case F_DOWNICONMGR: + row_inc = 1; + break; + + case F_LEFTICONMGR: + col_inc = -1; + break; + + case F_RIGHTICONMGR: + col_inc = 1; + break; + } + + /* If got_it is FALSE ast this point then we got a left, right, + * up, or down, command. We will enter this loop until we find + * a window to warp to. + */ + new_row = cur_row; + new_col = cur_col; + + while (!got_it) + { + new_row += row_inc; + new_col += col_inc; + if (new_row < 0) + new_row = ip->cur_rows - 1; + if (new_col < 0) + new_col = ip->cur_columns - 1; + if (new_row >= ip->cur_rows) + new_row = 0; + if (new_col >= ip->cur_columns) + new_col = 0; + + /* Now let's go through the list to see if there is an entry with this + * new position + */ + for (tmp = ip->first; tmp != NULL; tmp = tmp->next) + { + if (tmp->row == new_row && tmp->col == new_col) + { + got_it = TRUE; + break; + } + } + } + + if (!got_it) + { + fprintf (stderr, + "%s: unable to find window (%d, %d) in icon manager\n", + ProgramName, new_row, new_col); + return; + } + + if (tmp == NULL) + return; + + /* raise the frame so the icon manager is visible */ + if (ip->twm_win->mapped) { + XRaiseWindow(dpy, ip->twm_win->frame); + +/* djhjr - 5/30/00 + RaiseStickyAbove(); + RaiseAutoPan(); + + XWarpPointer(dpy, None, tmp->icon, 0,0,0,0, 5, 5); +*/ + WarpInIconMgr(tmp, ip->twm_win); + } else { +/* djhjr - 5/30/00 + if (tmp->twm->title_height) { + int tbx = Scr->TBInfo.titlex; + int x = tmp->twm->highlightx; + XWarpPointer (dpy, None, tmp->twm->title_w, 0, 0, 0, 0, + tbx + (x - tbx) / 2, + Scr->TitleHeight / 4); + } else { + XWarpPointer (dpy, None, tmp->twm->w, 0, 0, 0, 0, 5, 5); + } +*/ + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + WarpToWindow(tmp->twm); + } +} + +/*********************************************************************** + * + * Procedure: + * JumpIconManager - jump from one icon manager to another, + * possibly even on another screen + * + * Inputs: + * dir - one of the following: + * F_NEXTICONMGR - go to the next icon manager + * F_PREVICONMGR - go to the previous one + * + *********************************************************************** + */ + +void JumpIconManager(dir) + register int dir; +{ + IconMgr *ip, *tmp_ip = NULL; + int got_it = FALSE; + ScreenInfo *sp; + int screen; + + if (!Active) return; + + +#define ITER(i) (dir == F_NEXTICONMGR ? (i)->next : (i)->prev) +#define IPOFSP(sp) (dir == F_NEXTICONMGR ? &(sp->iconmgr) : sp->iconmgr.lasti) +#define TEST(ip) if ((ip)->count != 0 && (ip)->twm_win->mapped) \ + { got_it = TRUE; break; } + + ip = Active->iconmgr; + for (tmp_ip = ITER(ip); tmp_ip; tmp_ip = ITER(tmp_ip)) { + TEST (tmp_ip); + } + + if (!got_it) { + int origscreen = ip->scr->screen; + int inc = (dir == F_NEXTICONMGR ? 1 : -1); + + for (screen = origscreen + inc; ; screen += inc) { + if (screen >= NumScreens) + screen = 0; + else if (screen < 0) + screen = NumScreens - 1; + + sp = ScreenList[screen]; + if (sp) { + for (tmp_ip = IPOFSP (sp); tmp_ip; tmp_ip = ITER(tmp_ip)) { + TEST (tmp_ip); + } + } + if (got_it || screen == origscreen) break; + } + } + +#undef ITER +#undef IPOFSP +#undef TEST + + if (!got_it) { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + return; + } + + /* raise the frame so it is visible */ + XRaiseWindow(dpy, tmp_ip->twm_win->frame); + +/* djhjr - 5/30/00 + RaiseStickyAbove(); * DSE * + RaiseAutoPan(); +*/ + + if (tmp_ip->active) +/* djhjr - 5/30/00 + XWarpPointer(dpy, None, tmp_ip->active->icon, 0,0,0,0, 5, 5); +*/ + WarpInIconMgr(tmp_ip->active, tmp_ip->twm_win); + else +/* djhjr - 5/30/00 + XWarpPointer(dpy, None, tmp_ip->w, 0,0,0,0, 5, 5); +*/ + { + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + WarpToWindow(tmp_ip->twm_win); + } +} + +/*********************************************************************** + * + * Procedure: + * AddIconManager - add a window to an icon manager + * + * Inputs: + * tmp_win - the TwmWindow structure + * + *********************************************************************** + */ + +WList *AddIconManager(tmp_win) + TwmWindow *tmp_win; +{ + WList *tmp; + int h; + unsigned long valuemask; /* mask for create windows */ + XSetWindowAttributes attributes; /* attributes for create windows */ + IconMgr *ip; + + tmp_win->list = NULL; + + /* djhjr - 10/2/01 */ + if (Scr->StrictIconManager) + { + if (tmp_win->icon || (!tmp_win->iconified && + (tmp_win->wmhints && + (tmp_win->wmhints->flags & StateHint) && + tmp_win->wmhints->initial_state == IconicState))) + ; + else + return NULL; + } + + if (tmp_win->iconmgr || tmp_win->transient || Scr->NoIconManagers) + return NULL; + + if (LookInList(Scr->IconMgrNoShow, tmp_win->full_name, &tmp_win->class)) + return NULL; + if (Scr->IconManagerDontShow && + !LookInList(Scr->IconMgrShow, tmp_win->full_name, &tmp_win->class)) + return NULL; + if ((ip = (IconMgr *)LookInList(Scr->IconMgrs, tmp_win->full_name, + &tmp_win->class)) == NULL) + ip = &Scr->iconmgr; + + tmp = (WList *) malloc(sizeof(WList)); + tmp->iconmgr = ip; + tmp->next = NULL; + tmp->active = FALSE; + tmp->down = FALSE; + + InsertInIconManager(ip, tmp, tmp_win); + + tmp->twm = tmp_win; + +/* djhjr - 4/19/96 + tmp->fore = Scr->IconManagerC.fore; + tmp->back = Scr->IconManagerC.back; +*/ + tmp->cp.fore = Scr->IconManagerC.fore; + tmp->cp.back = Scr->IconManagerC.back; + + tmp->highlight = Scr->IconManagerHighlight; + +/* djhjr - 4/19/96 + GetColorFromList(Scr->IconManagerFL, tmp_win->full_name, &tmp_win->class, + &tmp->fore); + GetColorFromList(Scr->IconManagerBL, tmp_win->full_name, &tmp_win->class, + &tmp->back); +*/ + GetColorFromList(Scr->IconManagerFL, tmp_win->full_name, &tmp_win->class, + &tmp->cp.fore); + GetColorFromList(Scr->IconManagerBL, tmp_win->full_name, &tmp_win->class, + &tmp->cp.back); + + GetColorFromList(Scr->IconManagerHighlightL, tmp_win->full_name, + &tmp_win->class, &tmp->highlight); + + /* djhjr - 4/19/96 */ + /* was 'Scr->use3Diconmanagers' - djhjr - 8/11/98 */ +/* djhjr - 10/30/02 + if (Scr->IconMgrBevelWidth > 0) +*/ + { + if (!Scr->BeNiceToColormap) GetShadeColors (&tmp->cp); +/* djhjr - 10/30/02 + tmp->iconifypm = Create3DIconManagerIcon (tmp->cp); +*/ + tmp->iconifypm = GetImage(Scr->iconMgrIconName, + iconifybox_width, iconifybox_height, + 0, tmp->cp); + } + + /* djhjr - 5/2/98 */ + h = ComputeIconMgrWindowHeight(); + + ip->height = h * ip->count; + tmp->me = ip->count; + tmp->x = -1; + tmp->y = -1; + + valuemask = (CWBackPixel | CWBorderPixel | CWEventMask | CWCursor); + +/* djhjr - 4/19/96 + attributes.background_pixel = tmp->back; + attributes.border_pixel = tmp->back; +*/ + attributes.background_pixel = tmp->cp.back; + attributes.border_pixel = tmp->cp.back; + + attributes.event_mask = (KeyPressMask | ButtonPressMask | + ButtonReleaseMask | ExposureMask | + EnterWindowMask | LeaveWindowMask); + attributes.cursor = Scr->IconMgrCursor; + + /* djhjr - 9/17/96 */ + if (Scr->BackingStore) + { + attributes.backing_store = WhenMapped; + valuemask |= CWBackingStore; + } + + tmp->w = XCreateWindow (dpy, ip->w, 0, 0, (unsigned int) 1, + (unsigned int) h, (unsigned int) 0, + CopyFromParent, (unsigned int) CopyFromParent, + (Visual *) CopyFromParent, valuemask, &attributes); + + + valuemask = (CWBackPixel | CWBorderPixel | CWEventMask | CWCursor); + +/* djhjr - 4/19/96 + attributes.background_pixel = tmp->back; +*/ + attributes.background_pixel = tmp->cp.back; + + attributes.border_pixel = Scr->Black; + attributes.event_mask = (ButtonReleaseMask| ButtonPressMask | + ExposureMask); + attributes.cursor = Scr->ButtonCursor; + + /* djhjr - 5/5/98 */ + if (!iconmgr_iconx) + { + /* was 'Scr->use3Diconmanagers' - djhjr - 8/11/98 */ + if (Scr->IconMgrBevelWidth > 0) + iconmgr_iconx = Scr->IconMgrBevelWidth + 5; + else + iconmgr_iconx = Scr->BorderWidth + 5; + iconmgr_textx = iconmgr_iconx + siconify_width + 5; + } + + /* 'iconmgr_iconx' was '5' - djhjr - 5/5/98 */ + tmp->icon = XCreateWindow (dpy, tmp->w, iconmgr_iconx, (int) (h - siconify_height)/2, + (unsigned int) siconify_width, + (unsigned int) siconify_height, + (unsigned int) 0, CopyFromParent, + (unsigned int) CopyFromParent, + (Visual *) CopyFromParent, + valuemask, &attributes); + + ip->count += 1; + PackIconManager(ip); + XMapWindow(dpy, tmp->w); + + XSaveContext(dpy, tmp->w, IconManagerContext, (caddr_t) tmp); + XSaveContext(dpy, tmp->w, TwmContext, (caddr_t) tmp_win); + XSaveContext(dpy, tmp->w, ScreenContext, (caddr_t) Scr); + XSaveContext(dpy, tmp->icon, TwmContext, (caddr_t) tmp_win); + XSaveContext(dpy, tmp->icon, ScreenContext, (caddr_t) Scr); + tmp_win->list = tmp; + + if (!ip->twm_win->icon) + { + XMapWindow(dpy, ip->w); + XMapWindow(dpy, ip->twm_win->frame); + } + + /* djhjr - 9/21/99 */ + else + XMapWindow(dpy, ip->twm_win->icon_w); + + return (tmp); +} + +/*********************************************************************** + * + * Procedure: + * InsertInIconManager - put an allocated entry into an icon + * manager + * + * Inputs: + * ip - the icon manager pointer + * tmp - the entry to insert + * + *********************************************************************** + */ + +void InsertInIconManager(ip, tmp, tmp_win) + IconMgr *ip; + WList *tmp; + TwmWindow *tmp_win; +{ + WList *tmp1; + int added; + int (*compar)() = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); + + added = FALSE; + if (ip->first == NULL) + { + ip->first = tmp; + tmp->prev = NULL; + ip->last = tmp; + added = TRUE; + } + else if (Scr->SortIconMgr) + { + for (tmp1 = ip->first; tmp1 != NULL; tmp1 = tmp1->next) + { + if ((*compar)(tmp_win->icon_name, tmp1->twm->icon_name) < 0) + { + tmp->next = tmp1; + tmp->prev = tmp1->prev; + tmp1->prev = tmp; + if (tmp->prev == NULL) + ip->first = tmp; + else + tmp->prev->next = tmp; + added = TRUE; + break; + } + } + } + + if (!added) + { + ip->last->next = tmp; + tmp->prev = ip->last; + ip->last = tmp; + } +} + +void RemoveFromIconManager(ip, tmp) + IconMgr *ip; + WList *tmp; +{ + if (tmp->prev == NULL) + ip->first = tmp->next; + else + tmp->prev->next = tmp->next; + + if (tmp->next == NULL) + ip->last = tmp->prev; + else + tmp->next->prev = tmp->prev; +} + +/*********************************************************************** + * + * Procedure: + * RemoveIconManager - remove a window from the icon manager + * + * Inputs: + * tmp_win - the TwmWindow structure + * + *********************************************************************** + */ + +void RemoveIconManager(tmp_win) + TwmWindow *tmp_win; +{ + IconMgr *ip; + WList *tmp; + + if (tmp_win->list == NULL) + return; + + tmp = tmp_win->list; + + /* submitted by Jonathan Paisley - 11/11/02 */ + if (Active == tmp) + Active = NULL; + + /* + * Believe it or not, the kludge in events.c:HandleKeyPress() needs + * this, or a window that's been destroyed still registers there, + * even though the whole mess gets freed in just a few microseconds! + * + * djhjr - 6/5/98 + */ + /* + * Somehwere alone the line, whatever it was got fixed, and this is + * needed again - djhjr - 5/27/03 + */ +/*#ifdef NEVER*/ /* warps to icon managers uniquely handled in menus.c:WarpToWindow() */ + tmp->active = FALSE; + tmp->iconmgr->active = NULL; +/*#endif*/ + + tmp_win->list = NULL; + ip = tmp->iconmgr; + + RemoveFromIconManager(ip, tmp); + + XDeleteContext(dpy, tmp->icon, TwmContext); + XDeleteContext(dpy, tmp->icon, ScreenContext); + XDestroyWindow(dpy, tmp->icon); + XDeleteContext(dpy, tmp->w, IconManagerContext); + XDeleteContext(dpy, tmp->w, TwmContext); + XDeleteContext(dpy, tmp->w, ScreenContext); + XDestroyWindow(dpy, tmp->w); + ip->count -= 1; + +#ifdef NEVER /* can't do this, else we lose the button entirely! */ + /* about damn time I did this! - djhjr - 6/5/98 */ + XFreePixmap(dpy, tmp->iconifypm); +#endif + + free((char *) tmp); + + PackIconManager(ip); + + if (ip->count == 0) + { + /* djhjr - 9/21/99 */ + if (ip->twm_win->icon) + XUnmapWindow(dpy, ip->twm_win->icon_w); + else + + XUnmapWindow(dpy, ip->twm_win->frame); + } + +} + +void ActiveIconManager(active) + WList *active; +{ + active->active = TRUE; + Active = active; + Active->iconmgr->active = active; + +/* djhjr - 4/19/96 + DrawIconManagerBorder(active); +*/ + DrawIconManagerBorder(active, False); +} + +void NotActiveIconManager(active) + WList *active; +{ + active->active = FALSE; + +/* djhjr - 4/19/96 + DrawIconManagerBorder(active); +*/ + DrawIconManagerBorder(active, False); +} + +/* djhjr - 4/19/96 +void DrawIconManagerBorder(tmp) + WList *tmp; +*/ +void DrawIconManagerBorder(tmp, fill) + WList *tmp; + int fill; +{ + /* was 'Scr->use3Diconmanagers' - djhjr - 8/11/98 */ + if (Scr->IconMgrBevelWidth > 0) { + int shadow_width; + +/* djhjr - 4/28/98 + shadow_width = 2; +*/ + shadow_width = Scr->IconMgrBevelWidth; + +/* djhjr - 1/27/98 + if (tmp->active && Scr->Highlight) +*/ + if (tmp->active && Scr->IconMgrHighlight) + Draw3DBorder (tmp->w, 0, 0, tmp->width, tmp->height, shadow_width, + tmp->cp, on, fill, False); + else + Draw3DBorder (tmp->w, 0, 0, tmp->width, tmp->height, shadow_width, + tmp->cp, off, fill, False); + } + else { +/* + XSetForeground(dpy, Scr->NormalGC, tmp->fore); +*/ + XSetForeground(dpy, Scr->NormalGC, tmp->cp.fore); + XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 2, 2, + tmp->width-5, tmp->height-5); + +/* djhjr - 1/27/98 + if (tmp->active && Scr->Highlight) +*/ + if (tmp->active && Scr->IconMgrHighlight) + XSetForeground(dpy, Scr->NormalGC, tmp->highlight); + else +/* + XSetForeground(dpy, Scr->NormalGC, tmp->back); +*/ + XSetForeground(dpy, Scr->NormalGC, tmp->cp.back); + + XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 0, 0, + tmp->width-1, tmp->height-1); + XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 1, 1, + tmp->width-3, tmp->height-3); + } +} + +/*********************************************************************** + * + * Procedure: + * SortIconManager - sort the dude + * + * Inputs: + * ip - a pointer to the icon manager struture + * + *********************************************************************** + */ + +void SortIconManager(ip) + IconMgr *ip; +{ + WList *tmp1, *tmp2; + int done; + int (*compar)() = (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); + + if (ip == NULL) + ip = Active->iconmgr; + + done = FALSE; + do + { + for (tmp1 = ip->first; tmp1 != NULL; tmp1 = tmp1->next) + { + if ((tmp2 = tmp1->next) == NULL) + { + done = TRUE; + break; + } + if ((*compar)(tmp1->twm->icon_name, tmp2->twm->icon_name) > 0) + { + /* take it out and put it back in */ + RemoveFromIconManager(ip, tmp2); + InsertInIconManager(ip, tmp2, tmp2->twm); + break; + } + } + } + while (!done); + PackIconManager(ip); +} + +/*********************************************************************** + * + * Procedure: + * PackIconManager - pack the icon manager windows following + * an addition or deletion + * + * Inputs: + * ip - a pointer to the icon manager struture + * + *********************************************************************** + */ + +void PackIconManager(ip) + IconMgr *ip; +{ + int newwidth, i, row, col, maxcol, colinc, rowinc, wheight, wwidth; + int new_x, new_y; + int savewidth; + WList *tmp; + + /* djhjr - 5/2/98 */ + wheight = ComputeIconMgrWindowHeight(); + + wwidth = ip->width / ip->columns; + + rowinc = wheight; + colinc = wwidth; + + row = 0; + col = ip->columns; + maxcol = 0; + for (i = 0, tmp = ip->first; tmp != NULL; i++, tmp = tmp->next) + { + tmp->me = i; + if (++col >= ip->columns) + { + col = 0; + row += 1; + } + if (col > maxcol) + maxcol = col; + + new_x = col * colinc; + new_y = (row-1) * rowinc; + + /* if the position or size has not changed, don't touch it */ + if (tmp->x != new_x || tmp->y != new_y || + tmp->width != wwidth || tmp->height != wheight) + { + XMoveResizeWindow(dpy, tmp->w, new_x, new_y, wwidth, wheight); + + tmp->row = row-1; + tmp->col = col; + tmp->x = new_x; + tmp->y = new_y; + tmp->width = wwidth; + tmp->height = wheight; + } + } + maxcol += 1; + + ip->cur_rows = row; + ip->cur_columns = maxcol; + ip->height = row * rowinc; + if (ip->height == 0) + ip->height = rowinc; + newwidth = maxcol * colinc; + if (newwidth == 0) + newwidth = colinc; + + XResizeWindow(dpy, ip->w, newwidth, ip->height); + + savewidth = ip->width; + if (ip->twm_win) + { + + /* limit the min and max sizes of an icon manager - djhjr - 3/1/99 */ + ip->twm_win->hints.flags |= (PMinSize | PMaxSize); + ip->twm_win->hints.min_width = maxcol * (2 * iconmgr_iconx + siconify_width); + ip->twm_win->hints.min_height = ip->height; + ip->twm_win->hints.max_width = Scr->MyDisplayWidth; + ip->twm_win->hints.max_height = ip->height; + +/* djhjr - 4/19/96 + SetupWindow (ip->twm_win, + ip->twm_win->frame_x, ip->twm_win->frame_y, + newwidth, ip->height + ip->twm_win->title_height, -1); +*/ + SetupWindow (ip->twm_win, + ip->twm_win->frame_x, ip->twm_win->frame_y, + newwidth + 2 * ip->twm_win->frame_bw3D, + ip->height + ip->twm_win->title_height + 2 * ip->twm_win->frame_bw3D, -1); + } + + ip->width = savewidth; +} + +/* + * ComputeIconMgrWindowHeight() + * scale the icon manager window height to the font used + * + * djhjr - 5/2/98 + */ +static int ComputeIconMgrWindowHeight() +{ + int h; + + /* was 'Scr->use3Diconmanagers' - djhjr - 8/11/98 */ + if (Scr->IconMgrBevelWidth > 0) + { + h = Scr->IconManagerFont.height + 2 * Scr->IconMgrBevelWidth + 4; + if (h < (siconify_height + 2 * Scr->IconMgrBevelWidth + 4)) + h = siconify_height + 2 * Scr->IconMgrBevelWidth + 4; + } + else + { + h = Scr->IconManagerFont.height + 10; + if (h < (siconify_height + 4)) + h = siconify_height + 4; + } + + /* make height be odd so buttons look nice and centered */ + if (!(h & 1)) h++; + + return (h); +} + diff --git a/iconmgr.h b/iconmgr.h new file mode 100644 index 0000000..227e810 --- /dev/null +++ b/iconmgr.h @@ -0,0 +1,97 @@ +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/*********************************************************************** + * + * $XConsortium: iconmgr.h,v 1.11 89/12/10 17:47:02 jim Exp $ + * + * Icon Manager includes + * + * 09-Mar-89 Tom LaStrange File Created + * + ***********************************************************************/ + +#ifndef _ICONMGR_ +#define _ICONMGR_ + +typedef struct WList +{ + struct WList *next; + struct WList *prev; + struct TwmWindow *twm; + struct IconMgr *iconmgr; + Window w; + Window icon; + int x, y, width, height; + int row, col; + int me; + + /* djhjr - 4/19/96 */ + ColorPair cp; + /* was Pixmap - djhjr - 10/30/02 */ + Image *iconifypm; + + Pixel fore, back, highlight; + unsigned top, bottom; + short active; + short down; +} WList; + +typedef struct IconMgr +{ + struct IconMgr *next; /* pointer to the next icon manager */ + struct IconMgr *prev; /* pointer to the previous icon mgr */ + struct IconMgr *lasti; /* pointer to the last icon mgr */ + struct WList *first; /* first window in the list */ + struct WList *last; /* last window in the list */ + struct WList *active; /* the active entry */ + TwmWindow *twm_win; /* back pointer to the new parent */ + struct ScreenInfo *scr; /* the screen this thing is on */ + Window w; /* this icon manager window */ + char *geometry; /* geometry string */ + char *name; + char *icon_name; + int x, y, width, height; + int columns, cur_rows, cur_columns; + int count; +} IconMgr; + +extern int iconmgr_textx; +extern WList *DownIconManager; +extern void SetIconMgrPixmap(); +extern void CreateIconManagers(); +extern IconMgr *AllocateIconManager(); +extern void MoveIconManager(); +extern void JumpIconManager(); +extern WList *AddIconManager(); +extern void InsertInIconManager(); +extern void RemoveFromIconManager(); +extern void RemoveIconManager(); +extern void ActiveIconManager(); +extern void NotActiveIconManager(); +extern void DrawIconManagerBorder(); +extern void SortIconManager(); +extern void PackIconManager(); + +/* djhjr - 5/19/98 */ +#define VTWM_ICONMGR_CLASS "VTWM Icon Manager" + +#endif /* _ICONMGR_ */ diff --git a/icons.c b/icons.c new file mode 100644 index 0000000..4ea526e --- /dev/null +++ b/icons.c @@ -0,0 +1,970 @@ +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/********************************************************************** + * + * $XConsortium: icons.c,v 1.22 91/07/12 09:58:38 dave Exp $ + * + * Icon releated routines + * + * 10-Apr-89 Tom LaStrange Initial Version. + * + **********************************************************************/ + +#include +#include +#include "twm.h" +#include "screen.h" +#include "regions.h" +#include "list.h" +#include "gram.h" +#include "parse.h" +#include "util.h" + +extern void splitRegionEntry(); +extern int roundEntryUp(); +extern RegionEntry *prevRegionEntry(); +extern void mergeRegionEntries(); +extern void downRegionEntry(); +extern RootRegion *AddRegion(); + +#define iconWidth(w) (Scr->IconBorderWidth * 2 + w->icon_w_width) +#define iconHeight(w) (Scr->IconBorderWidth * 2 + w->icon_w_height) + +void PlaceIcon(tmp_win, def_x, def_y, final_x, final_y) +TwmWindow *tmp_win; +int def_x, def_y; +int *final_x, *final_y; +{ + RootRegion *rr; + RegionEntry *re; + int w, h; + + re = 0; + for (rr = Scr->FirstIconRegion; rr; rr = rr->next) { + w = roundEntryUp (iconWidth (tmp_win), rr->stepx); + h = roundEntryUp (iconHeight (tmp_win), rr->stepy); + for (re = rr->entries; re; re=re->next) { + if (re->usedby) + continue; +/* don't include grid spacing - djhjr - 5/22/99 + if (re->w >= w && re->h >= h) +*/ + if (re->w >= iconWidth(tmp_win) && re->h >= iconHeight(tmp_win)) + break; + } + if (re) + break; + } + if (re) { + splitRegionEntry (re, rr->grav1, rr->grav2, w, h); + re->usedby = USEDBY_TWIN; + re->u.twm_win = tmp_win; + +/* evenly spaced icon placement - djhjr - 4/24/99 + *final_x = re->x + (re->w - iconWidth (tmp_win)) / 2; + *final_y = re->y + (re->h - iconHeight (tmp_win)) / 2; +*/ + *final_x = re->x; + *final_y = re->y; + + /* adjust for region gravity - djhjr 4/26/99 */ + if (rr->grav2 == D_EAST) + *final_x += re->w - iconWidth(tmp_win); + if (rr->grav1 == D_SOUTH) + *final_y += re->h - iconHeight(tmp_win); + + } else { + *final_x = def_x; + *final_y = def_y; + } + return; +} + +static RegionEntry * +FindIconEntry (tmp_win, rrp) + TwmWindow *tmp_win; + RootRegion **rrp; +{ + RootRegion *rr; + RegionEntry *re; + + for (rr = Scr->FirstIconRegion; rr; rr = rr->next) { + for (re = rr->entries; re; re=re->next) + if (re->u.twm_win == tmp_win) { + if (rrp) + *rrp = rr; + return re; + } + } + return 0; +} + +void IconUp (tmp_win) + TwmWindow *tmp_win; +{ + int x, y; + int defx, defy; + struct RootRegion *rr; + + /* + * If the client specified a particular location, let's use it (this might + * want to be an option at some point). Otherwise, try to fit within the + * icon region. + */ + if (tmp_win->wmhints && (tmp_win->wmhints->flags & IconPositionHint)) + return; + + if (tmp_win->icon_moved) { + if (!XGetGeometry (dpy, tmp_win->icon_w, &JunkRoot, &defx, &defy, + &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth)) + return; + +/* evenly spaced icon placement - djhjr - 4/24/99 + x = defx + ((int) JunkWidth) / 2; + y = defy + ((int) JunkHeight) / 2; +*/ + x = defx; + y = defy; + + for (rr = Scr->FirstIconRegion; rr; rr = rr->next) { + if (x >= rr->x && x < (rr->x + rr->w) && + y >= rr->y && y < (rr->y + rr->h)) + break; + } + if (!rr) return; /* outside icon regions, leave alone */ + } + + defx = -100; + defy = -100; + PlaceIcon(tmp_win, defx, defy, &x, &y); + if (x != defx || y != defy) { + XMoveWindow (dpy, tmp_win->icon_w, x, y); + tmp_win->icon_moved = FALSE; /* since we've restored it */ + } +} + +void +IconDown (tmp_win) + TwmWindow *tmp_win; +{ + RegionEntry *re; + RootRegion *rr; + + re = FindIconEntry (tmp_win, &rr); + if (re) + downRegionEntry(rr, re); +} + +void +AddIconRegion(geom, grav1, grav2, stepx, stepy) +char *geom; +int grav1, grav2, stepx, stepy; +{ + RootRegion *rr; + + rr = AddRegion(geom, grav1, grav2, stepx, stepy); + + if (Scr->LastIconRegion) + Scr->LastIconRegion->next = rr; + Scr->LastIconRegion = rr; + if (!Scr->FirstIconRegion) + Scr->FirstIconRegion = rr; +} + +#ifdef ORIGINAL_PIXMAPS +void CreateIconWindow(tmp_win, def_x, def_y) +TwmWindow *tmp_win; +int def_x, def_y; +{ + unsigned long event_mask; + unsigned long valuemask; /* mask for create windows */ + XSetWindowAttributes attributes; /* attributes for create windows */ + Pixmap pm = None; /* tmp pixmap variable */ + int final_x, final_y; + int x; + + /* djhjr - 4/27/96 */ + GetColorFromList(Scr->IconBorderColorL, tmp_win->full_name, &tmp_win->class, + &tmp_win->icon_border); + GetColorFromList(Scr->IconForegroundL, tmp_win->full_name, &tmp_win->class, + &tmp_win->iconc.fore); + GetColorFromList(Scr->IconBackgroundL, tmp_win->full_name, &tmp_win->class, + &tmp_win->iconc.back); + +/* djhjr - 5/5/98 + if (Scr->use3Diconmanagers && !Scr->BeNiceToColormap) GetShadeColors(&tmp_win->iconc); +*/ + /* was 'Scr->use3Dicons' - djhjr - 8/11/98 */ + if (Scr->IconBevelWidth > 0 && !Scr->BeNiceToColormap) GetShadeColors(&tmp_win->iconc); + + FB(tmp_win->iconc.fore, tmp_win->iconc.back); + + tmp_win->forced = FALSE; + tmp_win->icon_not_ours = FALSE; + + /* now go through the steps to get an icon window, if ForceIcon is + * set, then no matter what else is defined, the bitmap from the + * .twmrc file is used + */ + if (Scr->ForceIcon) + { + char *icon_name; + Pixmap bm; + + icon_name = LookInNameList(Scr->IconNames, tmp_win->full_name); + if (icon_name == NULL) + icon_name = LookInList(Scr->IconNames, tmp_win->full_name, + &tmp_win->class); + + bm = None; + if (icon_name != NULL) + { + if ((bm = (Pixmap)LookInNameList(Scr->Icons, icon_name)) == None) + { + if ((bm = GetBitmap (icon_name)) != None) + /* added 'type' argument - djhjr - 10/20/01 */ + AddToList(&Scr->Icons, icon_name, LTYPE_EXACT_NAME, + (char *)bm); + } + } + + if (bm != None) + { + XGetGeometry(dpy, bm, &JunkRoot, &JunkX, &JunkY, + (unsigned int *) &tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, + &JunkBW, &JunkDepth); + + pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width, + tmp_win->icon_height, Scr->d_depth); + + /* the copy plane works on color ! */ + XCopyPlane(dpy, bm, pm, Scr->NormalGC, + 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + + tmp_win->forced = TRUE; + } + } + + /* if the pixmap is still NULL, we didn't get one from the above code, + * that could mean that ForceIcon was not set, or that the window + * was not in the Icons list, now check the WM hints for an icon + */ + if (pm == None && tmp_win->wmhints && + tmp_win->wmhints->flags & IconPixmapHint) + { + + XGetGeometry(dpy, tmp_win->wmhints->icon_pixmap, + &JunkRoot, &JunkX, &JunkY, + (unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, &JunkBW, &JunkDepth); + + pm = XCreatePixmap(dpy, Scr->Root, + tmp_win->icon_width, tmp_win->icon_height, + Scr->d_depth); + + XCopyPlane(dpy, tmp_win->wmhints->icon_pixmap, pm, Scr->NormalGC, + 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + } + + /* if we still haven't got an icon, let's look in the Icon list + * if ForceIcon is not set + */ + if (pm == None && !Scr->ForceIcon) + { + char *icon_name; + Pixmap bm; + + icon_name = LookInNameList(Scr->IconNames, tmp_win->full_name); + if (icon_name == NULL) + icon_name = LookInList(Scr->IconNames, tmp_win->full_name, + &tmp_win->class); + + bm = None; + if (icon_name != NULL) + { + if ((bm = (Pixmap)LookInNameList(Scr->Icons, icon_name)) == None) + { + if ((bm = GetBitmap (icon_name)) != None) + /* added 'type' argument - djhjr - 10/20/01 */ + AddToList(&Scr->Icons, icon_name, LTYPE_EXACT_NAME, + (char *)bm); + } + } + + if (bm != None) + { + XGetGeometry(dpy, bm, &JunkRoot, &JunkX, &JunkY, + (unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, + &JunkBW, &JunkDepth); + + pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width, + tmp_win->icon_height, Scr->d_depth); + + /* the copy plane works on color ! */ + XCopyPlane(dpy, bm, pm, Scr->NormalGC, + 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + } + } + + /* if we still don't have an icon, assign the UnknownIcon */ + + if (pm == None && Scr->UnknownPm != None) + { + tmp_win->icon_width = Scr->UnknownWidth; + tmp_win->icon_height = Scr->UnknownHeight; + + pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width, + tmp_win->icon_height, Scr->d_depth); + + /* the copy plane works on color ! */ + XCopyPlane(dpy, Scr->UnknownPm, pm, Scr->NormalGC, + 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + } + + if (pm == None) + { + tmp_win->icon_height = 0; + tmp_win->icon_width = 0; + valuemask = 0; + } + else + { + /* added pixel specs - djhjr - 12/28/98 */ + valuemask = CWBackPixmap | CWBackPixel; + attributes.background_pixmap = pm; + attributes.background_pixel = tmp_win->iconc.fore; + } + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont, +#else + tmp_win->icon_w_width = XTextWidth(Scr->IconFont.font, +#endif + tmp_win->icon_name, strlen(tmp_win->icon_name)); + +/* djhjr - 6/11/96 + tmp_win->icon_w_width += 6; + if (tmp_win->icon_w_width < tmp_win->icon_width) + { + tmp_win->icon_x = (tmp_win->icon_width - tmp_win->icon_w_width)/2; + tmp_win->icon_x += 3; + tmp_win->icon_w_width = tmp_win->icon_width; + } + else + { + tmp_win->icon_x = 3; + } +*/ + tmp_win->icon_w_width += 8; + if (tmp_win->icon_w_width < tmp_win->icon_width + 8) + { + tmp_win->icon_x = (((tmp_win->icon_width + 8) - tmp_win->icon_w_width)/2) + 4; + tmp_win->icon_w_width = tmp_win->icon_width + 8; + } + else + tmp_win->icon_x = 4; + +/* djhjr - 6/11/96 + tmp_win->icon_y = tmp_win->icon_height + Scr->IconFont.height; +*/ + tmp_win->icon_y = tmp_win->icon_height + Scr->IconFont.height + 2; + +/* djhjr - 4/27/96 + tmp_win->icon_w_height = tmp_win->icon_height + Scr->IconFont.height + 4; +*/ +/* djhjr - 6/11/96 + tmp_win->icon_w_height = tmp_win->icon_height + Scr->IconFont.height + 6; +*/ + tmp_win->icon_w_height = tmp_win->icon_height + Scr->IconFont.height + 8; + + event_mask = 0; + if (tmp_win->wmhints && tmp_win->wmhints->flags & IconWindowHint) + { + tmp_win->icon_w = tmp_win->wmhints->icon_window; + if (tmp_win->forced || + XGetGeometry(dpy, tmp_win->icon_w, &JunkRoot, &JunkX, &JunkY, + (unsigned int *)&tmp_win->icon_w_width, (unsigned int *)&tmp_win->icon_w_height, + &JunkBW, &JunkDepth) == 0) + { + tmp_win->icon_w = None; + tmp_win->wmhints->flags &= ~IconWindowHint; + } + else + { + tmp_win->icon_not_ours = TRUE; + event_mask = EnterWindowMask | LeaveWindowMask; + } + } + else + { + tmp_win->icon_w = None; + } + + /* djhjr - 5/5/98 */ + /* was 'Scr->use3Dicons' and 'Scr->BorderBevelWidth' - djhjr - 8/11/98 */ + if (Scr->IconBevelWidth > 0) + { + tmp_win->icon_w_width += 2 * Scr->IconBevelWidth; + tmp_win->icon_w_height += 2 * Scr->IconBevelWidth; + + tmp_win->icon_x += Scr->IconBevelWidth; + tmp_win->icon_y += Scr->IconBevelWidth; + } + + if (tmp_win->icon_w == None) + { + tmp_win->icon_w = XCreateSimpleWindow(dpy, Scr->Root, + 0,0, + tmp_win->icon_w_width, tmp_win->icon_w_height, + Scr->IconBorderWidth, tmp_win->icon_border, tmp_win->iconc.back); + event_mask = ExposureMask; + } + + XSelectInput (dpy, tmp_win->icon_w, + KeyPressMask | ButtonPressMask | ButtonReleaseMask | + event_mask); + + tmp_win->icon_bm_w = None; + if (pm != None && + (! (tmp_win->wmhints && tmp_win->wmhints->flags & IconWindowHint))) + { + int y; + +/* djhjr - 6/11/96 + y = 0; +*/ + y = 4; + + if (tmp_win->icon_w_width == tmp_win->icon_width) + x = 0; + else + x = (tmp_win->icon_w_width - tmp_win->icon_width)/2; + + /* djhjr - 5/5/98 */ + /* was 'Scr->use3Dicons' and 'Scr->BorderBevelWidth' - djhjr - 8/11/98 */ + if (Scr->IconBevelWidth > 0) + y += Scr->IconBevelWidth; + + tmp_win->icon_bm_w = XCreateWindow (dpy, tmp_win->icon_w, x, y, + (unsigned int)tmp_win->icon_width, + (unsigned int)tmp_win->icon_height, + (unsigned int) 0, Scr->d_depth, + (unsigned int) CopyFromParent, + Scr->d_visual, valuemask, + &attributes); + } + + /* I need to figure out where to put the icon window now, because + * getting here means that I am going to make the icon visible + */ + if (tmp_win->wmhints && + tmp_win->wmhints->flags & IconPositionHint) + { + final_x = tmp_win->wmhints->icon_x; + final_y = tmp_win->wmhints->icon_y; + } + else + { + PlaceIcon(tmp_win, def_x, def_y, &final_x, &final_y); + } + + if (final_x > Scr->MyDisplayWidth) + final_x = Scr->MyDisplayWidth - tmp_win->icon_w_width - + (2 * Scr->IconBorderWidth); + + if (final_y > Scr->MyDisplayHeight) + final_y = Scr->MyDisplayHeight - tmp_win->icon_height - + Scr->IconFont.height - 4 - (2 * Scr->IconBorderWidth); + + XMoveWindow(dpy, tmp_win->icon_w, final_x, final_y); + tmp_win->iconified = TRUE; + + XMapSubwindows(dpy, tmp_win->icon_w); + XSaveContext(dpy, tmp_win->icon_w, TwmContext, (caddr_t)tmp_win); + XSaveContext(dpy, tmp_win->icon_w, ScreenContext, (caddr_t)Scr); + XDefineCursor(dpy, tmp_win->icon_w, Scr->IconCursor); + if (pm) XFreePixmap (dpy, pm); + return; +} +#else /* ORIGINAL_PIXMAPS */ +/* + * to help clean up CreateIconWindow() below - djhjr - 8/13/98 + * added background color and XPM indicator - djhjr - 12/28/98 + */ +Image * +GetIconImage(name, background, numcolors) +char *name; +Pixel background; +unsigned int *numcolors; +{ + Image *iconimage; + GC gc; + Pixmap bm; + int bitmap_height, bitmap_width; + + iconimage = (Image *)LookInNameList(Scr->Icons, name); + if (iconimage == NULL) + { + bm = FindBitmap(name, &bitmap_width, &bitmap_height); + if (bm != None) + { + iconimage = (Image *)malloc(sizeof(Image)); + iconimage->mask = None; + iconimage->height = bitmap_height; + iconimage->width = bitmap_width; + iconimage->pixmap = XCreatePixmap(dpy, Scr->Root, bitmap_width, + bitmap_height, Scr->d_depth); + + XGetGeometry(dpy, bm, + &JunkRoot, &JunkX, &JunkY, + &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth); + + /* + * XCopyArea() seems to be necessary for some apps that change + * their icons - djhjr - rem'd 8/23/98, re-instated 11/15/98 + */ + if (JunkDepth == Scr->d_depth) + XCopyArea(dpy, bm, iconimage->pixmap, + Scr->NormalGC, 0, 0, iconimage->width, iconimage->height, + 0, 0); + else + XCopyPlane(dpy, bm, iconimage->pixmap, + Scr->NormalGC, 0, 0, iconimage->width, iconimage->height, + 0, 0, 1); + + iconimage->mask = XCreatePixmap(dpy, Scr->Root, + iconimage->width, iconimage->height, 1); + if (iconimage->mask) + { + gc = XCreateGC(dpy, iconimage->mask, 0, NULL); + if (gc) + { + XCopyArea(dpy, bm, iconimage->mask, + gc, 0, 0, iconimage->width, iconimage->height, 0, 0); + XFreeGC (dpy, gc); + } + } + + XFreePixmap(dpy, bm); + } +#ifndef NO_XPM_SUPPORT + else + { + /* added color argument - djhjr - 9/28/99 */ + iconimage = FindImage(name, background); + } +#endif + + if (iconimage != NULL) + /* added 'type' argument - djhjr - 10/20/01 */ + AddToList(&Scr->Icons, name, LTYPE_EXACT_NAME, + (char *)iconimage); + } + + /* djhjr - 12/28/98 */ + *numcolors = 0; +#ifndef NO_XPM_SUPPORT + if (iconimage != NULL) + *numcolors = SetPixmapsBackground(iconimage, Scr->Root, background); +#endif + + return (iconimage); +} + +/* + * Submitted by Jason Gloudon + */ +void +CreateIconWindow(tmp_win, def_x, def_y) +TwmWindow *tmp_win; +int def_x, def_y; +{ + unsigned long event_mask; + unsigned long valuemask; /* mask for create windows */ + XSetWindowAttributes attributes; /* attributes for create windows */ + Pixmap pm; /* tmp pixmap variable */ + Image *iconimage; + char *icon_name; + int x, final_x, final_y; + unsigned int pm_numcolors = 0; /* djhjr - 12/28/98 */ + + /* djhjr - 4/27/96 */ + GetColorFromList(Scr->IconBorderColorL, tmp_win->full_name, &tmp_win->class, + &tmp_win->icon_border); + GetColorFromList(Scr->IconForegroundL, tmp_win->full_name, &tmp_win->class, + &tmp_win->iconc.fore); + GetColorFromList(Scr->IconBackgroundL, tmp_win->full_name, &tmp_win->class, + &tmp_win->iconc.back); + +/* djhjr - 5/5/98 + if (Scr->use3Diconmanagers && !Scr->BeNiceToColormap) GetShadeColors(&tmp_win->iconc); +*/ + /* was 'Scr->use3Dicons' - djhjr - 8/11/98 */ + if (Scr->IconBevelWidth > 0 && !Scr->BeNiceToColormap) GetShadeColors(&tmp_win->iconc); + + FB(tmp_win->iconc.fore, tmp_win->iconc.back); + + tmp_win->forced = FALSE; + tmp_win->icon_not_ours = FALSE; + iconimage = NULL; + pm = None; + + /* + * now go through the steps to get an icon window, if ForceIcon is + * set, then no matter what else is defined, the bitmap from the + * .vtwmrc file is used + */ + if (Scr->ForceIcon) + { + icon_name = LookInNameList(Scr->IconNames, tmp_win->full_name); + if (icon_name == NULL) + icon_name = LookInList(Scr->IconNames, tmp_win->full_name, + &tmp_win->class); + + if (icon_name != NULL) + /* added background and XPM indicator - djhjr - 12/28/98 */ + iconimage = GetIconImage(icon_name, tmp_win->iconc.back, + &pm_numcolors); + + if (iconimage != NULL) + { + tmp_win->icon_width = iconimage->width; + tmp_win->icon_height = iconimage->height; + + pm = iconimage->pixmap; + tmp_win->forced = TRUE; + } + } + + /* + * if the pixmap is still NULL, we didn't get one from the above code, + * that could mean that ForceIcon was not set, or that the window + * was not in the Icons list, now check the WM hints for an icon + */ + if (pm == None && tmp_win->wmhints && + tmp_win->wmhints->flags & IconPixmapHint) + { +/* djhjr - 8/14/98 + XGetGeometry(dpy, tmp_win->wmhints->icon_pixmap, + &JunkRoot, &JunkX, &JunkY, + (unsigned int *)&tmp_win->icon_width, + (unsigned int *)&tmp_win->icon_height, &JunkBW, &JunkDepth); + + pm = XCreatePixmap(dpy, Scr->Root, + tmp_win->icon_width, tmp_win->icon_height, + Scr->d_depth); + + XCopyPlane(dpy, tmp_win->wmhints->icon_pixmap, pm, Scr->NormalGC, + 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + + XFreePixmap(dpy, pm); +*/ + XGetGeometry(dpy, tmp_win->wmhints->icon_pixmap, + &JunkRoot, &JunkX, &JunkY, + &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth); + + pm_numcolors = 3; /* Submitted by Caveh Frank Jalali */ + + iconimage = (Image*)malloc(sizeof(Image)); + iconimage->mask = None; + iconimage->width = JunkWidth; + iconimage->height = JunkHeight; + iconimage->pixmap = XCreatePixmap(dpy, Scr->Root, iconimage->width, + iconimage->height, Scr->d_depth); + + if (JunkDepth == Scr->d_depth) + XCopyArea(dpy, tmp_win->wmhints->icon_pixmap, iconimage->pixmap, + Scr->NormalGC, 0, 0, iconimage->width, iconimage->height, + 0, 0); + else + XCopyPlane(dpy, tmp_win->wmhints->icon_pixmap, iconimage->pixmap, + Scr->NormalGC, 0, 0, iconimage->width, iconimage->height, + 0, 0, 1); + + if ((tmp_win->wmhints->flags & IconMaskHint) && + XGetGeometry(dpy, tmp_win->wmhints->icon_mask, + &JunkRoot, &JunkX, &JunkY, &JunkWidth, &JunkHeight, + &JunkBW, &JunkDepth) && + JunkDepth == 1) + { + GC gc; + + iconimage->mask = XCreatePixmap(dpy, Scr->Root, + JunkWidth, JunkHeight, 1); + if (iconimage->mask) + { + gc = XCreateGC(dpy, iconimage->mask, 0, NULL); + if (gc) + { + XCopyArea(dpy, tmp_win->wmhints->icon_mask, iconimage->mask, + gc, 0, 0, JunkWidth, JunkHeight, 0, 0); + XFreeGC (dpy, gc); + } + } + } + + if (iconimage != NULL) + { + tmp_win->icon_width = iconimage->width; + tmp_win->icon_height = iconimage->height; + + pm = iconimage->pixmap; + } + } + + /* + * if we still haven't got an icon, let's look in the Icon list + * if ForceIcon is not set + */ + if (pm == None && !Scr->ForceIcon) + { + icon_name = LookInNameList(Scr->IconNames, tmp_win->full_name); + if (icon_name == NULL) + icon_name = LookInList(Scr->IconNames, tmp_win->full_name, + &tmp_win->class); + + if (icon_name != NULL) + /* added background and XPM indicator - djhjr - 12/28/98 */ + iconimage = GetIconImage(icon_name, tmp_win->iconc.back, + &pm_numcolors); + + if (iconimage != NULL) + { + tmp_win->icon_width = iconimage->width; + tmp_win->icon_height = iconimage->height; + + pm = iconimage->pixmap; + } + } + + /* + * if we still don't have an icon, assign the UnknownIcon + */ +/* djhjr - 8/13/98 + if (pm == None && Scr->UnknownPm != None) + { + tmp_win->icon_width = Scr->UnknownWidth; + tmp_win->icon_height = Scr->UnknownHeight; + + pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width, + tmp_win->icon_height, Scr->d_depth); + + * the copy plane works on color ! * + XCopyPlane(dpy, Scr->UnknownPm, pm, Scr->NormalGC, + 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + + XFreePixmap(dpy, pm); + } +*/ + if (pm == None && Scr->unknownName != NULL) + { + /* added background and XPM indicator - djhjr - 12/28/98 */ + iconimage = GetIconImage(Scr->unknownName, tmp_win->iconc.back, + &pm_numcolors); + + if (iconimage != NULL) + { + tmp_win->icon_width = iconimage->width; + tmp_win->icon_height = iconimage->height; + + pm = iconimage->pixmap; + } + } + + if (pm == None) + { + tmp_win->icon_height = 0; + tmp_win->icon_width = 0; + valuemask = 0; + } + else + { + valuemask = CWBackPixmap; + attributes.background_pixmap = pm; + + /* djhjr - 12/28/98 */ + if (pm_numcolors <= 2) /* not a pixmap */ + { + valuemask |= CWBackPixel; + attributes.background_pixel = tmp_win->iconc.fore; + } + } + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont, +#else + tmp_win->icon_w_width = XTextWidth(Scr->IconFont.font, +#endif + tmp_win->icon_name, strlen(tmp_win->icon_name)); + +/* djhjr - 6/11/96 + tmp_win->icon_w_width += 6; + if (tmp_win->icon_w_width < tmp_win->icon_width) + { + tmp_win->icon_x = (tmp_win->icon_width - tmp_win->icon_w_width)/2; + tmp_win->icon_x += 3; + tmp_win->icon_w_width = tmp_win->icon_width; + } + else + { + tmp_win->icon_x = 3; + } +*/ + tmp_win->icon_w_width += 8; + if (tmp_win->icon_w_width < tmp_win->icon_width + 8) + { + tmp_win->icon_x = (((tmp_win->icon_width + 8) - tmp_win->icon_w_width)/2) + 4; + tmp_win->icon_w_width = tmp_win->icon_width + 8; + } + else + tmp_win->icon_x = 4; + +/* djhjr - 6/11/96 + tmp_win->icon_y = tmp_win->icon_height + Scr->IconFont.height; +*/ + tmp_win->icon_y = tmp_win->icon_height + Scr->IconFont.height + 2; + +/* djhjr - 4/27/96 + tmp_win->icon_w_height = tmp_win->icon_height + Scr->IconFont.height + 4; +*/ +/* djhjr - 6/11/96 + tmp_win->icon_w_height = tmp_win->icon_height + Scr->IconFont.height + 6; +*/ + tmp_win->icon_w_height = tmp_win->icon_height + Scr->IconFont.height + 8; + + event_mask = 0; + if (tmp_win->wmhints && tmp_win->wmhints->flags & IconWindowHint) + { + tmp_win->icon_w = tmp_win->wmhints->icon_window; + if (tmp_win->forced || + XGetGeometry(dpy, tmp_win->icon_w, &JunkRoot, &JunkX, &JunkY, + (unsigned int *)&tmp_win->icon_w_width, (unsigned int *)&tmp_win->icon_w_height, + &JunkBW, &JunkDepth) == 0) + { + tmp_win->icon_w = None; + tmp_win->wmhints->flags &= ~IconWindowHint; + } + else + { + tmp_win->icon_not_ours = TRUE; + event_mask = EnterWindowMask | LeaveWindowMask; + } + } + else + { + tmp_win->icon_w = None; + } + + /* djhjr - 5/5/98 */ + /* was 'Scr->use3Dicons' and 'Scr->BorderBevelWidth' - djhjr - 8/11/98 */ + if (Scr->IconBevelWidth > 0) + { + tmp_win->icon_w_width += 2 * Scr->IconBevelWidth; + tmp_win->icon_w_height += 2 * Scr->IconBevelWidth; + + tmp_win->icon_x += Scr->IconBevelWidth; + tmp_win->icon_y += Scr->IconBevelWidth; + } + + if (tmp_win->icon_w == None) + { + tmp_win->icon_w = XCreateSimpleWindow(dpy, Scr->Root, + 0,0, + tmp_win->icon_w_width, tmp_win->icon_w_height, + Scr->IconBorderWidth, tmp_win->icon_border, tmp_win->iconc.back); + event_mask = ExposureMask; + } + + XSelectInput (dpy, tmp_win->icon_w, + KeyPressMask | ButtonPressMask | ButtonReleaseMask | + event_mask); + + tmp_win->icon_bm_w = None; + if (pm != None && + (! (tmp_win->wmhints && tmp_win->wmhints->flags & IconWindowHint))) + { + int y; + +/* djhjr - 6/11/96 + y = 0; +*/ + y = 4; + + if (tmp_win->icon_w_width == tmp_win->icon_width) + x = 0; + else + x = (tmp_win->icon_w_width - tmp_win->icon_width)/2; + + /* djhjr - 5/5/98 */ + /* was 'Scr->use3Dicons' and 'Scr->BorderBevelWidth' - djhjr - 8/11/98 */ + if (Scr->IconBevelWidth > 0) + y += Scr->IconBevelWidth; + + tmp_win->icon_bm_w = XCreateWindow (dpy, tmp_win->icon_w, x, y, + (unsigned int)tmp_win->icon_width, + (unsigned int)tmp_win->icon_height, + (unsigned int) 0, Scr->d_depth, + (unsigned int) CopyFromParent, + Scr->d_visual, valuemask, + &attributes); + + if (HasShape) + if (iconimage != NULL && iconimage->mask != None) + XShapeCombineMask(dpy,tmp_win->icon_bm_w , ShapeBounding, 0, 0, + iconimage->mask, ShapeSet); + } + + /* I need to figure out where to put the icon window now, because + * getting here means that I am going to make the icon visible + */ + if (tmp_win->wmhints && + tmp_win->wmhints->flags & IconPositionHint) + { + final_x = tmp_win->wmhints->icon_x; + final_y = tmp_win->wmhints->icon_y; + } + else + { + PlaceIcon(tmp_win, def_x, def_y, &final_x, &final_y); + } + + if (final_x > Scr->MyDisplayWidth) + final_x = Scr->MyDisplayWidth - tmp_win->icon_w_width - + (2 * Scr->IconBorderWidth); + + if (final_y > Scr->MyDisplayHeight) + final_y = Scr->MyDisplayHeight - tmp_win->icon_height - + Scr->IconFont.height - 4 - (2 * Scr->IconBorderWidth); + + XMoveWindow(dpy, tmp_win->icon_w, final_x, final_y); + tmp_win->iconified = TRUE; + + XMapSubwindows(dpy, tmp_win->icon_w); + XSaveContext(dpy, tmp_win->icon_w, TwmContext, (caddr_t)tmp_win); + XSaveContext(dpy, tmp_win->icon_w, ScreenContext, (caddr_t)Scr); + XDefineCursor(dpy, tmp_win->icon_w, Scr->IconCursor); + + return; +} +#endif /* ORIGINAL_PIXMAPS */ + diff --git a/lex.l b/lex.l new file mode 100644 index 0000000..f7e9c70 --- /dev/null +++ b/lex.l @@ -0,0 +1,111 @@ +%{ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + +/*********************************************************************** + * + * $XConsortium: lex.l,v 1.62 89/12/10 17:46:33 jim Exp $ + * + * .twmrc lex file + * + * 12-Nov-87 Thomas E. LaStrange File created + * + ***********************************************************************/ + +/* #include */ /* lex already includes stdio.h */ +#include "gram.h" +#include "parse.h" + +extern int parse_keyword(); +extern void twmrc_error_prefix(); + +extern char *ProgramName; +extern int ParseError; + +#ifdef FLEX_SCANNER +#undef YY_INPUT +#define YY_INPUT(b,r,s) r = ((b[0] = (*twmInputFunc)()) != 0) +#endif +%} + +string \"([^"]|\\.)*\" +regexp \/([^/]|\\.)*\/ +number [0-9]+ +%% +"{" { return (LB); } +"}" { return (RB); } +"(" { return (LP); } +")" { return (RP); } +"=" { return (EQUALS); } +"~" { return (TILDE); } +":" { return (COLON); } +"+" { return PLUS; } +"-" { return MINUS; } +"|" { return OR; } + +[a-zA-Z\.]+ { int token = parse_keyword (yytext, + &yylval.num); + if (token == ERRORTOKEN) { + twmrc_error_prefix(); + fprintf (stderr, + "ignoring unknown keyword: %s\n", + yytext); + ParseError = 1; + } else + return token; + } + +"!" { yylval.num = F_EXEC; return FSKEYWORD; } +"^" { yylval.num = F_CUT; return FSKEYWORD; } + +{string} { yylval.ptr = (char *)yytext; return STRING; } +{regexp} { yylval.ptr = (char *)yytext; return REGEXP; } +{number} { (void)sscanf((char *)&yytext[0], "%d", &yylval.num); + return (NUMBER); + } +\#[^\n]*\n {;} +[\n\t ] {;} +. { + twmrc_error_prefix(); + fprintf (stderr, + "ignoring character \"%s\"\n", + yytext); + ParseError = 1; + } +%% +#ifndef FLEX_SCANNER +yywrap() { return(1);} + +#undef input +#undef feof +#define feof() (1) +#define input() (*twmInputFunc)() +#endif +#undef output +#define output(c) TwmOutput(c) +#undef unput +#define unput(c) twmUnput(c) diff --git a/list.c b/list.c new file mode 100644 index 0000000..e91a69a --- /dev/null +++ b/list.c @@ -0,0 +1,704 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/********************************************************************** + * + * $XConsortium: list.c,v 1.20 91/01/09 17:13:30 rws Exp $ + * + * TWM code to deal with the name lists for the NoTitle list and + * the AutoRaise list + * + * 11-Apr-88 Tom LaStrange Initial Version. + * + **********************************************************************/ + +/* + * Stolen from TVTWM pl11, updated it to conform to the POSIX 1003.2 + * regex spec, backported VTWM 5.3's internal wildcarding code, and + * made it work without regex support. + * + * D. J. Hawkey Jr. - 10/20/01 + */ + +#include +#include + +#ifndef NO_REGEX_SUPPORT +#include +#include +#endif + +#include "twm.h" +#include "screen.h" +#include "list.h" +#include "gram.h" + +#define REGCOMP_FLAGS (REG_EXTENDED | REG_NOSUB) + +#define strdup Strdup /* avoid conflict with system header files */ +extern char *strdup(char *); + +struct name_list_struct +{ + name_list *next; /* pointer to the next name */ + char *name; /* the name of the window */ +#ifndef NO_REGEX_SUPPORT + regex_t re; /* compile only once */ +#else + char re; /* not used */ +#endif + short type; /* what type of match */ + Atom property; /* if (type == property) */ + char *ptr; /* list dependent data */ +}; + +#ifndef NO_REGEX_SUPPORT +static char buffer[256]; +#endif + +int match(); + +/*********************************************************************** + * + * Wrappers to allow code to step through a list + * + ***********************************************************************/ + +name_list * +next_entry(list) +name_list *list; +{ + return (list->next); +} + +char * +contents_of_entry(list) +name_list *list; +{ + return (list->ptr); +} + +/**********************************************************************/ + +#ifdef DEBUG +static void +printNameList(name, nptr) +char *name; +name_list *nptr; +{ + printf("printNameList(): %s=[", name); + + while (nptr) + { + printf(" '%s':%d", nptr->name, nptr->type); + nptr = nptr->next; + } + + printf(" ]\n"); +} +#endif + +/*********************************************************************** + * + * Procedure: + * AddToList - add a window name to the appropriate list + * + * Inputs: + * list - the address of the pointer to the head of a list + * name - a pointer to the name of the window + * type - a bitmask of what to match against + * property- a window propery to match against + * ptr - pointer to list dependent data + * + * Special Considerations + * If the list does not use the ptr value, a non-null value + * should be placed in it. LookInList returns this ptr value + * and procedures calling LookInList will check for a non-null + * return value as an indication of success. + * + *********************************************************************** + */ + +void +AddToList(list_head, name, type, /*property, */ptr) +name_list **list_head; +char *name; +short type; +/* Atom property; */ +char *ptr; +{ + Atom property = None; + name_list *nptr; + + if (!list_head) return; /* ignore empty inserts */ + + nptr = (name_list *)malloc(sizeof(name_list)); + if (nptr == NULL) + { + fprintf (stderr, "%s: unable to allocate %d bytes for name_list\n", + ProgramName, sizeof(name_list)); + Done(); + } + +#if 0 + while (*list_head) + list_head = &((*list_head)->next); + + nptr->next = NULL; +#else + nptr->next = *list_head; +#endif + + nptr->name = (char *)strdup(name); + if (type & LTYPE_HOST) + { + nptr->type = (type & ~LTYPE_HOST) | LTYPE_PROPERTY; + nptr->property = XA_WM_CLIENT_MACHINE; + } + else + { + nptr->type = type; + nptr->property = property; + } + nptr->ptr = (ptr == NULL) ? (char *)TRUE : ptr; + + *list_head = nptr; +} + + /********************************************************************\ + * * + * New LookInList code by RJC. * + * * + * Since we want to be able to look for multiple matches (eg, to * + * check which relevant icon regions are on the screen), the basic * + * procedure is now MultiLookInList and uses a (pseudo-)continuation * + * to keep track of where it is. * + * * + * LookInList is a trivial specialisation of that. * + * * + * Also, we now allow regular expressions in lists, so here we use * + * Henry Spencer's regular expression code. It is possible that we * + * should pre-compile all the regular expressions for maximum * + * speed. * + * * + \********************************************************************/ + +int +MatchName(name, pattern, compiled, type) +char *name; +char *pattern; +#ifndef NO_REGEX_SUPPORT +regex_t *compiled; +#else +char *compiled; +#endif +short type; +{ +#ifdef DEBUG + fprintf(stderr, "MatchName(): compare '%s' with '%s'\n", name, pattern); +#endif + + if (type & LTYPE_ANYTHING) + return (0); + + if (type & LTYPE_REGEXP) + { +#ifndef NO_REGEX_SUPPORT + regex_t re; + int result; + + if ((result = regcomp(&re, pattern, REGCOMP_FLAGS)) != 0) + { + regerror(result, &re, buffer, sizeof(buffer)); + regfree(&re); + + fprintf(stderr, "%s: (1) regcomp(\"%s\") error: %s\n", + ProgramName, pattern, buffer); + return (result); + } + + result = regexec(&re, name, 0, NULL, 0); + regfree(&re); + + return (result); +#else + fprintf(stderr, "%s: (1) no support for regcomp(\"%s\")\n", + ProgramName, pattern); + return (1); +#endif + } + + if (type & LTYPE_C_REGEXP) + { +#ifndef NO_REGEX_SUPPORT + return (regexec(compiled, name, 0, NULL, 0)); +#else + fprintf(stderr, "%s: no support for regexec(\"%s\")\n", + ProgramName, name); + return (1); +#endif + } + + if (type & LTYPE_STRING) + return (match(pattern, name)); + + fprintf(stderr, "%s: bad list type (%d) comparing \"%s\" with \"%s\"\n", + ProgramName, type, name, pattern); + return (1); +} + +static char * +MultiLookInList(list_head, name, class, /*win, */continuation) +name_list *list_head; +char *name; +XClassHint *class; +/* Window win; */ +name_list **continuation; +{ + name_list *nptr; +#if 0 + Window win = None; +#endif + +#ifdef DEBUG + fprintf(stderr, "MultiLookInList(): looking for '%s'\n", name); +#endif + + for (nptr = list_head ; nptr ; nptr = nptr->next) + { + /* pre-compile and cache the regex_t */ + if (nptr->type & LTYPE_REGEXP) + { +#ifndef NO_REGEX_SUPPORT + int result; + + if ((result = regcomp(&nptr->re, nptr->name, REGCOMP_FLAGS)) != 0) + { + regerror(result, &nptr->re, buffer, sizeof(buffer)); + regfree(&nptr->re); + + fprintf(stderr, "%s: (2) regcomp(\"%s\") error: %s\n", + ProgramName, nptr->name, buffer); + + nptr->type |= LTYPE_NOTHING; + } + else + nptr->type |= LTYPE_C_REGEXP; +#else + fprintf(stderr, "%s: (2) no support for regcomp(\"%s\")\n", + ProgramName, nptr->name); + + nptr->type |= LTYPE_NOTHING; +#endif + + nptr->type &= ~LTYPE_REGEXP; + } + + if (nptr->type & LTYPE_NOTHING) + continue; /* skip illegal entry */ + + if (nptr->type & LTYPE_ANYTHING) + { + *continuation = nptr->next; + return (nptr->ptr); + } + + if (nptr->type & LTYPE_NAME) + if (MatchName(name, nptr->name, &nptr->re, nptr->type) == 0) + { + *continuation = nptr->next; + return (nptr->ptr); + } + + if (class) + { + if (nptr->type & LTYPE_RES_NAME) + if (MatchName(class->res_name, nptr->name, &nptr->re, + nptr->type) == 0) + { + *continuation = nptr->next; + return (nptr->ptr); + } + + if (nptr->type & LTYPE_RES_CLASS) + if (MatchName(class->res_class, nptr->name, &nptr->re, + nptr->type) == 0) + { + *continuation = nptr->next; + return (nptr->ptr); + } + } + +#if 0 + if (win && (nptr->type & LTYPE_PROPERTY)) + { + char *s = GetPropertyString(win, nptr->property); + + if (s && MatchName(s, nptr->name, &nptr->re, nptr->type) == 0) + { + free(s); + + *continuation = nptr->next; + return (nptr->ptr); + } + + if (s) free(s); + } +#endif + } + + *continuation = NULL; + return (NULL); +} + +char * +LookInList(list_head, name, class/*, win*/) +name_list *list_head; +char *name; +XClassHint *class; +/* Window win; */ +{ +#if 0 + name_list *nptr; +#endif + name_list *rest; + char *return_name = MultiLookInList(list_head, name, class, /*win, */&rest); + +#if 0 + if ((Scr->ListRings == TRUE) && (return_name != NULL) + && (list_head->next != NULL)) + { + /* To implement a ring on the linked list where we cant change the */ + /* list_head, use a simple unlink/link-at-end alg. unless you need */ + /* to move the first link. In that case swap the contents of the */ + /* first link with the contents of the second then proceed as */ + /* normal. */ + name_list *tmp_namelist; + + if (list_head->ptr == return_name) + { + char *tmp_name; + short tmp_type; + char *tmp_ptr; + + tmp_name = list_head->name; + tmp_type = list_head->type; + tmp_ptr = list_head->ptr; + + list_head->name = list_head->next->name; + list_head->type = list_head->next->type; + list_head->ptr = list_head->next->ptr; + + list_head->next->name = tmp_name; + list_head->next->type = tmp_type; + list_head->next->ptr = tmp_ptr; + } + + for (nptr = list_head; nptr->next != NULL; nptr = nptr->next) + { + if (nptr->next->ptr == return_name) + break; + } + + if (nptr->next->next != NULL) + { + tmp_namelist = nptr->next; + nptr->next = nptr->next->next; + + for (nptr = nptr->next; nptr->next != NULL; nptr = nptr->next); + nptr->next = tmp_namelist; + nptr->next->next = NULL; + } + } +#endif + + return (return_name); +} + +#if 0 +static char * +MultiLookInNameList(list_head, name, continuation) +name_list *list_head; +char *name; +name_list **continuation; +{ + return (MultiLookInList(list_head, name, NULL, /*None, */continuation)); +} +#endif + +char * +LookInNameList(list_head, name) +name_list *list_head; +char *name; +{ + return (MultiLookInList(list_head, name, NULL, /*None, */&list_head)); +} + +/*********************************************************************** + * + * Procedure: + * GetColorFromList - look through a list for a window name, or class + * + * Returned Value: + * TRUE if the name was found + * FALSE if the name was not found + * + * Inputs: + * list - a pointer to the head of a list + * name - a pointer to the name to look for + * class - a pointer to the class to look for + * + * Outputs: + * ptr - fill in the list value if the name was found + * + *********************************************************************** + */ + +int GetColorFromList(list_head, name, class, /*win, */ptr) +name_list *list_head; +char *name; +XClassHint *class; +/* Window win; */ +Pixel *ptr; +{ + int save; + char *val = LookInList(list_head, name, class/*, win*/); + + if (val) + { + save = Scr->FirstTime; + Scr->FirstTime = TRUE; + GetColor(Scr->Monochrome, ptr, val); + Scr->FirstTime = save; + + return (TRUE); + } + + return (FALSE); +} + +/*********************************************************************** + * + * Procedure: + * FreeList - free up a list + * + *********************************************************************** + */ + +void FreeList(list) +name_list **list; +{ + name_list *nptr; + name_list *tmp; + + for (nptr = *list; nptr != NULL; ) + { + tmp = nptr->next; + +#ifndef NO_REGEX_SUPPORT + if (nptr->type & LTYPE_C_REGEXP) + regfree(&nptr->re); +#endif + free(nptr->name); + free((char *) nptr); + + nptr = tmp; + } + + *list = NULL; +} + +/*********************************************************************** + * + * MSDOS-ish, Unix-ish, VTWM 5.3 wildcard support + * + **********************************************************************/ + +#if 0 +static int is_pattern(p) +char *p; +{ + while (*p) + { + switch (*p++) + { + case '?': + case '*': + case '[': + return (TRUE); + case '\\': + if (!*p++) return (FALSE); + } + } + + return (FALSE); +} +#endif + +#define ABORT 2 + +static int regex_match(); + +static int regex_match_after_star(p, t) +char *p, *t; +{ + register int match; + register int nextp; + + while ((*p == '?') || (*p == '*')) + { + if (*p == '?') + if (!*t++) return (ABORT); + + p++; + } + if (!*p) return (TRUE); + + nextp = *p; + if (nextp == '\\') nextp = p[1]; + + match = FALSE; + while (match == FALSE) + { + if (nextp == *t || nextp == '[') + match = regex_match(p, t); + + if (!*t++) match = ABORT; + } + + return (match); +} + +static int regex_match(p, t) +char *p, *t; +{ + register char range_start, range_end; + int invert; + int member_match; + int loop; + + for (; *p; p++, t++) + { + if (!*t) return ((*p == '*' && *++p == '\0') ? TRUE : ABORT); + + switch (*p) + { + case '?': + break; + case '*': + return (regex_match_after_star(p, t)); + case '[': + { + p++; + invert = FALSE; + if (*p == '!' || *p == '^') + { + invert = TRUE; + p++; + } + + if (*p == ']') return (ABORT); + + member_match = FALSE; + loop = TRUE; + while (loop) + { + if (*p == ']') + { + loop = FALSE; + continue; + } + + if (*p == '\\') + range_start = range_end = *++p; + else + range_start = range_end = *p; + if (!range_start) return (ABORT); + + if (*++p == '-') + { + range_end = *++p; + if (range_end == '\0' || range_end == ']') + return (ABORT); + + if (range_end == '\\') + range_end = *++p; + p++; + } + + if (range_start < range_end) + { + if (*t >= range_start && *t <= range_end) + { + member_match = TRUE; + loop = FALSE; + } + } + else + { + if (*t >= range_end && *t <= range_start) + { + member_match = TRUE; + loop = FALSE; + } + } + } + + if ((invert && member_match) || !(invert || member_match)) + return (FALSE); + + if (member_match) + { + while (*p != ']') + { + if (!*p) return (ABORT); + + if (*p == '\\') p++; + p++; + } + } + break; + } + case '\\': + p++; + + default: + if (*p != *t) return (FALSE); + } + } + + return (!*t); +} + +int match(p, t) +char *p, *t; +{ + if ((p == NULL) || (t == NULL)) return (TRUE); + + return ((regex_match(p, t) == TRUE) ? FALSE : TRUE); +} diff --git a/list.h b/list.h new file mode 100644 index 0000000..0971d8c --- /dev/null +++ b/list.h @@ -0,0 +1,72 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/********************************************************************** + * + * $XConsortium: list.h,v 1.12 90/09/14 14:54:42 converse Exp $ + * + * TWM list handling external definitions + * + * 11-Apr-88 Tom LaStrange Initial Version. + * + **********************************************************************/ + +#ifndef _LIST_ +#define _LIST_ + +#define LTYPE_NAME (1<<0) /* match against window name */ +#define LTYPE_RES_NAME (1<<1) /* match against resource name */ +#define LTYPE_RES_CLASS (1<<2) /* match against resource class */ +#define LTYPE_PROPERTY (1<<3) /* match against a window property */ +#define LTYPE_HOST (1<<4) /* match against a host name */ + +#define LTYPE_REGEXP (1<<8) /* match as a regular expression */ +#define LTYPE_C_REGEXP (1<<9) /* match as a compiled regexp */ +#define LTYPE_STRING (1<<10) /* match as an exact string */ +#define LTYPE_ANYTHING (1<<11) /* match anything */ +#define LTYPE_NOTHING (1<<12) /* match nothing */ + +#define LTYPE_ANY_STRING (LTYPE_NAME | LTYPE_RES_NAME | \ + LTYPE_RES_CLASS | LTYPE_STRING) +#define LTYPE_ANY_REGEXP (LTYPE_NAME | LTYPE_RES_NAME | \ + LTYPE_RES_CLASS | LTYPE_REGEXP) +#define LTYPE_EXACT_NAME (LTYPE_NAME | LTYPE_STRING) + +typedef struct name_list_struct name_list; + +extern void AddToList(); +extern char *LookInList(); +extern char *LookInNameList(); +extern int GetColorFromList(); +extern void FreeList(); + +extern name_list *next_entry(); +extern char *contents_of_entry(); + +#endif /* _LIST_ */ + diff --git a/menus.c b/menus.c new file mode 100644 index 0000000..63072a8 --- /dev/null +++ b/menus.c @@ -0,0 +1,6773 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + +/*********************************************************************** + * + * $XConsortium: menus.c,v 1.186 91/07/17 13:58:00 dave Exp $ + * + * twm menu code + * + * 17-Nov-87 Thomas E. LaStrange File created + * + ***********************************************************************/ + +#include +#include +/* djhjr - 10/27/02 */ +#ifndef NO_REGEX_SUPPORT +#include +#include +#endif +#include +#include +#include +#include +#include +#ifdef NEED_PROCESS_H +#include +#endif +#include /* DSE */ +#include "twm.h" +#include "gc.h" +#include "menus.h" +#include "resize.h" +#include "events.h" +#include "util.h" +#include "parse.h" +#include "gram.h" +#include "screen.h" +#include "doors.h" +#include "desktop.h" +#include "add_window.h" +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +#include "sound.h" +#endif +#include "version.h" + +#define strdup Strdup /* avoid conflict with system header files */ +extern char *strdup(char *); + +extern void IconUp(), IconDown(), CreateIconWindow(); + +/* djhjr - 4/26/99 */ +extern void AppletDown(); + +/* djhjr - 12/2/01 */ +extern void delete_pidfile(); + +/* djhjr - 10/27/02 */ +extern int MatchName(); + +extern void ResizeTwmWindowContents(); +extern void SetRaiseWindow(); + +extern char *Action; +extern int Context; +extern int ConstrainedMoveTime; +extern TwmWindow *ButtonWindow, *Tmp_win; +extern XEvent Event, ButtonEvent; +extern char *InitFile; + +int RootFunction = F_NOFUNCTION; +MenuRoot *ActiveMenu = NULL; /* the active menu */ +MenuItem *ActiveItem = NULL; /* the active menu item */ +int MoveFunction = F_NOFUNCTION; /* or F_MOVE or F_FORCEMOVE */ +int WindowMoved = FALSE; +int menuFromFrameOrWindowOrTitlebar = FALSE; +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +int createSoundFromFunction = FALSE; +int destroySoundFromFunction = FALSE; +#endif + +void BumpWindowColormap(); +void DestroyMenu(); +void HideIconManager(); +void MakeMenu(); +void SendDeleteWindowMessage(); +void SendSaveYourselfMessage(); +void WarpClass(); +void WarpToScreen(); +void WarpScreenToWindow(); +Cursor NeedToDefer(); /* was an 'int' - Submitted by Michel Eyckmans */ + +int ConstMove = FALSE; /* constrained move variables */ + +/* for comparison against MoveDelta - djhjr - 9/5/98 */ +static int MenuOrigX, MenuOrigY; + +/* Globals used to keep track of whether the mouse has moved during + a resize function. */ +int ResizeOrigX; +int ResizeOrigY; + +extern int origx, origy, origWidth, origHeight; + +int MenuDepth = 0; /* number of menus up */ +static struct { + int x; + int y; +} MenuOrigins[MAXMENUDEPTH]; +static Cursor LastCursor; + +static char *actionHack = ""; /* Submitted by Michel Eyckmans */ + +/* + * context bitmaps for TwmWindows menu, f.showdesktop and f.showiconmgr + * djhjr - 9/10/99 + */ +static int have_twmwindows = -1; +static int have_showdesktop = -1; +static int have_showlist = -1; + +void WarpAlongRing(); + +/* djhjr - 4/18/96 */ +void Paint3DEntry(); + +static void Identify(); +void PaintNormalEntry(); + +/* djhjr - 5/13/98 */ +static TwmWindow *next_by_class(); +static int warp_if_warpunmapped(); + +/* djhjr - 7/31/98 */ +static void setup_restart(); +void RestartVtwm(); + +/* djhjr - 9/21/99 */ +int FindMenuOrFuncInBindings(); +int FindMenuOrFuncInWindows(); +int FindMenuInMenus(); +int FindFuncInMenus(); + +/* djhjr - 9/21/99 */ +void HideIconMgr(); +void ShowIconMgr(); + +/* djhjr - 9/17/02 */ +static int do_squeezetitle(); + +/* djhjr */ +#undef MAX +/* DSE */ +#define MAX(x,y) ((x)>(y)?(x):(y)) + +#define SHADOWWIDTH 5 /* in pixels */ + +#define EDGE_OFFSET 5 /* DSE */ + +/* djhjr - 5/5/98 +#define PULLDOWNMENU_OFFSET ((Scr->RightHandSidePulldownMenus)?\ + (ActiveMenu->width - EDGE_OFFSET * 2 - Scr->pullW):\ + (ActiveMenu->width >> 1)) * DSE * +*/ +#define PULLDOWNMENU_OFFSET ((Scr->RightHandSidePulldownMenus)?\ + (JunkWidth - EDGE_OFFSET * 2 - Scr->pullW):\ + (JunkWidth >> 1)) + + + +/*********************************************************************** + * + * Procedure: + * InitMenus - initialize menu roots + * + *********************************************************************** + */ + +void +InitMenus() +{ + int i, j, k; + FuncKey *key, *tmp; + + for (i = 0; i < MAX_BUTTONS+1; i++) + for (j = 0; j < NUM_CONTEXTS; j++) + for (k = 0; k < MOD_SIZE; k++) + { + Scr->Mouse[i][j][k].func = F_NOFUNCTION; + Scr->Mouse[i][j][k].item = NULL; + } + + Scr->DefaultFunction.func = F_NOFUNCTION; + Scr->WindowFunction.func = F_NOFUNCTION; + + if (FirstScreen) + { + for (key = Scr->FuncKeyRoot.next; key != NULL;) + { + free(key->name); + tmp = key; + key = key->next; + free((char *) tmp); + } + Scr->FuncKeyRoot.next = NULL; + } +} + + + +/*********************************************************************** + * + * Procedure: + * AddFuncKey - add a function key to the list + * + * Inputs: + * name - the name of the key + * cont - the context to look for the key press in + * mods - modifier keys that need to be pressed + * func - the function to perform + * win_name- the window name (if any) + * action - the action string associated with the function (if any) + * + *********************************************************************** + */ + +Bool AddFuncKey (name, cont, mods, func, win_name, action) + char *name; + int cont, mods, func; + char *win_name; + char *action; +{ + FuncKey *tmp; + KeySym keysym; + KeyCode keycode; + + /* + * Don't let a 0 keycode go through, since that means AnyKey to the + * XGrabKey call in GrabKeys(). + */ + if ((keysym = XStringToKeysym(name)) == NoSymbol || + (keycode = XKeysymToKeycode(dpy, keysym)) == 0) + { + return False; + } + + /* see if there already is a key defined for this context */ + for (tmp = Scr->FuncKeyRoot.next; tmp != NULL; tmp = tmp->next) + { + if (tmp->keysym == keysym && + tmp->cont == cont && + tmp->mods == mods) + break; + } + + if (tmp == NULL) + { + tmp = (FuncKey *) malloc(sizeof(FuncKey)); + tmp->next = Scr->FuncKeyRoot.next; + Scr->FuncKeyRoot.next = tmp; + } + + tmp->name = name; + tmp->keysym = keysym; + tmp->keycode = keycode; + tmp->cont = cont; + tmp->mods = mods; + tmp->func = func; + tmp->win_name = win_name; + tmp->action = action; + + return True; +} + + + +int CreateTitleButton (name, func, action, menuroot, rightside, append) + char *name; + int func; + char *action; + MenuRoot *menuroot; + Bool rightside; + Bool append; +{ + TitleButton *tb = (TitleButton *) malloc (sizeof(TitleButton)); + + if (!tb) { + fprintf (stderr, + "%s: unable to allocate %d bytes for title button\n", + ProgramName, sizeof(TitleButton)); + return 0; + } + + tb->next = NULL; + tb->name = name; /* note that we are not copying */ + +/* djhjr - 10/30/02 + * djhjr - 4/19/96 * + tb->image = NULL; +*/ + +/* tb->bitmap = None;*/ /* WARNING, values not set yet */ + tb->width = 0; /* see InitTitlebarButtons */ + tb->height = 0; /* ditto */ + tb->func = func; + tb->action = action; + tb->menuroot = menuroot; + tb->rightside = rightside; + if (rightside) { + Scr->TBInfo.nright++; + } else { + Scr->TBInfo.nleft++; + } + + /* + * Cases for list: + * + * 1. empty list, prepend left put at head of list + * 2. append left, prepend right put in between left and right + * 3. append right put at tail of list + * + * Do not refer to widths and heights yet since buttons not created + * (since fonts not loaded and heights not known). + */ + if ((!Scr->TBInfo.head) || ((!append) && (!rightside))) { /* 1 */ + tb->next = Scr->TBInfo.head; + Scr->TBInfo.head = tb; + } else if (append && rightside) { /* 3 */ + register TitleButton *t; + + for (t = Scr->TBInfo.head; t->next; t = t->next) + ; /* SUPPRESS 530 */ + t->next = tb; + tb->next = NULL; + } else { /* 2 */ + register TitleButton *t, *prev = NULL; + + for (t = Scr->TBInfo.head; t && !t->rightside; t = t->next) + prev = t; + if (prev) { + tb->next = prev->next; + prev->next = tb; + } else { + tb->next = Scr->TBInfo.head; + Scr->TBInfo.head = tb; + } + } + + return 1; +} + + + +/* + * InitTitlebarButtons - Do all the necessary stuff to load in a titlebar + * button. If we can't find the button, then put in a question; if we can't + * find the question mark, something is wrong and we are probably going to be + * in trouble later on. + */ +/* was of type 'void', now returns button height - djhjr - 12/10/98 */ +int InitTitlebarButtons () +{ + Image *image; + TitleButton *tb; + int h, height; + + /* + * initialize dimensions + */ + Scr->TBInfo.width = (Scr->TitleHeight - + 2 * (Scr->FramePadding + Scr->ButtonIndent)); + +/* djhjr - 10/18/02 + * djhjr - 4/19/96 * + * was 'Scr->use3Dtitles' - djhjr - 8/11/98 * + if (Scr->TitleBevelWidth > 0) + Scr->TBInfo.pad = ((Scr->TitlePadding > 1) + ? ((Scr->TitlePadding + 1) / 2) : 0); + else + + Scr->TBInfo.pad = ((Scr->TitlePadding > 1) + ? ((Scr->TitlePadding + 1) / 2) : 1); +*/ + Scr->TBInfo.pad = Scr->TitlePadding; + + h = Scr->TBInfo.width - 2 * Scr->TBInfo.border; + /* djhjr - 10/30/02 */ + if (!(h & 1)) h--; + height = h; + + /* + * add in some useful buttons and bindings so that novices can still + * use the system. -- modified by DSE + */ + + if (!Scr->NoDefaultTitleButtons) /* DSE */ + { + /* insert extra buttons */ + + /* djhjr - 4/19/96 */ + /* was 'Scr->use3Dtitles' - djhjr - 8/11/98 */ + if (Scr->TitleBevelWidth > 0) { + if (!CreateTitleButton (TBPM_3DDOT, F_ICONIFY, "", (MenuRoot *) NULL, + False, False)) + fprintf (stderr, "%s: unable to add iconify button\n", ProgramName); + if (!CreateTitleButton (TBPM_3DRESIZE, F_RESIZE, "", (MenuRoot *) NULL, + True, True)) + fprintf (stderr, "%s: unable to add resize button\n", ProgramName); + } + else { + + if (!CreateTitleButton (TBPM_ICONIFY, F_ICONIFY, "", (MenuRoot *) NULL, + False, False)) + fprintf(stderr,"%s: unable to add iconify button\n",ProgramName); + if (!CreateTitleButton (TBPM_RESIZE, F_RESIZE, "", (MenuRoot *) NULL, + True, True)) + fprintf(stderr,"%s: unable to add resize button\n",ProgramName); + } + } + if (!Scr->NoDefaultMouseOrKeyboardBindings) /* DSE */ + { + AddDefaultBindings (); + } + + ComputeCommonTitleOffsets (); + +/* djhjr - 6/15/98 - moved it back to here... */ +/* djhjr - 9/14/96 - moved to CreateWindowTitlebarButtons()... */ + /* + * load in images and do appropriate centering + */ + for (tb = Scr->TBInfo.head; tb; tb = tb->next) { + +/* djhjr - 4/19/96 + tb->bitmap = FindBitmap (tb->name, &tb->width, &tb->height); + if (!tb->bitmap) { + tb->bitmap = FindBitmap (TBPM_QUESTION, &tb->width, &tb->height); + if (!tb->bitmap) { * cannot happen (see util.c) * + fprintf (stderr, + "%s: unable to add titlebar button \"%s\"\n", + ProgramName, tb->name); + } + } +*/ +/* djhjr - 9/21/96 + tb->image = GetImage (tb->name, Scr->TitleC); + if (!tb->image) { + tb->image = GetImage (TBPM_QUESTION, Scr->TitleC); + if (!tb->image) { * cannot happen (see util.c) * + fprintf (stderr, "%s: unable to add titlebar button \"%s\"\n", + ProgramName, tb->name); + } + } +*/ + /* added width and height - 10/30/02 */ + image = GetImage (tb->name, h, h, Scr->ButtonBevelWidth * 2, + (Scr->ButtonColorIsFrame) ? Scr->BorderColorC : Scr->TitleC); + + tb->width = image->width; + + /* added 'height = ' - djhjr - 12/10/98 */ + height = tb->height = image->height; + + tb->dstx = (h - tb->width + 1) / 2; + if (tb->dstx < 0) { /* clip to minimize copying */ + tb->srcx = -(tb->dstx); + tb->width = h; + tb->dstx = 0; + } else { + tb->srcx = 0; + } + tb->dsty = (h - tb->height + 1) / 2; + if (tb->dsty < 0) { + tb->srcy = -(tb->dsty); + tb->height = h; + tb->dsty = 0; + } else { + tb->srcy = 0; + } + + } /* for(...) */ + + /* djhjr - 12/10/98 */ + return (height > h) ? height : h; +/* ...end of moved */ +} + + + +/* djhjr - 10/30/02 */ +void SetMenuIconPixmap(filename) + char *filename; +{ + Scr->menuIconName = filename; +} + +void PaintEntry(mr, mi, exposure) +MenuRoot *mr; +MenuItem *mi; +int exposure; +{ + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0) + Paint3DEntry (mr, mi, exposure); + + /* djhjr - 4/22/96 */ + else + + PaintNormalEntry (mr, mi, exposure); +} + +void Paint3DEntry(mr, mi, exposure) +MenuRoot *mr; +MenuItem *mi; +int exposure; +{ + int y_offset; + int text_y; + GC gc; + +/* djhjr - 4/29/98 + y_offset = mi->item_num * Scr->EntryHeight + 2; +*/ +/* djhjr - 5/22/00 + y_offset = mi->item_num * Scr->EntryHeight + Scr->MenuBevelWidth; +*/ + y_offset = (mi->item_num - mr->top) * Scr->EntryHeight + Scr->MenuBevelWidth; + +/* djhjr - 9/25/96 + text_y = y_offset + Scr->MenuFont.y + 2; +*/ + text_y = y_offset + (((Scr->EntryHeight - Scr->MenuFont.height) / 2) + Scr->MenuFont.y); + + if (mi->func != F_TITLE) + { + int x, y; + + if (mi->state) + { + +/* djhjr - 9/25/96 + Draw3DBorder (mr->w, 2, y_offset, mr->width - 4, Scr->EntryHeight, 1, + mi->highlight, off, True, False); +*/ +/* djhjr - 4/29/98 + Draw3DBorder (mr->w, 2, y_offset + 1, mr->width - 4, Scr->EntryHeight - 1, 1, + mi->highlight, off, True, False); +*/ + Draw3DBorder (mr->w, Scr->MenuBevelWidth, y_offset + 1, mr->width - 2 * Scr->MenuBevelWidth, Scr->EntryHeight - 1, 1, + mi->highlight, off, True, False); + + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(mi->highlight.fore, mi->highlight.back, Scr->MenuFont); + +/* djhjr - 4/29/98 + XDrawImageString(dpy, mr->w, Scr->NormalGC, mi->x + 2, text_y, mi->item, mi->strlen); +*/ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString(dpy, mr->w, &Scr->MenuFont, +#else + XDrawImageString(dpy, mr->w, +#endif + Scr->NormalGC, mi->x + Scr->MenuBevelWidth, text_y, mi->item, mi->strlen); + + gc = Scr->NormalGC; + } + else + { + if (mi->user_colors || !exposure) + { + XSetForeground (dpy, Scr->NormalGC, mi->normal.back); + +/* djhjr - 9/25/96 + XFillRectangle (dpy, mr->w, Scr->NormalGC, 2, y_offset, + mr->width - 4, Scr->EntryHeight); +*/ +/* djhjr - 4/29/98 + XFillRectangle (dpy, mr->w, Scr->NormalGC, 2, y_offset + 1, + mr->width - 4, Scr->EntryHeight - 1); +*/ + XFillRectangle (dpy, mr->w, Scr->NormalGC, Scr->MenuBevelWidth, y_offset + 1, + mr->width - 2 * Scr->MenuBevelWidth, Scr->EntryHeight - 1); + + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF (mi->normal.fore, mi->normal.back, Scr->MenuFont); + + gc = Scr->NormalGC; + } + else + { + gc = Scr->MenuGC; + } + +/* djhjr - 4/29/98 + XDrawImageString (dpy, mr->w, gc, mi->x + 2, text_y, mi->item, mi->strlen); +*/ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString (dpy, mr->w, &Scr->MenuFont, +#else + XDrawImageString (dpy, mr->w, +#endif + gc, mi->x + Scr->MenuBevelWidth, text_y, mi->item, mi->strlen); + + if (mi->separated) + { + /* this 'if (...)' - djhjr - 1/19/98 */ + if (!Scr->BeNiceToColormap) + { + FB (Scr->MenuC.shadd, Scr->MenuC.shadc); + +/* djhjr - 9/25/96 + XDrawLine (dpy, mr->w, Scr->NormalGC, 1, y_offset + Scr->MenuFont.y + 5, + mr->width - 2, y_offset + Scr->MenuFont.y + 5); +*/ +/* djhjr - 4/29/98 + XDrawLine (dpy, mr->w, Scr->NormalGC, 1, y_offset + Scr->EntryHeight - 1, + mr->width - 2, y_offset + Scr->EntryHeight - 1); +*/ + XDrawLine (dpy, mr->w, Scr->NormalGC, Scr->MenuBevelWidth + 1, y_offset + Scr->EntryHeight - 1, + mr->width - Scr->MenuBevelWidth - 3, y_offset + Scr->EntryHeight - 1); + } + + FB (Scr->MenuC.shadc, Scr->MenuC.shadd); + +/* djhjr - 9/25/96 + XDrawLine (dpy, mr->w, Scr->NormalGC, 2, y_offset + Scr->MenuFont.y + 6, + mr->width - 3, y_offset + Scr->MenuFont.y + 6); +*/ +/* djhjr - 4/29/98 + XDrawLine (dpy, mr->w, Scr->NormalGC, 2, y_offset + Scr->EntryHeight, + mr->width - 3, y_offset + Scr->EntryHeight); +*/ + XDrawLine (dpy, mr->w, Scr->NormalGC, Scr->MenuBevelWidth + 2, y_offset + Scr->EntryHeight, + mr->width - Scr->MenuBevelWidth - 2, y_offset + Scr->EntryHeight); + } + } + + if (mi->func == F_MENU) + { +/* djhjr - 10/30/02 + * create the pull right pixmap if needed * + if (Scr->pullPm == None) + { + Scr->pullPm = Create3DMenuIcon (Scr->MenuFont.height, &Scr->pullW, + &Scr->pullH, Scr->MenuC); +*/ + Image *image; + Pixel back; + + back = Scr->MenuC.back; + if (mi->state) + Scr->MenuC.back = mi->highlight.back; + else + Scr->MenuC.back = mi->normal.back; + + Scr->pullW = Scr->pullH = Scr->MenuFont.height; + image = GetImage(Scr->menuIconName, + Scr->pullW, Scr->pullH, + 0, Scr->MenuC); + + Scr->MenuC.back = back; +/* djhjr - 10/30/02 + } +*/ + +/* djhjr - 4/29/98 + x = mr->width - Scr->pullW - 5; +*/ + x = mr->width - Scr->pullW - Scr->MenuBevelWidth - EDGE_OFFSET; + +/* djhjr - 9/25/96 + y = y_offset + ((Scr->MenuFont.height - Scr->pullH) / 2) + 2; +*/ + y = y_offset + ((Scr->EntryHeight - Scr->pullH) / 2) + 1; + + XCopyArea (dpy, image->pixmap, mr->w, gc, 0, 0, Scr->pullW, Scr->pullH, x, y); + } + } + else + { + +/* djhjr - 4/29/96 + Draw3DBorder (mr->w, 2, y_offset, mr->width - 4, Scr->EntryHeight, 1, + mi->normal, off, True, False); +*/ +/* djhjr - 4/29/98 + Draw3DBorder (mr->w, 2, y_offset, mr->width - 4, Scr->EntryHeight + 1, 1, + mi->normal, off, True, False); +*/ + Draw3DBorder (mr->w, Scr->MenuBevelWidth, y_offset, mr->width - 2 * Scr->MenuBevelWidth, Scr->EntryHeight + 1, 1, + mi->normal, off, True, False); + +/* djhjr - 4/29/96 + FBF (mi->normal.fore, mi->normal.back, Scr->MenuFont.font->fid); +*/ + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF (mi->normal.fore, mi->normal.back, Scr->MenuTitleFont); + +/* djhjr - 9/25/96 + XDrawImageString (dpy, mr->w, Scr->NormalGC, mi->x + 2, text_y, mi->item, mi->strlen); +*/ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString (dpy, mr->w, &Scr->MenuTitleFont, +#else + XDrawImageString (dpy, mr->w, +#endif + Scr->NormalGC, mi->x, text_y, mi->item, mi->strlen); + } +} + + + +void PaintNormalEntry(mr, mi, exposure) +MenuRoot *mr; +MenuItem *mi; +int exposure; +{ + int y_offset; + int text_y; + GC gc; + +/* djhjr - 5/22/00 + y_offset = mi->item_num * Scr->EntryHeight; +*/ + y_offset = (mi->item_num - mr->top) * Scr->EntryHeight; + +/* djhjr - 9/26/96 + text_y = y_offset + Scr->MenuFont.y; +*/ + text_y = y_offset + (((Scr->EntryHeight - Scr->MenuFont.height) / 2) + Scr->MenuFont.y); + + if (mi->func != F_TITLE) + { + int x, y; + + if (mi->state) + { + XSetForeground(dpy, Scr->NormalGC, mi->highlight.back); + + XFillRectangle(dpy, mr->w, Scr->NormalGC, 0, y_offset, + mr->width, Scr->EntryHeight); + + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(mi->highlight.fore, mi->highlight.back, Scr->MenuFont); + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString(dpy, mr->w, &Scr->MenuFont, +#else + XDrawString(dpy, mr->w, +#endif + Scr->NormalGC, mi->x, + text_y, mi->item, mi->strlen); + + gc = Scr->NormalGC; + } + else + { + if (mi->user_colors || !exposure) + { + XSetForeground(dpy, Scr->NormalGC, mi->normal.back); + + XFillRectangle(dpy, mr->w, Scr->NormalGC, 0, y_offset, + mr->width, Scr->EntryHeight); + + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(mi->normal.fore, mi->normal.back, Scr->MenuFont); + + gc = Scr->NormalGC; + } + else + { + gc = Scr->MenuGC; + } + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString(dpy, mr->w, &Scr->MenuFont, +#else + XDrawString(dpy, mr->w, +#endif + gc, mi->x, text_y, mi->item, mi->strlen); + + if (mi->separated) + +/* djhjr - 9/26/96 + XDrawLine (dpy, mr->w, gc, 0, y_offset + Scr->MenuFont.y + 5, + mr->width, y_offset + Scr->MenuFont.y + 5); +*/ + XDrawLine (dpy, mr->w, gc, 0, y_offset + Scr->EntryHeight - 1, + mr->width, y_offset + Scr->EntryHeight - 1); + } + + if (mi->func == F_MENU) + { +/* djhjr - 10/30/02 + * create the pull right pixmap if needed * + if (Scr->pullPm == None) + { + Scr->pullPm = CreateMenuIcon (Scr->MenuFont.height, + &Scr->pullW, &Scr->pullH); +*/ + Image *image; + ColorPair cp; + + cp.back = Scr->MenuC.back; + if (strncmp(Scr->menuIconName, ":xpm:", 5) != 0) + { + cp.fore = Scr->MenuC.fore; + Scr->MenuC.fore = (mi->state) ? mi->highlight.fore : mi->normal.fore; + Scr->MenuC.back = (mi->state) ? mi->highlight.back : mi->normal.back; + } + else + Scr->MenuC.back = (mi->state) ? mi->highlight.back : mi->normal.back; + + Scr->pullW = Scr->pullH = Scr->MenuFont.height; + image = GetImage(Scr->menuIconName, + Scr->pullW, Scr->pullH, + 0, Scr->MenuC); + + Scr->MenuC.back = cp.back; + if (strncmp(Scr->menuIconName, ":xpm:", 5) != 0) + Scr->MenuC.fore = cp.fore; +/* djhjr - 10/30/02 + } +*/ + + x = mr->width - Scr->pullW - EDGE_OFFSET; + +/* djhjr - 9/26/96 + y = y_offset + ((Scr->MenuFont.height - Scr->pullH) / 2); +*/ + y = y_offset + ((Scr->EntryHeight - Scr->pullH) / 2); + +/* djhjr - 10/30/02 + XCopyPlane(dpy, Scr->pullPm->pixmap, mr->w, gc, 0, 0, + Scr->pullW, Scr->pullH, x, y, 1); +*/ + XCopyArea (dpy, image->pixmap, mr->w, gc, 0, 0, + Scr->pullW, Scr->pullH, x, y); + } + } + else + { + int y; + + XSetForeground(dpy, Scr->NormalGC, mi->normal.back); + + /* fill the rectangle with the title background color */ + XFillRectangle(dpy, mr->w, Scr->NormalGC, 0, y_offset, + mr->width, Scr->EntryHeight); + + XSetForeground(dpy, Scr->NormalGC, mi->normal.fore); + + /* now draw the dividing lines */ + if (y_offset) + XDrawLine (dpy, mr->w, Scr->NormalGC, 0, y_offset, + mr->width, y_offset); + + y = ((mi->item_num+1) * Scr->EntryHeight)-1; + XDrawLine(dpy, mr->w, Scr->NormalGC, 0, y, mr->width, y); + +/* djhjr - 4/29/96 + FBF(mi->normal.fore, mi->normal.back, Scr->MenuFont.font->fid); +*/ + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF (mi->normal.fore, mi->normal.back, Scr->MenuTitleFont); + + /* finally render the title */ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString(dpy, mr->w, &Scr->MenuTitleFont, +#else + XDrawString(dpy, mr->w, +#endif + Scr->NormalGC, mi->x, text_y, mi->item, mi->strlen); + } +} + +void PaintMenu(mr, e) +MenuRoot *mr; +XEvent *e; +{ + MenuItem *mi; + /* djhjr - 5/22/00 */ + int y_offset; + + /* djhjr - 4/22/96 */ + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0) { +/* djhjr - 4/29/98 + Draw3DBorder (mr->w, 0, 0, mr->width, mr->height, 2, Scr->MenuC, off, False, False); +*/ + Draw3DBorder (mr->w, 0, 0, mr->width, mr->height, Scr->MenuBevelWidth, Scr->MenuC, off, False, False); + } + + for (mi = mr->first; mi != NULL; mi = mi->next) + { + /* djhjr - 5/22/00 */ + if (mi->item_num < mr->top) continue; + +/* djhjr - 5/22/00 + int y_offset = mi->item_num * Scr->EntryHeight; +*/ + y_offset = (mi->item_num - mr->top) * Scr->EntryHeight; + + /* djhjr - 5/22/00 */ + if (y_offset + Scr->EntryHeight > mr->height) break; + + /* some servers want the previous entry redrawn - djhjr - 10/24/00 */ + if (Scr->MenuBevelWidth > 0) y_offset += Scr->EntryHeight; + + /* + * Be smart about handling the expose, redraw only the entries + * that we need to. + */ + /* those servers want the next entry redrawn, too - djhjr - 10/24/00 */ + if (e->xexpose.y < (y_offset + Scr->EntryHeight) && + (e->xexpose.y + e->xexpose.height) > y_offset - ((mr->shadow) ? Scr->EntryHeight : 0)) + { + PaintEntry(mr, mi, True); + } + } + XSync(dpy, 0); +} + + + +static Bool fromMenu; + +extern int GlobalFirstTime; /* for StayUpMenus -- PF */ + +void UpdateMenu() +{ + MenuItem *mi; + int i, x, y, x_root, y_root, entry; + int done; + MenuItem *badItem = NULL; + static int firstTime = True; + + fromMenu = TRUE; + + while (TRUE) + { /* block until there is an event */ +#ifdef NEVER /* see the '#else' - Steve Ratcliffe */ +#if 0 + if (!menuFromFrameOrWindowOrTitlebar && ! Scr->StayUpMenus) { + XMaskEvent(dpy, + ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | ExposureMask | + VisibilityChangeMask | LeaveWindowMask | + ButtonMotionMask, &Event); + } + if (Event.type == MotionNotify) { + /* discard any extra motion events before a release */ + while(XCheckMaskEvent(dpy, + ButtonMotionMask | ButtonReleaseMask, &Event)) + if (Event.type == ButtonRelease) + break; + } +#else + while (XCheckMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | ExposureMask, &Event)) + { /* taken from tvtwm */ +#endif /* 0 */ +#else + /* Submitted by Steve Ratcliffe */ + XNextEvent(dpy, &Event); +#endif /* NEVER */ + + if (!DispatchEvent ()) continue; + + if (Event.type == ButtonRelease ) + { if (Scr->StayUpMenus) + { + if (firstTime == True) + { /* it was the first release of the button */ + firstTime = False; + } + else + { /* thats the second we need to return now */ + firstTime = True; + menuFromFrameOrWindowOrTitlebar = FALSE; + fromMenu = FALSE; + return; + } + } + else + { /* not stay-up */ + menuFromFrameOrWindowOrTitlebar = FALSE; + fromMenu = FALSE; + return; + } + } + + if (Cancel) return; + +#ifdef NEVER /* see the above - Steve Ratcliffe */ + } +#endif + + /* re-instated - Steve Ratcliffe */ + if (Event.type != MotionNotify) + continue; + + /* if we haven't received the enter notify yet, wait */ + if (!ActiveMenu || !ActiveMenu->entered) + continue; + + done = FALSE; + XQueryPointer( dpy, ActiveMenu->w, &JunkRoot, &JunkChild, + &x_root, &y_root, &x, &y, &JunkMask); + + /* djhjr - 9/5/98 */ + if (!ActiveItem) + if (abs(x_root - MenuOrigX) < Scr->MoveDelta && + abs(y_root - MenuOrigY) < Scr->MoveDelta) + continue; + +#if 0 + /* if we haven't recieved the enter notify yet, wait */ + if (ActiveMenu && !ActiveMenu->entered) + continue; +#endif + + XFindContext(dpy, ActiveMenu->w, ScreenContext, (caddr_t *)&Scr); + + JunkWidth = ActiveMenu->width; + JunkHeight = ActiveMenu->height; + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0) + { + x -= Scr->MenuBevelWidth; + y -= Scr->MenuBevelWidth; + + JunkWidth -= 2 * Scr->MenuBevelWidth; + JunkHeight -= Scr->MenuBevelWidth; + } + +/* djhjr - 5/22/00 + if (x < 0 || y < 0 || x >= JunkWidth || y >= JunkHeight) +*/ + if ((x < 0 || y < 0 || x >= JunkWidth || y >= JunkHeight) || + (ActiveMenu->too_tall && (y < Scr->MenuScrollBorderWidth || + y > JunkHeight - Scr->MenuScrollBorderWidth))) + { + if (ActiveItem && ActiveItem->func != F_TITLE) + { + ActiveItem->state = 0; + PaintEntry(ActiveMenu, ActiveItem, False); + } + ActiveItem = NULL; + + /* menu scrolling - djhjr - 5/22/00 */ + if (ActiveMenu->too_tall && x >= 0 && x < JunkWidth) + { + short j = ActiveMenu->top; + + if (y < Scr->MenuScrollBorderWidth) + { + if (ActiveMenu->top - Scr->MenuScrollJump < 0) + continue; + else + j -= Scr->MenuScrollJump; + } + else if (y > JunkHeight - Scr->MenuScrollBorderWidth) + { + int k = JunkHeight / Scr->EntryHeight; + + if (ActiveMenu->top + k >= ActiveMenu->items) + continue; + else + j += Scr->MenuScrollJump; + } + + if (ActiveMenu->top != j) + { + ActiveMenu->top = j; + XClearArea(dpy, ActiveMenu->w, 0, 0, 0, 0, True); + } + } + + continue; + } + + /* look for the entry that the mouse is in */ +/* djhjr - 5/22/00 + entry = y / Scr->EntryHeight; +*/ + entry = (y / Scr->EntryHeight) + ActiveMenu->top; + for (i = 0, mi = ActiveMenu->first; mi != NULL; i++, mi=mi->next) + { + if (i == entry) + break; + } + + /* if there is an active item, we might have to turn it off */ + if (ActiveItem) + { + /* is the active item the one we are on ? */ + if (ActiveItem->item_num == entry && ActiveItem->state) + done = TRUE; + + /* if we weren't on the active entry, let's turn the old + * active one off + */ + if (!done && ActiveItem->func != F_TITLE) + { + ActiveItem->state = 0; + PaintEntry(ActiveMenu, ActiveItem, False); + } + } + + /* djhjr - 5/22/00 */ + if (ActiveMenu->too_tall && y + Scr->EntryHeight > JunkHeight) + continue; + + /* if we weren't on the active item, change the active item and turn + * it on + */ + if (!done) + { + ActiveItem = mi; + +/* djhjr - 5/20/98 + if (ActiveItem->func != F_TITLE && !ActiveItem->state) +*/ + if (ActiveItem && ActiveItem->func != F_TITLE && !ActiveItem->state) + { + ActiveItem->state = 1; + PaintEntry(ActiveMenu, ActiveItem, False); + + if (Scr->StayUpOptionalMenus) /* PF */ + GlobalFirstTime = firstTime = False; /* PF */ + + } + } + + /* now check to see if we were over the arrow of a pull right entry */ + +/* djhjr - 5/20/98 + if (ActiveItem->func == F_MENU && +*/ + if (ActiveItem && ActiveItem->func == F_MENU && + +/* ((ActiveMenu->width - x) < (ActiveMenu->width >> 1))) */ + ( x > PULLDOWNMENU_OFFSET )) /* DSE */ + { + MenuRoot *save = ActiveMenu; + int savex = MenuOrigins[MenuDepth - 1].x; + int savey = MenuOrigins[MenuDepth - 1].y; + + if (MenuDepth < MAXMENUDEPTH) { + PopUpMenu (ActiveItem->sub, + (savex + PULLDOWNMENU_OFFSET), /* DSE */ + (savey + ActiveItem->item_num * Scr->EntryHeight) + /*(savey + ActiveItem->item_num * Scr->EntryHeight + + (Scr->EntryHeight >> 1))*/, False); + } else if (!badItem) { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + badItem = ActiveItem; + } + + /* if the menu did get popped up, unhighlight the active item */ + if (save != ActiveMenu && ActiveItem->state) + { + ActiveItem->state = 0; + PaintEntry(save, ActiveItem, False); + ActiveItem = NULL; + } + } + + if (badItem != ActiveItem) badItem = NULL; + XFlush(dpy); + } +} + + + +/*********************************************************************** + * + * Procedure: + * NewMenuRoot - create a new menu root + * + * Returned Value: + * (MenuRoot *) + * + * Inputs: + * name - the name of the menu root + * + *********************************************************************** + */ + +MenuRoot * +NewMenuRoot(name) + char *name; +{ + MenuRoot *tmp; + +#define UNUSED_PIXEL ((unsigned long) (~0)) /* more than 24 bits */ + + tmp = (MenuRoot *) malloc(sizeof(MenuRoot)); + +/* djhjr - 5/22/96 + tmp->hi_fore = UNUSED_PIXEL; + tmp->hi_back = UNUSED_PIXEL; +*/ + tmp->highlight.fore = UNUSED_PIXEL; + tmp->highlight.back = UNUSED_PIXEL; + + tmp->name = name; + tmp->prev = NULL; + tmp->first = NULL; + tmp->last = NULL; + tmp->items = 0; + tmp->width = 0; + tmp->mapped = NEVER_MAPPED; + tmp->pull = FALSE; + tmp->w = None; + tmp->shadow = None; + tmp->real_menu = FALSE; + + /* djhjr - 5/22/00 */ + tmp->too_tall = 0; + tmp->top = 0; + + if (Scr->MenuList == NULL) + { + Scr->MenuList = tmp; + Scr->MenuList->next = NULL; + } + + if (Scr->LastMenu == NULL) + { + Scr->LastMenu = tmp; + Scr->LastMenu->next = NULL; + } + else + { + Scr->LastMenu->next = tmp; + Scr->LastMenu = tmp; + Scr->LastMenu->next = NULL; + } + +/* djhjr - 5/4/98 + if (strcmp(name, TWM_WINDOWS) == 0) +*/ + if (strcmp(name, TWM_WINDOWS) == 0 || strcmp(name, VTWM_WINDOWS) == 0) + Scr->Windows = tmp; + + return (tmp); +} + + + +/*********************************************************************** + * + * Procedure: + * AddToMenu - add an item to a root menu + * + * Returned Value: + * (MenuItem *) + * + * Inputs: + * menu - pointer to the root menu to add the item + * item - the text to appear in the menu + * action - the string to possibly execute + * sub - the menu root if it is a pull-right entry + * func - the numeric function + * fore - foreground color string + * back - background color string + * + *********************************************************************** + */ + +MenuItem * +AddToMenu(menu, item, action, sub, func, fore, back) + MenuRoot *menu; + char *item, *action; + MenuRoot *sub; + int func; + char *fore, *back; +{ + MenuItem *tmp; + int width; + MyFont *font; /* DSE */ + +#ifdef DEBUG_MENUS + fprintf(stderr, "adding menu item=\"%s\", action=%s, sub=%d, f=%d\n", + item, action, sub, func); +#endif + + tmp = (MenuItem *) malloc(sizeof(MenuItem)); + tmp->root = menu; + + if (menu->first == NULL) + { + menu->first = tmp; + tmp->prev = NULL; + } + else + { + menu->last->next = tmp; + tmp->prev = menu->last; + } + menu->last = tmp; + + tmp->item = item; + tmp->strlen = strlen(item); + tmp->action = action; + tmp->next = NULL; + tmp->sub = NULL; + tmp->state = 0; + tmp->func = func; + + /* djhjr - 4/22/96 */ + tmp->separated = 0; + + if ( func == F_TITLE && (Scr->MenuTitleFont.name != NULL) ) /* DSE */ + font= &(Scr->MenuTitleFont); + else + font= &(Scr->MenuFont); + + if (!Scr->HaveFonts) CreateFonts(); +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + width = MyFont_TextWidth(font, +#else + width = XTextWidth(font->font, +#endif + item, tmp->strlen); + if (width <= 0) + width = 1; + if (width > menu->width) + menu->width = width; + + tmp->user_colors = FALSE; + if (Scr->Monochrome == COLOR && fore != NULL) + { + int save; + + save = Scr->FirstTime; + Scr->FirstTime = TRUE; + +/* djhjr - 4/22/96 + GetColor(COLOR, &tmp->fore, fore); + GetColor(COLOR, &tmp->back, back); +*/ + GetColor(COLOR, &tmp->normal.fore, fore); + GetColor(COLOR, &tmp->normal.back, back); + + /* djhjr - 4/22/96 */ + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + /* rem'd 'Scr->MenuBevelWidth' djhjr - 10/30/02 */ + if (/*Scr->MenuBevelWidth > 0 && */!Scr->BeNiceToColormap) GetShadeColors (&tmp->normal); + + Scr->FirstTime = save; + tmp->user_colors = TRUE; + } + if (sub != NULL) + { + tmp->sub = sub; + menu->pull = TRUE; + } + tmp->item_num = menu->items++; + + return (tmp); +} + + + +void MakeMenus() +{ + MenuRoot *mr; + + for (mr = Scr->MenuList; mr != NULL; mr = mr->next) + { + if (mr->real_menu == FALSE) + continue; + + MakeMenu(mr); + } +} + + + +void MakeMenu(mr) +MenuRoot *mr; +{ + MenuItem *start, *end, *cur, *tmp; + XColor f1, f2, f3; + XColor b1, b2, b3; + XColor save_fore, save_back; + int num, i; + int fred, fgreen, fblue; + int bred, bgreen, bblue; + int width; + + /* djhjr - 4/22/96 */ + int borderwidth; + + unsigned long valuemask; + XSetWindowAttributes attributes; + Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c; + MyFont *titleFont; + + if ( Scr->MenuTitleFont.name != NULL ) /* DSE */ + { + Scr->EntryHeight = MAX(Scr->MenuFont.height, + Scr->MenuTitleFont.height) + 4; + titleFont = &(Scr->MenuTitleFont); + } + else + { + Scr->EntryHeight = Scr->MenuFont.height + 4; + titleFont= &(Scr->MenuFont); + } + + + /* lets first size the window accordingly */ + if (mr->mapped == NEVER_MAPPED) + { + if (mr->pull == TRUE) + { + mr->width += 16 + 2 * EDGE_OFFSET; /* DSE */ + } + +/* djhjr - 4/29/98 + * djhjr - 9/18/96 * + if (Scr->use3Dmenus) mr->width += 4; +*/ + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0) mr->width += 2 * Scr->MenuBevelWidth; + + width = mr->width + 2 * EDGE_OFFSET; /* DSE */ + + for (cur = mr->first; cur != NULL; cur = cur->next) + { + if (cur->func != F_TITLE) + cur->x = EDGE_OFFSET; /* DSE */ + else + { + cur->x = width - +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_TextWidth(titleFont, +#else + XTextWidth(titleFont->font, +#endif + cur->item, cur->strlen); + cur->x /= 2; + } + } + mr->height = mr->items * Scr->EntryHeight; + +/* djhjr - 4/29/98 + * djhjr - 4/22/96 * + if (Scr->use3Dmenus) mr->height += 4; +*/ + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0) mr->height += 2 * Scr->MenuBevelWidth; + + /* djhjr - 4/22/96 */ + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + borderwidth = (Scr->MenuBevelWidth > 0) ? 0 : 1; + + /* djhjr - 5/22/00 */ + if (mr->height > Scr->MyDisplayHeight) + { + mr->too_tall = 1; + mr->height = Scr->MyDisplayHeight - borderwidth * 2; + } + + /* added this 'if () ... else' - djhjr - 4/29/98 */ + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0) + mr->width += 2 * Scr->MenuBevelWidth + 6; + else + mr->width += 10; + + if (Scr->Shadow) + { + /* + * Make sure that you don't draw into the shadow window or else + * the background bits there will get saved + */ + valuemask = (CWBackPixel | CWBorderPixel); + attributes.background_pixel = Scr->MenuShadowColor; + attributes.border_pixel = Scr->MenuShadowColor; + if (Scr->SaveUnder) { + valuemask |= CWSaveUnder; + attributes.save_under = True; + } + mr->shadow = XCreateWindow (dpy, Scr->Root, 0, 0, + (unsigned int) mr->width, + (unsigned int) mr->height, + (unsigned int)0, + CopyFromParent, + (unsigned int) CopyFromParent, + (Visual *) CopyFromParent, + valuemask, &attributes); + } + + valuemask = (CWBackPixel | CWBorderPixel | CWEventMask); + attributes.background_pixel = Scr->MenuC.back; + attributes.border_pixel = Scr->MenuC.fore; + attributes.event_mask = (ExposureMask | EnterWindowMask); + if (Scr->SaveUnder) { + valuemask |= CWSaveUnder; + attributes.save_under = True; + } + if (Scr->BackingStore) { + valuemask |= CWBackingStore; + attributes.backing_store = Always; + } + + mr->w = XCreateWindow (dpy, Scr->Root, 0, 0, (unsigned int) mr->width, + +/* djhjr - 4/22/96 + (unsigned int) mr->height, (unsigned int) 1, +*/ + (unsigned int) mr->height, (unsigned int) borderwidth, + + CopyFromParent, (unsigned int) CopyFromParent, + (Visual *) CopyFromParent, + valuemask, &attributes); + + + XSaveContext(dpy, mr->w, MenuContext, (caddr_t)mr); + XSaveContext(dpy, mr->w, ScreenContext, (caddr_t)Scr); + + mr->mapped = UNMAPPED; + } + + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0 && (Scr->Monochrome == COLOR) && (mr->highlight.back == UNUSED_PIXEL)) { + XColor xcol; + char colname [32]; + short save; + + xcol.pixel = Scr->MenuC.back; + XQueryColor (dpy, cmap, &xcol); + sprintf (colname, "#%04x%04x%04x", + 5 * (xcol.red / 6), 5 * (xcol.green / 6), 5 * (xcol.blue / 6)); + save = Scr->FirstTime; + Scr->FirstTime = True; + GetColor (Scr->Monochrome, &mr->highlight.back, colname); + Scr->FirstTime = save; + } + + /* djhjr - 4/22/96 */ + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0 && (Scr->Monochrome == COLOR) && (mr->highlight.fore == UNUSED_PIXEL)) { + XColor xcol; + char colname [32]; + short save; + xcol.pixel = Scr->MenuC.fore; + XQueryColor (dpy, cmap, &xcol); + sprintf (colname, "#%04x%04x%04x", + 5 * (xcol.red / 6), 5 * (xcol.green / 6), 5 * (xcol.blue / 6)); + save = Scr->FirstTime; + Scr->FirstTime = True; + GetColor (Scr->Monochrome, &mr->highlight.fore, colname); + Scr->FirstTime = save; + } + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0 && !Scr->BeNiceToColormap) GetShadeColors (&mr->highlight); + + /* get the default colors into the menus */ + for (tmp = mr->first; tmp != NULL; tmp = tmp->next) + { +/* djhjr - 4/22/96 + if (!tmp->user_colors) { + if (tmp->func != F_TITLE) { + tmp->fore = Scr->MenuC.fore; + tmp->back = Scr->MenuC.back; + } else { + tmp->fore = Scr->MenuTitleC.fore; + tmp->back = Scr->MenuTitleC.back; + } + } + + if (mr->hi_fore != UNUSED_PIXEL) + { + tmp->hi_fore = mr->hi_fore; + tmp->hi_back = mr->hi_back; + } + else + { + tmp->hi_fore = tmp->back; + tmp->hi_back = tmp->fore; + } +*/ + if (!tmp->user_colors) { + if (tmp->func != F_TITLE) { + tmp->normal.fore = Scr->MenuC.fore; + tmp->normal.back = Scr->MenuC.back; + } else { + tmp->normal.fore = Scr->MenuTitleC.fore; + tmp->normal.back = Scr->MenuTitleC.back; + } + } + + if (mr->highlight.fore != UNUSED_PIXEL) + { + tmp->highlight.fore = mr->highlight.fore; + tmp->highlight.back = mr->highlight.back; + } + else + { + tmp->highlight.fore = tmp->normal.back; + tmp->highlight.back = tmp->normal.fore; + } + /* was 'Scr->use3Dmenus' - djhjr - 8/11/98 */ + if (Scr->MenuBevelWidth > 0 && !Scr->BeNiceToColormap) { + if (tmp->func != F_TITLE) + GetShadeColors (&tmp->highlight); + else + GetShadeColors (&tmp->normal); + } + + + } /* end for(...) */ + + if (Scr->Monochrome == MONOCHROME || !Scr->InterpolateMenuColors) + return; + + start = mr->first; + while (TRUE) + { + for (; start != NULL; start = start->next) + { + if (start->user_colors) + break; + } + if (start == NULL) + break; + + for (end = start->next; end != NULL; end = end->next) + { + if (end->user_colors) + break; + } + if (end == NULL) + break; + + /* we have a start and end to interpolate between */ + num = end->item_num - start->item_num; + +/* djhjr - 4/22/96 + f1.pixel = start->fore; + XQueryColor(dpy, cmap, &f1); + f2.pixel = end->fore; + XQueryColor(dpy, cmap, &f2); + + b1.pixel = start->back; + XQueryColor(dpy, cmap, &b1); + b2.pixel = end->back; + XQueryColor(dpy, cmap, &b2); +*/ + f1.pixel = start->normal.fore; + XQueryColor(dpy, cmap, &f1); + f2.pixel = end->normal.fore; + XQueryColor(dpy, cmap, &f2); + b1.pixel = start->normal.back; + XQueryColor(dpy, cmap, &b1); + b2.pixel = end->normal.back; + XQueryColor(dpy, cmap, &b2); + + fred = ((int)f2.red - (int)f1.red) / num; + fgreen = ((int)f2.green - (int)f1.green) / num; + fblue = ((int)f2.blue - (int)f1.blue) / num; + + bred = ((int)b2.red - (int)b1.red) / num; + bgreen = ((int)b2.green - (int)b1.green) / num; + bblue = ((int)b2.blue - (int)b1.blue) / num; + + f3 = f1; + f3.flags = DoRed | DoGreen | DoBlue; + + b3 = b1; + b3.flags = DoRed | DoGreen | DoBlue; + + /* djhjr - 4/23/96 */ + start->highlight.back = start->normal.fore; + start->highlight.fore = start->normal.back; + + num -= 1; + for (i = 0, cur = start->next; i < num; i++, cur = cur->next) + { + f3.red += fred; + f3.green += fgreen; + f3.blue += fblue; + save_fore = f3; + + b3.red += bred; + b3.green += bgreen; + b3.blue += bblue; + save_back = b3; + + if (Scr->DontInterpolateTitles && (cur->func == F_TITLE)) + continue; /* DSE -- from tvtwm */ + + XAllocColor(dpy, cmap, &f3); + XAllocColor(dpy, cmap, &b3); + +/* djhjr - 4/22/96 + cur->hi_back = cur->fore = f3.pixel; + cur->hi_fore = cur->back = b3.pixel; +*/ + cur->highlight.back = cur->normal.fore = f3.pixel; + cur->highlight.fore = cur->normal.back = b3.pixel; + cur->user_colors = True; + + f3 = save_fore; + b3 = save_back; + } + start = end; + + /* djhjr - 4/22/96 + start->highlight.back = start->normal.fore; + start->highlight.fore = start->normal.back; + */ + } +} + + + +/*********************************************************************** + * + * Procedure: + * PopUpMenu - pop up a pull down menu + * + * Inputs: + * menu - the root pointer of the menu to pop up + * x, y - location of upper left of menu + * center - whether or not to center horizontally over position + * + *********************************************************************** + */ + +Bool PopUpMenu (menu, x, y, center) + MenuRoot *menu; + int x, y; + Bool center; +{ + int WindowNameOffset, WindowNameCount; + TwmWindow **WindowNames; + TwmWindow *tmp_win2,*tmp_win3; + int mask; + int i; + int (*compar)() = + (Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1); + + /* djhjr - 9/5/98 */ + int x_root, y_root; + + if (!menu) return False; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + if (!PlaySound(F_MENU)) PlaySound(S_MMAP); +#endif + + /* djhjr - 5/22/00 */ + menu->top = 0; + if (menu->w) XClearArea(dpy, menu->w, 0, 0, 0, 0, True); + + InstallRootColormap(); + + if (menu == Scr->Windows) + { + TwmWindow *tmp_win; + + /* this is the twm windows menu, let's go ahead and build it */ + + DestroyMenu (menu); + + menu->first = NULL; + menu->last = NULL; + menu->items = 0; + menu->width = 0; + menu->mapped = NEVER_MAPPED; + +/* djhjr - 5/4/98 + AddToMenu(menu, "TWM Windows", NULLSTR, (MenuRoot *)NULL, F_TITLE,NULLSTR,NULLSTR); +*/ + AddToMenu(menu, "VTWM Windows", NULLSTR, (MenuRoot *)NULL, F_TITLE,NULLSTR,NULLSTR); + + WindowNameOffset=(char *)Scr->TwmRoot.next->name - + (char *)Scr->TwmRoot.next; + for(tmp_win = Scr->TwmRoot.next , WindowNameCount=0; + tmp_win != NULL; + tmp_win = tmp_win->next) + WindowNameCount++; + + if (WindowNameCount != 0) /* Submitted by Jennifer Elaan */ + { + WindowNames = + (TwmWindow **)malloc(sizeof(TwmWindow *)*WindowNameCount); + WindowNames[0] = Scr->TwmRoot.next; + for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1; + tmp_win != NULL; + tmp_win = tmp_win->next,WindowNameCount++) + { + /* Submitted by Erik Agsjo */ + if (LookInList(Scr->DontShowInTWMWindows, tmp_win->full_name, &tmp_win->class)) + { + WindowNameCount--; + continue; + } + + tmp_win2 = tmp_win; + for (i=0;iname,WindowNames[i]->name) < 0) + { + tmp_win3 = tmp_win2; + tmp_win2 = WindowNames[i]; + WindowNames[i] = tmp_win3; + } + } + WindowNames[WindowNameCount] = tmp_win2; + } + for (i=0; iname, (char *)WindowNames[i], + (MenuRoot *)NULL, F_POPUP,NULLSTR,NULLSTR); + if (!Scr->OldFashionedTwmWindowsMenu + && Scr->Monochrome == COLOR)/*RFBCOLOR*/ + {/*RFBCOLOR*/ + menu->last->user_colors = TRUE;/*RFBCOLOR*/ + +/* djhjr - 4/22/96 + menu->last->fore = + WindowNames[i]->virtual.fore;*RFBCOLOR* +*/ +/* djhjr - 5/4/98 + menu->last->normal.fore = + WindowNames[i]->virtual.fore;*RFBCOLOR* +*/ + menu->last->normal.fore = Scr->MenuC.fore; + +/* djhjr - 4/22/96 + menu->last->back = + WindowNames[i]->virtual.back;*RFBCOLOR* +*/ + menu->last->normal.back = + WindowNames[i]->virtual.back; + +/**********************************************************/ +/* */ +/* Okay, okay, it's a bit of a kludge. */ +/* */ +/* On the other hand, it's nice to have the VTWM Windows */ +/* menu come up with "the right colors". And the colors */ +/* from the panner are not a bad choice... */ +/* */ +/**********************************************************/ + }/*RFBCOLOR*/ + } + free(WindowNames); + } + MakeMenu(menu); + } + + if (menu->w == None || menu->items == 0) return False; + + /* Prevent recursively bringing up menus. */ + if (menu->mapped == MAPPED) return False; + + /* + * Dynamically set the parent; this allows pull-ups to also be main + * menus, or to be brought up from more than one place. + */ + menu->prev = ActiveMenu; + + /* + * Submitted by Steve Ratcliffe + */ + mask = ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | PointerMotionHintMask; + if (Scr->StayUpMenus) + mask |= PointerMotionMask; + + XGrabPointer(dpy, Scr->Root, True, mask, + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->MenuCursor, CurrentTime); + + ActiveMenu = menu; + menu->mapped = MAPPED; + menu->entered = FALSE; + + if (center) { + x -= (menu->width / 2); + y -= (Scr->EntryHeight / 2); /* sticky menus would be nice here */ + } + + /* + * clip to screen + */ + /* next line and " - i" to "x = " and "y = " - djhjr - 5/22/00 */ + i = (Scr->MenuBevelWidth > 0) ? 0 : 2; + if (x + menu->width > Scr->MyDisplayWidth) { + x = Scr->MyDisplayWidth - menu->width - i; + } + if (x < 0) x = 0; + if (y + menu->height > Scr->MyDisplayHeight) { + y = Scr->MyDisplayHeight - menu->height - i; + } + if (y < 0) y = 0; + + MenuOrigins[MenuDepth].x = x; + MenuOrigins[MenuDepth].y = y; + MenuDepth++; + + XMoveWindow(dpy, menu->w, x, y); + if (Scr->Shadow) { + XMoveWindow (dpy, menu->shadow, x + SHADOWWIDTH, y + SHADOWWIDTH); + } + if (Scr->Shadow) { + XRaiseWindow (dpy, menu->shadow); + } + XMapRaised(dpy, menu->w); + if (Scr->Shadow) { + XMapWindow (dpy, menu->shadow); + } + XSync(dpy, 0); + + /* djhjr - 9/5/98 */ + XQueryPointer(dpy, menu->w, &JunkRoot, &JunkChild, + &x_root, &y_root, &JunkX, &JunkY, &JunkMask); + MenuOrigX = x_root; + MenuOrigY = y_root; + + return True; +} + + + +/*********************************************************************** + * + * Procedure: + * PopDownMenu - unhighlight the current menu selection and + * take down the menus + * + *********************************************************************** + */ + +void PopDownMenu() +{ + MenuRoot *tmp; + + if (ActiveMenu == NULL) + return; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(S_MUNMAP); +#endif + + if (ActiveItem) + { + ActiveItem->state = 0; + PaintEntry(ActiveMenu, ActiveItem, False); + } + + for (tmp = ActiveMenu; tmp != NULL; tmp = tmp->prev) + { + if (Scr->Shadow) { + XUnmapWindow (dpy, tmp->shadow); + } + XUnmapWindow(dpy, tmp->w); + tmp->mapped = UNMAPPED; + UninstallRootColormap(); + } + + XFlush(dpy); + ActiveMenu = NULL; + ActiveItem = NULL; + MenuDepth = 0; + if (Context == C_WINDOW || Context == C_FRAME || Context == C_TITLE) + { menuFromFrameOrWindowOrTitlebar = TRUE; + } +} + + + +/*********************************************************************** + * + * Procedure: + * FindMenuRoot - look for a menu root + * + * Returned Value: + * (MenuRoot *) - a pointer to the menu root structure + * + * Inputs: + * name - the name of the menu root + * + *********************************************************************** + */ + +MenuRoot * +FindMenuRoot(name) + char *name; +{ + MenuRoot *tmp; + + for (tmp = Scr->MenuList; tmp != NULL; tmp = tmp->next) + { + if (strcmp(name, tmp->name) == 0) + return (tmp); + } + return NULL; +} + + + +static Bool belongs_to_twm_window (t, w) + register TwmWindow *t; + register Window w; +{ + if (!t) return False; + +#if 0 +StayUpMenus + if (w == t->frame || w == t->title_w || w == t->hilite_w || + w == t->icon_w || w == t->icon_bm_w) return True; +#endif + + if (t && t->titlebuttons) { + register TBWindow *tbw; + register int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + for (tbw = t->titlebuttons; nb > 0; tbw++, nb--) { + if (tbw->window == w) return True; + } + } + return False; +} + + + +/* + * Hack^H^H^H^HWrapper to moves for non-menu contexts. + * + * djhjr - 10/11/01 10/4/02 + */ +static void moveFromCenterWrapper(tmp_win) +TwmWindow *tmp_win; +{ + if (!tmp_win->opaque_move) XUngrabServer(dpy); + + WarpScreenToWindow(tmp_win); + + /* now here's a nice little kludge... */ + { + int hilite = tmp_win->highlight; + + tmp_win->highlight = True; + SetBorder(tmp_win, (hilite) ? True : False); + tmp_win->highlight = hilite; + + Scr->Focus = tmp_win; + } + + if (!tmp_win->opaque_move) XGrabServer(dpy); +} + +/* + * Jason P. Venner jason@tfs.com + * This function is used by F_WARPTO to match the action name + * against window names. + * Re-written to use list.c:MatchName(), allowing VTWM-style wilcards. + * djhjr - 10/27/02 + */ +int MatchWinName(action, t) +char *action; +TwmWindow *t; +{ + int matched = 0; +#ifndef NO_REGEX_SUPPORT + regex_t re; +#else + char re; +#endif + + if (MatchName(t->full_name, action, &re, LTYPE_ANY_STRING)) + if (MatchName(t->class.res_name, action, &re, LTYPE_ANY_STRING)) + if (MatchName(t->class.res_class, action, &re, LTYPE_ANY_STRING)) + matched = 1; + + return (matched); +} + + + +/*********************************************************************** + * + * Procedure: + * ExecuteFunction - execute a twm root function + * + * Inputs: + * func - the function to execute + * action - the menu action to execute + * w - the window to execute this function on + * tmp_win - the twm window structure + * event - the event that caused the function + * context - the context in which the button was pressed + * pulldown- flag indicating execution from pull down menu + * + * Returns: + * TRUE if should continue with remaining actions else FALSE to abort + * + *********************************************************************** + */ + +extern int MovedFromKeyPress; + +int +ExecuteFunction(func, action, w, tmp_win, eventp, context, pulldown) + int func; + char *action; + Window w; + TwmWindow *tmp_win; + XEvent *eventp; + int context; + int pulldown; +{ + char tmp[200]; + char *ptr; + char buff[MAX_FILE_SIZE]; + int count, fd; + int do_next_action = TRUE; + + actionHack = action; /* Submitted by Michel Eyckmans */ + RootFunction = F_NOFUNCTION; + if (Cancel) + return TRUE; /* XXX should this be FALSE? */ + + switch (func) + { + case F_UPICONMGR: + case F_LEFTICONMGR: + case F_RIGHTICONMGR: + case F_DOWNICONMGR: + case F_FORWICONMGR: + case F_BACKICONMGR: + case F_NEXTICONMGR: + case F_PREVICONMGR: + case F_NOP: + case F_TITLE: + case F_DELTASTOP: + case F_RAISELOWER: + case F_WARP: /* PF */ + case F_WARPCLASSNEXT: /* PF */ + case F_WARPCLASSPREV: /* PF */ + case F_WARPTOSCREEN: + case F_WARPTO: + case F_WARPRING: + case F_WARPTOICONMGR: + case F_COLORMAP: + + /* djhjr - 4/30/96 */ + case F_SEPARATOR: + + /* djhjr - 12/14/98 */ + case F_STATICICONPOSITIONS: + + /* djhjr - 5/30/00 */ + case F_WARPSNUG: + case F_WARPVISIBLE: + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + case F_SOUNDS: +#endif + + /* djhjr - 10/2/01 */ + case F_STRICTICONMGR: + + /* djhjr - 9/9/02 */ + case F_BINDBUTTONS: + case F_BINDKEYS: + case F_UNBINDBUTTONS: + case F_UNBINDKEYS: + + break; + default: + XGrabPointer(dpy, Scr->Root, True, + ButtonPressMask | ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->WaitCursor, CurrentTime); + break; + } + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + switch (func) + { + case F_BEEP: + case F_SQUEEZECENTER: + case F_SQUEEZELEFT: + case F_SQUEEZERIGHT: + + /* djhjr - 11/4/03 */ + case F_MOVESCREEN: + + case F_FORCEMOVE: + case F_MOVE: + case F_RESIZE: + case F_EXEC: + case F_DELETE: + case F_DELETEDOOR: + case F_DESTROY: + case F_DEICONIFY: + case F_ICONIFY: + case F_IDENTIFY: + case F_VERSION: + case F_QUIT: + case F_WARP: + case F_WARPCLASSNEXT: + case F_WARPCLASSPREV: + case F_WARPRING: + case F_WARPTO: + case F_WARPTOICONMGR: + case F_WARPTONEWEST: + case F_WARPTOSCREEN: + /* handle uniquely */ + break; + case F_POPUP: + /* ignore */ + break; + case F_LOWER: + case F_RAISE: + case F_RAISELOWER: + case F_NAIL: + case F_NAMEDOOR: + case F_BOTTOMZOOM: + case F_FULLZOOM: + case F_HORIZOOM: + case F_LEFTZOOM: + case F_RIGHTZOOM: + case F_TOPZOOM: + case F_ZOOM: + case F_BACKICONMGR: + case F_DOWNICONMGR: + case F_FORWICONMGR: + case F_LEFTICONMGR: + case F_RIGHTICONMGR: + case F_UPICONMGR: + case F_FOCUS: + case F_SAVEYOURSELF: + case F_STICKYABOVE: + case F_RING: + case F_WINREFRESH: + + /* djhjr - 9/9/02 */ + case F_BINDBUTTONS: + case F_BINDKEYS: + case F_UNBINDBUTTONS: + case F_UNBINDKEYS: + + /* ignore if from a root menu */ + if (Context != C_ROOT && Context != C_NO_CONTEXT) + PlaySound(func); + break; + default: + /* unconditional */ + PlaySound(func); + break; + } +#endif + + switch (func) + { + case F_NOP: + case F_TITLE: + break; + + case F_DELTASTOP: + if (WindowMoved) do_next_action = FALSE; + break; + + case F_RESTART: + + /* added this 'case' and 'if () ... else ' - djhjr - 7/15/98 */ + case F_STARTWM: + if (func == F_STARTWM) + { + /* dynamic allocation of (char **)my_argv - djhjr - 9/26/02 */ + + char *p, *delims = " \t"; + char *new_argv = NULL, **my_argv = NULL; + int i = 0, j = 0; + + p = strtok(action, delims); + while (p) + { + if (j >= i) + { + i += 5; + new_argv = (char *)realloc((char *)my_argv, + i * sizeof(char *)); + if (new_argv == NULL) + { + fprintf(stderr, + "%s: unable to allocate %d bytes for execvp()\n", + ProgramName, i * sizeof(char *)); + break; + } + else + my_argv = (char **)new_argv; + } + + my_argv[j++] = strdup(p); + p = strtok(NULL, delims); + } + + if (new_argv != NULL) + { + my_argv[j] = NULL; + + /* djhjr - 7/31/98 */ + setup_restart(eventp->xbutton.time); + + execvp(*my_argv, my_argv); + fprintf(stderr, "%s: unable to start \"%s\"\n", + ProgramName, *my_argv); + new_argv = NULL; + } + + if (new_argv == NULL) + { + i = 0; + while (i < j) + free(my_argv[i++]); + if (j) + free((char *)my_argv); + } + } + else + /* djhjr - 7/31/98 */ + RestartVtwm(eventp->xbutton.time); + + break; + + case F_UPICONMGR: + case F_DOWNICONMGR: + case F_LEFTICONMGR: + case F_RIGHTICONMGR: + case F_FORWICONMGR: + case F_BACKICONMGR: + MoveIconManager(func); + break; + + case F_NEXTICONMGR: + case F_PREVICONMGR: + JumpIconManager(func); + break; + + case F_SHOWLIST: + + /* added this 'if (...) else ...' - djhjr - 9/21/99 */ + if (context == C_ROOT) + { + name_list *list; + + ShowIconMgr(&Scr->iconmgr); + + /* + * New code in list.c necessitates 'next_entry()' and + * 'contents_of_entry()' - djhjr - 10/20/01 + */ + for (list = Scr->IconMgrs; list != NULL; list = next_entry(list)) + ShowIconMgr((IconMgr *)contents_of_entry(list)); + } + else + { + IconMgr *ip; + + if ((ip = (IconMgr *)LookInList(Scr->IconMgrs, tmp_win->full_name, + &tmp_win->class)) == NULL) + ip = &Scr->iconmgr; + + ShowIconMgr(ip); + } + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + break; + + case F_HIDELIST: + + if (Scr->NoIconManagers) + break; + + /* added argument - djhjr - 9/21/99 */ + HideIconManager((context == C_ROOT) ? NULL : tmp_win); + + break; + + case F_SORTICONMGR: + + /* djhjr - 6/10/98 */ + if (Scr->NoIconManagers || Scr->iconmgr.count == 0) + break; + + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + { + int save_sort; + + save_sort = Scr->SortIconMgr; + Scr->SortIconMgr = TRUE; + + if (context == C_ICONMGR) + SortIconManager((IconMgr *) NULL); + else if (tmp_win->iconmgr) + SortIconManager(tmp_win->iconmgrp); + else + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + + Scr->SortIconMgr = save_sort; + } + break; + + case F_IDENTIFY: + if (DeferExecution(context, func, Scr->SelectCursor)) + { + return TRUE; + } + + Identify(tmp_win); + break; + + case F_VERSION: + Identify ((TwmWindow *) NULL); + break; + + case F_ZOOMZOOM: /* RFB silly */ + /* added args to iconmgrs - djhjr - 10/11/01 */ + Zoom( None, NULL, None, NULL ); + break; + + case F_AUTOPAN:/*RFB F_AUTOPAN*/ + { /* toggle autopan *//*RFB F_AUTOPAN*/ + static int saved;/*RFB F_AUTOPAN*/ + + if ( Scr->AutoPanX ) + { saved = Scr->AutoPanX;/*RFB F_AUTOPAN*/ + Scr->AutoPanX = 0;/*RFB F_AUTOPAN*/ + } else { /*RFB F_AUTOPAN*/ + Scr->AutoPanX = saved;/*RFB F_AUTOPAN*/ + /* if restart with no autopan, we'll set the + ** variable but we won't pan + */ + RaiseAutoPan(); /* DSE */ + }/*RFB F_AUTOPAN*/ + break;/*RFB F_AUTOPAN*/ + }/*RFB F_AUTOPAN*/ + + case F_STICKYABOVE: /* DSE */ + if (Scr->StickyAbove) { + LowerSticky(); Scr->StickyAbove = FALSE; + /* don't change the order of execution! */ + } else { + Scr->StickyAbove = TRUE; RaiseStickyAbove(); RaiseAutoPan(); + /* don't change the order of execution! */ + } + return TRUE; + /* break; *//* NOT REACHABLE */ + + case F_AUTORAISE: + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + tmp_win->auto_raise = !tmp_win->auto_raise; + if (tmp_win->auto_raise) ++(Scr->NumAutoRaises); + else --(Scr->NumAutoRaises); + break; + + case F_BEEP: + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + /* sound has priority over bell */ + if (PlaySound(func)) break; +#endif + + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + + case F_POPUP: + tmp_win = (TwmWindow *)action; + if (Scr->WindowFunction.func != F_NOFUNCTION) + { + ExecuteFunction(Scr->WindowFunction.func, + Scr->WindowFunction.item->action, + w, tmp_win, eventp, C_FRAME, FALSE); + } + else + { + DeIconify(tmp_win); + XRaiseWindow (dpy, tmp_win->frame); + XRaiseWindow (dpy, tmp_win->VirtualDesktopDisplayWindow); + + RaiseStickyAbove(); + RaiseAutoPan(); + } + break; + + case F_RESIZE: + { + TwmWindow *focused = NULL; /* djhjr - 5/27/03 */ + Bool fromtitlebar = False; + long releaseEvent; + long movementMask; + int resizefromcenter = 0; /* djhjr - 10/2/02 */ +/* djhjr - 10/6/02 */ +#ifndef NO_SOUND_SUPPORT + int did_playsound = FALSE; +#endif + + if (DeferExecution(context, func, Scr->ResizeCursor)) + return TRUE; + + PopDownMenu(); + + if (pulldown) + XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, + eventp->xbutton.x_root, + eventp->xbutton.y_root); + + EventHandler[EnterNotify] = HandleUnknown; + EventHandler[LeaveNotify] = HandleUnknown; + +/* allow the resizing of doors - djhjr - 2/22/99 + if ((w != tmp_win->icon_w) && (context != C_DOOR)) +*/ + if (context == C_ICON) /* can't resize icons */ + { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + } + + /* + * Resizing from a titlebar menu was handled uniquely long + * before I got here, and I added virtual windows and icon + * managers on 9/15/99 and 10/11/01, leveraging that code. + * It's all been integrated here. + * djhjr - 10/3/02 + */ + if (Context & (C_FRAME_BIT | C_WINDOW_BIT | C_TITLE_BIT) + && menuFromFrameOrWindowOrTitlebar) + { + XGetGeometry(dpy, w, &JunkRoot, &origDragX, &origDragY, + (unsigned int *)&DragWidth, + (unsigned int *)&DragHeight, + &JunkBW, &JunkDepth); + + resizefromcenter = 2; + } + else if (Context == C_VIRTUAL_WIN) + { + TwmWindow *twin; + + if ((XFindContext(dpy, eventp->xbutton.subwindow, + VirtualContext, (caddr_t *) &twin) == XCNOENT)) + { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + } + + context = C_WINDOW; + tmp_win = twin; + resizefromcenter = 1; + } + else if (Context == C_ICONMGR && tmp_win->list) + { + /* added the second argument - djhjr - 5/28/00 */ + if (!warp_if_warpunmapped(tmp_win, F_NOFUNCTION)) + { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + } + + resizefromcenter = 1; + } + + if (resizefromcenter) + { + WarpScreenToWindow(tmp_win); + + XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, + tmp_win->frame_x + tmp_win->frame_width / 2, + tmp_win->frame_y + tmp_win->frame_height / 2); + + /* grr - djhjr - 5/27/03 */ + focused = Scr->Focus; + Scr->Focus = tmp_win; + SetBorder(Scr->Focus, True); + + /* save positions so we can tell if it was moved or not */ + ResizeOrigX = tmp_win->frame_x + tmp_win->frame_width / 2; + ResizeOrigY = tmp_win->frame_y + tmp_win->frame_height / 2; + } + else + { + /* save position so we can tell if it was moved or not */ + ResizeOrigX = eventp->xbutton.x_root; + ResizeOrigY = eventp->xbutton.y_root; + } + + /* see if this is being done from the titlebar */ + fromtitlebar = belongs_to_twm_window(tmp_win, + eventp->xbutton.window); + + if (resizefromcenter == 2) + { + MenuStartResize(tmp_win, origDragX, origDragY, + DragWidth, DragHeight, Context); + + releaseEvent = ButtonPress; + movementMask = PointerMotionMask; + } + else + { + StartResize(eventp, tmp_win, fromtitlebar, context); + + fromtitlebar = False; + releaseEvent = ButtonRelease; + movementMask = ButtonMotionMask; + } + + /* substantially re-worked - djhjr - 5/27/03 */ + while (TRUE) + { + /* added exposure event masks - djhjr - 10/11/01 */ + XMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask | + ExposureMask | VisibilityChangeMask | + movementMask, &Event); + +/* + * See down below, after this loop - djhjr - 5/27/03 + */ +#if 0 + /* discard crossing events before a release - djhjr - 10/11/01 */ + if (Event.xany.type == EnterNotify || + Event.xany.type == LeaveNotify) + { + /* this can't be the proper place - djhjr - 10/2/02 */ + SetBorder(tmp_win, True); + + continue; + } +#endif + + /* + * Don't discard exposure events before release + * or window borders and/or their titles in the + * virtual desktop won't get redrawn - djhjr + */ + + /* discard any extra motion events before a release */ + if (Event.type == MotionNotify) + { + /* was 'ButtonMotionMask' - djhjr - 10/11/01 */ + while (XCheckMaskEvent(dpy, releaseEvent | movementMask, + &Event)) + { + if (Event.type == releaseEvent) + break; + } + } + +/* + * See above, before this loop - djhjr - 5/27/03 + */ +#if 0 + if (fromtitlebar && Event.type == ButtonPress) { + fromtitlebar = False; + continue; + } +#endif + + if (Event.type == releaseEvent) + { + if (Cancel) + { + if (tmp_win->opaque_resize) + { + ConstrainSize(tmp_win, &origWidth, &origHeight); + SetupWindow(tmp_win, origx, origy, + origWidth, origHeight, -1); + ResizeTwmWindowContents(tmp_win, + origWidth, origHeight); + } + else + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + + ResizeWindow = None; + resizing_window = 0; + do_next_action = FALSE; + } + else + { + if (resizefromcenter == 2) + { + /* added passing of 'Context' - djhjr - 9/30/02 */ + MenuEndResize(tmp_win, Context); + } + else + EndResize(); + + /* DispatchEvent2() is depreciated - djhjr - 10/6/02 */ + DispatchEvent(); + + /* djhjr - 5/27/03 11/2/03 */ + if (!Scr->NoRaiseResize && !Scr->RaiseOnStart && + WindowMoved) + { + XRaiseWindow(dpy, tmp_win->frame); + SetRaiseWindow(tmp_win); + } + } + + break; + } + + /* DispatchEvent2() is depreciated - djhjr - 10/6/02 */ + if (!DispatchEvent()) continue; + + if (Event.type != MotionNotify) continue; + + XQueryPointer(dpy, Scr->Root, + &JunkRoot, &JunkChild, &JunkX, &JunkY, + &AddingX, &AddingY, &JunkMask); + + if (!resizing_window && + (abs(AddingX - ResizeOrigX) < Scr->MoveDelta && + abs(AddingY - ResizeOrigY) < Scr->MoveDelta)) + { + continue; + } + + resizing_window = 1; + WindowMoved = TRUE; + + /* djhjr - 5/27/03 11/3/03 */ + if ((!Scr->NoRaiseResize && Scr->RaiseOnStart) + /* trap a Shape extention bug - djhjr - 5/27/03 */ + || (tmp_win->opaque_resize && + (HasShape && + (tmp_win->wShaped || tmp_win->squeeze_info))) + ) + { + XRaiseWindow(dpy, tmp_win->frame); + SetRaiseWindow(tmp_win); + if (Scr->Virtual && tmp_win->VirtualDesktopDisplayWindow) + XRaiseWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); + } + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + if (did_playsound == FALSE) + { + PlaySound(func); + did_playsound = TRUE; + } +#endif + + /* MenuDoResize() is depreciated - djhjr - 10/6/02 */ + DoResize(AddingX, AddingY, tmp_win); + } + +/* djhjr - 6/4/98 + return TRUE; +*/ + +/* djhjr - 7/17/98 + * djhjr - 4/7/98 * + if (!Scr->NoGrabServer) XUngrabServer(dpy); +*/ + if (!tmp_win->opaque_resize) XUngrabServer(dpy); + + /* + * All this stuff from resize.c:EndResize() - djhjr - 10/6/02 + */ + + if (!tmp_win->opaque_resize) + UninstallRootColormap(); + + /* discard queued enter and leave events - djhjr - 5/27/03 */ + while (XCheckMaskEvent(dpy, EnterWindowMask | LeaveWindowMask, + &Event)) + ; + + if (!Scr->NoRaiseResize) + { + RaiseStickyAbove (); /* DSE */ + RaiseAutoPan(); + } + + /* update virtual coords */ + tmp_win->virtual_frame_x = Scr->VirtualDesktopX + tmp_win->frame_x; + tmp_win->virtual_frame_y = Scr->VirtualDesktopY + tmp_win->frame_y; + + /* UpdateDesktop(tmp_win); Stig */ +/* djhjr - 5/27/03 + MoveResizeDesktop(tmp_win, Scr->NoRaiseResize); * Stig * +*/ + MoveResizeDesktop(tmp_win, Cancel | Scr->NoRaiseResize); /* Stig */ + + /* djhjr - 9/30/02 10/6/02 */ + if (Context == C_VIRTUAL_WIN) + { + /* + * Mask a bug that calls MoveOutline(zeros) after the + * border has been repainted, leaving artifacts. I think + * I know what the bug is, but I can't seem to fix it. + */ + if (Scr->BorderBevelWidth > 0) PaintBorders(tmp_win, False); + + JunkX = tmp_win->virtual_frame_x + tmp_win->frame_width / 2; + JunkY = tmp_win->virtual_frame_y + tmp_win->frame_height / 2; + XWarpPointer(dpy, None, Scr->VirtualDesktopDisplayOuter, + 0, 0, 0, 0, SCALE_D(JunkX), SCALE_D(JunkY)); + + /* grr - djhjr - 5/27/03 */ + SetBorder(Scr->Focus, False); + Scr->Focus = focused; + } + + /* djhjr - 6/4/98 */ + /* don't re-map if the window is the virtual desktop - djhjr - 2/28/99 */ + if (Scr->VirtualReceivesMotionEvents && + /* !tmp_win->opaque_resize && */ + tmp_win->w != Scr->VirtualDesktopDisplayOuter) + { + XUnmapWindow(dpy, Scr->VirtualDesktopDisplay); + XMapWindow(dpy, Scr->VirtualDesktopDisplay); + } + + break; + } + + case F_ZOOM: + case F_HORIZOOM: + case F_FULLZOOM: + case F_LEFTZOOM: + case F_RIGHTZOOM: + case F_TOPZOOM: + case F_BOTTOMZOOM: + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + /* djhjr - 4/1/00 */ + PopDownMenu(); + + fullzoom(tmp_win, func); + /* UpdateDesktop(tmp_win); Stig */ + MoveResizeDesktop(tmp_win, Scr->NoRaiseMove); /* Stig */ + break; + + case F_MOVE: + case F_FORCEMOVE: + { + static Time last_time = 0; + Window rootw; + Bool fromtitlebar = False; + int moving_icon = FALSE; + int constMoveDir, constMoveX, constMoveY; + int constMoveXL, constMoveXR, constMoveYT, constMoveYB; + int origX, origY; + long releaseEvent; + long movementMask; + int xl, yt, xr, yb; + int movefromcenter = 0; /* djhjr - 10/4/02 */ +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + int did_playsound = FALSE; +#endif + + if (DeferExecution(context, func, Scr->MoveCursor)) + return TRUE; + + PopDownMenu(); + rootw = eventp->xbutton.root; + + if (pulldown) + XWarpPointer(dpy, None, Scr->Root, + 0, 0, 0, 0, eventp->xbutton.x_root, + eventp->xbutton.y_root); + + EventHandler[EnterNotify] = HandleUnknown; + EventHandler[LeaveNotify] = HandleUnknown; + +/* djhjr - 4/7/98 + if (!Scr->NoGrabServer || !Scr->OpaqueMove) XGrabServer(dpy); +*/ +/* djhjr - 7/17/98 + if (!Scr->NoGrabServer) XGrabServer(dpy); +*/ + if (!tmp_win->opaque_move) XGrabServer(dpy); + +/* use initialized size... djhjr - 5/9/96 + * djhjr - 4/27/96 * + Scr->SizeStringOffset = SIZE_HINDENT; + XResizeWindow(dpy, Scr->SizeWindow, + Scr->SizeStringWidth + SIZE_HINDENT * 2, + Scr->SizeFont.height + SIZE_VINDENT * 2); +*/ + + XGrabPointer(dpy, eventp->xbutton.root, True, + ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | PointerMotionMask, + /* PointerMotionHintMask */ + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->MoveCursor, CurrentTime); + + /* added this 'if (...) else' - djhjr - 10/11/01 */ + if (context == C_VIRTUAL_WIN) + { + TwmWindow *twin; + + if ((XFindContext(dpy, eventp->xbutton.subwindow, + VirtualContext, (caddr_t *) &twin) == XCNOENT)) + { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + } + + tmp_win = twin; + moveFromCenterWrapper(tmp_win); + /* these two - djhjr - 10/4/02 */ + w = tmp_win->frame; + movefromcenter = 1; + } + else + + /* added this 'if (...) else' - djhjr - 9/15/99 */ + if (context == C_ICONMGR && tmp_win->list) + { + /* added the second argument - djhjr - 5/28/00 */ + if (!warp_if_warpunmapped(tmp_win, F_NOFUNCTION)) + { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + } + + moveFromCenterWrapper(tmp_win); /* djhjr - 10/11/01 */ + /* these two - djhjr - 10/4/02 */ + w = tmp_win->frame; + movefromcenter = 1; + } + else + + if (context == C_ICON && tmp_win->icon_w) + { + DragX = eventp->xbutton.x; + DragY = eventp->xbutton.y; + + w = tmp_win->icon_w; + moving_icon = TRUE; + } + else if (w != tmp_win->icon_w) + { + XTranslateCoordinates(dpy, w, tmp_win->frame, + eventp->xbutton.x, + eventp->xbutton.y, + &DragX, &DragY, &JunkChild); + + w = tmp_win->frame; + } + + XMapRaised (dpy, Scr->SizeWindow); + + DragWindow = None; + + MoveFunction = func; /* set for DispatchEvent() */ + + XGetGeometry(dpy, w, &JunkRoot, &origDragX, &origDragY, + (unsigned int *)&DragWidth, + (unsigned int *)&DragHeight, + &JunkBW, &JunkDepth); + + /* added this 'if (...) else' - djhjr - 10/4/02 */ + if (menuFromFrameOrWindowOrTitlebar || + movefromcenter || (moving_icon && fromMenu)) + { + origX = DragX = origDragX + DragWidth / 2; + origY = DragY = origDragY + DragHeight / 2; + } + else + { + origX = eventp->xbutton.x_root; + origY = eventp->xbutton.y_root; + } + + CurrentDragX = origDragX; + CurrentDragY = origDragY; + + /* + * Only do the constrained move if timer is set - + * need to check it in case of stupid or wicked fast servers. + */ + if ( ConstrainedMoveTime && + eventp->xbutton.time - last_time < ConstrainedMoveTime) + { + int width, height; + + ConstMove = TRUE; + constMoveDir = MOVE_NONE; + constMoveX = eventp->xbutton.x_root - DragX - JunkBW; + constMoveY = eventp->xbutton.y_root - DragY - JunkBW; + width = DragWidth + 2 * JunkBW; + height = DragHeight + 2 * JunkBW; + constMoveXL = constMoveX + width/3; + constMoveXR = constMoveX + 2*(width/3); + constMoveYT = constMoveY + height/3; + constMoveYB = constMoveY + 2*(height/3); + + XWarpPointer(dpy, None, w, + 0, 0, 0, 0, DragWidth/2, DragHeight/2); + + XQueryPointer(dpy, w, &JunkRoot, &JunkChild, + &JunkX, &JunkY, &DragX, &DragY, &JunkMask); + } + last_time = eventp->xbutton.time; + +/* djhjr - 4/7/98 + if (!Scr->OpaqueMove) +*/ + if (!tmp_win->opaque_move) + { + InstallRootColormap(); + /*if (!Scr->MoveDelta)*/ /* djhjr - 10/2/02 */ + { + /* + * Draw initial outline. This was previously done the + * first time though the outer loop by dropping out of + * the XCheckMaskEvent inner loop down to one of the + * MoveOutline's below. + */ + MoveOutline(rootw, + origDragX - JunkBW, origDragY - JunkBW, + DragWidth + 2 * JunkBW, DragHeight + 2 * JunkBW, + tmp_win->frame_bw, +/* djhjr - 4/22/96 + moving_icon ? 0 : tmp_win->title_height); +*/ + moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D); + + /* + * This next line causes HandleButtonRelease to call + * XRaiseWindow(). This is solely to preserve the + * previous behaviour that raises a window being moved + * on button release even if you never actually moved + * any distance (unless you move less than MoveDelta or + * NoRaiseMove is set or OpaqueMove is set). + * + * It's set way down below; no need to force it here. + * djhjr - 10/4/02 + * + * The code referred to above is 'if 0'd out now anyway. + * djhjr - 10/6/02 + */ + /*DragWindow = w;*/ + } + } + + /* + * see if this is being done from the titlebar + */ + fromtitlebar = belongs_to_twm_window(tmp_win, + eventp->xbutton.window); + + /* added 'movefromcenter' and 'moving_icon' - djhjr - 10/4/02 */ + if ((menuFromFrameOrWindowOrTitlebar && !fromtitlebar) || + movefromcenter || (moving_icon && fromMenu)) + { + /* warp the pointer to the middle of the window */ + XWarpPointer(dpy, None, Scr->Root, 0, 0, 0, 0, + origDragX + DragWidth / 2, + origDragY + DragHeight / 2); + + SetBorder(tmp_win, True); /* grr */ + + XFlush(dpy); + } + + /* djhjr - 4/27/96 */ + DisplayPosition(CurrentDragX, CurrentDragY); + + if (menuFromFrameOrWindowOrTitlebar) + { + releaseEvent = ButtonPress; + movementMask = PointerMotionMask; + } + else + { + releaseEvent = ButtonRelease; + movementMask = ButtonMotionMask; + } + + while (TRUE) + { + /* block until there is an interesting event */ + XMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask | + ExposureMask | VisibilityChangeMask | + movementMask, &Event); + +/* + * See down below, after this loop - djhjr - 5/23/03 + */ +#if 0 + /* throw away enter and leave events until release */ + if (Event.xany.type == EnterNotify || + Event.xany.type == LeaveNotify) + { + continue; + } +#endif + + /* + * Don't discard exposure events before release + * or window borders and/or their titles in the + * virtual desktop won't get redrawn - djhjr + */ + + /* discard any extra motion events before a release */ + if (Event.type == MotionNotify) + { + while (XCheckMaskEvent(dpy, movementMask | releaseEvent, + &Event)) + { + if (Event.type == releaseEvent) + break; + } + } + + /* + * There used to be a couple of routines that handled the + * cancel functionality here, each doing a portion of the + * job, then returning immediately. They became redundant + * to just letting program execution fall through. So now, + * the 'if (Event.type == releaseEvent) if (Cancel)' below + * does just that, clearing a few flags first. + * djhjr - 10/6/02 + */ + + if (fromtitlebar && Event.type == ButtonPress) + { + fromtitlebar = False; + CurrentDragX = origX = Event.xbutton.x_root; + CurrentDragY = origY = Event.xbutton.y_root; + XTranslateCoordinates(dpy, rootw, tmp_win->frame, + origX, origY, + &DragX, &DragY, &JunkChild); + + continue; + } + + /* DispatchEvent2() is depreciated - djhjr - 10/6/02 */ + if (!DispatchEvent()) continue; + + /* re-wrote this stuff - djhjr - 10/4/02 5/24/03 11/2/03 */ + if (Event.type == releaseEvent) + { + MoveOutline(rootw, 0, 0, 0, 0, 0, 0); + + if (Cancel) + { + DragWindow = None; + ConstMove = WindowMoved = do_next_action = FALSE; + } + else if (WindowMoved) + { + if (moving_icon) + { + tmp_win->icon_moved = TRUE; + XMoveWindow(dpy, tmp_win->icon_w, + CurrentDragX, CurrentDragY); + + if (!Scr->NoRaiseMove && !Scr->RaiseOnStart) + { + XRaiseWindow(dpy, tmp_win->icon_w); + SetRaiseWindow(tmp_win->icon_w); + } + } + else + { + if (movefromcenter) + { + tmp_win->frame_x = Event.xbutton.x_root - + DragWidth / 2; + tmp_win->frame_y = Event.xbutton.y_root - + DragHeight / 2; + } + else + { + tmp_win->frame_x = CurrentDragX; + tmp_win->frame_y = CurrentDragY; + } + + XMoveWindow(dpy, tmp_win->frame, + tmp_win->frame_x, tmp_win->frame_y); + SendConfigureNotify(tmp_win, tmp_win->frame_x, + tmp_win->frame_y); + + if (!Scr->NoRaiseMove && !Scr->RaiseOnStart) + { + XRaiseWindow(dpy, tmp_win->frame); + SetRaiseWindow(tmp_win); + } + } + } + + break; + } + + /* something left to do only if the pointer moved */ + if (Event.type != MotionNotify) continue; + + XQueryPointer(dpy, rootw, &(eventp->xmotion.root), &JunkChild, + &(eventp->xmotion.x_root), + &(eventp->xmotion.y_root), + &JunkX, &JunkY, &JunkMask); + + if (DragWindow == None && + abs(eventp->xmotion.x_root - origX) < Scr->MoveDelta && + abs(eventp->xmotion.y_root - origY) < Scr->MoveDelta) + { + continue; + } + + WindowMoved = TRUE; + DragWindow = w; + +/* djhjr - 4/7/98 + if (!Scr->NoRaiseMove && Scr->OpaqueMove) +*/ +/* djhjr - 10/6/02 + if (!Scr->NoRaiseMove && tmp_win->opaque_move) + XRaiseWindow(dpy, DragWindow); +*/ + /* djhjr - 5/24/03 11/3/03 */ + if (!Scr->NoRaiseMove && Scr->RaiseOnStart) + { + if (moving_icon) + { + XRaiseWindow(dpy, tmp_win->icon_w); + SetRaiseWindow(tmp_win->icon_w); + } + else + { + XRaiseWindow(dpy, tmp_win->frame); + SetRaiseWindow(tmp_win); + if (Scr->Virtual && + tmp_win->VirtualDesktopDisplayWindow) + XRaiseWindow(dpy, + tmp_win->VirtualDesktopDisplayWindow); + } + } + + if (ConstMove) + { + switch (constMoveDir) + { + case MOVE_NONE: + if (eventp->xmotion.x_root < constMoveXL || + eventp->xmotion.x_root > constMoveXR) + { + constMoveDir = MOVE_HORIZ; + } + if (eventp->xmotion.y_root < constMoveYT || + eventp->xmotion.y_root > constMoveYB) + { + constMoveDir = MOVE_VERT; + } + XQueryPointer(dpy, DragWindow, &JunkRoot, + &JunkChild, &JunkX, &JunkY, + &DragX, &DragY, &JunkMask); + break; + case MOVE_VERT: + constMoveY = eventp->xmotion.y_root - DragY - + JunkBW; + break; + case MOVE_HORIZ: + constMoveX = eventp->xmotion.x_root - DragX - + JunkBW; + break; + } + + xl = constMoveX; + yt = constMoveY; + } + else if (DragWindow != None) + { + /* added 'movefromcenter' and 'moving_icon' - djhjr - 10/4/02 */ + if (!menuFromFrameOrWindowOrTitlebar && + !movefromcenter && !(moving_icon && fromMenu)) + { + xl = eventp->xmotion.x_root - DragX - JunkBW; + yt = eventp->xmotion.y_root - DragY - JunkBW; + } + else + { + xl = eventp->xmotion.x_root - (DragWidth / 2); + yt = eventp->xmotion.y_root - (DragHeight / 2); + } + } + + if ((ConstMove && constMoveDir != MOVE_NONE) || + DragWindow != None) + { + int width = DragWidth + 2 * JunkBW; + int height = DragHeight + 2 * JunkBW; + + if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE) + { + xr = xl + width; + yb = yt + height; + + if (xl < 0) xl = 0; + if (xr > Scr->MyDisplayWidth) + xl = Scr->MyDisplayWidth - width; + + if (yt < 0) yt = 0; + if (yb > Scr->MyDisplayHeight) + yt = Scr->MyDisplayHeight - height; + } + + CurrentDragX = xl; + CurrentDragY = yt; + +/* djhjr - 6/22/01 10/6/02 */ +#ifndef NO_SOUND_SUPPORT + if ((!ConstMove || constMoveDir != MOVE_NONE) && + did_playsound == FALSE) + { + PlaySound(func); + did_playsound = TRUE; + } +#endif + +/* djhjr - 4/7/98 + if (Scr->OpaqueMove) +*/ + if (tmp_win->opaque_move) + XMoveWindow(dpy, DragWindow, xl, yt); + else + MoveOutline(eventp->xmotion.root, xl, yt, + width, height, tmp_win->frame_bw, +/* djhjr - 4/22/96 + moving_icon ? 0 : tmp_win->title_height); +*/ + moving_icon ? 0 : tmp_win->title_height + tmp_win->frame_bw3D); + +/* djhjr - 4/17/98 + * move the small representation window + * this knows a bit much about the internals i guess + * XMoveWindow(dpy, tmp_win->VirtualDesktopDisplayWindow, SCALE_D(xl), SCALE_D(yt)); +*/ + if (Scr->VirtualReceivesMotionEvents) + { + tmp_win->virtual_frame_x = R_TO_V_X(xl); + tmp_win->virtual_frame_y = R_TO_V_Y(yt); +/* djhjr - 5/24/03 + MoveResizeDesktop(tmp_win, Scr->NoRaiseMove); +*/ + MoveResizeDesktop(tmp_win, TRUE); + } + + /* djhjr - 4/27/96 */ + DisplayPosition (xl, yt); + } + } + +/* djhjr - 7/17/98 + * djhjr - 4/7/98 * + if (!Scr->NoGrabServer) XUngrabServer(dpy); +*/ + if (!tmp_win->opaque_move) XUngrabServer(dpy); + + /* djhjr - 4/27/96 */ + XUnmapWindow (dpy, Scr->SizeWindow); + + MovedFromKeyPress = False; + + if (!tmp_win->opaque_move) + UninstallRootColormap(); + + /* discard queued enter and leave events - djhjr - 5/23/03 */ + while (XCheckMaskEvent(dpy, EnterWindowMask | LeaveWindowMask, + &Event)) + ; + + /* from events.c:HandleButtonRelease() - djhjr - 10/6/02 */ + if (!Scr->NoRaiseMove) + { + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + } + + /* update virtual coords */ + tmp_win->virtual_frame_x = Scr->VirtualDesktopX + tmp_win->frame_x; + tmp_win->virtual_frame_y = Scr->VirtualDesktopY + tmp_win->frame_y; + + /* UpdateDesktop() hoses the stacking order - djhjr - 10/6/02 */ +/* djhjr - 5/24/03 + MoveResizeDesktop(tmp_win, Scr->NoRaiseMove); +*/ + MoveResizeDesktop(tmp_win, Cancel | Scr->NoRaiseMove); + + /* djhjr - 10/4/02 10/6/02 */ + if (Context == C_VIRTUAL_WIN) + { + /* + * Mask a bug that calls MoveOutline(zeros) after the + * border has been repainted, leaving artifacts. I think + * I know what the bug is, but I can't seem to fix it. + */ + if (Scr->BorderBevelWidth > 0) PaintBorders(tmp_win, False); + + JunkX = tmp_win->virtual_frame_x + tmp_win->frame_width / 2; + JunkY = tmp_win->virtual_frame_y + tmp_win->frame_height / 2; + XWarpPointer(dpy, None, Scr->VirtualDesktopDisplayOuter, + 0, 0, 0, 0, SCALE_D(JunkX), SCALE_D(JunkY)); + } + + /* djhjr - 6/4/98 */ + /* don't re-map if the window is the virtual desktop - djhjr - 2/28/99 */ + if (Scr->VirtualReceivesMotionEvents && + /* !tmp_win->opaque_move && */ + tmp_win->w != Scr->VirtualDesktopDisplayOuter) + { + XUnmapWindow(dpy, Scr->VirtualDesktopDisplay); + XMapWindow(dpy, Scr->VirtualDesktopDisplay); + } + + MoveFunction = F_NOFUNCTION; /* clear for DispatchEvent() */ + + /* sanity check (also in events.c:HandleButtonRelease()) - djhjr - 10/6/02 */ + DragWindow = None; + ConstMove = FALSE; + + break; + } + case F_FUNCTION: + { + MenuRoot *mroot; + MenuItem *mitem; + Cursor cursor; + + if ((mroot = FindMenuRoot(action)) == NULL) + { + fprintf (stderr, "%s: couldn't find function \"%s\"\n", + ProgramName, action); + return TRUE; + } + +/* + * Changed this 'if ()' for deferred keyboard events (see also events.c) + * Submitted by Michel Eyckmans + * + if (NeedToDefer(mroot) && DeferExecution(context, func, Scr->SelectCursor)) + */ + if ((cursor = NeedToDefer(mroot)) != None && DeferExecution(context, func, cursor)) + return TRUE; + else + { + for (mitem = mroot->first; mitem != NULL; mitem = mitem->next) + { + if (!ExecuteFunction (mitem->func, mitem->action, w, + tmp_win, eventp, context, pulldown)) + break; + } + } + } + break; + + case F_DEICONIFY: + case F_ICONIFY: + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + /* added '|| (...)' - djhjr - 6/3/03 */ + if (tmp_win->icon || + (func == F_DEICONIFY && tmp_win == tmp_win->list->twm)) + { +/* djhjr - 6/3/03 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(func); +#endif + + DeIconify(tmp_win); + + /* + * now HERE's a fine bit of kludge! it's to mask a hole in the + * code I can't find that messes up when trying to warp to the + * de-iconified window not in the real screen when WarpWindows + * isn't used. see also the change in DeIconify(). + * djhjr - 1/24/98 + */ + if (!Scr->WarpWindows && (Scr->WarpCursor || + LookInList(Scr->WarpCursorL, tmp_win->full_name, &tmp_win->class))) + { + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + WarpToWindow(tmp_win); /* PF */ + } + } + else if (func == F_ICONIFY) + { + /* djhjr - 9/10/99 */ + TwmDoor *d; + TwmWindow *tmgr = NULL, *twin = NULL; + MenuRoot *mr; + + /* sanity check for what's next - djhjr - 9/10/99 */ + if (XFindContext(dpy, tmp_win->w, DoorContext, + (caddr_t *)&d) != XCNOENT) + { + twin = tmp_win; + tmp_win = d->twin; + } + + /* + * don't iconify if there's no way to get it back - not fool-proof + * djhjr - 9/10/99 + */ + if (tmp_win->iconify_by_unmapping) + { + /* iconified by unmapping */ + + if (tmp_win->list) tmgr = tmp_win->list->iconmgr->twm_win; + + if ((tmgr && !tmgr->mapped && tmgr->iconify_by_unmapping) || + ((Scr->IconManagerDontShow || + LookInList(Scr->IconMgrNoShow, tmp_win->full_name, &tmp_win->class)) && + LookInList(Scr->IconMgrShow, tmp_win->full_name, &tmp_win->class) == (char *)NULL)) + { + /* icon manager not mapped or not shown in one */ + + if (have_twmwindows == -1) + { + have_twmwindows = 0; + + /* better than two calls to FindMenuRoot() */ + for (mr = Scr->MenuList; mr != NULL; mr = mr->next) + if (strcmp(mr->name, TWM_WINDOWS) == 0 || + strcmp(mr->name, VTWM_WINDOWS) == 0) + { + /* djhjr - 9/21/99 */ + have_twmwindows = FindMenuOrFuncInBindings(C_ALL_BITS, mr, F_NOFUNCTION); + break; + } + } + /* djhjr - 9/21/99 */ + if (have_showdesktop == -1) + have_showdesktop = FindMenuOrFuncInBindings(C_ALL_BITS, NULL, F_SHOWDESKTOP); + if (have_showlist == -1) + have_showlist = FindMenuOrFuncInBindings(C_ALL_BITS, NULL, F_SHOWLIST); + + /* djhjr - 9/21/99 */ + if (!FindMenuOrFuncInWindows(tmp_win, have_twmwindows, mr, F_NOFUNCTION) || + LookInList(Scr->DontShowInTWMWindows, tmp_win->full_name, &tmp_win->class)) + { + /* no TwmWindows menu or not shown in it */ + + if (tmp_win->w == Scr->VirtualDesktopDisplayOuter && + FindMenuOrFuncInWindows(tmp_win, have_showdesktop, NULL, F_SHOWDESKTOP)) + ; + else if (tmp_win->iconmgr && + FindMenuOrFuncInWindows(tmp_win, have_showlist, NULL, F_SHOWLIST)) + ; + else if (tmgr && + FindMenuOrFuncInWindows(tmgr, have_showlist, NULL, F_SHOWLIST)) + ; + else + { + /* no f.showdesktop or f.showiconmgr */ + + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + + if (twin) tmp_win = twin; + break; + } + } + } + } + + if (twin) tmp_win = twin; + + if (tmp_win->list || !Scr->NoIconifyIconManagers) /* PF */ + { +/* djhjr - 6/3/03 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(func); +#endif + + Iconify (tmp_win, eventp->xbutton.x_root - EDGE_OFFSET, /* DSE */ + eventp->xbutton.y_root - EDGE_OFFSET); /* DSE */ + } + } + break; + + case F_RAISELOWER: + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + if (!WindowMoved) { + XWindowChanges xwc; + + xwc.stack_mode = Opposite; + if (w != tmp_win->icon_w) + w = tmp_win->frame; + XConfigureWindow (dpy, w, CWStackMode, &xwc); + XConfigureWindow (dpy, tmp_win->VirtualDesktopDisplayWindow, CWStackMode, &xwc); + /* ug */ + XLowerWindow(dpy, Scr->VirtualDesktopDScreen); + } + break; + + case F_RAISE: + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + /* check to make sure raise is not from the WindowFunction */ + if (w == tmp_win->icon_w && Context != C_ROOT) + XRaiseWindow(dpy, tmp_win->icon_w); + else + { + XRaiseWindow(dpy, tmp_win->frame); + XRaiseWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); + } + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + break; + + case F_LOWER: + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + if (!(Scr->StickyAbove && tmp_win->nailed)) { /* DSE */ + if (w == tmp_win->icon_w) + XLowerWindow(dpy, tmp_win->icon_w); + else + { XLowerWindow(dpy, tmp_win->frame); + XLowerWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); + XLowerWindow(dpy, Scr->VirtualDesktopDScreen); + } + } /* DSE */ + + break; + + case F_FOCUS: + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + if (tmp_win->icon == FALSE) + { + if (!Scr->FocusRoot && Scr->Focus == tmp_win) + { + FocusOnRoot(); + } + else + { + if (Scr->Focus != NULL) { + SetBorder (Scr->Focus, False); + +/* djhjr - 4/25/96 + if (Scr->Focus->hilite_w) + XUnmapWindow (dpy, Scr->Focus->hilite_w); +*/ + PaintTitleHighlight(Scr->Focus, off); + + } + + InstallWindowColormaps (0, tmp_win); + +/* djhjr - 4/25/96 + if (tmp_win->hilite_w) XMapWindow (dpy, tmp_win->hilite_w); +*/ + PaintTitleHighlight(tmp_win, on); + + SetBorder (tmp_win, True); + SetFocus (tmp_win, eventp->xbutton.time); + Scr->FocusRoot = FALSE; + Scr->Focus = tmp_win; + } + } + break; + + case F_DESTROY: + if (DeferExecution(context, func, Scr->DestroyCursor)) + return TRUE; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + /* flag for the handler */ + if (PlaySound(func)) destroySoundFromFunction = TRUE; +#endif + + /* djhjr - 9/10/96 */ + if (tmp_win == Scr->VirtualDesktopDisplayTwin) + { + /* added this 'if (...) ...' and 'if (...) else' - djhjr - 9/21/99 */ + if (have_showdesktop == -1) + have_showdesktop = FindMenuOrFuncInBindings(C_ALL_BITS, NULL, F_SHOWDESKTOP); + if (FindMenuOrFuncInWindows(tmp_win, have_showdesktop, NULL, F_SHOWDESKTOP)) + XUnmapWindow(dpy, Scr->VirtualDesktopDisplayTwin->frame); + else + + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + } + + { + TwmDoor *d; + + if (XFindContext(dpy, tmp_win->w, DoorContext, + (caddr_t *) &d) != XCNOENT) + { +/* djhjr - 9/10/99 + XBell(dpy, 0); +*/ + /* for some reason, we don't get the button up event - djhjr - 9/10/99 */ + ButtonPressed = -1; + door_delete(tmp_win->w, d); + + break; + } + } + + if (tmp_win->iconmgr) /* don't send ourself a message */ + { + /* added this 'if (...) ...' and 'if (...) else ...' - djhjr - 9/21/99 */ + if (have_showlist == -1) + have_showlist = FindMenuOrFuncInBindings(C_ALL_BITS, NULL, F_SHOWLIST); + if (FindMenuOrFuncInWindows(tmp_win, have_showlist, NULL, F_SHOWLIST)) + + /* added argument - djhjr - 9/21/99 */ + HideIconManager(tmp_win); + + else + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + } + else + { + /* djhjr - 4/26/99 */ + AppletDown(tmp_win); + + XKillClient(dpy, tmp_win->w); + } + break; + + case F_DELETE: + if (DeferExecution(context, func, Scr->DestroyCursor)) + return TRUE; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + /* flag for the handler */ + if (PlaySound(func)) destroySoundFromFunction = TRUE; +#endif + + /* djhjr - 9/21/99 */ + if (tmp_win == Scr->VirtualDesktopDisplayTwin) + { + if (have_showdesktop == -1) + have_showdesktop = FindMenuOrFuncInBindings(C_ALL_BITS, NULL, F_SHOWDESKTOP); + if (FindMenuOrFuncInWindows(tmp_win, have_showdesktop, NULL, F_SHOWDESKTOP)) + XUnmapWindow(dpy, Scr->VirtualDesktopDisplayTwin->frame); + else + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + + break; + } + + /* djhjr - 9/10/99 */ + { + TwmDoor *d; + + if (XFindContext(dpy, tmp_win->w, DoorContext, + (caddr_t *) &d) != XCNOENT) + { + /* for some reason, we don't get the button up event - djhjr - 9/10/99 */ + ButtonPressed = -1; + door_delete(tmp_win->w, d); + + break; + } + } + + if (tmp_win->iconmgr) /* don't send ourself a message */ + { + /* added this 'if (...) ...' and 'if (...) else ...' - djhjr - 9/21/99 */ + if (have_showlist == -1) + have_showlist = FindMenuOrFuncInBindings(C_ALL_BITS, NULL, F_SHOWLIST); + if (FindMenuOrFuncInWindows(tmp_win, have_showlist, NULL, F_SHOWLIST)) + + /* added argument - djhjr - 9/21/99 */ + HideIconManager(tmp_win); + + else + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + } + else if (tmp_win->protocols & DoesWmDeleteWindow) + { + /* djhjr - 4/26/99 */ + AppletDown(tmp_win); + + SendDeleteWindowMessage (tmp_win, LastTimestamp()); + } + else + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + + case F_SAVEYOURSELF: + if (DeferExecution (context, func, Scr->SelectCursor)) + return TRUE; + + if (tmp_win->protocols & DoesWmSaveYourself) + SendSaveYourselfMessage (tmp_win, LastTimestamp()); + else + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + + case F_CIRCLEUP: + XCirculateSubwindowsUp(dpy, Scr->Root); + break; + + case F_CIRCLEDOWN: + XCirculateSubwindowsDown(dpy, Scr->Root); + break; + + case F_EXEC: + PopDownMenu(); + if (!Scr->NoGrabServer) { + XUngrabServer (dpy); + XSync (dpy, 0); + } + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + /* flag for the handler */ + if (PlaySound(func)) createSoundFromFunction = TRUE; +#endif + + Execute(action); + break; + + case F_UNFOCUS: + FocusOnRoot(); + break; + + case F_CUT: + strcpy(tmp, action); + strcat(tmp, "\n"); + XStoreBytes(dpy, tmp, strlen(tmp)); + break; + + case F_CUTFILE: + ptr = XFetchBytes(dpy, &count); + if (ptr) { + if (sscanf (ptr, "%s", tmp) == 1) { + XFree (ptr); + ptr = ExpandFilename(tmp); + if (ptr) { + fd = open (ptr, 0); + if (fd >= 0) { + count = read (fd, buff, MAX_FILE_SIZE - 1); + if (count > 0) XStoreBytes (dpy, buff, count); + close(fd); + } else { + fprintf (stderr, + "%s: unable to open cut file \"%s\"\n", + ProgramName, tmp); + } + if (ptr != tmp) free (ptr); + } + } else { + XFree(ptr); + } + } else { + fprintf(stderr, "%s: cut buffer is empty\n", ProgramName); + } + break; + + case F_WARPTOSCREEN: + { + if (strcmp (action, WARPSCREEN_NEXT) == 0) { + WarpToScreen (Scr->screen + 1, 1); + } else if (strcmp (action, WARPSCREEN_PREV) == 0) { + WarpToScreen (Scr->screen - 1, -1); + } else if (strcmp (action, WARPSCREEN_BACK) == 0) { + WarpToScreen (PreviousScreen, 0); + } else { + WarpToScreen (atoi (action), 0); + } + } + break; + + case F_COLORMAP: + { + if (strcmp (action, COLORMAP_NEXT) == 0) { + BumpWindowColormap (tmp_win, 1); + } else if (strcmp (action, COLORMAP_PREV) == 0) { + BumpWindowColormap (tmp_win, -1); + } else { + BumpWindowColormap (tmp_win, 0); + } + } + break; + + case F_WARPCLASSNEXT: /* PF */ + case F_WARPCLASSPREV: /* PF */ + WarpClass(func == F_WARPCLASSNEXT, tmp_win, action); + break; + + case F_WARPTONEWEST: /* PF */ + /* added '&& warp_if_warpunmapped()' - djhjr - 5/13/98 */ + /* added the second argument - djhjr - 5/28/00 */ + if (Scr->Newest && warp_if_warpunmapped(Scr->Newest, F_NOFUNCTION)) + { + RaiseStickyAbove(); + RaiseAutoPan(); + +/* djhjr - 6/3/03 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(func); +#endif + + WarpToWindow(Scr->Newest); + } + else + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + + case F_WARPTO: + { + register TwmWindow *t; + /* djhjr - 6/3/03 */ + int did_warpto = FALSE; + + for (t = Scr->TwmRoot.next; t != NULL; t = t->next) + { + /* + * This used to fall through into F_WARP, but the + * warp_if_warpunmapped() meant this loop couldn't + * continue to look for a match in the window list. + * djhjr - 10/27/02 + */ + + /* jason@tfs.com */ + if (MatchWinName(action, t) == 0 && + warp_if_warpunmapped(t, func)) + { + tmp_win = t; /* PF */ + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + /* djhjr - 6/3/03 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(func); +#endif + did_warpto = TRUE; + + WarpToWindow(tmp_win); /* PF */ + break; + } + } + + /* djhjr - 6/3/03 */ + if (!did_warpto) + DoAudible(); + } + break; + + case F_WARP: /* PF */ + { /* PF */ + /* added '&& warp_if_warpunmapped()' - djhjr - 5/13/98 */ + /* added the second argument - djhjr - 5/28/00 */ + if (tmp_win && warp_if_warpunmapped(tmp_win, F_NOFUNCTION)) /* PF */ + { + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + +/* djhjr - 6/3/03 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(func); +#endif + + WarpToWindow(tmp_win); /* PF */ + } else { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + } + } /* PF */ + break; + + case F_WARPTOICONMGR: + { + TwmWindow *t; + int len; + +/* djhjr - 5/13/98 + Window raisewin = None, iconwin = None; +*/ +/* + * raisewin now points to the window's icon manager entry, and + * iconwin now points to raisewin's icon manager - djhjr - 5/30/00 + * + TwmWindow *raisewin = None; + Window iconwin = None; +*/ + WList *raisewin = NULL; + TwmWindow *iconwin = None; + + len = strlen(action); + if (len == 0) { + if (tmp_win && tmp_win->list) { +/* djhjr - 5/13/98 + raisewin = tmp_win->list->iconmgr->twm_win->frame; +*/ +/* djhjr - 5/30/00 + raisewin = tmp_win->list->iconmgr->twm_win; + iconwin = tmp_win->list->icon; +*/ + raisewin = tmp_win->list; + } else if (Scr->iconmgr.active) { +/* djhjr - 5/13/98 + raisewin = Scr->iconmgr.twm_win->frame; +*/ +/* djhjr - 5/30/00 + raisewin = Scr->iconmgr.twm_win; + iconwin = Scr->iconmgr.active->w; +*/ + raisewin = Scr->iconmgr.active; + } + } else { + for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { + if (strncmp (action, t->icon_name, len) == 0) { + if (t->list && t->list->iconmgr->twm_win->mapped) { + +/* djhjr - 5/13/98 + raisewin = t->list->iconmgr->twm_win->frame; +*/ +/* djhjr - 5/30/00 + raisewin = t->list->iconmgr->twm_win; + iconwin = t->list->icon; +*/ + raisewin = t->list; + break; + } + } + } + } + + /* djhjr - 6/14/00 */ + if (!raisewin) + { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + } + + /* djhjr - 5/30/00 */ + iconwin = raisewin->iconmgr->twm_win; + + /* added '&& warp_if_warpunmapped()' - djhjr - 5/13/98 */ + /* added the second argument - djhjr - 5/28/00 */ + /* was 'raisewin' - djhjr - 5/30/00 */ + if (iconwin && warp_if_warpunmapped(iconwin, F_NOFUNCTION)) { +/* djhjr - 6/3/03 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(func); +#endif + +/* djhjr - 5/30/00 + XWarpPointer (dpy, None, iconwin, 0, 0, 0, 0, + EDGE_OFFSET, EDGE_OFFSET); * DSE * +*/ + WarpInIconMgr(raisewin, iconwin); + } else { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + } + } + break; + + case F_SQUEEZELEFT:/*RFB*/ + { + static SqueezeInfo left_squeeze = { J_LEFT, 0, 0 }; + + /* too much dup'd code - djhjr - 9/17/02 */ + if (do_squeezetitle(context, func, tmp_win, &left_squeeze)) + return TRUE; /* deferred */ + } + break; + + case F_SQUEEZERIGHT:/*RFB*/ + { + static SqueezeInfo right_squeeze = { J_RIGHT, 0, 0 }; + + /* too much dup'd code - djhjr - 9/17/02 */ + if (do_squeezetitle(context, func, tmp_win, &right_squeeze)) + return TRUE; /* deferred */ + } + break; + + case F_SQUEEZECENTER:/*RFB*/ + { + static SqueezeInfo center_squeeze = { J_CENTER, 0, 0 }; + + /* too much dup'd code - djhjr - 9/17/02 */ + if (do_squeezetitle(context, func, tmp_win, ¢er_squeeze)) + return TRUE; /* deferred */ + } + break; + + case F_RING:/*RFB*/ + if (DeferExecution (context, func, Scr->SelectCursor)) + return TRUE; + if ( tmp_win->ring.next || tmp_win->ring.prev ) + RemoveWindowFromRing(tmp_win); + else + AddWindowToRing(tmp_win); +#ifdef ORIGINAL_WARPRINGCOORDINATES /* djhjr - 5/11/98 */ + tmp_win->ring.cursor_valid = False; +#endif + break; + + case F_WARPRING: + switch (action[0]) { + case 'n': + WarpAlongRing (&eventp->xbutton, True); + break; + case 'p': + WarpAlongRing (&eventp->xbutton, False); + break; + default: + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + break; + } + break; + + case F_FILE: + action = ExpandFilename(action); + fd = open(action, 0); + if (fd >= 0) + { + count = read(fd, buff, MAX_FILE_SIZE - 1); + if (count > 0) + XStoreBytes(dpy, buff, count); + + close(fd); + } + else + { + fprintf (stderr, "%s: unable to open file \"%s\"\n", + ProgramName, action); + } + break; + + case F_REFRESH: + { + XSetWindowAttributes attributes; + unsigned long valuemask; + + valuemask = (CWBackPixel | CWBackingStore | CWSaveUnder); + attributes.background_pixel = Scr->Black; + attributes.backing_store = NotUseful; + attributes.save_under = False; + w = XCreateWindow (dpy, Scr->Root, 0, 0, + (unsigned int) Scr->MyDisplayWidth, + (unsigned int) Scr->MyDisplayHeight, + (unsigned int) 0, + CopyFromParent, (unsigned int) CopyFromParent, + (Visual *) CopyFromParent, valuemask, + &attributes); + XMapWindow (dpy, w); + XDestroyWindow (dpy, w); + XFlush (dpy); + } + break; + + case F_WINREFRESH: + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + if (context == C_ICON && tmp_win->icon_w) + w = XCreateSimpleWindow(dpy, tmp_win->icon_w, + 0, 0, 9999, 9999, 0, Scr->Black, Scr->Black); + else + w = XCreateSimpleWindow(dpy, tmp_win->frame, + 0, 0, 9999, 9999, 0, Scr->Black, Scr->Black); + + XMapWindow(dpy, w); + XDestroyWindow(dpy, w); + XFlush(dpy); + break; + + case F_NAIL: + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + + tmp_win->nailed = !tmp_win->nailed; + /* update the vd display */ + /* UpdateDesktop(tmp_win); Stig */ + NailDesktop(tmp_win); /* Stig */ + +#ifdef DEBUG + fprintf(stdout, "%s: nail state of %s is now %s\n", + ProgramName, tmp_win->name, (tmp_win->nailed ? "nailed" : "free")); +#endif /* DEBUG */ + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); /* DSE */ + + break; + + /* + * move a percentage in a particular direction + */ + case F_PANDOWN: + PanRealScreen(0, (atoi(action) * Scr->MyDisplayHeight) / 100 + /* DSE */ ,NULL,NULL); + break; + case F_PANLEFT: + PanRealScreen(-((atoi(action) * Scr->MyDisplayWidth) / 100), 0 + /* DSE */ ,NULL,NULL); + break; + case F_PANRIGHT: + PanRealScreen((atoi(action) * Scr->MyDisplayWidth) / 100, 0 + /* DSE */ ,NULL,NULL); + break; + case F_PANUP: + PanRealScreen(0, -((atoi(action) * Scr->MyDisplayHeight) / 100) + /* DSE */ ,NULL,NULL); + break; + + case F_RESETDESKTOP: + SetRealScreen(0, 0); + break; + +/*SNUG*/ /* Robert Forsman added these two functions */ +/*SNUG*/ { +/*SNUG*/ TwmWindow *scan; +/*SNUG*/ int right, left, up, down; +/*SNUG*/ int inited; +/*SNUG*/ case F_SNUGDESKTOP: +/*SNUG*/ +/*SNUG*/ inited = 0; +/*SNUG*/ for (scan = Scr->TwmRoot.next; scan!=NULL; scan = scan->next) +/*SNUG*/ { +/*SNUG*/ if (scan->nailed) +/*SNUG*/ continue; +/*SNUG*/ if (scan->frame_x > Scr->MyDisplayWidth || +/*SNUG*/ scan->frame_y > Scr->MyDisplayHeight) +/*SNUG*/ continue; +/*SNUG*/ if (scan->frame_x+scan->frame_width < 0 || +/*SNUG*/ scan->frame_y+scan->frame_height < 0) +/*SNUG*/ continue; +/*SNUG*/ if ( inited==0 || scan->frame_xframe_x; +/*SNUG*/ if ( inited==0 || scan->frame_yframe_y; +/*SNUG*/ if ( inited==0 || scan->frame_x+scan->frame_width>left ) +/*SNUG*/ left = scan->frame_x+scan->frame_width; +/*SNUG*/ if ( inited==0 || scan->frame_y+scan->frame_height>down ) +/*SNUG*/ down = scan->frame_y+scan->frame_height; +/*SNUG*/ inited = 1; +/*SNUG*/ } +/*SNUG*/ if (inited) +/*SNUG*/ { +/*SNUG*/ int dx,dy; +/*SNUG*/ if (left-right < Scr->MyDisplayWidth && (right<0 || left>Scr->MyDisplayWidth) ) +/*SNUG*/ dx = right - ( Scr->MyDisplayWidth - (left-right) ) /2; +/*SNUG*/ else +/*SNUG*/ dx = 0; +/*SNUG*/ if (down-up < Scr->MyDisplayHeight && (up<0 || down>Scr->MyDisplayHeight) ) +/*SNUG*/ dy = up - (Scr->MyDisplayHeight - (down-up) ) /2; +/*SNUG*/ else +/*SNUG*/ dy = 0; +/*SNUG*/ if (dx!=0 || dy!=0) +/*SNUG*/ PanRealScreen(dx,dy,NULL,NULL); +/*SNUG*/ /* DSE */ +/*SNUG*/ else +/*SNUG*/ DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ +/*SNUG*/ } +/*SNUG*/ else +/*SNUG*/ DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ +/*SNUG*/ break; +/*SNUG*/ +/*SNUG*/ case F_SNUGWINDOW: +/*SNUG*/ if (DeferExecution(context, func, Scr->SelectCursor)) +/*SNUG*/ return TRUE; +/*SNUG*/ +/*SNUG*/ inited = 0; +/*SNUG*/ right = tmp_win->frame_x; +/*SNUG*/ left = tmp_win->frame_x + tmp_win->frame_width; +/*SNUG*/ up = tmp_win->frame_y; +/*SNUG*/ down = tmp_win->frame_y + tmp_win->frame_height; +/*SNUG*/ inited = 1; +/*SNUG*/ if (inited) +/*SNUG*/ { +/*SNUG*/ int dx,dy; +/*SNUG*/ dx = 0; +/*SNUG*/ if (left-right < Scr->MyDisplayWidth) +/*SNUG*/ { +/*SNUG*/ if (right<0) +/*SNUG*/ dx = right; +/*SNUG*/ else if (left>Scr->MyDisplayWidth) +/*SNUG*/ dx = left - Scr->MyDisplayWidth; +/*SNUG*/ } +/*SNUG*/ +/*SNUG*/ dy = 0; +/*SNUG*/ if (down-up < Scr->MyDisplayHeight) +/*SNUG*/ { +/*SNUG*/ if (up<0) +/*SNUG*/ dy = up; +/*SNUG*/ else if (down>Scr->MyDisplayHeight) +/*SNUG*/ dy = down - Scr->MyDisplayHeight; +/*SNUG*/ } +/*SNUG*/ +/*SNUG*/ if (dx!=0 || dy!=0) +/*SNUG*/ PanRealScreen(dx,dy,NULL,NULL); +/*SNUG*/ /* DSE */ +/*SNUG*/ else +/*SNUG*/ DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ +/*SNUG*/ } +/*SNUG*/ else +/*SNUG*/ DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ +/*SNUG*/ +/*SNUG*/ break; +/*SNUG*/ } + + /* Next four submitted by Seth Robertson - 9/9/02 */ + case F_BINDBUTTONS: + { + int i, j; + + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + for (i = 0; i < MAX_BUTTONS+1; i++) + for (j = 0; j < MOD_SIZE; j++) + if (Scr->Mouse[i][C_WINDOW][j].func != F_NOFUNCTION) + XGrabButton(dpy, i, j, tmp_win->frame, + True, ButtonPressMask | ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, None, + Scr->FrameCursor); + break; + } + case F_BINDKEYS: + { + FuncKey *tmp; + + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + for (tmp = Scr->FuncKeyRoot.next; tmp != NULL; tmp = tmp->next) + if (tmp->cont == C_WINDOW) +/* djhjr - 9/10/03 + XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->w, True, + GrabModeAsync, GrabModeAsync); +*/ + GrabModKeys(tmp_win->w, tmp); + break; + } + case F_UNBINDBUTTONS: + { + int i, j; + + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + for (i = 0; i < MAX_BUTTONS+1; i++) + for (j = 0; j < MOD_SIZE; j++) + if (Scr->Mouse[i][C_WINDOW][j].func != F_NOFUNCTION) + XUngrabButton(dpy, i, j, tmp_win->frame); + break; + } + case F_UNBINDKEYS: + { + FuncKey *tmp; + + if (DeferExecution(context, func, Scr->SelectCursor)) + return TRUE; + for (tmp = Scr->FuncKeyRoot.next; tmp != NULL; tmp = tmp->next) + if (tmp->cont == C_WINDOW) +/* djhjr - 9/10/03 + XUngrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->w); +*/ + UngrabModKeys(tmp_win->w, tmp); + break; + } + + case F_MOVESCREEN: + + /* + * Breaks badly if not called by the default button press. + */ + + { + long releaseEvent = ButtonRelease; + long movementMask = ButtonMotionMask; +#ifndef NO_SOUND_SUPPORT + int did_playsound = FALSE; +#endif + + StartMoveWindowInDesktop(eventp->xmotion); + + while (TRUE) + { + /* added exposure event masks - djhjr - 10/11/01 */ + XMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask | + ExposureMask | VisibilityChangeMask | + movementMask, &Event); + + /* + * Don't discard exposure events before release + * or window borders and/or their titles in the + * virtual desktop won't get redrawn - djhjr + */ + + /* discard any extra motion events before a release */ + if (Event.type == MotionNotify) + { + /* was 'ButtonMotionMask' - djhjr - 10/11/01 */ + while (XCheckMaskEvent(dpy, releaseEvent | movementMask, + &Event)) + { + if (Event.type == releaseEvent) + break; + } + } + + if (Event.type == releaseEvent) + { + EndMoveWindowOnDesktop(); + break; + } + + if (!DispatchEvent()) continue; + + if (Event.type != MotionNotify) continue; + +#ifndef NO_SOUND_SUPPORT + if (did_playsound == FALSE) + { + PlaySound(func); + did_playsound = TRUE; + } +#endif + + DoMoveWindowOnDesktop(Event.xmotion.x, Event.xmotion.y); + } + + /* discard queued enter and leave events */ + while (XCheckMaskEvent(dpy, EnterWindowMask | LeaveWindowMask, + &Event)) + ; + + /* will clear the XGrabPointer() in events.c:HandleButtonPress() */ + ButtonPressed = -1; + + break; + } + + case F_SNAP: + SnapRealScreen(); + /* and update the data structures */ + SetRealScreen(Scr->VirtualDesktopX, Scr->VirtualDesktopY); + break; + + case F_SNAPREALSCREEN: + Scr->snapRealScreen = ! Scr->snapRealScreen; + break; + + /* djhjr - 12/14/98 */ + case F_STATICICONPOSITIONS: + Scr->StaticIconPositions = ! Scr->StaticIconPositions; + break; + + /* djhjr - 12/14/98 */ + case F_STRICTICONMGR: + { + TwmWindow *t; + + Scr->StrictIconManager = ! Scr->StrictIconManager; + if (Scr->StrictIconManager) + { + for (t = Scr->TwmRoot.next; t != NULL; t = t->next) + if (!t->icon) + RemoveIconManager(t); + } + else + { + for (t = Scr->TwmRoot.next; t != NULL; t = t->next) + if (!t->list) + AddIconManager(t); + } + + break; + } + + case F_SETREALSCREEN: + { + int newx = Scr->VirtualDesktopX; + int newy = Scr->VirtualDesktopY; + + /* parse the geometry */ + JunkMask = XParseGeometry (action, &JunkX, &JunkY, &JunkWidth, &JunkHeight); + + if (JunkMask & XValue) + newx = JunkX; + if (JunkMask & YValue) + newy = JunkY; + + if (newx < 0) + newx = Scr->VirtualDesktopWidth + newx; + if (newy < 0) + newy = Scr->VirtualDesktopHeight + newy; + + SetRealScreen(newx, newy); + + break; + } + + case F_HIDEDESKTOP: + if (Scr->Virtual) + XUnmapWindow(dpy, Scr->VirtualDesktopDisplayTwin->frame); + break; + + case F_SHOWDESKTOP: + if (Scr->Virtual) { + XMapWindow(dpy, Scr->VirtualDesktopDisplayTwin->frame); + + /* djhjr - 9/14/96 */ + if (Scr->VirtualDesktopDisplayTwin->icon) + DeIconify(Scr->VirtualDesktopDisplayTwin); + } + break; + + case F_ENTERDOOR: + { + TwmDoor *d; + + if (XFindContext(dpy, tmp_win->w, DoorContext, + (caddr_t *) &d) != XCNOENT) + door_enter(tmp_win->w, d); + break; + } + + case F_DELETEDOOR: + { /*marcel@duteca.et.tudelft.nl*/ + TwmDoor *d; + + if (DeferExecution(context, func, Scr->DestroyCursor)) + return TRUE; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + /* flag for the handler */ + if (PlaySound(func)) destroySoundFromFunction = TRUE; +#endif + + if (XFindContext(dpy, tmp_win->w, DoorContext, + (caddr_t *) &d) != XCNOENT) + { + /* for some reason, we don't get the button up event - djhjr - 5/13/99 */ + ButtonPressed = -1; + + door_delete(tmp_win->w, d); + } + break; + } + + case F_NEWDOOR: + PopDownMenu(); + door_new(); + break; + + /* djhjr - 4/20/98 */ + case F_NAMEDOOR: + { + TwmDoor *d; + + if (XFindContext(dpy, tmp_win->w, DoorContext, + (caddr_t *) &d) != XCNOENT) + door_paste_name(tmp_win->w, d); + break; + } + + case F_QUIT: +/* djhjr - 9/14/96 - it's in Done()... + SetRealScreen(0,0); +*/ + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + if (PlaySound(func)) + { + /* allow time to emit */ + if (Scr->PauseOnQuit) sleep(Scr->PauseOnQuit); + } + else + PlaySoundDone(); +#endif + + Done(); + break; + + case F_VIRTUALGEOMETRIES: + Scr->GeometriesAreVirtual = ! Scr->GeometriesAreVirtual; + break; + + /* submitted by Ugen Antsilevitch - 5/28/00 */ + case F_WARPVISIBLE: + Scr->WarpVisible = ! Scr->WarpVisible; + break; + + /* djhjr - 5/30/00 */ + case F_WARPSNUG: + Scr->WarpSnug = ! Scr->WarpSnug; + break; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + case F_SOUNDS: + ToggleSounds(); + break; + + /* djhjr - 11/15/02 */ + case F_PLAYSOUND: + PlaySoundAdhoc(action); + break; +#endif + } + + if (ButtonPressed == -1) XUngrabPointer(dpy, CurrentTime); + return do_next_action; +} + + + +/*********************************************************************** + * + * Procedure: + * DeferExecution - defer the execution of a function to the + * next button press if the context is C_ROOT + * + * Inputs: + * context - the context in which the mouse button was pressed + * func - the function to defer + * cursor - the cursor to display while waiting + * + *********************************************************************** + */ + +int +DeferExecution(context, func, cursor) +int context, func; +Cursor cursor; +{ + if (context == C_ROOT) + { + LastCursor = cursor; + XGrabPointer(dpy, Scr->Root, True, + ButtonPressMask | ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, cursor, CurrentTime); + + RootFunction = func; + Action = actionHack; /* Submitted by Michel Eyckmans */ + + return (TRUE); + } + + return (FALSE); +} + + + +/*********************************************************************** + * + * Procedure: + * ReGrab - regrab the pointer with the LastCursor; + * + *********************************************************************** + */ + +void ReGrab() +{ + XGrabPointer(dpy, Scr->Root, True, + ButtonPressMask | ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, LastCursor, CurrentTime); +} + + + +/*********************************************************************** + * + * Procedure: + * NeedToDefer - checks each function in the list to see if it + * is one that needs to be defered. + * + * Inputs: + * root - the menu root to check + * + *********************************************************************** + */ + +/* was of type 'int' - Submitted by Michel Eyckmans */ +Cursor +NeedToDefer(root) +MenuRoot *root; +{ + MenuItem *mitem; + + for (mitem = root->first; mitem != NULL; mitem = mitem->next) + { + switch (mitem->func) + { + case F_RESIZE: + return Scr->ResizeCursor; /* Submitted by Michel Eyckmans */ + case F_MOVE: + case F_FORCEMOVE: + return Scr->MoveCursor; /* Submitted by Michel Eyckmans */ + /* these next four - Submitted by Michel Eyckmans */ + case F_DELETE: + case F_DELETEDOOR: + case F_DESTROY: + return Scr->DestroyCursor; + case F_IDENTIFY: /* was with 'F_RESIZE' - Submitted by Michel Eyckmans */ + case F_DEICONIFY: + case F_ICONIFY: + case F_RAISELOWER: + case F_RAISE: + case F_LOWER: + case F_FOCUS: + case F_WINREFRESH: + case F_ZOOM: + case F_FULLZOOM: + case F_HORIZOOM: + case F_RIGHTZOOM: + case F_LEFTZOOM: + case F_TOPZOOM: + case F_BOTTOMZOOM: + case F_AUTORAISE: + case F_NAIL: + case F_SNUGWINDOW: + return Scr->SelectCursor; + } + } + return None; +} + + + +void +Execute(s) + char *s; +{ + static char buf[256]; + char *ds = DisplayString (dpy); + char *colon, *dot1; + char oldDisplay[256]; + char *doisplay; + int restorevar = 0; + + char *append_this = " &"; + char *es = (char *)malloc(strlen(s)+strlen(append_this)+1); + sprintf(es,s); + /* a new copy of s, with extra space incase -- DSE */ + + if (Scr->EnhancedExecResources) /* DSE */ + { + /* chop all space characters from the end of the string */ + while ( isspace ( es[strlen(es)-1] ) ) + { + es[strlen(es)-1] = '\0'; + } + switch ( es[strlen(es)-1] ) /* last character */ + { + case ';': + es[strlen(es)-1] = '\0'; /* remove the semicolon */ + break; + case '&': /* already there so do nothing */ + break; + default: + strcat(es,append_this); /* don't block the window manager */ + break; + } + } + + oldDisplay[0] = '\0'; + doisplay=getenv("DISPLAY"); + if (doisplay) + strcpy (oldDisplay, doisplay); + + /* + * Build a display string using the current screen number, so that + * X programs which get fired up from a menu come up on the screen + * that they were invoked from, unless specifically overridden on + * their command line. + */ + colon = rindex (ds, ':'); + if (colon) { /* if host[:]:dpy */ + strcpy (buf, "DISPLAY="); + strcat (buf, ds); + colon = buf + 8 + (colon - ds); /* use version in buf */ + dot1 = index (colon, '.'); /* first period after colon */ + if (!dot1) dot1 = colon + strlen (colon); /* if not there, append */ + (void) sprintf (dot1, ".%d", Scr->screen); + putenv (buf); + restorevar = 1; + } + + (void) system (es); /* DSE */ + free (es); /* DSE */ + + if (restorevar) { /* why bother? */ + (void) sprintf (buf, "DISPLAY=%s", oldDisplay); + putenv (buf); + } +} + + + +/*********************************************************************** + * + * Procedure: + * FocusOnRoot - put input focus on the root window + * + *********************************************************************** + */ + +void +FocusOnRoot() +{ + SetFocus ((TwmWindow *) NULL, LastTimestamp()); + if (Scr->Focus != NULL) + { + SetBorder (Scr->Focus, False); + +/* djhjr - 4/25/96 + if (Scr->Focus->hilite_w) XUnmapWindow (dpy, Scr->Focus->hilite_w); +*/ + PaintTitleHighlight(Scr->Focus, off); + + } + InstallWindowColormaps(0, &Scr->TwmRoot); + Scr->Focus = NULL; + Scr->FocusRoot = TRUE; +} + +void DeIconify(tmp_win) +TwmWindow *tmp_win; +{ + TwmWindow *t; + + /* + * De-iconify the main window first + */ + + /* re-vamped the zoom stuff - djhjr - 10/11/01 */ + if (Scr->DoZoom && Scr->ZoomCount > 0) + { + IconMgr *ipf = NULL; + Window wt = None, wf = None; + + if (tmp_win->icon) + { + if (tmp_win->icon_on) + { + wf = tmp_win->icon_w; wt = tmp_win->frame; + } + else if (tmp_win->list) /* djhjr - 10/11/01 */ + { + wf = tmp_win->list->w; wt = tmp_win->frame; + ipf = tmp_win->list->iconmgr; + } + else if (tmp_win->group != None) + { + for (t = Scr->TwmRoot.next; t != NULL; t = t->next) + if (tmp_win->group == t->w) + { + if (t->icon_on) + wf = t->icon_w; + else if (t->list) /* djhjr - 10/11/01 */ + { + wf = t->list->w; + ipf = t->list->iconmgr; + } + + wt = tmp_win->frame; + break; + } + } + } + + /* added Zoom()s args to iconmgrs - djhjr - 10/11/01 */ + if (Scr->ZoomZoom || (wf != None && wt != None)) + Zoom(wf, ipf, wt, NULL); /* RFBZOOM */ + } + + XMapWindow(dpy, tmp_win->w); + tmp_win->mapped = TRUE; + + if (Scr->NoRaiseDeicon) + XMapWindow(dpy, tmp_win->frame); + else + { + XMapRaised(dpy, tmp_win->frame); + XRaiseWindow(dpy, tmp_win->VirtualDesktopDisplayWindow); + } + SetMapStateProp(tmp_win, NormalState); + + if (tmp_win->icon_w) { + XUnmapWindow(dpy, tmp_win->icon_w); + IconDown (tmp_win); + } + + tmp_win->icon = FALSE; + tmp_win->icon_on = FALSE; + + if (tmp_win->list) + XUnmapWindow(dpy, tmp_win->list->icon); + + /* + * RemoveIconManager() done in events.c:HandleMapNotify() + */ + + UpdateDesktop(tmp_win); + + /* + * Now de-iconify transients + */ + + for (t = Scr->TwmRoot.next; t != NULL; t = t->next) + { + if (t->transient && t->transientfor == tmp_win->w) + { + /* this 'if (...) else' (see also Iconify()) - djhjr - 6/22/99 */ + if (Scr->DontDeiconifyTransients && t->icon_w && + t->icon == TRUE && t->icon_on == FALSE) + { + IconUp(t); + XMapRaised(dpy, t->icon_w); + t->icon_on = TRUE; + } + else + { + /* added Zoom()s args to iconmgrs - djhjr - 10/11/01 */ + if (t->icon_on) + Zoom(t->icon_w, NULL, t->frame, NULL); + else + Zoom(tmp_win->icon_w, NULL, t->frame, NULL); + + XMapWindow(dpy, t->w); + t->mapped = TRUE; + + if (Scr->NoRaiseDeicon) + XMapWindow(dpy, t->frame); + else + { + XMapRaised(dpy, t->frame); + XRaiseWindow(dpy, t->VirtualDesktopDisplayWindow); + } + SetMapStateProp(t, NormalState); + + if (t->icon_w) + { + XUnmapWindow(dpy, t->icon_w); + IconDown (t); + } + + t->icon = FALSE; + t->icon_on = FALSE; + + if (t->list) XUnmapWindow(dpy, t->list->icon); + + /* + * RemoveIconManager() done in events.c:HandleMapNotify() + */ + + UpdateDesktop(t); + } + } + } + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + /* + * added '&& Scr->WarpWindows'. + * see the kludge in ExecuteFunction(F_ICONIFY, ...). + * djhjr - 1/24/98 + */ + if (((Scr->WarpCursor || + LookInList(Scr->WarpCursorL, tmp_win->full_name, + &tmp_win->class)) && + tmp_win->icon) && Scr->WarpWindows) + WarpToWindow (tmp_win); + + XSync (dpy, 0); +} + + + +void Iconify(tmp_win, def_x, def_y) +TwmWindow *tmp_win; +int def_x, def_y; +{ + TwmWindow *t; + int iconify; + XWindowAttributes winattrs; + unsigned long eventMask; + /* djhjr - 6/22/99 */ + short fake_icon; + + iconify = ((!tmp_win->iconify_by_unmapping) || tmp_win->transient); + if (iconify) + { + if (tmp_win->icon_w == None) + CreateIconWindow(tmp_win, def_x, def_y); + else + IconUp(tmp_win); + + XMapRaised(dpy, tmp_win->icon_w); + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + } + + XGetWindowAttributes(dpy, tmp_win->w, &winattrs); + eventMask = winattrs.your_event_mask; + + /* + * Iconify transients first + */ + + for (t = Scr->TwmRoot.next; t != NULL; t = t->next) + { + if (t->transient && t->transientfor == tmp_win->w) + { + + /* RemoveFromDesktop(t); Stig */ + + /* + * Prevent the receipt of an UnmapNotify, since that would + * cause a transition to the Withdrawn state. + */ + t->mapped = FALSE; + XSelectInput(dpy, t->w, eventMask & ~StructureNotifyMask); + XUnmapWindow(dpy, t->w); + XSelectInput(dpy, t->w, eventMask); + XUnmapWindow(dpy, t->frame); + + /* moved to make zooms more aesthetically pleasing -- DSE */ + if (iconify) + { + /* added Zoom()s args to iconmgrs - djhjr - 10/11/01 */ + if (t->icon_on) + Zoom(t->icon_w, NULL, tmp_win->icon_w, NULL); + else + Zoom(t->frame, NULL, tmp_win->icon_w, NULL); + } + + if (t->icon_w) + XUnmapWindow(dpy, t->icon_w); + SetMapStateProp(t, IconicState); + SetBorder (t, False); + if (t == Scr->Focus) + { + SetFocus ((TwmWindow *) NULL, LastTimestamp()); + Scr->Focus = NULL; + Scr->FocusRoot = TRUE; + } + + /* + * let current status ride, but "fake out" UpdateDesktop() + * (see also DeIconify()) - djhjr - 6/22/99 + */ + fake_icon = t->icon; + + t->icon = TRUE; + t->icon_on = FALSE; + + /* djhjr - 10/2/01 */ + if (Scr->StrictIconManager) + if (!t->list) + AddIconManager(t); + + if (t->list) XMapWindow(dpy, t->list->icon); + + UpdateDesktop(t); + + /* restore icon status - djhjr - 6/22/99 */ + t->icon = fake_icon; + } + } + + /* + * Now iconify the main window + */ + +/* if (iconify) RFBZOOM*/ + + /* RemoveFromDesktop(tmp_win); Stig */ + + /* + * Prevent the receipt of an UnmapNotify, since that would + * cause a transition to the Withdrawn state. + */ + tmp_win->mapped = FALSE; + XSelectInput(dpy, tmp_win->w, eventMask & ~StructureNotifyMask); + XUnmapWindow(dpy, tmp_win->w); + XSelectInput(dpy, tmp_win->w, eventMask); + XUnmapWindow(dpy, tmp_win->frame); + + SetMapStateProp(tmp_win, IconicState); + + SetBorder (tmp_win, False); + if (tmp_win == Scr->Focus) + { + SetFocus ((TwmWindow *) NULL, LastTimestamp()); + Scr->Focus = NULL; + Scr->FocusRoot = TRUE; + } + + tmp_win->icon = TRUE; + if (iconify) + tmp_win->icon_on = TRUE; + else + tmp_win->icon_on = FALSE; + + /* djhjr - 10/2/01 */ + if (Scr->StrictIconManager) + if (!tmp_win->list) + AddIconManager(tmp_win); + + /* moved to make zooms more aesthetically pleasing -- DSE */ + /* moved again to ensure an icon manager entry exists - djhjr - 10/11/01 */ + /* added Zoom()s args to iconmgrs - djhjr - 10/11/01 */ + if (iconify) + Zoom(tmp_win->frame, NULL, tmp_win->icon_w, NULL); + else if (tmp_win->list) /* djhjr - 10/11/01 */ + Zoom(tmp_win->frame, NULL, tmp_win->list->w, tmp_win->list->iconmgr); + + if (tmp_win->list) + XMapWindow(dpy, tmp_win->list->icon); + + UpdateDesktop(tmp_win); + XSync (dpy, 0); +} + + + +static void Identify (t) +TwmWindow *t; +{ + int i, n, twidth, width, height; + int x, y; + unsigned int wwidth, wheight, bw, depth; + Window junk; + int px, py, dummy; + unsigned udummy; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(F_IDENTIFY); +#endif + + n = 0; + (void) sprintf(Info[n++], "%s", Version); + Info[n++][0] = '\0'; + + if (t) { + XGetGeometry (dpy, t->w, &JunkRoot, &JunkX, &JunkY, + &wwidth, &wheight, &bw, &depth); + (void) XTranslateCoordinates (dpy, t->w, Scr->Root, 0, 0, + &x, &y, &junk); + +/* looks bad with variable fonts... djhjr - 5/10/96 + (void) sprintf(Info[n++], "Name = \"%s\"", t->full_name); + (void) sprintf(Info[n++], "Class.res_name = \"%s\"", t->class.res_name); + (void) sprintf(Info[n++], "Class.res_class = \"%s\"", t->class.res_class); + Info[n++][0] = '\0'; + (void) sprintf(Info[n++], "Geometry/root = %dx%d+%d+%d", wwidth, wheight, x, y); + (void) sprintf(Info[n++], "Border width = %d", bw); + (void) sprintf(Info[n++], "Depth = %d", depth); +*/ + (void) sprintf(Info[n++], "Name: \"%s\"", t->full_name); + (void) sprintf(Info[n++], "Class.res_name: \"%s\"", t->class.res_name); + (void) sprintf(Info[n++], "Class.res_class: \"%s\"", t->class.res_class); + Info[n++][0] = '\0'; + (void) sprintf(Info[n++], "Geometry/root: %dx%d+%d+%d", wwidth, wheight, x, y); + (void) sprintf(Info[n++], "Border width: %d", bw); + (void) sprintf(Info[n++], "Depth: %d", depth); + + Info[n++][0] = '\0'; + } +/* djhjr - 9/19/96 */ +#ifndef NO_BUILD_INFO + else + { + char is_m4, is_xpm; + char is_rplay; /* djhjr - 6/22/01 */ + char is_regex; /* djhjr - 10/20/01 */ + char is_i18n; /* djhjr - 10/20/01 */ + +/* djhjr - 6/22/99 */ +#ifdef WE_REALLY_DO_WANT_TO_SEE_THIS + (void) sprintf(Info[n++], "X Server: %s Version %d.%d Release %d", + ServerVendor(dpy), ProtocolVersion(dpy), ProtocolRevision(dpy), + VendorRelease(dpy)); +#endif + + /* + * Was a 'do ... while()' that accessed unallocated memory. + * This and the change to Imakefile submitted by Takeharu Kato + */ + i = 0; + while (lastmake[i][0] != '\0') + (void) sprintf(Info[n++], "%s", lastmake[i++]); + +/* djhjr - 1/31/99 */ +#ifdef NO_M4_SUPPORT + is_m4 = '-'; +#else + is_m4 = '+'; +#endif +#ifdef NO_XPM_SUPPORT + is_xpm = '-'; +#else + is_xpm = '+'; +#endif +/* djhjr - 6/22/01 */ +#ifdef NO_SOUND_SUPPORT + is_rplay = '-'; +#else + is_rplay = '+'; +#endif +/* djhjr - 6/22/01 */ +#ifdef NO_REGEX_SUPPORT + is_regex = '-'; +#else + is_regex = '+'; +#endif +/* djhjr - 9/14/03 */ +#ifdef NO_I18N_SUPPORT + is_i18n = '-'; +#else + is_i18n = '+'; +#endif + (void) sprintf(Info[n++], + "Options: %ci18n %cm4 %cregex %crplay %cxpm", + is_i18n, is_m4, is_regex, is_rplay, is_xpm); + + Info[n++][0] = '\0'; + } +#endif + + (void) sprintf(Info[n++], "Click to dismiss..."); + + /* figure out the width and height of the info window */ + +/* djhjr - 4/29/98 + height = (n * (Scr->InfoFont.height+2)) + 10; * some padding * +*/ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + i = (Scr->InfoBevelWidth > 0) ? Scr->InfoBevelWidth + 8 : 10; + height = (n * (Scr->InfoFont.height+2)) + i; /* some padding */ + + width = 1; + for (i = 0; i < n; i++) + { +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + twidth = MyFont_TextWidth(&Scr->InfoFont, +#else + twidth = XTextWidth(Scr->InfoFont.font, +#endif + Info[i], strlen(Info[i])); + if (twidth > width) + width = twidth; + } + if (InfoLines) XUnmapWindow(dpy, Scr->InfoWindow); + +/* djhjr - 4/29/98 + width += 20; * some padding * +*/ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + i = (Scr->InfoBevelWidth > 0) ? Scr->InfoBevelWidth + 18 : 20; + width += i; /* some padding */ + + if (XQueryPointer (dpy, Scr->Root, &JunkRoot, &JunkChild, &px, &py, + &dummy, &dummy, &udummy)) { + px -= (width / 2); + py -= (height / 3); + + /* added this 'if ()' - djhjr - 4/29/98 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (Scr->InfoBevelWidth > 0) + { + if (px + width + 2 * Scr->InfoBevelWidth >= Scr->MyDisplayWidth) + px = Scr->MyDisplayWidth - width - 2 * Scr->InfoBevelWidth; + if (py + height + 2 * Scr->InfoBevelWidth >= Scr->MyDisplayHeight) + py = Scr->MyDisplayHeight - height - 2 * Scr->InfoBevelWidth; + } + else + { + if (px + width + BW2 >= Scr->MyDisplayWidth) + px = Scr->MyDisplayWidth - width - BW2; + if (py + height + BW2 >= Scr->MyDisplayHeight) + py = Scr->MyDisplayHeight - height - BW2; + } + + if (px < 0) px = 0; + if (py < 0) py = 0; + } else { + px = py = 0; + } + + XMoveResizeWindow(dpy, Scr->InfoWindow, px, py, width, height); + +/* done in HandleExpose() in events.c - djhjr - 4/30/98 */ +#ifdef NEVER + /* djhjr - 5/9/96 */ + if (Scr->use3Dborders > 0) + { + XGetGeometry (dpy, Scr->InfoWindow, &JunkRoot, &JunkX, &JunkY, + &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth); + Draw3DBorder(Scr->InfoWindow, 0, 0, JunkWidth, JunkHeight, +/* djhjr - 4/29/98 + BW, Scr->DefaultC, off, False, False); +*/ + Scr->InfoBevelWidth, Scr->DefaultC, off, False, False); + } +#endif + + XMapRaised(dpy, Scr->InfoWindow); + InfoLines = n; +} + + + +void SetMapStateProp(tmp_win, state) +TwmWindow *tmp_win; +int state; +{ + unsigned long data[2]; /* "suggested" by ICCCM version 1 */ + + data[0] = (unsigned long) state; + data[1] = (unsigned long) (tmp_win->iconify_by_unmapping ? None : + tmp_win->icon_w); + + XChangeProperty (dpy, tmp_win->w, _XA_WM_STATE, _XA_WM_STATE, 32, + PropModeReplace, (unsigned char *) data, 2); +} + + + +Bool GetWMState (w, statep, iwp) + Window w; + int *statep; + Window *iwp; +{ + Atom actual_type; + int actual_format; + unsigned long nitems, bytesafter; + unsigned long *datap = NULL; + Bool retval = False; + + /* used to test for '!datap' - djhjr - 1/10/98 */ + if (XGetWindowProperty (dpy, w, _XA_WM_STATE, 0L, 2L, False, _XA_WM_STATE, + &actual_type, &actual_format, &nitems, &bytesafter, + (unsigned char **) &datap) != Success || + actual_type == None) + return False; + + if (nitems <= 2) { /* "suggested" by ICCCM version 1 */ + *statep = (int) datap[0]; + *iwp = (Window) datap[1]; + retval = True; + } + + XFree ((char *) datap); + return retval; +} + + + +/* + * BumpWindowColormap - rotate our internal copy of WM_COLORMAP_WINDOWS + */ + +void BumpWindowColormap (tmp, inc) + TwmWindow *tmp; + int inc; +{ + int i, j, previously_installed; + ColormapWindow **cwins; + + if (!tmp) return; + + if (inc && tmp->cmaps.number_cwins > 0) { + cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *)* + tmp->cmaps.number_cwins); + if (cwins) { + if ((previously_installed = + (Scr->cmapInfo.cmaps == &tmp->cmaps) && + tmp->cmaps.number_cwins)) { + for (i = tmp->cmaps.number_cwins; i-- > 0; ) + tmp->cmaps.cwins[i]->colormap->state = 0; + } + + for (i = 0; i < tmp->cmaps.number_cwins; i++) { + j = i - inc; + if (j >= tmp->cmaps.number_cwins) + j -= tmp->cmaps.number_cwins; + else if (j < 0) + j += tmp->cmaps.number_cwins; + cwins[j] = tmp->cmaps.cwins[i]; + } + + free((char *) tmp->cmaps.cwins); + + tmp->cmaps.cwins = cwins; + + if (tmp->cmaps.number_cwins > 1) + memset( tmp->cmaps.scoreboard, 0, + ColormapsScoreboardLength(&tmp->cmaps)); + + if (previously_installed) + InstallWindowColormaps(PropertyNotify, (TwmWindow *) NULL); + } + } else + FetchWmColormapWindows (tmp); +} + + + +void HideIconManager(tmp_win) +TwmWindow *tmp_win; +{ + /* added this 'if (...) else ...' - djhjr - 9/21/99 */ + if (tmp_win == NULL) + { + name_list *list; + + HideIconMgr(&Scr->iconmgr); + + /* + * New code in list.c necessitates 'next_entry()' and + * 'contents_of_entry()' - djhjr - 10/20/01 + */ + for (list = Scr->IconMgrs; list != NULL; list = next_entry(list)) + HideIconMgr((IconMgr *)contents_of_entry(list)); + } + else + { + IconMgr *ip; + + if ((ip = (IconMgr *)LookInList(Scr->IconMgrs, tmp_win->full_name, + &tmp_win->class)) == NULL) + ip = &Scr->iconmgr; + + HideIconMgr(ip); + } +} + +/* djhjr - 9/21/99 */ +void HideIconMgr(ip) +IconMgr *ip; +{ + /* djhjr - 6/10/98 */ + if (ip->count == 0) + return; + + SetMapStateProp (ip->twm_win, WithdrawnState); + XUnmapWindow(dpy, ip->twm_win->frame); + if (ip->twm_win->icon_w) + XUnmapWindow (dpy, ip->twm_win->icon_w); + ip->twm_win->mapped = FALSE; + ip->twm_win->icon = TRUE; +} + +/* djhjr - 9/21/99 */ +void ShowIconMgr(ip) +IconMgr *ip; +{ + /* added the second condition - djhjr - 6/10/98 */ + if (Scr->NoIconManagers || ip->count == 0) + return; + + DeIconify(ip->twm_win); + XRaiseWindow(dpy, ip->twm_win->frame); + XRaiseWindow(dpy, ip->twm_win->VirtualDesktopDisplayWindow); +} + + +void SetBorder (tmp, onoroff) +TwmWindow *tmp; +Bool onoroff; +{ + if (tmp->highlight) + { + /* djhjr - 4/22/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (Scr->BorderBevelWidth > 0) + PaintBorders (tmp, onoroff); + else + { + if (onoroff) + { +/* djhjr - 4/24/96 + XSetWindowBorder (dpy, tmp->frame, tmp->border); +*/ +/* djhjr - 11/17/97 + XSetWindowBorder (dpy, tmp->frame, tmp->border_tile.back); +*/ + XSetWindowBorder (dpy, tmp->frame, tmp->border.back); + + if (tmp->title_w) +/* djhjr - 4/24/96 + XSetWindowBorder (dpy, tmp->title_w, tmp->border); +*/ +/* djhjr - 11/17/97 + XSetWindowBorder (dpy, tmp->title_w, tmp->border_tile.back); +*/ + XSetWindowBorder (dpy, tmp->title_w, tmp->border.back); + } + else + { + XSetWindowBorderPixmap (dpy, tmp->frame, tmp->gray); + + if (tmp->title_w) + XSetWindowBorderPixmap (dpy, tmp->title_w, tmp->gray); + } + } + + /* djhjr - 11/17/97 */ + /* rem'd out test for button color - djhjr - 9/15/99 */ + if (/*Scr->ButtonColorIsFrame && */tmp->titlebuttons) + { + int i, nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + TBWindow *tbw; + + /* collapsed two functions - djhjr - 8/10/98 */ + for (i = 0, tbw = tmp->titlebuttons; i < nb; i++, tbw++) + PaintTitleButton(tmp, tbw, (onoroff) ? 2 : 1); + } + } +} + + + +void DestroyMenu (menu) + MenuRoot *menu; +{ + MenuItem *item; + + if (menu->w) { + XDeleteContext (dpy, menu->w, MenuContext); + XDeleteContext (dpy, menu->w, ScreenContext); + if (Scr->Shadow) XDestroyWindow (dpy, menu->shadow); + XDestroyWindow(dpy, menu->w); + } + + for (item = menu->first; item; ) { + MenuItem *tmp = item; + item = item->next; + free ((char *) tmp); + } +} + + + +/* + * warping routines + */ + +/* for moves and resizes from center - djhjr - 10/4/02 */ +void WarpScreenToWindow(t) +TwmWindow *t; +{ + int warpwin = Scr->WarpWindows; + int warpsnug = Scr->WarpSnug; + + Scr->WarpWindows = Scr->WarpSnug = FALSE; + WarpToWindow(t); + Scr->WarpWindows = warpwin; + Scr->WarpSnug = warpsnug; + + /* + * This is an attempt to have windows redraw themselves, but + * it doesn't always work (non-raising windows in particular). + */ + XSync(dpy, 0); +} + +/* was in-lined in WarpToWindow() - djhjr - 5/30/00 */ +void WarpWindowOrScreen(t) +TwmWindow *t; +{ + + /* + * we are either moving the window onto the screen, or the screen to the + * window, the distances remain the same + */ + + if ((t->frame_x < Scr->MyDisplayWidth) + && (t->frame_y < Scr->MyDisplayHeight) + && (t->frame_x + t->frame_width >= 0) + && (t->frame_y + t->frame_height >= 0)) + { + + /* + * window is visible; you can simply + * snug it if WarpSnug or WarpWindows is set -- DSE + */ + + if (Scr->WarpSnug || Scr->WarpWindows) + { + int right,left,up,down,dx,dy; + + /* + * Adjustment for border widths submitted by Steve Ratcliffe + * Note: Do not include the 3D border width! + */ + right = t->frame_x; + left = t->frame_x + t->frame_width + 2 * t->frame_bw; + up = t->frame_y; + down = t->frame_y + t->frame_height + 2 * t->frame_bw; + + dx = 0; + if (left-right < Scr->MyDisplayWidth) + { + if (right<0) + dx = right; + else if (left>Scr->MyDisplayWidth) + dx = left - Scr->MyDisplayWidth; + } + + dy = 0; + if (down-up < Scr->MyDisplayHeight) + { + if (up<0) + dy = up; + else if (down>Scr->MyDisplayHeight) + dy = down - Scr->MyDisplayHeight; + } + + if (dx!=0 || dy!=0) { + /* added 'Scr->WarpSnug ||' - djhjr - 5/30/00 */ + if (Scr->WarpSnug || Scr->WarpWindows) + { + /* move the window */ + VirtualMoveWindow(t, t->virtual_frame_x - dx, + t->virtual_frame_y - dy); + } + else + { + /* move the screen */ + PanRealScreen(dx,dy,NULL,NULL); + } + } + } + } + else + { + + /* + * Window is invisible; we need to move it or the screen. + */ + + int xdiff, ydiff; + + xdiff = ((Scr->MyDisplayWidth - t->frame_width) / 2) - t->frame_x; + ydiff = ((Scr->MyDisplayHeight - t->frame_height) / 2) - t->frame_y; + + /* added 'Scr->WarpSnug ||' - djhjr - 5/30/00 */ + if (Scr->WarpSnug || Scr->WarpWindows) + { + /* move the window */ + VirtualMoveWindow(t, t->virtual_frame_x + xdiff, + t->virtual_frame_y + ydiff); + } + else + { + /* move the screen */ + PanRealScreen(-xdiff, -ydiff,NULL,NULL); /* DSE */ + } + } + + if (t->auto_raise || !Scr->NoRaiseWarp) + AutoRaiseWindow (t); +} + +/* for icon manager management - djhjr - 5/30/00 */ +void WarpInIconMgr(w, t) +WList *w; +TwmWindow *t; +{ + int x, y, pan_margin = 0; + /* djhjr - 9/9/02 */ + int bw = t->frame_bw3D + t->frame_bw; + + RaiseStickyAbove(); + RaiseAutoPan(); + + WarpWindowOrScreen(t); + + /* was 'Scr->BorderWidth' - djhjr - 9/9/02 */ + x = w->x + bw + EDGE_OFFSET + 5; + x += (Scr->IconMgrBevelWidth > 0) ? Scr->IconMgrBevelWidth : bw; + y = w->y + bw + w->height / 2; + y += (Scr->IconMgrBevelWidth > 0) ? Scr->IconMgrBevelWidth : bw; + y += w->iconmgr->twm_win->title_height; + + /* + * adjust the pointer for partially visible windows and the + * AutoPan border width + */ + + if (Scr->AutoPanX) pan_margin = Scr->AutoPanBorderWidth; + + if (x + t->frame_x >= Scr->MyDisplayWidth - pan_margin) + x = Scr->MyDisplayWidth - t->frame_x - pan_margin - 2; + if (x + t->frame_x <= pan_margin) + x = -t->frame_x + pan_margin + 2; + if (y + t->frame_y >= Scr->MyDisplayHeight - pan_margin) + y = Scr->MyDisplayHeight - t->frame_y - pan_margin - 2; + if (y + t->frame_y <= pan_margin) + y = -t->frame_y + pan_margin + 2; + + XWarpPointer(dpy, None, t->frame, 0, 0, 0, 0, x, y); /* DSE */ +} + +/* + * substantially re-written and added passing 'next' to next_by_class() + * + * djhjr - 5/13/98 6/6/98 6/15/98 + */ +#ifdef ORIGINAL_WARPCLASS +void WarpClass (next, t, class) + int next; + TwmWindow *t; + char *class; +{ + int len = strlen(class); + + if (!strncmp(class, t->class.res_class, len)) + t = next_by_class(t, class); + else + t = next_by_class((TwmWindow *)NULL, class); + if (t) { + if (Scr->WarpUnmapped || t->mapped) { + if (!t->mapped) DeIconify (t); + if (!Scr->NoRaiseWarp) + { + XRaiseWindow (dpy, t->frame); + } + XRaiseWindow (dpy, t->VirtualDesktopDisplayWindow); + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + + WarpToWindow (t); + } + } +} +#else /* ORIGINAL_WARPCLASS */ +void WarpClass(next, t, class) + int next; + TwmWindow *t; + char *class; +{ + TwmWindow *tt; + XClassHint ch; + int i; + + /* + * if an empty class string + * if a TwmWindow + * class = the TwmWindow's class + * else if a window with focus + * if it's classed + * class = the focused window's class + * else + * return + * if still an empty class string + * class = "VTWM" + */ + if (!strlen(class)) + { + if (t) + class = t->class.res_class; + else if (Scr->Focus) + { + i = XGetClassHint(dpy, Scr->Focus->w, &ch); + if (i && !strncmp(class, ch.res_class, strlen(class))) + class = ch.res_class; + } + /* djhjr - 6/21/00 */ + else + { + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + return; + } + } + if (!strlen(class) || !strncmp(class, "VTWM", 4)) + class = "VTWM"; + +/* djhjr - 8/3/98 + if (!(tt = next_by_class(next, t, class))) + if (t) tt = t; +*/ + + /* djhjr - 5/28/00 */ + while (1) + { + + tt = NULL; + do + { + if ((tt = next_by_class(next, t, class))) + { + /* multiple icon managers: gotta test for those without entries */ + if (tt->iconmgr && tt->iconmgrp->count == 0) + { + t = tt; + tt = NULL; + } + } + else if (t) + tt = t; + else + break; + } while (!tt); + + /* added the second argument - djhjr - 5/28/00 */ + if (tt && warp_if_warpunmapped(tt, (next) ? F_WARPCLASSNEXT: F_WARPCLASSPREV)) + { + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + +/* djhjr - 6/3/03 */ +#ifndef NO_SOUND_SUPPORT + PlaySound((next) ? F_WARPCLASSNEXT: F_WARPCLASSPREV); +#endif + + WarpToWindow(tt); + + /* djhjr - 5/28/00 */ + break; + } +/* djhjr - 5/28/00 + else + XBell(dpy, 0); +*/ + t = tt; + } /* while (1) */ +} +#endif /* ORIGINAL_WARPCLASS */ + + + +/* moved from add_window.c - djhjr - 10/27/02 */ +void AddWindowToRing(tmp_win) +TwmWindow *tmp_win; +{ + if (Scr->Ring) + { + /* link window in after Scr->Ring */ + tmp_win->ring.prev = Scr->Ring; + tmp_win->ring.next = Scr->Ring->ring.next; + + /* Scr->Ring's next's prev points to this */ + /*if (Scr->Ring->ring.next->ring.prev)*/ + Scr->Ring->ring.next->ring.prev = tmp_win; + + /* Scr->Ring's next points to this */ + Scr->Ring->ring.next = tmp_win; + } + else + tmp_win->ring.next = tmp_win->ring.prev = Scr->Ring = tmp_win; +} + +/* moved from events.c - djhjr - 10/27/02 */ +void RemoveWindowFromRing(tmp_win) +TwmWindow *tmp_win; +{ + /* unlink window */ + if (tmp_win->ring.prev) + tmp_win->ring.prev->ring.next = tmp_win->ring.next; + if (tmp_win->ring.next) + tmp_win->ring.next->ring.prev = tmp_win->ring.prev; + + /* if window was only thing in ring, null out ring */ + if (Scr->Ring == tmp_win) + Scr->Ring = (tmp_win->ring.next != tmp_win) ? + tmp_win->ring.next : (TwmWindow *)NULL; + + /* if window was ring leader, set to next (or null) */ + if (!Scr->Ring || Scr->RingLeader == tmp_win) + Scr->RingLeader = Scr->Ring; + + tmp_win->ring.next = tmp_win->ring.prev = NULL; +} + +void WarpAlongRing (ev, forward) + XButtonEvent *ev; + Bool forward; +{ + TwmWindow *r, *head; + + /* + * Re-vamped much of this to properly handle icon managers, and + * clean up dumb code I added some time back. + * djhjr - 11/8/01 + * Cleaned it up again. I musta been high. Twice. + * djhjr - 10/27/02 + */ + + if (!(head = (Scr->RingLeader) ? Scr->RingLeader : Scr->Ring)) + { + DoAudible(); + return; + } + + if (forward) + r = head->ring.next; + else + r = head->ring.prev; + + while (r && r != head) + { + if (r->mapped || warp_if_warpunmapped(r, F_WARPRING)) + break; + + r = (forward) ? r->ring.next : r->ring.prev; + } + + if (r && r->mapped) + { +#ifdef ORIGINAL_WARPRINGCOORDINATES /* djhjr - 5/11/98 */ + TwmWindow *p = Scr->RingLeader, *t; +#endif + +/* done in WarpToWindow - djhjr - 10/27/02 + Scr->RingLeader = r; +*/ + + RaiseStickyAbove(); + RaiseAutoPan(); + +/* djhjr - 6/3/03 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(F_WARPRING); +#endif + + WarpToWindow (r); + +#ifdef ORIGINAL_WARPRINGCOORDINATES /* djhjr - 5/11/98 */ + if (p && p->mapped && + XFindContext (dpy, ev->window, TwmContext, (caddr_t *)&t) == XCSUCCESS && + p == t) + { + p->ring.cursor_valid = True; + p->ring.curs_x = ev->x_root - t->frame_x; + p->ring.curs_y = ev->y_root - t->frame_y; + if (p->ring.curs_x < -p->frame_bw || + p->ring.curs_x >= p->frame_width + p->frame_bw || + p->ring.curs_y < -p->frame_bw || + p->ring.curs_y >= p->frame_height + p->frame_bw) + { + /* somehow out of window */ + p->ring.curs_x = p->frame_width / 2; + p->ring.curs_y = p->frame_height / 2; + } + } +#endif + } + else + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ +} + + + +void WarpToScreen (n, inc) + int n, inc; +{ + Window dumwin; + int x, y, dumint; + unsigned int dummask; + ScreenInfo *newscr = NULL; + + while (!newscr) { + /* wrap around */ + if (n < 0) + n = NumScreens - 1; + else if (n >= NumScreens) + n = 0; + + newscr = ScreenList[n]; + if (!newscr) { /* make sure screen is managed */ + if (inc) { /* walk around the list */ + n += inc; + continue; + } + fprintf (stderr, "%s: unable to warp to unmanaged screen %d\n", + ProgramName, n); + DoAudible(); /* was 'XBell()' - djhjr - 6/22/01 */ + return; + } + } + + if (Scr->screen == n) return; /* already on that screen */ + + PreviousScreen = Scr->screen; + XQueryPointer (dpy, Scr->Root, &dumwin, &dumwin, &x, &y, + &dumint, &dumint, &dummask); + +/* djhjr - 6/3/03 */ +#ifndef NO_SOUND_SUPPORT + PlaySound(F_WARPTOSCREEN); +#endif + + XWarpPointer (dpy, None, newscr->Root, 0, 0, 0, 0, x, y); + return; +} + + + +void WarpToWindow (t) +TwmWindow *t; +{ + int x, y; + int pan_margin = 0; /* djhjr - 5/28/00 */ + int bw = t->frame_bw3D + t->frame_bw; /* djhjr - 9/9/02 */ + Window w = t->frame; /* djhjr - 5/30/00 */ + + WarpWindowOrScreen(t); /* djhjr - 5/30/00 */ + +#ifdef ORIGINAL_WARPRINGCOORDINATES /* djhjr - 5/11/98 */ + if (t->ring.cursor_valid) { + x = t->ring.curs_x; + y = t->ring.curs_y; + } + else { + x = t->frame_width / 2; + y = t->frame_height / 2; + } +#else + /* added this 'if (...) else' - djhjr - 6/10/98 */ + if (t->iconmgr) + { +/* djhjr - 5/30/00 + if (t->iconmgrp->count > 0) + XWarpPointer(dpy, None, t->iconmgrp->first->icon, 0,0,0,0, + EDGE_OFFSET, EDGE_OFFSET); + + return; +*/ + if (t->iconmgrp->count > 0) + { + w = t->iconmgrp->twm_win->frame; + + /* was 'Scr->BorderWidth' - djhjr - 9/9/02 */ + x = t->iconmgrp->x + bw + EDGE_OFFSET + 5; + x += (Scr->IconMgrBevelWidth > 0) ? Scr->IconMgrBevelWidth : bw; + y = t->iconmgrp->y + bw + t->iconmgrp->first->height / 2; + y += (Scr->IconMgrBevelWidth > 0) ? Scr->IconMgrBevelWidth : bw; + y += t->iconmgrp->twm_win->title_height; + } + } + else if (!t->title_w) + { + /* added this 'if (...) else' - djhjr - 10/16/02 */ + if (Scr->WarpCentered & WARPC_UNTITLED) + { + x = t->frame_width / 2; + y = t->frame_height / 2; + } + else + { + x = t->frame_width / 2; + y = (t->wShaped) ? bw : bw / 2; /* djhjr - 9/9/02 */ + } + } + else + { + /* added this 'if (...) else' - djhjr - 10/16/02 */ + if (Scr->WarpCentered & WARPC_TITLED) + { + x = t->frame_width / 2; + y = t->frame_height / 2; + } + else + { + /* + * Added 't->title_x + ' to handle titlebars that + * aren't flush left. + * Submitted by Steve Ratcliffe + * was '(t->frame_bw3D + t->frame_bw)' - djhjr - 9/9/02 + */ + x = t->title_x + t->title_width / 2 + bw; + y = t->title_height / 2 + bw; + } + } + + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (!Scr->BorderBevelWidth > 0) y -= t->frame_bw; +#endif + + /* + * adjust the pointer for partially visible windows and the + * AutoPan border width - djhjr - 5/30/00 + * was '(t->frame_bw3D + t->frame_bw)' - djhjr - 9/9/02 + */ + + if (Scr->AutoPanX) pan_margin = Scr->AutoPanBorderWidth; + + if (x + t->frame_x >= Scr->MyDisplayWidth - pan_margin) + x = Scr->MyDisplayWidth - t->frame_x - pan_margin - 2; + if (x + t->frame_x <= pan_margin) + { + if (t->title_w) + x = t->title_width - (t->frame_x + t->title_width) + + pan_margin + 2; + else + x = -t->frame_x + pan_margin + 2; + } + + /* added test for centered warps - djhjr - 10/16/02 */ + if (t->title_w && !(Scr->WarpCentered & WARPC_TITLED) && + (x < t->title_x || x > t->title_x + t->title_width)) + { + y = t->title_height + bw / 2; + } + if (y + t->frame_y >= Scr->MyDisplayHeight - pan_margin) + { + y = Scr->MyDisplayHeight - t->frame_y - pan_margin - 2; + + /* move centered warp to titlebar - djhjr - 10/16/02 */ + if (y < t->title_y + t->title_height) + x = t->title_x + t->title_width / 2 + bw; + } + if (y + t->frame_y <= pan_margin) + y = -t->frame_y + pan_margin + 2; + + /* was 't->frame' - djhjr - 5/30/00 */ + XWarpPointer (dpy, None, w, 0, 0, 0, 0, x, y); + + /* djhjr - 10/27/02 */ + if (t->ring.next) Scr->RingLeader = t; +} + + + +/* + * substantially re-written and added receiving and using 'next' + * + * djhjr - 5/13/98 5/19/98 6/6/98 6/15/98 + */ +#ifdef ORIGINAL_WARPCLASS +TwmWindow * +next_by_class (t, class) +TwmWindow *t; +char *class; +{ + TwmWindow *tt; + int len = strlen(class); + + if (t) + for (tt = t->next; tt != NULL; tt = tt->next) + if (!strncmp(class, tt->class.res_class, len)) return tt; + for (tt = Scr->TwmRoot.next; tt != NULL; tt = tt->next) + if (!strncmp(class, tt->class.res_class, len)) return tt; + return NULL; +} +#else /* ORIGINAL_WARPCLASS */ +static TwmWindow * +next_by_class (next, t, class) +int next; +TwmWindow *t; +char *class; +{ + static TwmWindow *tp = NULL; + TwmWindow *tt, *tl; + int i, len = strlen(class); + XClassHint ch; + +#ifdef DEBUG_WARPCLASS + fprintf(stderr, "class=\"%s\", next=%d, %s t, ", class, next, (t) ? "have" : "no"); +#endif + + /* forward or backward from current */ + tl = (next) ? ((tp) ? tp->next : Scr->TwmRoot.next) : ((tp) ? tp->prev : Scr->TwmRoot.prev); + for (tt = (next) ? ((t) ? t->next : tl) : ((t) ? t->prev : tl); + tt != NULL; + tt = (next) ? tt->next : tt->prev) + if (Scr->WarpUnmapped || tt->mapped) + { + i = XGetClassHint(dpy, tt->w, &ch); + if (i && !strncmp(class, ch.res_class, len)) + { +#ifdef DEBUG_WARPCLASS + fprintf(stderr, "matched \"%s\" \"%s\"\n", tt->class.res_class, tt->class.res_name); +#endif + tp = tt; + return tp; + } + else + { +#ifdef DEBUG_WARPCLASS + fprintf(stderr, "(1) skipping \"%s\"\n", (i) ? tt->class.res_class : "NO RES_CLASS!"); +#endif + if (i == 0) break; + } + } + + /* no match, wrap and retry */ + tp = tl = NULL; + for (tt = Scr->TwmRoot.next; tt != NULL; tt = tt->next) + if (Scr->WarpUnmapped || tt->mapped) + { + i = XGetClassHint(dpy, tt->w, &ch); + if (i && !strncmp(class, ch.res_class, len)) + { + if (next) + { +#ifdef DEBUG_WARPCLASS + fprintf(stderr, "next wrapped to \"%s\ \"%s\"\n", tt->class.res_class, tt->class.res_name); +#endif + tp = tt; + return tp; + } + else + tl = tt; + } +#ifdef DEBUG_WARPCLASS + else + fprintf(stderr, "(2) skipping \"%s\"\n", (i) ? tt->class.res_class : "NO RES_CLASS!"); +#endif + } + +#ifdef DEBUG_WARPCLASS + i = 0; if (tl) i = XGetClassHint(dpy, tl->w, &ch); + fprintf(stderr, "prev wrapped to \"%s\ \"%s\"\n", (i) ? ch.res_class : "NO RES_CLASS!", (i) ? ch.res_name : "NO RES_CLASS!"); +#endif + tp = tl; + return tp; +} +#endif /* ORIGINAL_WARPCLASS */ + +/* this was inlined in many places, and even more now - djhjr - 5/13/98 */ +/* added the second argument - djhjr - 5/28/00 */ +static int warp_if_warpunmapped(w, func) +TwmWindow *w; +int func; +{ + /* skip empty icon managers - 10/27/02 */ + if (w && (w->iconmgr && w->iconmgrp->count == 0)) + return (0); + + if (Scr->WarpUnmapped || w->mapped) + { + /* submitted by Ugen Antsilevitch - 5/28/00 */ + /* if F_NOFUNCTION, override WarpVisible - djhjr - 5/28/00 */ + if (func != F_NOFUNCTION && Scr->WarpVisible) + { + int pan_margin = 0; + + if (Scr->AutoPanX) pan_margin = Scr->AutoPanBorderWidth; + + if (w->frame_x >= Scr->MyDisplayWidth - pan_margin || + w->frame_y >= Scr->MyDisplayHeight - pan_margin || + w->frame_x + w->frame_width <= pan_margin || + w->frame_y + w->frame_height <= pan_margin) + return 0; + } + + if (!w->mapped) DeIconify(w); + if (!Scr->NoRaiseWarp) XRaiseWindow(dpy, w->frame); + XRaiseWindow(dpy, w->VirtualDesktopDisplayWindow); + + return (1); + } + + return (0); +} + +/* djhjr - 9/17/02 */ +static int +do_squeezetitle(context, func, tmp_win, squeeze) +int context, func; +TwmWindow *tmp_win; +SqueezeInfo *squeeze; +{ + if (DeferExecution (context, func, Scr->SelectCursor)) + return TRUE; + + /* honor "Don't Squeeze" resources - djhjr - 9/17/02 */ + if (Scr->SqueezeTitle && + !LookInList(Scr->DontSqueezeTitleL, tmp_win->full_name, &tmp_win->class)) + { + if ( tmp_win->title_height ) /* Not for untitled windows! */ + { + PopDownMenu(); /* djhjr - 9/17/02 */ + +#ifndef NO_SOUND_SUPPORT + PlaySound(func); +#endif + + tmp_win->squeeze_info = squeeze; + SetFrameShape( tmp_win ); + + /* Can't go in SetFrameShape()... - djhjr - 4/1/00 */ + if (Scr->WarpCursor || + LookInList(Scr->WarpCursorL, tmp_win->full_name, &tmp_win->class)) + WarpToWindow(tmp_win); + } + } + else + DoAudible(); + + return FALSE; +} + +/* + * Two functions to handle a restart from a SIGUSR1 signal + * (see also twm.c:Done() and twm.c:QueueRestartVtwm()) + * + * adapted from TVTWM-pl11 - djhjr - 7/31/98 + */ + +static void setup_restart(time) + Time time; +{ +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + CloseSound(); +#endif + + SetRealScreen(0,0); + XSync (dpy, 0); + Reborder (time); + XSync (dpy, 0); + + /* djhjr - 3/13/97 */ + XCloseDisplay(dpy); + + /* djhjr - 12/2/01 */ + delete_pidfile(); +} + +void RestartVtwm(time) + Time time; +{ + setup_restart(time); + + execvp(*Argv, Argv); + fprintf (stderr, "%s: unable to restart \"%s\"\n", ProgramName, *Argv); +} + + +/* + * ICCCM Client Messages - Section 4.2.8 of the ICCCM dictates that all + * client messages will have the following form: + * + * event type ClientMessage + * message type _XA_WM_PROTOCOLS + * window tmp->w + * format 32 + * data[0] message atom + * data[1] time stamp + */ + +static void send_clientmessage (w, a, timestamp) + Window w; + Atom a; + Time timestamp; +{ + XClientMessageEvent ev; + + ev.type = ClientMessage; + ev.window = w; + ev.message_type = _XA_WM_PROTOCOLS; + ev.format = 32; + ev.data.l[0] = a; + ev.data.l[1] = timestamp; + XSendEvent (dpy, w, False, 0L, (XEvent *) &ev); +} + +void SendDeleteWindowMessage (tmp, timestamp) + TwmWindow *tmp; + Time timestamp; +{ + send_clientmessage (tmp->w, _XA_WM_DELETE_WINDOW, timestamp); +} + +void SendSaveYourselfMessage (tmp, timestamp) + TwmWindow *tmp; + Time timestamp; +{ + send_clientmessage (tmp->w, _XA_WM_SAVE_YOURSELF, timestamp); +} + +void SendTakeFocusMessage (tmp, timestamp) + TwmWindow *tmp; + Time timestamp; +{ + send_clientmessage (tmp->w, _XA_WM_TAKE_FOCUS, timestamp); +} + + +/* djhjr - 4/27/96 */ +void DisplayPosition (x, y) +int x, y; +{ + char str [100]; + int i; + +/* djhjr - 5/10/96 + char signx = '+'; + char signy = '+'; + + if (x < 0) { + x = -x; + signx = '-'; + } + if (y < 0) { + y = -y; + signy = '-'; + } + + i = sprintf (str, " %c%-4d %c%-4d ", signx, x, signy, y); +*/ +/* + * Non-SysV systems - specifically, BSD-derived systems - return a + * pointer to the string, not its length. Submitted by Goran Larsson + i = sprintf (str, "%+6d %-+6d", x, y); + */ + sprintf (str, "%+6d %-+6d", x, y); + i = strlen (str); + + XRaiseWindow (dpy, Scr->SizeWindow); + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF (Scr->DefaultC.fore, Scr->DefaultC.back, Scr->SizeFont); +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, +#else + XDrawImageString (dpy, Scr->SizeWindow, +#endif + Scr->NormalGC, + +/* djhjr - 5/9/96 + Scr->SizeStringOffset, +*/ + (Scr->SizeStringWidth - +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_TextWidth(&Scr->SizeFont, +#else + XTextWidth(Scr->SizeFont.font, +#endif + str, i)) / 2, + +/* djhjr - 4/29/98 + Scr->SizeFont.font->ascent + SIZE_VINDENT, +*/ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ +/* djhjr - 9/14/03 + Scr->SizeFont.font->ascent + +*/ + Scr->SizeFont.ascent + + SIZE_VINDENT + + ((Scr->InfoBevelWidth > 0) ? Scr->InfoBevelWidth : 0), + + str, i); + + /* I know, I know, but the above code overwrites it... djhjr - 5/9/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (Scr->InfoBevelWidth > 0) + Draw3DBorder(Scr->SizeWindow, 0, 0, + Scr->SizeStringWidth, + +/* djhjr - 4/29/98 + (unsigned int) (Scr->SizeFont.height + SIZE_VINDENT*2), + BW, Scr->DefaultC, off, False, False); +*/ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + (unsigned int) (Scr->SizeFont.height + SIZE_VINDENT*2) + + ((Scr->InfoBevelWidth > 0) ? 2 * Scr->InfoBevelWidth : 0), + Scr->InfoBevelWidth, Scr->DefaultC, off, False, False); +} + +/* djhjr - 9/21/99 */ +int FindMenuOrFuncInBindings(contexts, mr, func) +int contexts; +MenuRoot *mr; +int func; +{ + MenuRoot *start; + FuncKey *key; + int found = 0; /* context bitmap for menu or function */ + int i, j, k, l, fallback = 0; + + if (mr) + { + if (Scr->DefaultFunction.func == F_MENU) + if (FindMenuInMenus(Scr->DefaultFunction.menu, mr)) + fallback = 1; + } + else + { + if (Scr->DefaultFunction.func == func) + fallback = 1; + else if (Scr->DefaultFunction.func == F_MENU) + if (FindFuncInMenus(Scr->DefaultFunction.menu, func)) + fallback = 1; + } + + for (j = 0; j < NUM_CONTEXTS; j++) + { + if ((contexts & (1 << j)) == 0) continue; + + if (fallback) + { + found |= (1 << j); + continue; + } + + for (i = 0; i < MAX_BUTTONS + 1; i++) + { + l = 0; + + for (k = 0; k < MOD_SIZE; k++) + { + if (mr) + { + if (Scr->Mouse[i][j][k].func == F_MENU) + l = FindMenuInMenus(Scr->Mouse[i][j][k].menu, mr); + } + else + { + if (Scr->Mouse[i][j][k].func == func) + l = 1; + else if (Scr->Mouse[i][j][k].func == F_MENU) + l = FindFuncInMenus(Scr->Mouse[i][j][k].menu, func); + } + + if (l) + { + found |= (1 << j); + i = MAX_BUTTONS + 1; + break; + } + } + } + + l = 0; + for (key = Scr->FuncKeyRoot.next; key != NULL; key = key->next) + if (key->cont & (1 << j)) + { + if (mr) + { + if (key->func == F_MENU) + for (start = Scr->MenuList; start != NULL; start = start->next) + if (strcmp(start->name, key->action) == 0) + { + l = FindMenuInMenus(start, mr); + break; + } + } + else + { + if (key->func == func) + l = 1; + else if (key->func == F_MENU) + for (start = Scr->MenuList; start != NULL; start = start->next) + if (strcmp(start->name, key->action) == 0) + { + l = FindFuncInMenus(start, func); + break; + } + } + + if (l) + { + found |= (1 << j); + break; + } + } + } + + return found; +} + +/* djhjr - 9/21/99 */ +int FindMenuOrFuncInWindows(tmp_win, contexts, mr, func) +TwmWindow *tmp_win; +int contexts; +MenuRoot *mr; +int func; +{ + TwmWindow *twin; + TwmDoor *d; + TBWindow *tbw; + int i, nb; + + if (contexts & C_ROOT_BIT) return 1; + + for (twin = Scr->TwmRoot.next; twin != NULL; twin = twin->next) + if (twin != tmp_win) + { + /* + * if this window is an icon manager, + * skip the windows that aren't in it + */ + if (tmp_win->iconmgr && twin->list && + tmp_win != twin->list->iconmgr->twm_win) + continue; + + if (twin->mapped) + { + for (i = 1; i < C_ALL_BITS; i = (1 << i)) + { + if ((contexts & i) == 0) continue; + + switch (i) + { + case C_WINDOW_BIT: + case C_FRAME_BIT: + break; + case C_TITLE_BIT: + if (!twin->title_height) continue; + break; + case C_VIRTUAL_BIT: + if (twin->w != Scr->VirtualDesktopDisplayOuter) + continue; + break; + case C_DOOR_BIT: + if (XFindContext(dpy, twin->w, DoorContext, + (caddr_t *)&d) == XCNOENT) + continue; + break; + default: + continue; + break; + } + + return 1; + } + + if (twin->titlebuttons) + { + nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + + for (tbw = twin->titlebuttons; nb > 0; tbw++, nb--) + if (mr) + { + if (tbw->info->menuroot) + if (FindMenuInMenus(tbw->info->menuroot, mr)) + return 1; + } + else + { + if (tbw->info->func == func) + return 1; + else if (tbw->info->menuroot) + if (FindFuncInMenus(tbw->info->menuroot, func)) + return 1; + } + } + } + else if (!twin->iconify_by_unmapping) + { + /* not mapped and shows an icon */ + + if (contexts & C_ICON_BIT) return 1; + } + } + + return 0; +} + +/* djhjr - 9/21/99 */ +int FindMenuInMenus(start, sought) +MenuRoot *start, *sought; +{ + MenuItem *mi; + + if (!start) return 0; /* submitted by Jonathan Paisley - 11/11/02 */ + if (start == sought) return 1; + + for (mi = start->first; mi != NULL; mi = mi->next) + if (mi->sub) + if (FindMenuInMenus(mi->sub, sought)) + return 1; + + return 0; +} + +/* djhjr - 9/21/99 */ +int FindFuncInMenus(mr, func) +MenuRoot *mr; +int func; +{ + MenuItem *mi; + + for (mi = mr->first; mi != NULL; mi = mi->next) + if (mi->func == func) + return 1; + else if (mi->sub) + if (FindFuncInMenus(mi->sub, func)) + return 1; + + return 0; +} + +/* djhjr - 6/22/01 */ +void DoAudible() +{ +#ifndef NO_SOUND_SUPPORT + if (PlaySound(S_BELL)) return; +#endif + + XBell(dpy, 0); +} + diff --git a/menus.h b/menus.h new file mode 100644 index 0000000..de8761a --- /dev/null +++ b/menus.h @@ -0,0 +1,220 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/*********************************************************************** + * + * $XConsortium: menus.h,v 1.24 89/12/10 17:46:26 jim Exp $ + * + * twm menus include file + * + * 17-Nov-87 Thomas E. LaStrange File created + * + ***********************************************************************/ + +#ifndef _MENUS_ +#define _MENUS_ + +#define TWM_ROOT "bLoB_GoOp" /* my private root menu */ + +#define TWM_WINDOWS "TwmWindows" /* for f.menu "TwmWindows" */ + +/* djhjr - 5/4/98 */ +#define VTWM_WINDOWS "VTWM Windows" /* for f.menu "VTWM Windows" */ + +#define MAX_FILE_SIZE 4096 /* max chars to read from file for cut */ + +typedef struct MenuItem +{ + struct MenuItem *next; /* next menu item */ + struct MenuItem *prev; /* prev menu item */ + struct MenuRoot *sub; /* MenuRoot of a pull right menu */ + struct MenuRoot *root; /* back pointer to my MenuRoot */ + char *item; /* the character string displayed */ + char *action; /* action to be performed */ + +/* djhjr - 4/22/96 + Pixel fore; * foreground color * + Pixel back; * background color * + Pixel hi_fore; * highlight foreground * + Pixel hi_back; * highlight background * +*/ + ColorPair normal; /* unhiglight colors */ + ColorPair highlight; /* highlight colors */ + + short item_num; /* item number of this menu */ + short x; /* x coordinate for text */ + short func; /* twm built in function */ + short state; /* video state, 0 = normal, 1 = reversed */ + short strlen; /* strlen(item) */ + short user_colors; /* colors were specified */ + + /* djhjr - 4/22/96 */ + short separated; /* separated from the next item */ + +} MenuItem; + +typedef struct MenuRoot +{ + struct MenuItem *first; /* first item in menu */ + struct MenuItem *last; /* last item in menu */ + struct MenuRoot *prev; /* previous root menu if pull right */ + struct MenuRoot *next; /* next in list of root menus */ + char *name; /* name of root */ + Window w; /* the window of the menu */ + Window shadow; /* the shadow window */ + +/* djhjr - 4/22/96 + Pixel hi_fore; * highlight foreground * + Pixel hi_back; * highlight background * +*/ + ColorPair highlight; /* highlight colors */ + + short mapped; /* NEVER_MAPPED, UNMAPPED, or MAPPED */ + short height; /* height of the menu */ + short width; /* width of the menu */ + short items; /* number of items in the menu */ + short pull; /* is there a pull right entry? */ + short entered; /* EnterNotify following pop up */ + short real_menu; /* this is a real menu */ + + /* djhjr - 5/22/00 */ + short too_tall; /* menu taller than display? */ + short top; /* first item displayed */ +} MenuRoot; + +#define NEVER_MAPPED 0 /* constants for mapped field of MenuRoot */ +#define UNMAPPED 1 +#define MAPPED 2 + + +typedef struct MouseButton +{ + int func; /* the function number */ + int mask; /* modifier mask */ + MenuRoot *menu; /* menu if func is F_MENU */ + MenuItem *item; /* action to perform if func != F_MENU */ +} MouseButton; + +typedef struct FuncButton +{ + struct FuncButton *next; /* next in the list of function buttons */ + int num; /* button number */ + int cont; /* context */ + int mods; /* modifiers */ + int func; /* the function number */ + MenuRoot *menu; /* menu if func is F_MENU */ + MenuItem *item; /* action to perform if func != F_MENU */ +} FuncButton; + +typedef struct FuncKey +{ + struct FuncKey *next; /* next in the list of function keys */ + char *name; /* key name */ + KeySym keysym; /* X keysym */ + KeyCode keycode; /* X keycode */ + int cont; /* context */ + int mods; /* modifiers */ + int func; /* function to perform */ + char *win_name; /* window name (if any) */ + char *action; /* action string (if any) */ +} FuncKey; + +extern int RootFunction; +extern MenuRoot *ActiveMenu; +extern MenuItem *ActiveItem; +extern int MoveFunction; +extern int WindowMoved; +extern int ConstMove; +/* private variables now - djhjr - 10/6/02 +extern int ConstMoveDir; +extern int ConstMoveX; +extern int ConstMoveY; +extern int ConstMoveXL; +extern int ConstMoveXR; +extern int ConstMoveYT; +extern int ConstMoveYB; +*/ + +#define MAXMENUDEPTH 10 /* max number of nested menus */ +extern int MenuDepth; + +#define MOVE_NONE 0 /* modes of constrained move */ +#define MOVE_VERT 1 +#define MOVE_HORIZ 2 + +#define WARPSCREEN_NEXT "next" +#define WARPSCREEN_PREV "prev" +#define WARPSCREEN_BACK "back" + +#define COLORMAP_NEXT "next" +#define COLORMAP_PREV "prev" +#define COLORMAP_DEFAULT "default" + +extern int InitTitlebarButtons(); +extern void InitMenus(); +extern MenuRoot *NewMenuRoot(); +extern void SetMenuIconPixmap(); +extern MenuItem *AddToMenu(); +extern Bool PopUpMenu(); +extern MenuRoot *FindMenuRoot(); +extern Bool AddFuncKey(); +extern int ExecuteFunction(); +extern int DeferExecution(); +extern void Execute(); +extern void FocusOnRoot(); +extern void SetBorder(); +extern void ReGrab(); +extern void WarpToWindow(); +extern void PaintEntry(); +extern void DeIconify(); +extern void SetMapStateProp(); +extern void Iconify(); +extern void PopDownMenu(); +extern void UpdateMenu(); +extern void SendTakeFocusMessage(); +extern void PaintEntry(); +extern void SetBorder(); +extern int CreateTitleButton(); +extern void MakeMenus(); +extern void PaintMenu(); + +/* djhjr - 4/27/96 */ +extern void DisplayPosition (); + +/* djhjr - 5/30/00 */ +extern void WarpWindowOrScreen(); +extern void WarpInIconMgr(); + +/* djhjr - 10/27/02 */ +extern void AddWindowToRing(); +extern void RemoveWindowFromRing(); + +/* djhjr - 6/22/01 */ +extern void DoAudible(); + +#endif /* _MENUS_ */ diff --git a/parse.c b/parse.c new file mode 100644 index 0000000..050794a --- /dev/null +++ b/parse.c @@ -0,0 +1,2325 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/*********************************************************************** + * + * $XConsortium: parse.c,v 1.52 91/07/12 09:59:37 dave Exp $ + * + * parse the .twmrc file + * + * 17-Nov-87 Thomas E. LaStrange File created + * 10-Oct-90 David M. Sternlicht Storing saved colors on root + ***********************************************************************/ + +#include +#include +#include +#include +#include +#include "twm.h" +#include "screen.h" +#include "menus.h" +#include "list.h" +#include "util.h" +#include "gram.h" +#include "parse.h" +#include + +/* Submitted by Jason Gloudon */ +#ifndef NO_M4_SUPPORT +#include +#include +#include +#include +#endif + +extern void twmrc_error_prefix(); + +#define BUF_LEN 300 + +static FILE *twmrc; +static int ptr = 0; +static int len = 0; +static char buff[BUF_LEN+1]; +static char overflowbuff[20]; /* really only need one */ +static int overflowlen; +static char **stringListSource, *currentString; +void put_pixel_on_root(); + +int RaiseDelay = 0; /* msec, for AutoRaise *//*RAISEDELAY*/ +extern int yylineno; +extern int mods; + +int ConstrainedMoveTime = 400; /* milliseconds, event times */ + +static int twmFileInput(), twmStringListInput(); +void twmUnput(); +int (*twmInputFunc)(); + +extern char *defTwmrc[]; /* default bindings */ + +/* Submitted by Jason Gloudon */ +#ifndef NO_M4_SUPPORT +#define Resolution(pixels, mm) ((((pixels) * 100000 / (mm)) + 50) / 100) +#define M4_MAXDIGITS 21 /* greater than the number of digits in a long int */ +extern Bool PrintErrorMessages; +char *make_m4_cmdline(); +#endif + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +extern void SetSoundHost(); +extern void SetSoundVolume(); +#endif + +/*********************************************************************** + * + * Procedure: + * ParseTwmrc - parse the .twmrc file + * + * Inputs: + * filename - the filename to parse. A NULL indicates $HOME/.twmrc + * + *********************************************************************** + */ + +static int doparse (ifunc, srctypename, srcname) + int (*ifunc)(); + char *srctypename; + char *srcname; +{ + mods = 0; + ptr = 0; + len = 0; +/* djhjr - 9/18/03 */ +#ifdef NEED_YYLINENO_V + yylineno = 1; +#endif + ParseError = FALSE; + twmInputFunc = ifunc; + overflowlen = 0; + + yyparse(); + + if (ParseError) { + fprintf (stderr, "%s: errors found in twm %s", + ProgramName, srctypename); + if (srcname) fprintf (stderr, " \"%s\"", srcname); + fprintf (stderr, "\n"); + } + return (ParseError ? 0 : 1); +} + +/* Changes for m4 pre-processing submitted by Jason Gloudon */ +/* added support for user-defined parameters - djhjr - 2/20/99 */ +#ifndef NO_M4_SUPPORT +int ParseTwmrc (filename, display_name, m4_preprocess, m4_option) + char *filename; + char *display_name; + int m4_preprocess; + char *m4_option; /* djhjr - 2/20/99 */ +#else +int ParseTwmrc (filename) + char *filename; +#endif +{ + int i; + char *cp = NULL; + char tmpfilename[257]; +#ifndef NO_M4_SUPPORT + char *m4_cmdline; + int m4_status; +#endif + + /* + * If filename given, try it, else try ~/.vtwmrc.#, else try ~/.vtwmrc, + * else try system.vtwmrc, else try ~/.twmrc.#, else ~/.twmrc, else + * system.twmrc; finally using built-in defaults. + * + * This choice allows user, then system, versions of .vtwmrc, followed + * by user, then system, versions of .twmrc. + * Thus, sites that have both twm and vtwm can allow users without + * private .vtwmrc or .twmrc files to fall back to system-wide + * defaults (very important when there are many users), yet the + * presence of a private .twmrc file for twm will not prevent + * features of a system-wide .vtwmrc file from exploiting the mew + * features of vtwm. Submitted by Nelson H. F. Beebe + */ + for (twmrc = NULL, i = 0; !twmrc && i <= 6; i++) { + switch (i) { + case 0: /* -f filename */ + cp = filename; + break; + + case 1: /* ~/.vtwmrc.screennum */ + if (!filename) { + cp = tmpfilename; + (void) sprintf (tmpfilename, "%s/.vtwmrc.%d", + Home, Scr->screen); + break; + } + continue; + + case 2: /* ~/.vtwmrc */ + if (!filename) { + tmpfilename[HomeLen + 8] = '\0'; + } + break; + + case 3: /* system.vtwmrc */ + cp = SYSTEM_VTWMRC; + break; + + case 4: /* ~/.twmrc.screennum */ + if (!filename) { + cp = tmpfilename; + (void) sprintf (tmpfilename, "%s/.twmrc.%d", + Home, Scr->screen); + break; + } + continue; + + case 5: /* ~/.twmrc */ + if(!filename){ + tmpfilename[HomeLen + 7] = '\0'; + } + break; + + case 6: /* system.twmrc */ + cp = SYSTEM_TWMRC; + break; + } + +#ifndef NO_M4_SUPPORT + if (cp) { + if (m4_preprocess && (access(cp, R_OK) == 0) ) { + if ((m4_cmdline = make_m4_cmdline(display_name, cp, m4_option)) != NULL) { + twmrc = popen(m4_cmdline, "r"); + free(m4_cmdline); + } + else { + m4_preprocess = 0; + twmrc = fopen (cp, "r"); + } + } + else { + twmrc = fopen (cp, "r"); + } + } +#else + if (cp) twmrc = fopen (cp, "r"); +#endif + } + + if (twmrc) { + int status; + + if (filename && cp != filename) { + fprintf (stderr, + "%s: unable to open twmrc file %s, using %s instead\n", + ProgramName, filename, cp); + } + status = doparse (twmFileInput, "file", cp); + +#ifndef NO_M4_SUPPORT + if(m4_preprocess){ + m4_status = pclose (twmrc); + if(!WIFEXITED(m4_status) || + (WIFEXITED(m4_status) && WEXITSTATUS(m4_status)) ){ + fprintf(stderr, + "%s: m4 returned %d\n", + ProgramName, WEXITSTATUS(m4_status)); + exit(-1); + } + } + else { + fclose (twmrc); + } +#else + fclose (twmrc); +#endif + + return status; + } else { + if (filename) { + fprintf (stderr, + "%s: unable to open twmrc file %s, using built-in defaults instead\n", + ProgramName, filename); + } + return ParseStringList (defTwmrc); + } +} + +int ParseStringList (sl) + char **sl; +{ + stringListSource = sl; + currentString = *sl; + return doparse (twmStringListInput, "string list", (char *)NULL); +} + + +/*********************************************************************** + * + * Procedure: + * twmFileInput - redefinition of the lex input routine for file input + * + * Returned Value: + * the next input character + * + *********************************************************************** + */ + +static int twmFileInput() +{ + if (overflowlen) return (int) overflowbuff[--overflowlen]; + + while (ptr == len) + { + if (fgets(buff, BUF_LEN, twmrc) == NULL) + return 0; + +/* djhjr - 9/18/03 */ +#ifdef NEED_YYLINENO_V + yylineno++; +#endif + + ptr = 0; + len = strlen(buff); + } + return ((int)buff[ptr++]); +} + +static int twmStringListInput() +{ + if (overflowlen) return (int) overflowbuff[--overflowlen]; + + /* + * return the character currently pointed to + */ + if (currentString) { + unsigned int c = (unsigned int) *currentString++; + + if (c) return c; /* if non-nul char */ + currentString = *++stringListSource; /* advance to next bol */ + return '\n'; /* but say that we hit last eol */ + } + return 0; /* eof */ +} + + +/*********************************************************************** + * + * Procedure: + * twmUnput - redefinition of the lex unput routine + * + * Inputs: + * c - the character to push back onto the input stream + * + *********************************************************************** + */ + +void twmUnput (c) + int c; +{ + if (overflowlen < sizeof overflowbuff) { + overflowbuff[overflowlen++] = (char) c; + } else { + twmrc_error_prefix (); + fprintf (stderr, "unable to unput character (%d)\n", + c); + } +} + + +/*********************************************************************** + * + * Procedure: + * TwmOutput - redefinition of the lex output routine + * + * Inputs: + * c - the character to print + * + *********************************************************************** + */ + +void +TwmOutput(c) +{ + putchar(c); +} + + +/********************************************************************** + * + * Parsing table and routines + * + ***********************************************************************/ + +typedef struct _TwmKeyword { + char *name; + int value; + int subnum; +} TwmKeyword; + +#define kw0_NoDefaults 1 +#define kw0_AutoRelativeResize 2 +#define kw0_ForceIcons 3 +#define kw0_NoIconManagers 4 +#define kw0_OpaqueMove 5 +#define kw0_InterpolateMenuColors 6 +#define kw0_NoVersion 7 +#define kw0_SortIconManager 8 +#define kw0_NoGrabServer 9 +#define kw0_NoMenuShadows 10 +#define kw0_NoRaiseOnMove 11 +#define kw0_NoRaiseOnResize 12 +#define kw0_NoRaiseOnDeiconify 13 +#define kw0_DontMoveOff 14 +#define kw0_NoBackingStore 15 +#define kw0_NoSaveUnders 16 +#define kw0_RestartPreviousState 17 +#define kw0_ClientBorderWidth 18 +#define kw0_NoTitleFocus 19 +#define kw0_RandomPlacement 20 +#define kw0_DecorateTransients 21 +#define kw0_ShowIconManager 22 +#define kw0_NoCaseSensitive 23 +#define kw0_NoRaiseOnWarp 24 +#define kw0_WarpUnmapped 25 +#define kw0_DeIconifyToScreen 26 +#define kw0_WarpWindows 27 +#define kw0_SnapRealScreen 28 +#define kw0_NotVirtualGeometries 29 +#define kw0_OldFashionedTwmWindowsMenu 30 /* RFB */ + +/* djhjr - 2/15/99 +#define kw0_UseRealScreenBorder 31 * RFB * +*/ + +#define kw0_StayUpMenus 32 +#define kw0_NaturalAutopanBehavior 33 /* DSE */ +#define kw0_EnhancedExecResources 34 /* DSE */ +#define kw0_RightHandSidePulldownMenus 35 /* DSE */ +#define kw0_LessRandomZoomZoom 36 /* DSE */ +#define kw0_PrettyZoom 37 /* DSE */ + +#define kw0_NoDefaultTitleButtons 38 /* DSE */ +#define kw0_NoDefaultMouseOrKeyboardBindings 39 /* DSE */ + +#define kw0_StickyAbove 40 /* DSE */ +#define kw0_DontInterpolateTitles 41 /* DSE */ +#define kw0_FixTransientVirtualGeometries 42 /* DSE */ + +#define kw0_WarpToTransients 43 /* PF */ +#define kw0_NoIconifyIconManagers 44 /* PF */ +#define kw0_StayUpOptionalMenus 45 /* PF */ + +#define kw0_WarpSnug 46 /* DSE */ + +#define kw0_PointerPlacement 47 /* cg */ +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 +* djhjr - 4/18/96 * +#define kw0_Use3DMenus 47 +#define kw0_Use3DTitles 48 +#define kw0_Use3DIconManagers 49 +#define kw0_Use3DBorders 50 +*/ + +/* obsoleted by the ":xpm:*" built-in pixmaps - djhjr - 10/26/02 +* djhjr - 4/25/96 * +#define kw0_SunkFocusWindowTitle 51 +*/ + +/* djhjr - 6/25/96 */ +#define kw0_ShallowReliefWindowButton 52 + +/* djhjr - 9/21/96 */ +#define kw0_ButtonColorIsFrame 53 + +/* djhjr - 1/6/98 */ +#define kw0_FixManagedVirtualGeometries 54 + +/* djhjr - 1/19/98 */ +#define kw0_BeNiceToColormap 55 + +/* djhjr - 4/17/98 */ +#define kw0_VirtualReceivesMotionEvents 56 +#define kw0_VirtualSendsMotionEvents 57 + +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 +* djhjr - 5/5/98 * +#define kw0_Use3DIcons 58 +*/ + +/* djhjr - 5/27/98 */ +#define kw0_NoIconManagerFocus 59 + +/* djhjr - 12/14/98 */ +#define kw0_StaticIconPositions 60 + +/* for rader - djhjr - 2/9/99 */ +#define kw0_NoPrettyTitles 61 + +/* djhjr - 6/22/99 */ +#define kw0_DontDeiconifyTransients 62 + +/* submitted by Ugen Antsilevitch - 5/28/00 */ +#define kw0_WarpVisible 63 + +/* djhjr - 10/2/01 */ +#define kw0_StrictIconManager 64 + +/* djhjr - 10/11/01 */ +#define kw0_ZoomZoom 65 + +/* djhjr - 10/20/02 */ +#define kw0_NoBorderDecorations 66 + +/* djhjr - 11/3/03 */ +#define kw0_RaiseOnStart 67 + +/* djhjr - 9/24/02 +#define kws_UsePPosition 1 +*/ +#define kws_IconFont 2 +#define kws_ResizeFont 3 +#define kws_MenuFont 4 +#define kws_TitleFont 5 +#define kws_IconManagerFont 6 +#define kws_UnknownIcon 7 +#define kws_IconDirectory 8 +#define kws_MaxWindowSize 9 +#define kws_VirtualFont 10 +#define kws_DoorFont 11 +#define kws_MenuTitleFont 12 /* DSE */ + +/* djhjr - 5/10/96 */ +#define kws_InfoFont 13 + +/* djhjr - 5/15/96 */ +#define kws_ResizeRegion 14 + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +#define kws_SoundHost 15 +#endif + +#define kwn_ConstrainedMoveTime 1 +#define kwn_MoveDelta 2 +#define kwn_XorValue 3 +#define kwn_FramePadding 4 +#define kwn_TitlePadding 5 +#define kwn_ButtonIndent 6 +#define kwn_BorderWidth 7 +#define kwn_IconBorderWidth 8 +#define kwn_TitleButtonBorderWidth 9 +#define kwn_PanDistanceX 10 +#define kwn_PanDistanceY 11 +#define kwn_AutoPan 12 +#define kwn_RaiseDelay 13 /* RAISEDELAY */ +#define kwn_AutoPanBorderWidth 14 /* DSE */ +#define kwn_AutoPanExtraWarp 15 /* DSE */ +#define kwn_RealScreenBorderWidth 16 /* DSE */ +#define kwn_AutoPanWarpWithRespectToRealScreen 17 /* DSE */ + +/* djhjr - 8/11/98 +* djhjr - 4/18/96 * +#define kwn_ThreeDBorderWidth 18 +*/ + +/* djhjr - 4/18/96 */ +#define kwn_ClearBevelContrast 19 +#define kwn_DarkBevelContrast 20 + +/* djhjr - 5/2/98 */ +#define kwn_BorderBevelWidth 21 +#define kwn_IconManagerBevelWidth 22 +#define kwn_InfoBevelWidth 23 +#define kwn_MenuBevelWidth 24 +#define kwn_TitleBevelWidth 25 + +/* djhjr - 8/11/98 */ +#define kwn_IconBevelWidth 26 +#define kwn_ButtonBevelWidth 27 + +/* djhjr - 2/7/99 */ +#define kwn_DoorBevelWidth 28 +#define kwn_VirtualDesktopBevelWidth 29 + +/* djhjr - 9/8/98 */ +#define kwn_PanResistance 30 + +/* djhjr - 5/22/00 */ +#define kwn_MenuScrollBorderWidth 31 +#define kwn_MenuScrollJump 32 + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +#define kwn_SoundVolume 33 +#endif +#define kwn_PauseOnExit 34 +#define kwn_PauseOnQuit 35 + +#define kwcl_BorderColor 1 +#define kwcl_IconManagerHighlight 2 +#define kwcl_BorderTileForeground 3 +#define kwcl_BorderTileBackground 4 +#define kwcl_TitleForeground 5 +#define kwcl_TitleBackground 6 +#define kwcl_IconForeground 7 +#define kwcl_IconBackground 8 +#define kwcl_IconBorderColor 9 +#define kwcl_IconManagerForeground 10 +#define kwcl_IconManagerBackground 11 +#define kwcl_VirtualDesktopBackground 12 +#define kwcl_VirtualDesktopForeground 13 +#define kwcl_VirtualDesktopBorder 14 +#define kwcl_DoorForeground 15 +#define kwcl_DoorBackground 16 + +#define kwc_DefaultForeground 1 +#define kwc_DefaultBackground 2 +#define kwc_MenuForeground 3 +#define kwc_MenuBackground 4 +#define kwc_MenuTitleForeground 5 +#define kwc_MenuTitleBackground 6 +#define kwc_MenuShadowColor 7 +#define kwc_VirtualForeground 8 /*RFB VCOLOR*/ +#define kwc_VirtualBackground 9 /*RFB VCOLOR*/ +#define kwc_RealScreenBackground 10 /* RFB 4/92 */ +#define kwc_RealScreenForeground 11 /* RFB 4/92 */ + +/* djhjr - 10/20/01 */ +#define kwm_Name LTYPE_NAME +#define kwm_ResName LTYPE_RES_NAME +#define kwm_ResClass LTYPE_RES_CLASS + +/* + * The following is sorted alphabetically according to name (which must be + * in lowercase and only contain the letters a-z). It is fed to a binary + * search to parse keywords. + */ +static TwmKeyword keytable[] = { + { "all", ALL, 0 }, + + /* djhjr - 4/26/99 */ + { "appletregion", APPLET_REGION, 0 }, + + { "autopan", NKEYWORD, kwn_AutoPan }, + { "autopanborderwidth", NKEYWORD, kwn_AutoPanBorderWidth }, /* DSE */ + { "autopanextrawarp", NKEYWORD, kwn_AutoPanExtraWarp }, /* DSE */ + { "autopanwarpwithrespecttorealscreen", NKEYWORD, + kwn_AutoPanWarpWithRespectToRealScreen }, /* DSE */ + { "autoraise", AUTO_RAISE, 0 }, + { "autoraisedelay", NKEYWORD, kwn_RaiseDelay },/*RAISEDELAY*/ + { "autorelativeresize", KEYWORD, kw0_AutoRelativeResize }, + + /* djhjr - 1/19/98 */ + { "benicetocolormap", KEYWORD, kw0_BeNiceToColormap }, + + /* djhjr - 5/2/98 */ + { "borderbevelwidth", NKEYWORD, kwn_BorderBevelWidth }, + + { "bordercolor", CLKEYWORD, kwcl_BorderColor }, + { "bordertilebackground", CLKEYWORD, kwcl_BorderTileBackground }, + { "bordertileforeground", CLKEYWORD, kwcl_BorderTileForeground }, + { "borderwidth", NKEYWORD, kwn_BorderWidth }, + { "button", BUTTON, 0 }, + + /* djhjr - 8/11/98 */ + { "buttonbevelwidth", NKEYWORD, kwn_ButtonBevelWidth }, + + /* djhjr - 9/21/96 */ + { "buttoncolorisframe", KEYWORD, kw0_ButtonColorIsFrame }, + + { "buttonindent", SNKEYWORD, kwn_ButtonIndent }, + { "c", CONTROL, 0 }, + { "center", JKEYWORD, J_CENTER }, + + /* djhjr - 4/19/96 */ + { "clearbevelcontrast", NKEYWORD, kwn_ClearBevelContrast }, + + { "clientborderwidth", KEYWORD, kw0_ClientBorderWidth }, + { "color", COLOR, 0 }, + { "constrainedmovetime", NKEYWORD, kwn_ConstrainedMoveTime }, + { "control", CONTROL, 0 }, + { "cursors", CURSORS, 0 }, + { "d", VIRTUAL_WIN, 0 }, + + /* djhjr - 4/19/96 */ + { "darkbevelcontrast", NKEYWORD, kwn_DarkBevelContrast }, + + { "decoratetransients", KEYWORD, kw0_DecorateTransients }, + { "defaultbackground", CKEYWORD, kwc_DefaultBackground }, + { "defaultforeground", CKEYWORD, kwc_DefaultForeground }, + { "defaultfunction", DEFAULT_FUNCTION, 0 }, + { "deiconifytoscreen", KEYWORD, kw0_DeIconifyToScreen }, + { "desktop", VIRTUAL_WIN, 0 }, + { "desktopdisplaybackground", + CLKEYWORD, kwcl_VirtualDesktopBackground }, + { "desktopdisplayborder", + CLKEYWORD, kwcl_VirtualDesktopBorder }, + { "desktopdisplayforeground", + CLKEYWORD, kwcl_VirtualDesktopForeground }, + { "destroy", KILL, 0 }, + + /* djhjr - 6/22/99 */ + { "dontdeiconifytransients", KEYWORD, kw0_DontDeiconifyTransients }, + + { "donticonifybyunmapping", DONT_ICONIFY_BY_UNMAPPING, 0 }, + { "dontinterpolatetitles", KEYWORD, kw0_DontInterpolateTitles }, + { "dontmoveoff", KEYWORD, kw0_DontMoveOff }, + { "dontshowindisplay", NO_SHOW_IN_DISPLAY, 0 }, + + /* Submitted by Erik Agsjo */ + { "dontshowintwmwindows", NO_SHOW_IN_TWMWINDOWS, 0 }, + /* djhjr - 6/25/98 */ + { "dontshowinvtwmwindows", NO_SHOW_IN_TWMWINDOWS, 0 }, + + { "dontsqueezetitle", DONT_SQUEEZE_TITLE, 0 }, + { "door", DOOR, 0 }, + { "doorbackground", CLKEYWORD, kwcl_DoorBackground }, + + /* djhjr - 2/7/99 */ + { "doorbevelwidth", NKEYWORD, kwn_DoorBevelWidth }, + + { "doorfont", SKEYWORD, kws_DoorFont }, + { "doorforeground", CLKEYWORD, kwcl_DoorForeground }, + { "doors", DOORS, 0 }, + { "east", DKEYWORD, D_EAST }, + { "enhancedexecresources", KEYWORD, kw0_EnhancedExecResources }, /* DSE */ + { "f", FRAME, 0 }, + { "f.autopan", FKEYWORD, F_AUTOPAN },/*RFB F_AUTOPAN*/ + { "f.autoraise", FKEYWORD, F_AUTORAISE }, + { "f.backiconmgr", FKEYWORD, F_BACKICONMGR }, + { "f.beep", FKEYWORD, F_BEEP }, + + /* Submitted by Seth Robertson - 9/9/02 */ + { "f.bindbuttons", FKEYWORD, F_BINDBUTTONS }, + { "f.bindkeys", FKEYWORD, F_BINDKEYS }, + + { "f.bottomzoom", FKEYWORD, F_BOTTOMZOOM }, + { "f.circledown", FKEYWORD, F_CIRCLEDOWN }, + { "f.circleup", FKEYWORD, F_CIRCLEUP }, + { "f.colormap", FSKEYWORD, F_COLORMAP }, + { "f.cut", FSKEYWORD, F_CUT }, + { "f.cutfile", FKEYWORD, F_CUTFILE }, + { "f.deiconify", FKEYWORD, F_DEICONIFY }, + { "f.delete", FKEYWORD, F_DELETE }, + { "f.deletedoor", FKEYWORD, F_DELETEDOOR }, + { "f.deltastop", FKEYWORD, F_DELTASTOP }, + { "f.destroy", FKEYWORD, F_DESTROY }, + { "f.downiconmgr", FKEYWORD, F_DOWNICONMGR }, + { "f.enterdoor", FKEYWORD, F_ENTERDOOR }, + { "f.exec", FSKEYWORD, F_EXEC }, + { "f.file", FSKEYWORD, F_FILE }, + { "f.focus", FKEYWORD, F_FOCUS }, + { "f.forcemove", FKEYWORD, F_FORCEMOVE }, + { "f.forwiconmgr", FKEYWORD, F_FORWICONMGR }, + { "f.fullzoom", FKEYWORD, F_FULLZOOM }, + { "f.function", FSKEYWORD, F_FUNCTION }, + { "f.hbzoom", FKEYWORD, F_BOTTOMZOOM }, + { "f.hidedesktopdisplay", FKEYWORD, F_HIDEDESKTOP }, + { "f.hideiconmgr", FKEYWORD, F_HIDELIST }, + { "f.horizoom", FKEYWORD, F_HORIZOOM }, + { "f.htzoom", FKEYWORD, F_TOPZOOM }, + { "f.hzoom", FKEYWORD, F_HORIZOOM }, + { "f.iconify", FKEYWORD, F_ICONIFY }, + { "f.identify", FKEYWORD, F_IDENTIFY }, + { "f.lefticonmgr", FKEYWORD, F_LEFTICONMGR }, + { "f.leftzoom", FKEYWORD, F_LEFTZOOM }, + { "f.lower", FKEYWORD, F_LOWER }, + { "f.menu", FSKEYWORD, F_MENU }, + { "f.move", FKEYWORD, F_MOVE }, + { "f.movescreen", FKEYWORD, F_MOVESCREEN }, + { "f.nail", FKEYWORD, F_NAIL }, + { "f.nailedabove", FKEYWORD, F_STICKYABOVE }, /* DSE */ + + /* djhjr - 4/20/98 */ + { "f.namedoor", FKEYWORD, F_NAMEDOOR }, + + { "f.newdoor", FKEYWORD, F_NEWDOOR }, + { "f.nexticonmgr", FKEYWORD, F_NEXTICONMGR }, + { "f.nop", FKEYWORD, F_NOP }, + { "f.pandown", FSKEYWORD, F_PANDOWN }, + { "f.panleft", FSKEYWORD, F_PANLEFT }, + { "f.panright", FSKEYWORD, F_PANRIGHT }, + { "f.panup", FSKEYWORD, F_PANUP }, + + /* djhjr - 11/15/02 */ + { "f.playsound", FSKEYWORD, F_PLAYSOUND }, + + { "f.previconmgr", FKEYWORD, F_PREVICONMGR }, + { "f.quit", FKEYWORD, F_QUIT }, + { "f.raise", FKEYWORD, F_RAISE }, + { "f.raiselower", FKEYWORD, F_RAISELOWER }, + { "f.refresh", FKEYWORD, F_REFRESH }, + { "f.resetdesktop", FKEYWORD, F_RESETDESKTOP }, + { "f.resize", FKEYWORD, F_RESIZE }, + { "f.restart", FKEYWORD, F_RESTART }, + { "f.righticonmgr", FKEYWORD, F_RIGHTICONMGR }, + { "f.rightzoom", FKEYWORD, F_RIGHTZOOM }, + { "f.ring", FKEYWORD, F_RING }, + { "f.saveyourself", FKEYWORD, F_SAVEYOURSELF }, + + /* djhjr - 4/30/96 */ + { "f.separator", FKEYWORD, F_SEPARATOR }, + + { "f.setrealscreen", FSKEYWORD, F_SETREALSCREEN }, + { "f.showdesktopdisplay", FKEYWORD, F_SHOWDESKTOP }, + { "f.showiconmgr", FKEYWORD, F_SHOWLIST }, + { "f.snap", FKEYWORD, F_SNAP }, + { "f.snaprealscreen", FKEYWORD, F_SNAPREALSCREEN }, + { "f.snugdesktop", FKEYWORD, F_SNUGDESKTOP }, + { "f.snugwindow", FKEYWORD, F_SNUGWINDOW }, + { "f.sorticonmgr", FKEYWORD, F_SORTICONMGR }, + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + { "f.sounds", FKEYWORD, F_SOUNDS }, +#endif + + { "f.source", FSKEYWORD, F_BEEP }, /* XXX - don't work */ + { "f.squeezecenter", FKEYWORD, F_SQUEEZECENTER },/*RFB SQUEEZE*/ + { "f.squeezeleft", FKEYWORD, F_SQUEEZELEFT },/*RFB SQUEEZE*/ + { "f.squeezeright", FKEYWORD, F_SQUEEZERIGHT },/*RFB SQUEEZE*/ + + /* djhjr - 7/15/98 */ + { "f.startwm", FSKEYWORD, F_STARTWM }, + + /* djhjr - 12/14/98 */ + { "f.staticiconpositions", FKEYWORD, F_STATICICONPOSITIONS }, + + { "f.stick", FKEYWORD, F_NAIL }, + { "f.stickyabove", FKEYWORD, F_STICKYABOVE }, /* DSE */ + + /* djhjr - 10/2/01 */ + { "f.stricticonmgr", FKEYWORD, F_STRICTICONMGR }, + + { "f.title", FKEYWORD, F_TITLE }, + { "f.topzoom", FKEYWORD, F_TOPZOOM }, + { "f.twmrc", FKEYWORD, F_RESTART }, + + /* Submitted by Seth Robertson - 9/9/02 */ + { "f.unbindbuttons", FKEYWORD, F_UNBINDBUTTONS }, + { "f.unbindkeys", FKEYWORD, F_UNBINDKEYS }, + + { "f.unfocus", FKEYWORD, F_UNFOCUS }, + { "f.upiconmgr", FKEYWORD, F_UPICONMGR }, + { "f.version", FKEYWORD, F_VERSION }, + { "f.virtualgeometries", FKEYWORD, F_VIRTUALGEOMETRIES }, + { "f.vlzoom", FKEYWORD, F_LEFTZOOM }, + { "f.vrzoom", FKEYWORD, F_RIGHTZOOM }, + { "f.warp", FKEYWORD, F_WARP }, /* PF */ + { "f.warpclassnext", FSKEYWORD, F_WARPCLASSNEXT }, /* PF */ + { "f.warpclassprev", FSKEYWORD, F_WARPCLASSPREV }, /* PF */ + { "f.warpring", FSKEYWORD, F_WARPRING }, + + /* djhjr - 5/30/00 */ + { "f.warpsnug", FKEYWORD, F_WARPSNUG }, + + { "f.warpto", FSKEYWORD, F_WARPTO }, + { "f.warptoiconmgr", FSKEYWORD, F_WARPTOICONMGR }, + { "f.warptonewest", FKEYWORD, F_WARPTONEWEST }, /* PF */ + { "f.warptoscreen", FSKEYWORD, F_WARPTOSCREEN }, + + /* submitted by Ugen Antsilevitch - 5/28/00 */ + { "f.warpvisible", FKEYWORD, F_WARPVISIBLE }, + + { "f.winrefresh", FKEYWORD, F_WINREFRESH }, + { "f.zoom", FKEYWORD, F_ZOOM }, + { "f.zoomzoom", FKEYWORD, F_ZOOMZOOM }, + + /* djhjr - 1/6/98 */ + { "fixmanagedvirtualgeometries", KEYWORD, kw0_FixManagedVirtualGeometries }, + + { "fixtransientvirtualgeometries", KEYWORD, + kw0_FixTransientVirtualGeometries }, /* DSE */ + { "forceicons", KEYWORD, kw0_ForceIcons }, + { "frame", FRAME, 0 }, + { "framepadding", NKEYWORD, kwn_FramePadding }, + { "function", FUNCTION, 0 }, + { "i", ICON, 0 }, + { "icon", ICON, 0 }, + { "iconbackground", CLKEYWORD, kwcl_IconBackground }, + + /* djhjr - 8/11/98 */ + { "iconbevelwidth", NKEYWORD, kwn_IconBevelWidth }, + + { "iconbordercolor", CLKEYWORD, kwcl_IconBorderColor }, + { "iconborderwidth", NKEYWORD, kwn_IconBorderWidth }, + { "icondirectory", SKEYWORD, kws_IconDirectory }, + { "iconfont", SKEYWORD, kws_IconFont }, + { "iconforeground", CLKEYWORD, kwcl_IconForeground }, + { "iconifybyunmapping", ICONIFY_BY_UNMAPPING, 0 }, + { "iconmanagerbackground", CLKEYWORD, kwcl_IconManagerBackground }, + + /* djhjr - 5/2/98 */ + { "iconmanagerbevelwidth", NKEYWORD, kwn_IconManagerBevelWidth }, + + { "iconmanagerdontshow", ICONMGR_NOSHOW, 0 }, + { "iconmanagerfont", SKEYWORD, kws_IconManagerFont }, + { "iconmanagerforeground", CLKEYWORD, kwcl_IconManagerForeground }, + { "iconmanagergeometry", ICONMGR_GEOMETRY, 0 }, + { "iconmanagerhighlight", CLKEYWORD, kwcl_IconManagerHighlight }, + + /* djhjr - 10/30/02 */ + { "iconmanagerpixmap", ICONMGRICONMAP, 0 }, + + { "iconmanagers", ICONMGRS, 0 }, + { "iconmanagershow", ICONMGR_SHOW, 0 }, + { "iconmgr", ICONMGR, 0 }, + { "iconregion", ICON_REGION, 0 }, + { "icons", ICONS, 0 }, + + /* djhjr - 9/10/03 */ + { "ignoremodifiers", IGNORE_MODS, 0 }, + + /* djhjr - 5/2/98 */ + { "infobevelwidth", NKEYWORD, kwn_InfoBevelWidth }, + + /* djhjr - 5/10/96 */ + { "infofont", SKEYWORD, kws_InfoFont }, + + { "interpolatemenucolors", KEYWORD, kw0_InterpolateMenuColors }, + { "l", LOCK, 0 }, + { "left", JKEYWORD, J_LEFT }, + { "lefttitlebutton", LEFT_TITLEBUTTON, 0 }, + { "lessrandomzoomzoom", KEYWORD, kw0_LessRandomZoomZoom }, /* DSE */ + { "lock", LOCK, 0 }, + { "m", META, 0 }, + { "maketitle", MAKE_TITLE, 0 }, + { "maxwindowsize", SKEYWORD, kws_MaxWindowSize }, + { "menu", MENU, 0 }, + { "menubackground", CKEYWORD, kwc_MenuBackground }, + + /* djhjr - 5/2/98 */ + { "menubevelwidth", NKEYWORD, kwn_MenuBevelWidth }, + + { "menufont", SKEYWORD, kws_MenuFont }, + { "menuforeground", CKEYWORD, kwc_MenuForeground }, + + /* djhjr - 10/30/02 */ + { "menuiconpixmap", MENUICONMAP, 0 }, + + /* djhjr - 5/22/00 */ + { "menuscrollborderwidth", NKEYWORD, kwn_MenuScrollBorderWidth }, + { "menuscrolljump", NKEYWORD, kwn_MenuScrollJump }, + + { "menushadowcolor", CKEYWORD, kwc_MenuShadowColor }, + { "menutitlebackground", CKEYWORD, kwc_MenuTitleBackground }, + { "menutitlefont", SKEYWORD, kws_MenuTitleFont }, /* DSE */ + { "menutitleforeground", CKEYWORD, kwc_MenuTitleForeground }, + { "meta", META, 0 }, + { "mod", META, 0 }, /* fake it */ + { "monochrome", MONOCHROME, 0 }, + { "move", MOVE, 0 }, + { "movedelta", NKEYWORD, kwn_MoveDelta }, + { "nailedabove", KEYWORD, kw0_StickyAbove }, /* DSE */ + { "naileddown", NAILEDDOWN, 0}, + + /* djhjr - 10/20/01 */ + { "name", MKEYWORD, kwm_Name }, + + { "naturalautopanbehavior", KEYWORD, + kw0_NaturalAutopanBehavior }, /* DSE */ + { "nobackingstore", KEYWORD, kw0_NoBackingStore }, + + /* submitted by Tim Wiess - 8/23/02 */ + { "noborder", NO_BORDER, 0 }, + + /* djhjr - 10/20/02 */ + { "noborderdecorations", KEYWORD, kw0_NoBorderDecorations }, + + { "nocasesensitive", KEYWORD, kw0_NoCaseSensitive }, + { "nodefaultmouseorkeyboardbindings", KEYWORD, + kw0_NoDefaultMouseOrKeyboardBindings }, /* DSE */ + { "nodefaults", KEYWORD, kw0_NoDefaults }, + { "nodefaulttitlebuttons", KEYWORD, kw0_NoDefaultTitleButtons }, /* DSE */ + { "nograbserver", KEYWORD, kw0_NoGrabServer }, + { "nohighlight", NO_HILITE, 0 }, + { "noiconifyiconmanagers", KEYWORD, kw0_NoIconifyIconManagers }, /* PF */ + + /* djhjr - 5/27/98 */ + { "noiconmanagerfocus", KEYWORD, kw0_NoIconManagerFocus }, + + /* djhjr - 1/27/98 */ + { "noiconmanagerhighlight", NO_ICONMGR_HILITE, 0 }, + + { "noiconmanagers", KEYWORD, kw0_NoIconManagers }, + { "nomenushadows", KEYWORD, kw0_NoMenuShadows }, + + /* djhjr - 4/7/98 */ + { "noopaquemove", NO_OPAQUE_MOVE, 0 }, + { "noopaqueresize", NO_OPAQUE_RESIZE, 0 }, + + /* for rader - djhjr - 2/9/99 */ + { "noprettytitles", KEYWORD, kw0_NoPrettyTitles }, + + { "noraiseondeiconify", KEYWORD, kw0_NoRaiseOnDeiconify }, + { "noraiseonmove", KEYWORD, kw0_NoRaiseOnMove }, + { "noraiseonresize", KEYWORD, kw0_NoRaiseOnResize }, + { "noraiseonwarp", KEYWORD, kw0_NoRaiseOnWarp }, + { "north", DKEYWORD, D_NORTH }, + { "nosaveunders", KEYWORD, kw0_NoSaveUnders }, + { "nostackmode", NO_STACKMODE, 0 }, + { "notitle", NO_TITLE, 0 }, + { "notitlefocus", KEYWORD, kw0_NoTitleFocus }, + { "notitlehighlight", NO_TITLE_HILITE, 0 }, + { "notvirtualgeometries", KEYWORD, kw0_NotVirtualGeometries }, + { "noversion", KEYWORD, kw0_NoVersion }, + + /* submitted by Jonathan Paisley - 10/27/02 */ + { "nowindowring", NO_WINDOW_RING, 0 }, + + { "oldfashionedtwmwindowsmenu", KEYWORD, + kw0_OldFashionedTwmWindowsMenu },/*RFB*/ + + /* djhjr - 6/25/98 */ + { "oldfashionedvtwmwindowsmenu", KEYWORD, + kw0_OldFashionedTwmWindowsMenu },/*RFB*/ + +/* djhjr - 4/7/98 + { "opaquemove", KEYWORD, kw0_OpaqueMove }, +*/ + { "opaquemove", OPAQUE_MOVE, 0 }, + + /* djhjr - 4/7/98 */ + { "opaqueresize", OPAQUE_RESIZE, 0 }, + + { "pandistancex", NKEYWORD, kwn_PanDistanceX }, + { "pandistancey", NKEYWORD, kwn_PanDistanceY }, + + /* djhjr - 4/7/98 */ + { "panresistance", NKEYWORD, kwn_PanResistance }, + + /* djhjr - 6/22/01 */ + { "pauseonexit", NKEYWORD, kwn_PauseOnExit }, + { "pauseonquit", NKEYWORD, kwn_PauseOnQuit }, + + { "pixmaps", PIXMAPS, 0 }, + { "pointerplacement", KEYWORD, kw0_PointerPlacement }, + { "prettyzoom", KEYWORD, kw0_PrettyZoom }, /* DSE */ + { "r", ROOT, 0 }, + { "raisedelay", NKEYWORD, kwn_RaiseDelay },/*RAISEDELAY*/ + + /* djhjr - 11/3/03 */ + { "raiseonstart", KEYWORD, kw0_RaiseOnStart }, + + { "randomplacement", KEYWORD, kw0_RandomPlacement }, + { "realscreenbackground", CKEYWORD, kwc_RealScreenBackground },/*RFB 4/92*/ + { "realscreenborderwidth", NKEYWORD, kwn_RealScreenBorderWidth }, /* DSE */ + { "realscreenforeground", CKEYWORD, kwc_RealScreenForeground },/*RFB 4/92*/ + { "realscreenpixmap", REALSCREENMAP, 0 },/*RFB PIXMAP*/ + + /* djhjr - 10/20/01 */ + { "resclass", MKEYWORD, kwm_ResClass }, + + { "resize", RESIZE, 0 }, + { "resizefont", SKEYWORD, kws_ResizeFont }, + + /* djhjr - 5/15/96 */ + { "resizeregion", SKEYWORD, kws_ResizeRegion }, + + /* djhjr - 10/20/01 */ + { "resname", MKEYWORD, kwm_ResName }, + + { "restartpreviousstate", KEYWORD, kw0_RestartPreviousState }, + { "rhspulldownmenus", KEYWORD, kw0_RightHandSidePulldownMenus }, /* DSE */ + { "right", JKEYWORD, J_RIGHT }, + { "righthandsidepulldownmenus", KEYWORD, kw0_RightHandSidePulldownMenus }, /* DSE */ + { "righttitlebutton", RIGHT_TITLEBUTTON, 0 }, + { "root", ROOT, 0 }, + { "s", SHIFT, 0 }, + { "savecolor", SAVECOLOR, 0}, + { "select", SELECT, 0 }, + + /* djhjr - 6/25/96 */ + { "shallowreliefwindowbutton", KEYWORD, kw0_ShallowReliefWindowButton }, + + { "shift", SHIFT, 0 }, + { "showiconmanager", KEYWORD, kw0_ShowIconManager }, + { "snaprealscreen", KEYWORD, kw0_SnapRealScreen }, + { "sorticonmanager", KEYWORD, kw0_SortIconManager }, + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + { "soundhost", SKEYWORD, kws_SoundHost }, + { "sounds", SOUNDS, 0 }, + { "soundvolume", NKEYWORD, kwn_SoundVolume }, +#endif + + { "south", DKEYWORD, D_SOUTH }, + { "squeezetitle", SQUEEZE_TITLE, 0 }, + { "starticonified", START_ICONIFIED, 0 }, + + /* djhjr - 12/14/98 */ + { "staticiconpositions", KEYWORD, kw0_StaticIconPositions }, + + { "stayupmenus", KEYWORD, kw0_StayUpMenus }, + { "stayupoptionalmenus", KEYWORD, kw0_StayUpOptionalMenus }, /* PF */ + { "sticky", NAILEDDOWN, 0 },/*RFB*/ + { "stickyabove", KEYWORD, kw0_StickyAbove }, /* DSE */ + + /* djhjr - 10/2/01 */ + { "stricticonmanager", KEYWORD, kw0_StrictIconManager }, + +/* obsoleted by the ":xpm:*" built-in pixmaps - djhjr - 10/26/02 + * djhjr - 4/25/96 * + { "sunkfocuswindowtitle", KEYWORD, kw0_SunkFocusWindowTitle }, +*/ + + { "t", TITLE, 0 }, + +/* djhjr - 8/11/98 + * djhjr - 4/18/96 * + { "threedborderwidth", NKEYWORD, kwn_ThreeDBorderWidth }, +*/ + + { "title", TITLE, 0 }, + { "titlebackground", CLKEYWORD, kwcl_TitleBackground }, + + /* djhjr - 5/2/98 */ + { "titlebevelwidth", NKEYWORD, kwn_TitleBevelWidth }, + + { "titlebuttonborderwidth", NKEYWORD, kwn_TitleButtonBorderWidth }, + { "titlefont", SKEYWORD, kws_TitleFont }, + { "titleforeground", CLKEYWORD, kwcl_TitleForeground }, + { "titlehighlight", TITLE_HILITE, 0 }, + { "titlepadding", NKEYWORD, kwn_TitlePadding }, + { "unknownicon", SKEYWORD, kws_UnknownIcon }, +/* djhjr - 9/24/02 + { "usepposition", SKEYWORD, kws_UsePPosition }, +*/ + { "usepposition", USE_PPOSITION, 0 }, + +/* djhjr - 2/15/99 - this is dumb - if RealScreenBorderWidth is defined, use it! + { "userealscreenborder", KEYWORD, kw0_UseRealScreenBorder }, *RFB* +*/ + +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 + * djhjr - 4/18/96 * + { "usethreedborders", KEYWORD, kw0_Use3DBorders }, + { "usethreediconmanagers", KEYWORD, kw0_Use3DIconManagers }, + + * djhjr - 5/5/98 * + { "usethreedicons", KEYWORD, kw0_Use3DIcons }, + + { "usethreedmenus", KEYWORD, kw0_Use3DMenus }, + { "usethreedtitles", KEYWORD, kw0_Use3DTitles }, +*/ + + { "v", VIRTUAL, 0 }, + { "virtual", VIRTUAL, 0 }, + { "virtualbackground", CKEYWORD, kwc_VirtualBackground },/*RFB VCOLOR*/ + { "virtualbackgroundpixmap", VIRTUALMAP, 0 },/*RFB PIXMAP*/ + { "virtualdesktop", VIRTUALDESKTOP, 0 }, + + /* djhjr - 2/7/99 */ + { "virtualdesktopbevelwidth", NKEYWORD, kwn_VirtualDesktopBevelWidth }, + + { "virtualdesktopfont", SKEYWORD, kws_VirtualFont }, + { "virtualforeground", CKEYWORD, kwc_VirtualForeground },/*RFB VCOLOR*/ + + /* djhjr - 4/17/98 */ + { "virtualreceivesmotionevents", KEYWORD, + kw0_VirtualReceivesMotionEvents }, + { "virtualsendsmotionevents", KEYWORD, + kw0_VirtualSendsMotionEvents }, + + { "w", WINDOW, 0 }, + { "wait", WAIT, 0 }, + + /* djhjr - 10/16/02 */ + { "warpcentered", WARP_CENTERED, 0 }, + + { "warpcursor", WARP_CURSOR, 0 }, + { "warpsnug", KEYWORD, kw0_WarpSnug }, /* DSE */ + { "warptotransients", KEYWORD, kw0_WarpToTransients }, /* PF */ + { "warpunmapped", KEYWORD, kw0_WarpUnmapped }, + + /* submitted by Ugen Antsilevitch - 5/28/00 */ + { "warpvisible", KEYWORD, kw0_WarpVisible }, + + { "warpwindows", KEYWORD, kw0_WarpWindows }, + { "west", DKEYWORD, D_WEST }, + { "window", WINDOW, 0 }, + { "windowfunction", WINDOW_FUNCTION, 0 }, + { "windowring", WINDOW_RING, 0 }, + { "xorvalue", NKEYWORD, kwn_XorValue }, + { "zoom", ZOOM, 0 }, + + /* djhjr - 10/11/01 */ + { "zoomzoom", KEYWORD, kw0_ZoomZoom }, +}; + +static int numkeywords = (sizeof(keytable)/sizeof(keytable[0])); + +int parse_keyword (s, nump) + char *s; + int *nump; +{ + register int lower = 0, upper = numkeywords - 1; + + XmuCopyISOLatin1Lowered (s, s); + while (lower <= upper) { + int middle = (lower + upper) / 2; + TwmKeyword *p = &keytable[middle]; + int res = strcmp (p->name, s); + + if (res < 0) { + lower = middle + 1; + } else if (res == 0) { + *nump = p->subnum; + return p->value; + } else { + upper = middle - 1; + } + } + return ERRORTOKEN; +} + + + +/* + * action routines called by grammar + */ + +int do_single_keyword (keyword) + int keyword; +{ + switch (keyword) { + case kw0_NoDefaults: + Scr->NoDefaultMouseOrKeyboardBindings = TRUE; + Scr->NoDefaultTitleButtons = TRUE; + return 1; + + case kw0_NoDefaultMouseOrKeyboardBindings: /* DSE */ + Scr->NoDefaultMouseOrKeyboardBindings = TRUE; + return 1; + + case kw0_NoDefaultTitleButtons: /* DSE */ + Scr->NoDefaultTitleButtons = TRUE; + return 1; + + case kw0_StayUpMenus: + if (Scr->FirstTime) Scr->StayUpMenus = TRUE; + return 1; + + case kw0_StayUpOptionalMenus: /* PF */ + if (Scr->FirstTime) Scr->StayUpOptionalMenus = Scr->StayUpMenus = TRUE; + return 1; + +/* djhjr - 2/15/99 - this is dumb - if RealScreenBorderWidth is defined, use it! + case kw0_UseRealScreenBorder: *RFB* + Scr->UseRealScreenBorder = TRUE; + return 1; +*/ + + case kw0_OldFashionedTwmWindowsMenu:/*RFB*/ + Scr->OldFashionedTwmWindowsMenu = TRUE; + return 1; + + case kw0_AutoRelativeResize: + Scr->AutoRelativeResize = TRUE; + return 1; + + case kw0_ForceIcons: + if (Scr->FirstTime) Scr->ForceIcon = TRUE; + return 1; + + case kw0_NoIconManagers: + Scr->NoIconManagers = TRUE; + return 1; + + case kw0_NoIconifyIconManagers: /* PF */ + Scr->NoIconifyIconManagers = TRUE; + return 1; + +/* djhjr - 4/7/98 + case kw0_OpaqueMove: + Scr->OpaqueMove = TRUE; + return 1; +*/ + + case kw0_InterpolateMenuColors: + if (Scr->FirstTime) Scr->InterpolateMenuColors = TRUE; + return 1; + + case kw0_NoVersion: + /* obsolete */ + return 1; + + case kw0_SortIconManager: + if (Scr->FirstTime) Scr->SortIconMgr = TRUE; + return 1; + + case kw0_NoGrabServer: + Scr->NoGrabServer = TRUE; + return 1; + + case kw0_NoMenuShadows: + if (Scr->FirstTime) Scr->Shadow = FALSE; + return 1; + + case kw0_NoRaiseOnMove: + if (Scr->FirstTime) Scr->NoRaiseMove = TRUE; + return 1; + + case kw0_NoRaiseOnResize: + if (Scr->FirstTime) Scr->NoRaiseResize = TRUE; + return 1; + + case kw0_NoRaiseOnDeiconify: + if (Scr->FirstTime) Scr->NoRaiseDeicon = TRUE; + return 1; + + case kw0_DontMoveOff: + Scr->DontMoveOff = TRUE; + return 1; + + case kw0_NoBackingStore: + Scr->BackingStore = FALSE; + return 1; + + case kw0_NoSaveUnders: + Scr->SaveUnder = FALSE; + return 1; + + case kw0_RestartPreviousState: + RestartPreviousState = True; + return 1; + + case kw0_ClientBorderWidth: + if (Scr->FirstTime) Scr->ClientBorderWidth = TRUE; + return 1; + + case kw0_NoTitleFocus: + Scr->TitleFocus = FALSE; + return 1; + + case kw0_RandomPlacement: + Scr->RandomPlacement = TRUE; + return 1; + + case kw0_PointerPlacement: + Scr->PointerPlacement = TRUE; + return 1; + + case kw0_DecorateTransients: + Scr->DecorateTransients = TRUE; + return 1; + + case kw0_WarpToTransients: /* PF */ + Scr->WarpToTransients = TRUE; + return 1; + + case kw0_ShowIconManager: + Scr->ShowIconManager = TRUE; + return 1; + + case kw0_NoCaseSensitive: + Scr->CaseSensitive = FALSE; + return 1; + + case kw0_NoRaiseOnWarp: + Scr->NoRaiseWarp = TRUE; + return 1; + + case kw0_WarpUnmapped: + Scr->WarpUnmapped = TRUE; + return 1; + + case kw0_DeIconifyToScreen: + Scr->DeIconifyToScreen = TRUE; + return 1; + + case kw0_WarpWindows: + Scr->WarpWindows = TRUE; + return 1; + + case kw0_SnapRealScreen: + Scr->snapRealScreen = TRUE; + return 1; + + case kw0_NotVirtualGeometries: + Scr->GeometriesAreVirtual = FALSE; + return 1; + + case kw0_NaturalAutopanBehavior: /* DSE */ + Scr->AutoPanWarpWithRespectToRealScreen = 100; + return 1; + case kw0_EnhancedExecResources: /* DSE */ + Scr->EnhancedExecResources = TRUE; + return 1; + case kw0_RightHandSidePulldownMenus: /* DSE */ + Scr->RightHandSidePulldownMenus = TRUE; + return 1; + case kw0_LessRandomZoomZoom: /* DSE */ + Scr->LessRandomZoomZoom = TRUE; + return 1; + case kw0_PrettyZoom: /* DSE */ + Scr->PrettyZoom = TRUE; + return 1; + case kw0_StickyAbove: /* DSE */ + Scr->StickyAbove = TRUE; + return 1; + case kw0_DontInterpolateTitles: /* DSE */ + Scr->DontInterpolateTitles = TRUE; + return 1; + + /* djhjr - 1/6/98 */ + case kw0_FixManagedVirtualGeometries: + Scr->FixManagedVirtualGeometries = TRUE; + return 1; + + case kw0_FixTransientVirtualGeometries: /* DSE */ + Scr->FixTransientVirtualGeometries = TRUE; + return 1; + case kw0_WarpSnug: /* DSE */ + Scr->WarpSnug = TRUE; + return 1; + + /* djhjr - 6/25/96 */ + case kw0_ShallowReliefWindowButton: + Scr->ShallowReliefWindowButton = 1; + return 1; + +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 + * djhjr - 4/18/96 * + case kw0_Use3DBorders: + Scr->use3Dborders = TRUE; + return 1; + case kw0_Use3DIconManagers: + Scr->use3Diconmanagers = TRUE; + return 1; + case kw0_Use3DMenus: + Scr->use3Dmenus = TRUE; + return 1; + case kw0_Use3DTitles: + Scr->use3Dtitles = TRUE; + return 1; + + * djhjr - 5/5/98 * + case kw0_Use3DIcons: + Scr->use3Dicons = TRUE; + return 1; +*/ + +/* obsoleted by the ":xpm:*" built-in pixmaps - djhjr - 10/26/02 + * djhjr - 4/25/96 * + case kw0_SunkFocusWindowTitle: + Scr->SunkFocusWindowTitle = TRUE; + return 1; +*/ + + /* djhjr - 9/21/96 */ + case kw0_ButtonColorIsFrame: + Scr->ButtonColorIsFrame = TRUE; + return 1; + + /* djhjr - 1/19/98 */ + case kw0_BeNiceToColormap: + Scr->BeNiceToColormap = TRUE; + return 1; + + /* djhjr - 4/17/98 */ + case kw0_VirtualReceivesMotionEvents: + Scr->VirtualReceivesMotionEvents = TRUE; + return 1; + case kw0_VirtualSendsMotionEvents: + Scr->VirtualSendsMotionEvents = TRUE; + return 1; + + /* djhjr - 5/27/98 */ + case kw0_NoIconManagerFocus: + Scr->IconManagerFocus = FALSE; + return 1; + + /* djhjr - 12/14/98 */ + case kw0_StaticIconPositions: + Scr->StaticIconPositions = TRUE; + return 1; + + /* for rader - djhjr - 2/9/99 */ + case kw0_NoPrettyTitles: + Scr->NoPrettyTitles = TRUE; + return 1; + + /* djhjr - 6/22/99 */ + case kw0_DontDeiconifyTransients: + Scr->DontDeiconifyTransients = TRUE; + return 1; + + /* submitted by Ugen Antsilevitch - 5/28/00 */ + case kw0_WarpVisible: + Scr->WarpVisible = TRUE; + return 1; + + /* djhjr - 10/2/01 */ + case kw0_StrictIconManager: + Scr->StrictIconManager = TRUE; + return 1; + + /* djhjr - 10/11/01 */ + case kw0_ZoomZoom: /* DSE */ + Scr->ZoomZoom = TRUE; + return 1; + + /* djhjr - 10/20/02 */ + case kw0_NoBorderDecorations: /* DSE */ + Scr->NoBorderDecorations = TRUE; + return 1; + + /* djhjr - 11/3/03 */ + case kw0_RaiseOnStart: + Scr->RaiseOnStart = TRUE; + return 1; + } + + return 0; +} + + +int do_string_keyword (keyword, s) + int keyword; + char *s; +{ + /* idea from Seth Robertson - djhjr - 9/17/03 */ + if (s == NULL || s[0] == '\0') + return 0; + + switch (keyword) { +/* now in gram.y - djhjr - 9/24/02 + case kws_UsePPosition: + { + int ppos = ParseUsePPosition (s); + if (ppos < 0) { + twmrc_error_prefix(); + fprintf (stderr, + "ignoring invalid UsePPosition argument \"%s\"\n", s); + } else { + Scr->UsePPosition = ppos; + } + return 1; + } +*/ + + case kws_IconFont: + if (!Scr->HaveFonts) Scr->IconFont.name = s; + return 1; + + case kws_ResizeFont: + if (!Scr->HaveFonts) Scr->SizeFont.name = s; + return 1; + + case kws_MenuFont: + if (!Scr->HaveFonts) Scr->MenuFont.name = s; + return 1; + + case kws_TitleFont: + if (!Scr->HaveFonts) Scr->TitleBarFont.name = s; + return 1; + + case kws_IconManagerFont: + if (!Scr->HaveFonts) Scr->IconManagerFont.name = s; + return 1; + + case kws_MenuTitleFont: /* DSE */ + if (!Scr->HaveFonts) Scr->MenuTitleFont.name = s; + return 1; + + /* djhjr - 5/10/96 */ + case kws_InfoFont: + if (!Scr->HaveFonts) Scr->InfoFont.name = s; + return 1; + + case kws_UnknownIcon: + if (Scr->FirstTime) GetUnknownIcon (s); + return 1; + + case kws_IconDirectory: + if (Scr->FirstTime) Scr->IconDirectory = ExpandFilename (s); + return 1; + + case kws_MaxWindowSize: + JunkMask = XParseGeometry (s, &JunkX, &JunkY, &JunkWidth, &JunkHeight); + if ((JunkMask & (WidthValue | HeightValue)) != + (WidthValue | HeightValue)) { + twmrc_error_prefix(); + fprintf (stderr, "bad MaxWindowSize \"%s\"\n", s); + return 0; + } + if (JunkWidth <= 0 || JunkHeight <= 0) { + twmrc_error_prefix(); + fprintf (stderr, "MaxWindowSize \"%s\" must be positive\n", s); + return 0; + } + Scr->MaxWindowWidth = JunkWidth; + Scr->MaxWindowHeight = JunkHeight; + return 1; + + case kws_VirtualFont: + Scr->NamesInVirtualDesktop = True; + if (!Scr->HaveFonts) Scr->VirtualFont.name = s; + return 1; + + case kws_DoorFont: + if (!Scr->HaveFonts) Scr->DoorFont.name = s; + return 1; + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + case kws_SoundHost: + if (Scr->FirstTime) SetSoundHost(s); + return 1; +#endif + + /* djhjr - 5/15/96 */ + case kws_ResizeRegion: + XmuCopyISOLatin1Lowered (s, s); + if (strcmp (s, "northwest") == 0) + { + Scr->ResizeX = R_NORTHWEST; + return 1; + } + else if (strcmp (s, "northeast") == 0) + { + Scr->ResizeX = R_NORTHEAST; + return 1; + } + if (strcmp (s, "southwest") == 0) + { + Scr->ResizeX = R_SOUTHWEST; + return 1; + } + else if (strcmp (s, "southeast") == 0) + { + Scr->ResizeX = R_SOUTHEAST; + return 1; + } + else if (strcmp (s, "centered") == 0) + { + Scr->ResizeX = R_CENTERED; + return 1; + } + else + { + twmrc_error_prefix(); + fprintf (stderr, "Invalid ResizeRegion \"%s\"\n", s); + return 0; + } + } + + return 0; +} + + +int do_number_keyword (keyword, num) + int keyword; + int num; +{ + switch (keyword) { + case kwn_ConstrainedMoveTime: + ConstrainedMoveTime = num; + return 1; + + case kwn_AutoPanBorderWidth: /* DSE */ + Scr->AutoPanBorderWidth = (num<1)?1:num; + return 1; + + case kwn_AutoPanExtraWarp: /* DSE */ + Scr->AutoPanExtraWarp = (num<0)?0:num; + return 1; + + case kwn_RealScreenBorderWidth: /* DSE */ + Scr->RealScreenBorderWidth = (num < 0) ? 0 : num; + return 1; + + case kwn_MoveDelta: + Scr->MoveDelta = num; + return 1; + + case kwn_XorValue: + if (Scr->FirstTime) Scr->XORvalue = num; + return 1; + + case kwn_FramePadding: + if (Scr->FirstTime) Scr->FramePadding = num; + return 1; + + case kwn_TitlePadding: + if (Scr->FirstTime) Scr->TitlePadding = num; + return 1; + + case kwn_ButtonIndent: + if (Scr->FirstTime) Scr->ButtonIndent = num; + return 1; + + case kwn_BorderWidth: + if (Scr->FirstTime) Scr->BorderWidth = num; + return 1; + + case kwn_IconBorderWidth: + if (Scr->FirstTime) Scr->IconBorderWidth = num; + return 1; + + case kwn_TitleButtonBorderWidth: + if (Scr->FirstTime) Scr->TBInfo.border = num; + return 1; + + case kwn_PanDistanceX: + if (Scr->FirstTime) + { + Scr->VirtualDesktopPanDistanceX = (num * Scr->MyDisplayWidth) / 100; + /* added this - djhjr - 1/4/98 */ + if (Scr->VirtualDesktopPanDistanceX <= 0) Scr->VirtualDesktopPanDistanceX = 1; + } + return 1; + + case kwn_PanDistanceY: + if (Scr->FirstTime) + { + Scr->VirtualDesktopPanDistanceY = (num * Scr->MyDisplayHeight) / 100; + /* added this - djhjr - 1/4/98 */ + if (Scr->VirtualDesktopPanDistanceY <= 0) Scr->VirtualDesktopPanDistanceY = 1; + } + return 1; + + /* djhjr - 9/8/98 */ + case kwn_PanResistance: + if (Scr->FirstTime) Scr->VirtualDesktopPanResistance = num; + if (Scr->VirtualDesktopPanResistance < 0) + Scr->VirtualDesktopPanResistance = 0; + return 1; + + case kwn_RaiseDelay: RaiseDelay = num; return 1;/*RAISEDELAY*/ + + case kwn_AutoPan: + if (Scr->FirstTime) + { + Scr->AutoPanX = (num * Scr->MyDisplayWidth) / 100; + Scr->AutoPanY = (num * Scr->MyDisplayHeight) / 100; + if (Scr->AutoPanX <= 0) Scr->AutoPanX = 1; + if (Scr->AutoPanY <= 0) Scr->AutoPanY = 1; + } + return 1; + + case kwn_AutoPanWarpWithRespectToRealScreen: /* DSE */ + Scr->AutoPanWarpWithRespectToRealScreen = (num<0)?0:(num>100)?100:num; + return 1; + +/* djhjr - 8/11/98 + * djhjr - 4/18/96 * + case kwn_ThreeDBorderWidth: + if (Scr->FirstTime) Scr->ThreeDBorderWidth = num; + return 1; +*/ + + /* djhjr - 4/19/96 */ + case kwn_ClearBevelContrast: + if (Scr->FirstTime) Scr->ClearBevelContrast = num; + if (Scr->ClearBevelContrast < 0) Scr->ClearBevelContrast = 0; + if (Scr->ClearBevelContrast > 100) Scr->ClearBevelContrast = 100; + return 1; + case kwn_DarkBevelContrast: + if (Scr->FirstTime) Scr->DarkBevelContrast = num; + if (Scr->DarkBevelContrast < 0) Scr->DarkBevelContrast = 0; + if (Scr->DarkBevelContrast > 100) Scr->DarkBevelContrast = 100; + return 1; + + /* djhjr - 5/2/98 */ + case kwn_BorderBevelWidth: + if (Scr->FirstTime) Scr->BorderBevelWidth = num; + if (Scr->BorderBevelWidth < 0) Scr->BorderBevelWidth = 0; + if (Scr->BorderBevelWidth > 9) Scr->BorderBevelWidth = 9; + return 1; + case kwn_IconManagerBevelWidth: + if (Scr->FirstTime) Scr->IconMgrBevelWidth = num; + if (Scr->IconMgrBevelWidth < 0) Scr->IconMgrBevelWidth = 0; + if (Scr->IconMgrBevelWidth > 9) Scr->IconMgrBevelWidth = 9; + return 1; + case kwn_InfoBevelWidth: + if (Scr->FirstTime) Scr->InfoBevelWidth = num; + if (Scr->InfoBevelWidth < 0) Scr->InfoBevelWidth = 0; + if (Scr->InfoBevelWidth > 9) Scr->InfoBevelWidth = 9; + return 1; + case kwn_MenuBevelWidth: + if (Scr->FirstTime) Scr->MenuBevelWidth = num; + if (Scr->MenuBevelWidth < 0) Scr->MenuBevelWidth = 0; + if (Scr->MenuBevelWidth > 9) Scr->MenuBevelWidth = 9; + return 1; + case kwn_TitleBevelWidth: + if (Scr->FirstTime) Scr->TitleBevelWidth = num; + if (Scr->TitleBevelWidth < 0) Scr->TitleBevelWidth = 0; + if (Scr->TitleBevelWidth > 9) Scr->TitleBevelWidth = 9; + return 1; + + /* djhjr - 8/11/98 */ + case kwn_ButtonBevelWidth: + if (Scr->FirstTime) Scr->ButtonBevelWidth = num; + if (Scr->ButtonBevelWidth < 0) Scr->ButtonBevelWidth = 0; + if (Scr->ButtonBevelWidth > 9) Scr->ButtonBevelWidth = 9; + return 1; + case kwn_IconBevelWidth: + if (Scr->FirstTime) Scr->IconBevelWidth = num; + if (Scr->IconBevelWidth < 0) Scr->IconBevelWidth = 0; + if (Scr->IconBevelWidth > 9) Scr->IconBevelWidth = 9; + return 1; + + /* djhjr - 2/7/99 */ + case kwn_DoorBevelWidth: + if (Scr->FirstTime) Scr->DoorBevelWidth = num; + if (Scr->DoorBevelWidth < 0) Scr->DoorBevelWidth = 0; + if (Scr->DoorBevelWidth > 9) Scr->DoorBevelWidth = 9; + return 1; + case kwn_VirtualDesktopBevelWidth: + if (Scr->FirstTime) Scr->VirtualDesktopBevelWidth = num; + if (Scr->VirtualDesktopBevelWidth < 0) Scr->VirtualDesktopBevelWidth = 0; + if (Scr->VirtualDesktopBevelWidth > 9) Scr->VirtualDesktopBevelWidth = 9; + return 1; + + /* djhjr - 5/22/00 */ + case kwn_MenuScrollBorderWidth: + if (Scr->FirstTime) Scr->MenuScrollBorderWidth = num; + return 1; + case kwn_MenuScrollJump: + if (Scr->FirstTime) Scr->MenuScrollJump = num; + return 1; + +/* djhjr - 8/16/01 */ +#ifndef NO_SOUND_SUPPORT + case kwn_SoundVolume: + if (Scr->FirstTime) SetSoundVolume(num); + return 1; +#endif + + /* djhjr - 6/22/01 */ + case kwn_PauseOnExit: + if (Scr->FirstTime) Scr->PauseOnExit = num; + return 1; + case kwn_PauseOnQuit: + if (Scr->FirstTime) Scr->PauseOnQuit = num; + return 1; + } + + return 0; +} + +name_list **do_colorlist_keyword (keyword, colormode, s) + int keyword; + int colormode; + char *s; +{ + switch (keyword) { + case kwcl_BorderColor: + GetColor (colormode, &Scr->BorderColor, s); + return &Scr->BorderColorL; + + case kwcl_IconManagerHighlight: + GetColor (colormode, &Scr->IconManagerHighlight, s); + return &Scr->IconManagerHighlightL; + + case kwcl_BorderTileForeground: + GetColor (colormode, &Scr->BorderTileC.fore, s); + return &Scr->BorderTileForegroundL; + + case kwcl_BorderTileBackground: + GetColor (colormode, &Scr->BorderTileC.back, s); + return &Scr->BorderTileBackgroundL; + + case kwcl_TitleForeground: + GetColor (colormode, &Scr->TitleC.fore, s); + return &Scr->TitleForegroundL; + + case kwcl_TitleBackground: + GetColor (colormode, &Scr->TitleC.back, s); + return &Scr->TitleBackgroundL; + + case kwcl_IconForeground: + GetColor (colormode, &Scr->IconC.fore, s); + return &Scr->IconForegroundL; + + case kwcl_IconBackground: + GetColor (colormode, &Scr->IconC.back, s); + return &Scr->IconBackgroundL; + + case kwcl_IconBorderColor: + GetColor (colormode, &Scr->IconBorderColor, s); + return &Scr->IconBorderColorL; + + case kwcl_IconManagerForeground: + GetColor (colormode, &Scr->IconManagerC.fore, s); + return &Scr->IconManagerFL; + + case kwcl_IconManagerBackground: + GetColor (colormode, &Scr->IconManagerC.back, s); + return &Scr->IconManagerBL; + + case kwcl_VirtualDesktopForeground: + GetColor (colormode, &Scr->VirtualDesktopDisplayC.fore, s); + return &Scr->VirtualDesktopColorFL; + + case kwcl_VirtualDesktopBackground: + GetColor (colormode, &Scr->VirtualDesktopDisplayC.back, s); + return &Scr->VirtualDesktopColorBL; + + case kwcl_VirtualDesktopBorder: + GetColor (colormode, &Scr->VirtualDesktopDisplayBorder, s); + return &Scr->VirtualDesktopColorBoL; + + case kwcl_DoorForeground: + GetColor (colormode, &Scr->DoorC.fore, s); + return &Scr->DoorForegroundL; + + case kwcl_DoorBackground: + GetColor (colormode, &Scr->DoorC.back, s); + return &Scr->DoorBackgroundL; + + } + return NULL; +} + +int do_color_keyword (keyword, colormode, s) + int keyword; + int colormode; + char *s; +{ + switch (keyword) { + case kwc_DefaultForeground: + GetColor (colormode, &Scr->DefaultC.fore, s); + return 1; + + case kwc_DefaultBackground: + GetColor (colormode, &Scr->DefaultC.back, s); + return 1; + + case kwc_MenuForeground: + GetColor (colormode, &Scr->MenuC.fore, s); + return 1; + + case kwc_MenuBackground: + GetColor (colormode, &Scr->MenuC.back, s); + return 1; + + case kwc_MenuTitleForeground: + GetColor (colormode, &Scr->MenuTitleC.fore, s); + return 1; + + case kwc_MenuTitleBackground: + GetColor (colormode, &Scr->MenuTitleC.back, s); + return 1; + + case kwc_MenuShadowColor: + GetColor (colormode, &Scr->MenuShadowColor, s); + return 1; + + case kwc_VirtualBackground:/*RFB VCOLOR*/ + GetColor (colormode, &Scr->VirtualC.back, s);/*RFB VCOLOR*/ + return 1;/*RFB VCOLOR*/ + + case kwc_VirtualForeground:/*RFB VCOLOR*/ + GetColor (colormode, &Scr->VirtualC.fore, s);/*RFB VCOLOR*/ + return 1;/*RFB VCOLOR*/ + + case kwc_RealScreenForeground: + GetColor( colormode, &Scr->RealScreenC.fore, s);/*RFB 4/92 */ + return 1; + + case kwc_RealScreenBackground: + GetColor( colormode, &Scr->RealScreenC.back, s);/*RFB 4/92 */ + return 1; + + } + + return 0; +} + +/* + * put_pixel_on_root() Save a pixel value in twm root window color property. + */ +void put_pixel_on_root(pixel) + Pixel pixel; +{ + int i, addPixel = 1; + Atom pixelAtom, retAtom; + int retFormat; + unsigned long nPixels, retAfter; + Pixel *retProp; + + pixelAtom = XInternAtom(dpy, "_MIT_PRIORITY_COLORS", True); + + /* added tests for success - djhjr - 1/10/98 */ + if (XGetWindowProperty(dpy, Scr->Root, pixelAtom, 0, 8192, + False, XA_CARDINAL, &retAtom, + &retFormat, &nPixels, &retAfter, + (unsigned char **)&retProp) != Success || retAtom == None) + return; + + for (i=0; i< nPixels; i++) + if (pixel == retProp[i]) addPixel = 0; + + if (addPixel) + XChangeProperty (dpy, Scr->Root, _XA_MIT_PRIORITY_COLORS, + XA_CARDINAL, 32, PropModeAppend, + (unsigned char *)&pixel, 1); +} + +/* + * do_string_savecolor() save a color from a string in the twmrc file. + */ +void do_string_savecolor(colormode, s) + int colormode; + char *s; +{ + Pixel p = ULONG_MAX; + GetColor(colormode, &p, s); + if (p != ULONG_MAX) + put_pixel_on_root(p); +} + +/* + * do_var_savecolor() save a color from a var in the twmrc file. + */ +typedef struct _cnode {int i; struct _cnode *next;} Cnode, *Cptr; +Cptr chead = NULL; + +void do_var_savecolor(key) +int key; +{ + Cptr cptrav, cpnew; + if (!chead) { + chead = (Cptr)malloc(sizeof(Cnode)); + chead->i = key; chead->next = NULL; + } + else { + cptrav = chead; + while (cptrav->next != NULL) { cptrav = cptrav->next; } + cpnew = (Cptr)malloc(sizeof(Cnode)); + cpnew->i = key; cpnew->next = NULL; cptrav->next = cpnew; + } +} + +/* + * assign_var_savecolor() traverse the var save color list placeing the pixels + * in the root window property. + */ +void assign_var_savecolor() +{ + Cptr cp = chead; + while (cp != NULL) { + switch (cp->i) { + case kwcl_BorderColor: + put_pixel_on_root(Scr->BorderColor); + break; + case kwcl_IconManagerHighlight: + put_pixel_on_root(Scr->IconManagerHighlight); + break; + case kwcl_BorderTileForeground: + put_pixel_on_root(Scr->BorderTileC.fore); + break; + case kwcl_BorderTileBackground: + put_pixel_on_root(Scr->BorderTileC.back); + break; + case kwcl_TitleForeground: + put_pixel_on_root(Scr->TitleC.fore); + break; + case kwcl_TitleBackground: + put_pixel_on_root(Scr->TitleC.back); + break; + case kwcl_IconForeground: + put_pixel_on_root(Scr->IconC.fore); + break; + case kwcl_IconBackground: + put_pixel_on_root(Scr->IconC.back); + break; + case kwcl_IconBorderColor: + put_pixel_on_root(Scr->IconBorderColor); + break; + case kwcl_IconManagerForeground: + put_pixel_on_root(Scr->IconManagerC.fore); + break; + case kwcl_IconManagerBackground: + put_pixel_on_root(Scr->IconManagerC.back); + break; + } + cp = cp->next; + } + if (chead) { + free(chead); + chead = NULL; + } +} + +/* added 'type' argument - djhjr - 10/20/01 */ +void do_squeeze_entry (list, name, type, justify, num, denom) + name_list **list; /* squeeze or dont-squeeze list */ + char *name; /* window name */ + short type; /* match type */ + int justify; /* left, center, right */ + int num; /* signed pixel count or fraction num */ + int denom; /* signed 0 or indicates fraction denom */ +{ + int absnum = (num < 0 ? -num : num); + int absdenom = (denom < 0 ? -denom : denom); + + if (num < 0) { + twmrc_error_prefix(); + fprintf (stderr, "SqueezeTitle numerator %d made positive\n", num); + } + if (denom < 0) { + twmrc_error_prefix(); + fprintf (stderr, "SqueezeTitle denominator %d made positive\n", denom); + } + if (absnum > absdenom && denom != 0) { + twmrc_error_prefix(); + fprintf (stderr, "SqueezeTitle fraction %d/%d outside window\n", + num, denom); + return; + } + if (denom == 1) { + twmrc_error_prefix(); + fprintf (stderr, "useless SqueezeTitle fraction %d/%d, assuming 0/0\n", + num, denom); + absnum = 0; + absdenom = 0; + } + + if (HasShape) { + SqueezeInfo *sinfo; + sinfo = (SqueezeInfo *) malloc (sizeof(SqueezeInfo)); + + if (!sinfo) { + twmrc_error_prefix(); + fprintf (stderr, "unable to allocate %d bytes for squeeze info\n", + sizeof(SqueezeInfo)); + return; + } + sinfo->justify = justify; + sinfo->num = absnum; + sinfo->denom = absdenom; + /* added 'type' argument - djhjr - 10/20/01 */ + AddToList (list, name, type, (char *)sinfo); + } +} + +/* Submitted by Jason Gloudon */ +/* added support for user-defined parameters - djhjr - 2/20/99 */ +/* added support for sound - djhjr - 6/22/01 */ +/* added support for regex - djhjr - 10/20/01 */ +/* added support for i18n - djhjr - 9/14/03 */ +#ifndef NO_M4_SUPPORT +char *make_m4_cmdline(display_name, cp, m4_option) +char *display_name; +char *cp; +char *m4_option; /* djhjr - 2/20/99 */ +{ + char *m4_lines[6] = { + "m4 -DHOME='%s' -DWIDTH='%d' -DHEIGHT='%d' -DSOUND='%s' ", + "-DPLANES='%d' -DBITS_PER_RGB='%d' -DCLASS='%s' -DXPM='%s' ", + "-DI18N='%s' -DCOLOR='%s' -DX_RESOLUTION='%d' -DY_RESOLUTION='%d' ", + "-DREGEX='%s' -DUSER='%s' -DSERVERHOST='%s' -DCLIENTHOST='%s' ", + "-DHOSTNAME='%s' -DTWM_TYPE='vtwm' -DVERSION='%d' ", + "-DREVISION='%d' -DVENDOR='%s' -DRELEASE='%d'" + }; + char *client, *server, *hostname; + char *m4_cmdline, *colon, *vc, *env_username; + char *is_sound, *is_xpm, *is_regex, *is_color, *is_i18n; + int i, client_len, opt_len = 0, cmd_len = 0, server_is_client = 0; + struct hostent *hostname_ent; + + /* djhjr - 2/20/99 */ + if (m4_option) + { + opt_len = strlen(m4_option); + + /* this isn't likely ever needed, but you just never know... */ + if (m4_option[0] == '\'' || m4_option[0] == '"') + { + if (m4_option[opt_len - 1] != '\'' && m4_option[opt_len - 1] != '"') + { + fprintf(stderr,"%s: badly formed user-defined m4 parameter\n", ProgramName); + return (NULL); + } + else + { + m4_option++; + opt_len -= 2; + } + } + } + + /* the sourcing of various hostnames is stolen from tvtwm */ + /* pad for NULL terminator - submitted by Jonathan Paisley - 11/11/02 */ + for(client = NULL, client_len = 256; client_len < 1024; client_len *= 2){ + if((client = malloc(client_len + 1)) == NULL){ + fprintf(stderr,"%s: cannot allocate %d bytes for m4\n", ProgramName, client_len + 1); + return (NULL); + } + + client[client_len] = '\0'; + XmuGetHostname(client, client_len); + + if(client[client_len] == '\0') + break; + + free(client); + client = NULL; + } + + if(client == NULL){ + fprintf(stderr, "%s: cannot get hostname for m4\n", ProgramName); + return (NULL); + } + + if((server = XDisplayName(display_name)) == NULL){ + fprintf(stderr, "%s: cannot get display name for m4\n", ProgramName); + return (NULL); + } + + /* we copy so we can modify it safely */ + server = strdup(server); + + if((colon = index(server, ':')) != NULL){ + *colon = '\0'; + } + + /* connected to :0 or unix:0 ? */ + if((server[0] == '\0') || (!strcmp(server, "unix"))){ + if (colon){ + *colon = ':'; + colon = NULL; + } + free(server); + server = client; + server_is_client = 1; + } + + hostname_ent = gethostbyname(client); + hostname = hostname_ent != NULL ? hostname_ent->h_name : client; + +#ifdef NO_XPM_SUPPORT + is_xpm = "No"; +#else + is_xpm = "Yes"; +#endif +#ifdef NO_SOUND_SUPPORT + is_sound = "No"; +#else + is_sound = "Yes"; +#endif +#ifdef NO_REGEX_SUPPORT + is_regex = "No"; +#else + is_regex = "Yes"; +#endif +#ifdef NO_I18N_SUPPORT + is_i18n = "No"; +#else + is_i18n = "Yes"; +#endif + + /* assume colour visual */ + is_color = "Yes"; + switch(Scr->d_visual->class) + { + case(StaticGray): vc = "StaticGray"; is_color = "No"; break; + case(GrayScale): vc = "GrayScale"; is_color = "No"; break; + case(StaticColor): vc = "StaticColor"; break; + case(PseudoColor): vc = "PseudoColor"; break; + case(TrueColor): vc = "TrueColor"; break; + case(DirectColor): vc = "DirectColor"; break; + default: vc = "NonStandard"; break; + } + + if((env_username = getenv("LOGNAME")) == NULL){ + env_username = ""; + } + + /* + * Start with slightly more than the minimal command line, add space for + * nine numeric fields, ensure we have room for each of the strings, and + * add some breathing room + * + * Then add space for any user-defined parameters - djhjr - 2/20/99 + */ + for (i = 0; i < 6; i++) cmd_len += strlen(m4_lines[i]); + cmd_len += M4_MAXDIGITS * 9 + HomeLen + strlen(vc) + strlen(is_xpm) + + strlen(is_color) + strlen(env_username) + strlen(server) + + strlen(client) + strlen(hostname) + strlen(ServerVendor(dpy)) + + strlen(is_sound) + strlen(is_regex) + strlen(is_i18n) + strlen(cp) + 16; + if (opt_len) cmd_len += opt_len; + + if((m4_cmdline = malloc(cmd_len)) == NULL){ + fprintf(stderr,"%s: cannot allocate %d bytes for m4\n", ProgramName, cmd_len); + return (NULL); + } + + /* + * Non-SysV systems - specifically, BSD-derived systems - return a + * pointer to the string, not its length. + */ + sprintf(m4_cmdline, m4_lines[0], Home, Scr->MyDisplayWidth, + Scr->MyDisplayHeight, is_sound); + cmd_len = strlen(m4_cmdline); + sprintf(m4_cmdline + cmd_len, m4_lines[1], Scr->d_depth, + Scr->d_visual->bits_per_rgb, vc, is_xpm); + cmd_len = strlen(m4_cmdline); + sprintf(m4_cmdline + cmd_len, m4_lines[2], is_i18n, is_color, + Resolution(Scr->MyDisplayWidth, DisplayWidthMM(dpy, Scr->screen)), + Resolution(Scr->MyDisplayHeight, DisplayHeightMM(dpy, Scr->screen))); + cmd_len = strlen(m4_cmdline); + sprintf(m4_cmdline + cmd_len, m4_lines[3], is_regex, env_username, + server, client); + cmd_len = strlen(m4_cmdline); + sprintf(m4_cmdline + cmd_len, m4_lines[4], hostname, ProtocolVersion(dpy)); + cmd_len = strlen(m4_cmdline); + sprintf(m4_cmdline + cmd_len, m4_lines[5], ProtocolRevision(dpy), + ServerVendor(dpy), VendorRelease(dpy)); + + /* djhjr - 2/20/99 */ + cmd_len = strlen(m4_cmdline); + if (opt_len) + { + sprintf(m4_cmdline + cmd_len, " %*.*s", opt_len, opt_len, m4_option); + cmd_len = strlen(m4_cmdline); + } + sprintf(m4_cmdline + cmd_len, " < %s", cp); + + if (PrintErrorMessages) + fprintf(stderr, "\n%s: %s\n", ProgramName, m4_cmdline); + + if (colon) *colon = ':'; + if (!server_is_client) free(server); + free(client); + + return (m4_cmdline); +} +#endif /* NO_M4_SUPPORT */ + diff --git a/parse.h b/parse.h new file mode 100644 index 0000000..4c7d4b2 --- /dev/null +++ b/parse.h @@ -0,0 +1,192 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/********************************************************************** + * + * $XConsortium: parse.h,v 1.14 89/12/14 14:51:25 jim Exp $ + * + * .twmrc parsing externs + * + * 8-Apr-88 Tom LaStrange Initial Version. + * + **********************************************************************/ + +#ifndef _PARSE_ +#define _PARSE_ + +extern int ParseTwmrc(), ParseStringList(); +extern int (*twmInputFunc)(); +extern void twmUnput(); +extern void TwmOutput(); + +/* + * This is private to VTWM, to indicate no or invalid functions. + * + * djhjr - 4/20/98 + */ +#define F_NOFUNCTION 0 + +#define F_NOP 0 +#define F_BEEP 1 +#define F_RESTART 2 +#define F_QUIT 3 +#define F_FOCUS 4 +#define F_REFRESH 5 +#define F_WINREFRESH 6 +#define F_DELTASTOP 7 +#define F_MOVE 8 +#define F_POPUP 9 +#define F_FORCEMOVE 10 +#define F_AUTORAISE 11 +#define F_IDENTIFY 12 +#define F_ICONIFY 13 +#define F_DEICONIFY 14 +#define F_UNFOCUS 15 +#define F_RESIZE 16 +#define F_ZOOM 17 +#define F_LEFTZOOM 18 +#define F_RIGHTZOOM 19 +#define F_TOPZOOM 20 +#define F_BOTTOMZOOM 21 +#define F_HORIZOOM 22 +#define F_FULLZOOM 23 +#define F_RAISE 24 +#define F_RAISELOWER 25 +#define F_LOWER 26 +#define F_DESTROY 27 +#define F_DELETE 28 +#define F_SAVEYOURSELF 29 +#define F_VERSION 30 +#define F_TITLE 31 +#define F_RIGHTICONMGR 32 +#define F_LEFTICONMGR 33 +#define F_UPICONMGR 34 +#define F_DOWNICONMGR 35 +#define F_FORWICONMGR 36 +#define F_BACKICONMGR 37 +#define F_NEXTICONMGR 38 +#define F_PREVICONMGR 39 +#define F_SORTICONMGR 40 +#define F_CIRCLEUP 41 +#define F_CIRCLEDOWN 42 +#define F_CUTFILE 43 +#define F_SHOWLIST 44 +#define F_HIDELIST 45 +#define F_NAIL 46 +#define F_PANDOWN 47 +#define F_PANLEFT 48 +#define F_PANRIGHT 49 +#define F_PANUP 50 +#define F_RESETDESKTOP 51 +#define F_MOVESCREEN 52 +#define F_SNAP 53 +#define F_HIDEDESKTOP 54 +#define F_SHOWDESKTOP 55 +#define F_ENTERDOOR 56 +#define F_NEWDOOR 57 +#define F_SNUGDESKTOP 58 +#define F_SNUGWINDOW 59 +#define F_AUTOPAN 60/*RFB F_AUTOPAN*/ +#define F_RING 61/*RFB F_RING*/ +#define F_SQUEEZELEFT 62/*RFB F_SQUEEZE*/ +#define F_SQUEEZERIGHT 63/*RFB F_SQUEEZE*/ +#define F_SQUEEZECENTER 64/*RFB F_SQUEEZE*/ +#define F_SNAPREALSCREEN 65/*RFB F_SNAPREALSCREEN*/ +#define F_VIRTUALGEOMETRIES 66/*marcel@duteca.et.tudelft.nl*/ +#define F_DELETEDOOR 67/*marcel@duteca.et.tudelft.nl*/ +#define F_ZOOMZOOM 68 /* RFB silly */ +#define F_WARP 69 /* PF */ +#define F_STICKYABOVE 70 /* DSE */ + +#define F_MENU 101 /* string */ +#define F_WARPTO 102 /* string */ +#define F_WARPTOICONMGR 103 /* string */ +#define F_WARPRING 104 /* string */ +#define F_FILE 105 /* string */ +#define F_EXEC 106 /* string */ +#define F_CUT 107 /* string */ +#define F_FUNCTION 108 /* string */ +#define F_WARPTOSCREEN 109 /* string */ +#define F_COLORMAP 110 /* string */ +#define F_SETREALSCREEN 111 /* string */ +#define F_WARPCLASSNEXT 112 /* string -- PF */ +#define F_WARPCLASSPREV 113 /* string -- PF */ +#define F_WARPTONEWEST 114 /* string -- PF */ + +/* djhjr - 4/30/96 */ +#define F_SEPARATOR 115 + +/* djhjr - 4/20/98 */ +#define F_NAMEDOOR 116 + +/* djhjr - 7/15/98 */ +#define F_STARTWM 117 + +/* djhjr - 12/14/98 */ +#define F_STATICICONPOSITIONS 118 + +/* submitted by Ugen Antsilevitch - 5/28/00 */ +#define F_WARPVISIBLE 119 + +/* djhjr - 5/30/00 */ +#define F_WARPSNUG 120 + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +#define F_SOUNDS 121 +#endif + +/* djhjr - 10/2/01 */ +#define F_STRICTICONMGR 122 + +/* Next four submitted by Seth Robertson - 9/9/02 */ +#define F_BINDBUTTONS 123 +#define F_BINDKEYS 124 +#define F_UNBINDBUTTONS 125 +#define F_UNBINDKEYS 126 + +/* djhjr - 11/15/02 */ +#define F_PLAYSOUND 127 + +#define D_NORTH 1 +#define D_SOUTH 2 +#define D_EAST 3 +#define D_WEST 4 + +/* djhjr - 5/15/96 */ +#define R_NORTH 1 +#define R_NORTHEAST 2 +#define R_EAST 3 +#define R_SOUTHEAST 4 +#define R_SOUTH 5 +#define R_SOUTHWEST 6 +#define R_WEST 7 +#define R_NORTHWEST 8 +#define R_CENTERED 9 + +#endif /* _PARSE_ */ diff --git a/regions.c b/regions.c new file mode 100644 index 0000000..1067f1c --- /dev/null +++ b/regions.c @@ -0,0 +1,258 @@ +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/********************************************************************** + * + * regions.c + * + * Region related routines + * + * 4/26/99 D. J. Hawkey Jr. + * + **********************************************************************/ + +#include +#include +#include "twm.h" +#include "screen.h" +#include "list.h" +#include "regions.h" +#include "gram.h" +#include "parse.h" +#include "util.h" + +void +splitRegionEntry (re, grav1, grav2, w, h) + RegionEntry *re; + int grav1, grav2; + int w, h; +{ + RegionEntry *new; + + switch (grav1) { + case D_NORTH: + case D_SOUTH: + if (w != re->w) + splitRegionEntry (re, grav2, grav1, w, re->h); + if (h != re->h) { + new = (RegionEntry *)malloc (sizeof (RegionEntry)); + new->u.twm_win = 0; + /* djhjr - 10/20/01 */ + new->type = LTYPE_EXACT_NAME; + new->usedby = 0; + new->next = re->next; + re->next = new; + new->x = re->x; + new->h = (re->h - h); + new->w = re->w; + re->h = h; + if (grav1 == D_SOUTH) { + new->y = re->y; + re->y = new->y + new->h; + } else + new->y = re->y + re->h; + } + break; + case D_EAST: + case D_WEST: + if (h != re->h) + splitRegionEntry (re, grav2, grav1, re->w, h); + if (w != re->w) { + new = (RegionEntry *)malloc (sizeof (RegionEntry)); + new->u.twm_win = 0; + /* djhjr - 10/20/01 */ + new->type = LTYPE_EXACT_NAME; + new->usedby = 0; + new->next = re->next; + re->next = new; + new->y = re->y; + new->w = (re->w - w); + new->h = re->h; + re->w = w; + if (grav1 == D_EAST) { + new->x = re->x; + re->x = new->x + new->w; + } else + new->x = re->x + re->w; + } + break; + } +} + +int +roundEntryUp (v, multiple) +{ + return ((v + multiple - 1) / multiple) * multiple; +} + +RegionEntry * +prevRegionEntry (re, rr) + RegionEntry *re; + RootRegion *rr; +{ + RegionEntry *ep; + + if (re == rr->entries) + return 0; + for (ep = rr->entries; ep->next != re; ep=ep->next) + ; + return ep; +} + +/* + * old is being freed; and is adjacent to re. Merge regions together. + */ +void +mergeRegionEntries (old, re) + RegionEntry *old, *re; +{ + if (old->y == re->y) { + re->w = old->w + re->w; + if (old->x < re->x) + re->x = old->x; + } else { + re->h = old->h + re->h; + if (old->y < re->y) + re->y = old->y; + } +} + +void +downRegionEntry(rr, re) +RootRegion *rr; +RegionEntry *re; +{ + RegionEntry *ep, *en; + + re->u.twm_win = 0; + re->usedby = 0; + ep = prevRegionEntry (re, rr); + en = re->next; + for (;;) { + if (ep && ep->usedby == 0 && + ((ep->x == re->x && ep->w == re->w) || + (ep->y == re->y && ep->h == re->h))) + { + ep->next = re->next; + mergeRegionEntries (re, ep); + if (re->usedby == USEDBY_NAME) + free(re->u.name); +/* djhjr - 10/20/01 */ +#ifndef NO_REGEX_SUPPORT + if (re->type & LTYPE_C_REGEXP) + regfree(&re->re); +#endif + free ((char *) re); + re = ep; + ep = prevRegionEntry (ep, rr); + } else if (en && en->usedby == 0 && + ((en->x == re->x && en->w == re->w) || + (en->y == re->y && en->h == re->h))) + { + re->next = en->next; + mergeRegionEntries (en, re); + if (en->usedby == USEDBY_NAME) + free(en->u.name); +/* djhjr - 10/20/01 */ +#ifndef NO_REGEX_SUPPORT + if (en->type & LTYPE_C_REGEXP) + regfree(&en->re); +#endif + free ((char *) en); + en = re->next; + } else + break; + } +} + +RootRegion * +AddRegion(geom, grav1, grav2, stepx, stepy) +char *geom; +int grav1, grav2, stepx, stepy; +{ + RootRegion *rr; + int mask; + + rr = (RootRegion *)malloc(sizeof(RootRegion)); + rr->next = NULL; + rr->grav1 = grav1; + rr->grav2 = grav2; + rr->stepx = (stepx <= 0) ? 2 : stepx; /* hard-coded value was '1' - djhjr - 9/26/99 */ + rr->stepy = (stepy <= 0) ? 1 : stepy; + rr->x = rr->y = rr->w = rr->h = 0; + + mask = XParseGeometry(geom, &rr->x, &rr->y, (unsigned int *)&rr->w, (unsigned int *)&rr->h); + if (mask & XNegative) + rr->x += Scr->MyDisplayWidth - rr->w; + if (mask & YNegative) + rr->y += Scr->MyDisplayHeight - rr->h; + + rr->entries = (RegionEntry *)malloc(sizeof(RegionEntry)); + rr->entries->next = 0; + rr->entries->x = rr->x; + rr->entries->y = rr->y; + rr->entries->w = rr->w; + rr->entries->h = rr->h; + rr->entries->u.twm_win = 0; + /* djhjr - 10/20/01 */ + rr->entries->type = LTYPE_EXACT_NAME; + rr->entries->usedby = 0; + + return rr; +} + +void +FreeRegionEntries (rr) + RootRegion *rr; +{ + RegionEntry *re, *tmp; + + for (re = rr->entries; re; re=tmp) + { + tmp = re->next; + if (re->usedby == USEDBY_NAME) + free(re->u.name); +/* djhjr - 10/20/01 */ +#ifndef NO_REGEX_SUPPORT + if (re->type & LTYPE_C_REGEXP) + regfree(&re->re); +#endif + free ((char *) re); + } +} + +void +FreeRegions (first, last) + RootRegion *first, *last; +{ + RootRegion *rr, *tmp; + + for (rr = first; rr != NULL;) + { + tmp = rr; + FreeRegionEntries (rr); + rr = rr->next; + free((char *) tmp); + } + first = NULL; + last = NULL; +} + diff --git a/regions.h b/regions.h new file mode 100644 index 0000000..bad1631 --- /dev/null +++ b/regions.h @@ -0,0 +1,76 @@ +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/********************************************************************** + * + * regions.h (was icons.h) + * + * Region related definitions + * + * 4/26/99 D. J. Hawkey Jr. + * + **********************************************************************/ + +#ifndef REGIONS_H +#define REGIONS_H + +#define USEDBY_TWIN 1 +#define USEDBY_NAME 2 + +/* djhjr - 10/20/01 */ +#ifndef NO_REGEX_SUPPORT +#include +#include +#endif + +typedef struct RootRegion +{ + struct RootRegion *next; + int x, y, w, h; + int grav1, grav2; + int stepx, stepy; + struct RegionEntry *entries; +} RootRegion; + +typedef struct RegionEntry +{ + struct RegionEntry *next; + int x, y, w, h; + + /* icons use twm_win, applets use both - djhjr - 4/26/99 */ + union + { + TwmWindow *twm_win; + char *name; + } u; + +/* djhjr - 10/20/01 */ +#ifndef NO_REGEX_SUPPORT + regex_t re; +#else + char re; +#endif + short type; + + short usedby; +} RegionEntry; + +#endif /* REGIONS_H */ diff --git a/resize.c b/resize.c new file mode 100644 index 0000000..6c77281 --- /dev/null +++ b/resize.c @@ -0,0 +1,1906 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/*********************************************************************** + * + * $XConsortium: resize.c,v 1.80 91/05/11 17:35:42 dave Exp $ + * + * window resizing borrowed from the "wm" window manager + * + * 11-Dec-87 Thomas E. LaStrange File created + * + ***********************************************************************/ + +#include +#include "twm.h" +#include "parse.h" +#include "util.h" +#include "resize.h" +#include "add_window.h" +#include "screen.h" +#include "desktop.h" +#include "events.h" +#include "menus.h" + +#define MINHEIGHT 0 /* had been 32 */ +#define MINWIDTH 0 /* had been 60 */ + +static int dragx; /* all these variables are used */ +static int dragy; /* in resize operations */ +static int dragWidth; +static int dragHeight; + +int origx; +int origy; +int origWidth; +int origHeight; + +static int clampTop; +static int clampBottom; +static int clampLeft; +static int clampRight; +static int clampDX; +static int clampDY; + +static int last_width; +static int last_height; + +static int resize_context; + +/* set in menus.c:ExecuteFunction(), cleared in *EndResize() - djhjr - 9/5/98 */ +int resizing_window = 0; + +/* djhjr - 4/6/98 */ +void PaintBorderAndTitlebar(); + +/* djhjr - 4/17/98 */ +static void DoVirtualMoveResize(); + +/* djhjr - 9/10/99 */ +void ResizeTwmWindowContents(); + +/* djhjr - 9/13/02 */ +static void SetVirtualDesktopIncrs(); +static void EndResizeAdjPointer(); + +static void do_auto_clamp (tmp_win, evp) + TwmWindow *tmp_win; + XEvent *evp; +{ + Window junkRoot; + int x, y, h, v, junkbw; + unsigned int junkMask; + + switch (evp->type) { + case ButtonPress: + x = evp->xbutton.x_root; + y = evp->xbutton.y_root; + break; + case KeyPress: + x = evp->xkey.x_root; + y = evp->xkey.y_root; + break; + default: + if (!XQueryPointer (dpy, Scr->Root, &junkRoot, &junkRoot, + &x, &y, &junkbw, &junkbw, &junkMask)) + return; + } + + h = ((x - dragx) / (dragWidth < 3 ? 1 : (dragWidth / 3))); + v = ((y - dragy - tmp_win->title_height) / + (dragHeight < 3 ? 1 : (dragHeight / 3))); + + if (h <= 0) { + clampLeft = 1; + clampDX = (x - dragx); + } else if (h >= 2) { + clampRight = 1; + clampDX = (x - dragx - dragWidth); + } + + if (v <= 0) { + clampTop = 1; + clampDY = (y - dragy); + } else if (v >= 2) { + clampBottom = 1; + clampDY = (y - dragy - dragHeight); + } +} + + +/*********************************************************************** + * + * Procedure: + * StartResize - begin a window resize operation + * + * Inputs: + * ev - the event structure (button press) + * tmp_win - the TwmWindow pointer + * fromtitlebar - action invoked from titlebar button + * + *********************************************************************** + */ + +void +StartResize(evp, tmp_win, fromtitlebar, context) +XEvent *evp; +TwmWindow *tmp_win; +Bool fromtitlebar; +int context; +{ + Window junkRoot; + unsigned int junkbw, junkDepth; + + resize_context = context; + + SetVirtualDesktopIncrs(tmp_win); /* djhjr - 9/13/02 */ + + if (context == C_VIRTUAL_WIN) + ResizeWindow = tmp_win->VirtualDesktopDisplayWindow; + else + ResizeWindow = tmp_win->frame; + +/* djhjr - 7/17/98 + * djhjr - 4/15/98 * + if (!Scr->NoGrabServer) +*/ + { + /* added test - djhjr - 4/7/98 */ + if (!tmp_win->opaque_resize) + XGrabServer(dpy); + } + if (context == C_VIRTUAL_WIN) + XGrabPointer(dpy, Scr->VirtualDesktopDisplay, True, + ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | PointerMotionHintMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->ResizeCursor, CurrentTime); + else + XGrabPointer(dpy, Scr->Root, True, + ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | PointerMotionHintMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->ResizeCursor, CurrentTime); + + XGetGeometry(dpy, (Drawable) ResizeWindow, &junkRoot, + &dragx, &dragy, (unsigned int *)&dragWidth, (unsigned int *)&dragHeight, &junkbw, + &junkDepth); + + if (context != C_VIRTUAL_WIN) { + dragx += tmp_win->frame_bw; + dragy += tmp_win->frame_bw; + } + origx = dragx; + origy = dragy; + origWidth = dragWidth; + origHeight = dragHeight; + clampTop = clampBottom = clampLeft = clampRight = clampDX = clampDY = 0; + + if (Scr->AutoRelativeResize && !fromtitlebar) + do_auto_clamp (tmp_win, evp); + +/* use initialized size... djhjr - 5/9/96 + Scr->SizeStringOffset = SIZE_HINDENT; + XResizeWindow (dpy, Scr->SizeWindow, + Scr->SizeStringWidth + SIZE_HINDENT * 2, + Scr->SizeFont.height + SIZE_VINDENT * 2); +*/ + + XMapRaised(dpy, Scr->SizeWindow); + if (!tmp_win->opaque_resize) InstallRootColormap(); + last_width = 0; + last_height = 0; + DisplaySize(tmp_win, origWidth, origHeight); + + if (resize_context == C_VIRTUAL_WIN) + MoveOutline (Scr->VirtualDesktopDisplay, dragx, + dragy, dragWidth, + dragHeight, + tmp_win->frame_bw, 0); + else + /* added this 'if ... else' - djhjr - 4/6/98 */ + if (tmp_win->opaque_resize) + { + SetupWindow (tmp_win, + dragx - tmp_win->frame_bw, dragy - tmp_win->frame_bw, + dragWidth, dragHeight, -1); + PaintBorderAndTitlebar(tmp_win); + } + else + MoveOutline (Scr->Root, dragx - tmp_win->frame_bw, + dragy - tmp_win->frame_bw, dragWidth + 2 * tmp_win->frame_bw, + dragHeight + 2 * tmp_win->frame_bw, +/* djhjr - 4/24/96 + tmp_win->frame_bw, tmp_win->title_height); +*/ + tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); +} + + + +/* added the passed 'context' - djhjr - 2/22/99 */ +void +MenuStartResize(tmp_win, x, y, w, h, context) +TwmWindow *tmp_win; +int x, y, w, h; +int context; +{ + /* djhjr - 2/22/99 */ + resize_context = context; + + SetVirtualDesktopIncrs(tmp_win); /* djhjr - 9/13/02 */ + +/* djhjr - 7/17/98 + * djhjr - 4/15/98 * + if (!Scr->NoGrabServer) +*/ + { + /* added test - djhjr - 4/7/98 */ + if (!tmp_win->opaque_resize) + XGrabServer(dpy); + } + XGrabPointer(dpy, Scr->Root, True, + ButtonPressMask | ButtonMotionMask | PointerMotionMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->ResizeCursor, CurrentTime); + dragx = x + tmp_win->frame_bw; + dragy = y + tmp_win->frame_bw; + origx = dragx; + origy = dragy; + dragWidth = origWidth = w; /* - 2 * tmp_win->frame_bw; */ + dragHeight = origHeight = h; /* - 2 * tmp_win->frame_bw; */ + clampTop = clampBottom = clampLeft = clampRight = clampDX = clampDY = 0; + last_width = 0; + last_height = 0; + +/* use initialized size... djhjr - 5/9/96 + Scr->SizeStringOffset = SIZE_HINDENT; + XResizeWindow (dpy, Scr->SizeWindow, + Scr->SizeStringWidth + SIZE_HINDENT * 2, + Scr->SizeFont.height + SIZE_VINDENT * 2); +*/ + + XMapRaised(dpy, Scr->SizeWindow); + if (!tmp_win->opaque_resize) InstallRootColormap(); + DisplaySize(tmp_win, origWidth, origHeight); + + /* added this 'if ... else' - djhjr - 4/6/98 */ + if (tmp_win->opaque_resize) + { + SetupWindow (tmp_win, + dragx - tmp_win->frame_bw, dragy - tmp_win->frame_bw, + dragWidth, dragHeight, -1); + PaintBorderAndTitlebar(tmp_win); + } + else + MoveOutline (Scr->Root, dragx - tmp_win->frame_bw, + dragy - tmp_win->frame_bw, + dragWidth + 2 * tmp_win->frame_bw, + dragHeight + 2 * tmp_win->frame_bw, +/* djhjr - 4/23/96 + tmp_win->frame_bw, tmp_win->title_height); +*/ + tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); +} + +/*********************************************************************** + * + * Procedure: + * AddStartResize - begin a windorew resize operation from AddWindow + * + * Inputs: + * tmp_win - the TwmWindow pointer + * + *********************************************************************** + */ + +void +AddStartResize(tmp_win, x, y, w, h) +TwmWindow *tmp_win; +int x, y, w, h; +{ + /* djhjr - 2/22/99 */ + resize_context = C_WINDOW; + + SetVirtualDesktopIncrs(tmp_win); /* djhjr - 9/13/02 */ + +/* djhjr - 7/17/98 + * djhjr - 4/15/98 * + if (!Scr->NoGrabServer) +*/ + { + /* added test - djhjr - 4/7/98 */ + if (!tmp_win->opaque_resize) + XGrabServer(dpy); + } + + XGrabPointer(dpy, Scr->Root, True, + ButtonReleaseMask | ButtonMotionMask | PointerMotionHintMask, + GrabModeAsync, GrabModeAsync, + Scr->Root, Scr->ResizeCursor, CurrentTime); + + dragx = x + tmp_win->frame_bw; + dragy = y + tmp_win->frame_bw; + origx = dragx; + origy = dragy; + dragWidth = origWidth = w - 2 * tmp_win->frame_bw; + dragHeight = origHeight = h - 2 * tmp_win->frame_bw; + clampTop = clampBottom = clampLeft = clampRight = clampDX = clampDY = 0; +/***** + if (Scr->AutoRelativeResize) { + clampRight = clampBottom = 1; + } +*****/ + last_width = 0; + last_height = 0; + DisplaySize(tmp_win, origWidth, origHeight); +} + + + +/* + * Functionally identical with DoResize(), except that this + * handles a virtual window differently, but it isn't used anyway. + * djhjr - 10/6/02 + */ +#if 0 +void +MenuDoResize(x_root, y_root, tmp_win) +int x_root; +int y_root; +TwmWindow *tmp_win; +{ + int action; + + action = 0; + + x_root -= clampDX; + y_root -= clampDY; + + if (clampTop) { + int delta = y_root - dragy; + if (dragHeight - delta < MINHEIGHT) { + delta = dragHeight - MINHEIGHT; + clampTop = 0; + } + dragy += delta; + dragHeight -= delta; + action = 1; + } + else if (y_root <= dragy/* || + y_root == findRootInfo(root)->rooty*/) { + dragy = y_root; + dragHeight = origy + origHeight - + y_root; + clampBottom = 0; + clampTop = 1; + clampDY = 0; + action = 1; + } + if (clampLeft) { + int delta = x_root - dragx; + if (dragWidth - delta < MINWIDTH) { + delta = dragWidth - MINWIDTH; + clampLeft = 0; + } + dragx += delta; + dragWidth -= delta; + action = 1; + } + else if (x_root <= dragx/* || + x_root == findRootInfo(root)->rootx*/) { + dragx = x_root; + dragWidth = origx + origWidth - + x_root; + clampRight = 0; + clampLeft = 1; + clampDX = 0; + action = 1; + } + if (clampBottom) { + int delta = y_root - dragy - dragHeight; + if (dragHeight + delta < MINHEIGHT) { + delta = MINHEIGHT - dragHeight; + clampBottom = 0; + } + dragHeight += delta; + action = 1; + } + else if (y_root >= dragy + dragHeight - 1/* || + y_root == findRootInfo(root)->rooty + + findRootInfo(root)->rootheight - 1*/) { + dragy = origy; + dragHeight = 1 + y_root - dragy; + clampTop = 0; + clampBottom = 1; + clampDY = 0; + action = 1; + } + if (clampRight) { + int delta = x_root - dragx - dragWidth; + if (dragWidth + delta < MINWIDTH) { + delta = MINWIDTH - dragWidth; + clampRight = 0; + } + dragWidth += delta; + action = 1; + } + else if (x_root >= dragx + dragWidth - 1/* || + x_root == findRootInfo(root)->rootx + + findRootInfo(root)->rootwidth - 1*/) { + dragx = origx; + dragWidth = 1 + x_root - origx; + clampLeft = 0; + clampRight = 1; + clampDX = 0; + action = 1; + } + + if (action) { + ConstrainSize (tmp_win, &dragWidth, &dragHeight); + if (clampLeft) + dragx = origx + origWidth - dragWidth; + if (clampTop) + dragy = origy + origHeight - dragHeight; + + if (resize_context == C_VIRTUAL_WIN) + MoveOutline(Scr->VirtualDesktopDisplay, + dragx, + dragy, + dragWidth, + dragHeight, + tmp_win->frame_bw, 0); + else { + /* added this 'if ... else' - djhjr - 4/6/98 */ + if (tmp_win->opaque_resize) + { + SetupWindow (tmp_win, + dragx - tmp_win->frame_bw, dragy - tmp_win->frame_bw, + dragWidth, dragHeight, -1); + + /* force the redraw of a door - djhjr - 2/28/99 */ + { + TwmDoor *door; + + if (XFindContext(dpy, tmp_win->w, DoorContext, (caddr_t *)&door) != XCNOENT) + RedoDoorName(tmp_win, door); + } + + /* force the redraw of the desktop - djhjr - 2/28/99 */ + if (!strcmp(tmp_win->class.res_class, VTWM_DESKTOP_CLASS)) + { + ResizeDesktopDisplay(dragWidth, dragHeight); + + Draw3DBorder(Scr->VirtualDesktopDisplayOuter, 0, 0, + Scr->VirtualDesktopMaxWidth + (Scr->VirtualDesktopBevelWidth * 2), + Scr->VirtualDesktopMaxHeight + (Scr->VirtualDesktopBevelWidth * 2), + Scr->VirtualDesktopBevelWidth, Scr->VirtualC, off, False, False); + } + + /* force the redraw of an icon manager - djhjr - 3/1/99 */ + if (tmp_win->iconmgr) + { + struct WList *list; + int ncols = tmp_win->iconmgrp->cur_columns; + if (ncols == 0) ncols = 1; + +/* djhjr - 4/24/96 + tmp_win->iconmgrp->width = (int) ((dragWidth * +*/ + tmp_win->iconmgrp->width = (int) (((dragWidth - 2 * tmp_win->frame_bw3D) * + + (long) tmp_win->iconmgrp->columns) + / ncols); + PackIconManager(tmp_win->iconmgrp); + + list = tmp_win->iconmgrp->first; + while (list) + { + RedoListWindow(list->twm); + list = list->next; + } + } + + PaintBorderAndTitlebar(tmp_win); + + /* djhjr - 4/15/98 */ + /* added '&& !resizing_window' - djhjr - 11/7/03 */ + if (!Scr->NoGrabServer && !resizing_window) + { + /* these let the application window be drawn - djhjr - 4/14/98 */ + XUngrabServer(dpy); XSync(dpy, 0); XGrabServer(dpy); + } + } + else + MoveOutline(Scr->Root, + dragx - tmp_win->frame_bw, + dragy - tmp_win->frame_bw, + dragWidth + 2 * tmp_win->frame_bw, + dragHeight + 2 * tmp_win->frame_bw, +/* djhjr - 4/24/96 + tmp_win->frame_bw, tmp_win->title_height); +*/ + tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); + + /* djhjr - 4/17/98 */ + if (Scr->VirtualReceivesMotionEvents) + DoVirtualMoveResize(tmp_win, dragx, dragy, dragWidth, dragHeight); + } + } + + DisplaySize(tmp_win, dragWidth, dragHeight); +} +#endif + +/*********************************************************************** + * + * Procedure: + * DoResize - move the rubberband around. This is called for + * each motion event when we are resizing + * + * Inputs: + * x_root - the X corrdinate in the root window + * y_root - the Y corrdinate in the root window + * tmp_win - the current twm window + * + *********************************************************************** + */ + +void +DoResize(x_root, y_root, tmp_win) +int x_root; +int y_root; +TwmWindow *tmp_win; +{ + int action; + + action = 0; + + x_root -= clampDX; + y_root -= clampDY; + + if (clampTop) { + int delta = y_root - dragy; + if (dragHeight - delta < MINHEIGHT) { + delta = dragHeight - MINHEIGHT; + clampTop = 0; + } + dragy += delta; + dragHeight -= delta; + action = 1; + } + else if (y_root <= dragy/* || + y_root == findRootInfo(root)->rooty*/) { + dragy = y_root; + dragHeight = origy + origHeight - + y_root; + clampBottom = 0; + clampTop = 1; + clampDY = 0; + action = 1; + } + if (clampLeft) { + int delta = x_root - dragx; + if (dragWidth - delta < MINWIDTH) { + delta = dragWidth - MINWIDTH; + clampLeft = 0; + } + dragx += delta; + dragWidth -= delta; + action = 1; + } + else if (x_root <= dragx/* || + x_root == findRootInfo(root)->rootx*/) { + dragx = x_root; + dragWidth = origx + origWidth - + x_root; + clampRight = 0; + clampLeft = 1; + clampDX = 0; + action = 1; + } + if (clampBottom) { + int delta = y_root - dragy - dragHeight; + if (dragHeight + delta < MINHEIGHT) { + delta = MINHEIGHT - dragHeight; + clampBottom = 0; + } + dragHeight += delta; + action = 1; + } + else if (y_root >= dragy + dragHeight - 1/* || + y_root == findRootInfo(root)->rooty + + findRootInfo(root)->rootheight - 1*/) { + dragy = origy; + dragHeight = 1 + y_root - dragy; + clampTop = 0; + clampBottom = 1; + clampDY = 0; + action = 1; + } + if (clampRight) { + int delta = x_root - dragx - dragWidth; + if (dragWidth + delta < MINWIDTH) { + delta = MINWIDTH - dragWidth; + clampRight = 0; + } + dragWidth += delta; + action = 1; + } + else if (x_root >= dragx + dragWidth - 1/* || + x_root == findRootInfo(root)->rootx + + findRootInfo(root)->rootwidth - 1*/) { + dragx = origx; + dragWidth = 1 + x_root - origx; + clampLeft = 0; + clampRight = 1; + clampDX = 0; + action = 1; + } + + if (action) { + ConstrainSize (tmp_win, &dragWidth, &dragHeight); + if (clampLeft) + dragx = origx + origWidth - dragWidth; + if (clampTop) + dragy = origy + origHeight - dragHeight; + + /* added this 'if() ... else' - djhjr - 4/6/98 */ + if (tmp_win->opaque_resize) + { + SetupWindow(tmp_win, + dragx - tmp_win->frame_bw, dragy - tmp_win->frame_bw, + dragWidth, dragHeight, -1); + + /* force the redraw of a door - djhjr - 2/28/99 */ + { + TwmDoor *door; + + if (XFindContext(dpy, tmp_win->w, DoorContext, (caddr_t *)&door) != XCNOENT) + RedoDoorName(tmp_win, door); + } + + /* force the redraw of the desktop - djhjr - 2/28/99 */ + if (!strcmp(tmp_win->class.res_class, VTWM_DESKTOP_CLASS)) + { + ResizeDesktopDisplay(dragWidth, dragHeight); + + Draw3DBorder(Scr->VirtualDesktopDisplayOuter, 0, 0, + Scr->VirtualDesktopMaxWidth + (Scr->VirtualDesktopBevelWidth * 2), + Scr->VirtualDesktopMaxHeight + (Scr->VirtualDesktopBevelWidth * 2), + Scr->VirtualDesktopBevelWidth, Scr->VirtualC, off, False, False); + } + + /* force the redraw of an icon manager - djhjr - 3/1/99 */ + if (tmp_win->iconmgr) + { + struct WList *list; + int ncols = tmp_win->iconmgrp->cur_columns; + if (ncols == 0) ncols = 1; + +/* djhjr - 4/24/96 + tmp_win->iconmgrp->width = (int) ((dragWidth * +*/ + tmp_win->iconmgrp->width = (int) (((dragWidth - 2 * tmp_win->frame_bw3D) * + + (long) tmp_win->iconmgrp->columns) + / ncols); + PackIconManager(tmp_win->iconmgrp); + + list = tmp_win->iconmgrp->first; + while (list) + { + RedoListWindow(list->twm); + list = list->next; + } + } + + PaintBorderAndTitlebar(tmp_win); + + /* djhjr - 4/15/98 */ + /* added '&& !resizing_window' - djhjr - 11/7/03 */ + if (!Scr->NoGrabServer && !resizing_window) + { + /* these let the application window be drawn - djhjr - 4/14/98 */ + XUngrabServer(dpy); XSync(dpy, 0); XGrabServer(dpy); + } + } + else + MoveOutline(Scr->Root, + dragx - tmp_win->frame_bw, + dragy - tmp_win->frame_bw, + dragWidth + 2 * tmp_win->frame_bw, + dragHeight + 2 * tmp_win->frame_bw, +/* djhjr - 4/24/96 + tmp_win->frame_bw, tmp_win->title_height); +*/ + tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D); + + /* djhjr - 4/17/98 */ + if (Scr->VirtualReceivesMotionEvents) + DoVirtualMoveResize(tmp_win, dragx, dragy, dragWidth, dragHeight); + } + + DisplaySize(tmp_win, dragWidth, dragHeight); +} + +/* djhjr - 9/13/02 */ +static void +SetVirtualDesktopIncrs(tmp_win) +TwmWindow *tmp_win; +{ + if (strcmp(tmp_win->class.res_class, VTWM_DESKTOP_CLASS) == 0) + { + if (Scr->snapRealScreen) + { + Scr->VirtualDesktopDisplayTwin->hints.flags |= PResizeInc; + Scr->VirtualDesktopDisplayTwin->hints.width_inc = + SCALE_D(Scr->VirtualDesktopPanDistanceX); + Scr->VirtualDesktopDisplayTwin->hints.height_inc = + SCALE_D(Scr->VirtualDesktopPanDistanceY); + } + else + Scr->VirtualDesktopDisplayTwin->hints.flags &= ~PResizeInc; + + XSetWMNormalHints(dpy, tmp_win->w, + &Scr->VirtualDesktopDisplayTwin->hints); + } +} + +/*********************************************************************** + * + * Procedure: + * DisplaySize - display the size in the dimensions window + * + * Inputs: + * tmp_win - the current twm window + * width - the width of the rubber band + * height - the height of the rubber band + * + *********************************************************************** + */ + +void +DisplaySize(tmp_win, width, height) +TwmWindow *tmp_win; +int width; +int height; +{ + char str[100]; + int i, dwidth, dheight; + + if (last_width == width && last_height == height) + return; + + last_width = width; + last_height = height; + + if (resize_context == C_VIRTUAL_WIN) { + dheight = SCALE_U(height) - tmp_win->title_height; + dwidth = SCALE_U(width); + } else { +/* djhjr - 4/24/96 + dheight = height - tmp_win->title_height; + dwidth = width; +*/ + dheight = height - tmp_win->title_height - 2 * tmp_win->frame_bw3D; + dwidth = width - 2 * tmp_win->frame_bw3D; + + } + + /* + * ICCCM says that PMinSize is the default is no PBaseSize is given, + * and vice-versa. + * Don't adjust if window is the virtual desktop - djhjr - 9/13/02 + */ + if (tmp_win->hints.flags&(PMinSize|PBaseSize) && tmp_win->hints.flags & PResizeInc) + { + if (tmp_win->hints.flags & PBaseSize) + { + dwidth -= tmp_win->hints.base_width; + dheight -= tmp_win->hints.base_height; + } else if (strcmp(tmp_win->class.res_class, VTWM_DESKTOP_CLASS) != 0) + { + dwidth -= tmp_win->hints.min_width; + dheight -= tmp_win->hints.min_height; + } + } + + if (tmp_win->hints.flags & PResizeInc) + { + dwidth /= tmp_win->hints.width_inc; + dheight /= tmp_win->hints.height_inc; + } + +/* + * Non-SysV systems - specifically, BSD-derived systems - return a + * pointer to the string, not its length. Submitted by Goran Larsson + i = sprintf (str, "%5d x %-5d", dwidth, dheight); + */ + sprintf (str, "%5d x %-5d", dwidth, dheight); + i = strlen (str); + + XRaiseWindow(dpy, Scr->SizeWindow); + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(Scr->DefaultC.fore, Scr->DefaultC.back, Scr->SizeFont); +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, +#else + XDrawImageString (dpy, Scr->SizeWindow, +#endif + Scr->NormalGC, + +/* djhjr - 5/9/96 + Scr->SizeStringOffset, +*/ + (Scr->SizeStringWidth - +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_TextWidth(&Scr->SizeFont, +#else + XTextWidth(Scr->SizeFont.font, +#endif + str, i)) / 2, + +/* djhjr - 4/29/98 + Scr->SizeFont.font->ascent + SIZE_VINDENT, +*/ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ +/* djhjr 9/14/03 + Scr->SizeFont.font->ascent + +*/ + Scr->SizeFont.ascent + + SIZE_VINDENT + + ((Scr->InfoBevelWidth > 0) ? Scr->InfoBevelWidth : 0), + + str, i); + + /* I know, I know, but the above code overwrites it... djhjr - 5/9/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (Scr->InfoBevelWidth > 0) + Draw3DBorder(Scr->SizeWindow, 0, 0, + Scr->SizeStringWidth, + +/* djhjr - 4/29/98 + (unsigned int) (Scr->SizeFont.height + SIZE_VINDENT*2), + BW, Scr->DefaultC, off, False, False); +*/ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + (unsigned int) (Scr->SizeFont.height + SIZE_VINDENT*2) + + ((Scr->InfoBevelWidth > 0) ? 2 * Scr->InfoBevelWidth : 0), + Scr->InfoBevelWidth, Scr->DefaultC, off, False, False); +} + +/*********************************************************************** + * + * Procedure: + * EndResize - finish the resize operation + * + *********************************************************************** + */ + +void +EndResize() +{ + TwmWindow *tmp_win; + +#ifdef DEBUG + fprintf(stderr, "EndResize\n"); +#endif + + if (resize_context == C_VIRTUAL_WIN) + MoveOutline(Scr->VirtualDesktopDisplay, 0, 0, 0, 0, 0, 0); + else + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + XUnmapWindow(dpy, Scr->SizeWindow); + + XFindContext(dpy, ResizeWindow, TwmContext, (caddr_t *)&tmp_win); + + if (resize_context == C_VIRTUAL_WIN) { + /* scale up */ + dragWidth = SCALE_U(dragWidth); + dragHeight = SCALE_U(dragHeight); + dragx = SCALE_U(dragx); + dragy = SCALE_U(dragy); + } + + ConstrainSize (tmp_win, &dragWidth, &dragHeight); + + if (dragWidth != tmp_win->frame_width || + dragHeight != tmp_win->frame_height) + tmp_win->zoomed = ZOOM_NONE; + + SetupWindow (tmp_win, dragx - tmp_win->frame_bw, dragy - tmp_win->frame_bw, + dragWidth, dragHeight, -1); + + EndResizeAdjPointer(tmp_win); /* djhjr - 9/13/02 */ + + /* added test for opaque resizing - djhjr - 2/28/99, 3/1/99 */ + if (!tmp_win->opaque_resize) + { + /* was inline code - djhjr - 9/10/99 */ + ResizeTwmWindowContents(tmp_win, dragWidth, dragHeight); + } + +#if 0 /* done in menus.c:ExecuteFunction() - djhjr - 10/6/02 */ + if (!Scr->NoRaiseResize) { + XRaiseWindow(dpy, tmp_win->frame); + + RaiseStickyAbove (); /* DSE */ + RaiseAutoPan(); + } + + UninstallRootColormap(); + + /* the resize can have cause the window to move on the screen, hence on the virtual + * desktop - need to fix the virtual coords */ + tmp_win->virtual_frame_x = R_TO_V_X(dragx); + tmp_win->virtual_frame_y = R_TO_V_Y(dragy); + + /* UpdateDesktop(tmp_win); Stig */ + MoveResizeDesktop(tmp_win, Scr->NoRaiseResize); /* Stig */ +#endif + +#if 0 /* done in menus.c:ExecuteFunction() - djhjr - 10/11/01 */ + /* djhjr - 6/4/98 */ + /* don't re-map if the window is the virtual desktop - djhjr - 2/28/99 */ + if (Scr->VirtualReceivesMotionEvents && + /* !tmp_win->opaque_resize && */ + tmp_win->w != Scr->VirtualDesktopDisplayOuter) + { + XUnmapWindow(dpy, Scr->VirtualDesktopDisplay); + XMapWindow(dpy, Scr->VirtualDesktopDisplay); + } +#endif + + ResizeWindow = None; + + /* djhjr - 9/5/98 */ + resizing_window = 0; +} + +/* added the passed 'context' - djhjr - 9/30/02 */ +void +MenuEndResize(tmp_win, context) +TwmWindow *tmp_win; +int context; +{ + /* added this 'if (...) ... else' - djhjr - 2/22/99 */ + if (resize_context == C_VIRTUAL_WIN) + MoveOutline(Scr->VirtualDesktopDisplay, 0, 0, 0, 0, 0, 0); + else + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + XUnmapWindow(dpy, Scr->SizeWindow); + + ConstrainSize (tmp_win, &dragWidth, &dragHeight); + + /* djhjr - 9/19/96 */ + if (dragWidth != tmp_win->frame_width || dragHeight != tmp_win->frame_height) + tmp_win->zoomed = ZOOM_NONE; + +/* djhjr - 10/6/02 + AddingX = dragx; + AddingY = dragy; + AddingW = dragWidth + (2 * tmp_win->frame_bw); + AddingH = dragHeight + (2 * tmp_win->frame_bw); + SetupWindow (tmp_win, AddingX, AddingY, AddingW, AddingH, -1); +*/ + SetupWindow (tmp_win, dragx - tmp_win->frame_bw, dragy - tmp_win->frame_bw, + dragWidth, dragHeight, -1); + + /* djhjr - 9/13/02 9/30/02 */ + if (context != C_VIRTUAL_WIN) + EndResizeAdjPointer(tmp_win); + + /* added test for opaque resizing - djhjr - 2/28/99, 3/1/99 */ + if (!tmp_win->opaque_resize) + { + /* was inline code - djhjr - 9/10/99 */ + ResizeTwmWindowContents(tmp_win, dragWidth, dragHeight); + } + +#if 0 /* done in menus.c:ExecuteFunction() - djhjr - 10/11/01 */ + /* djhjr - 6/4/98 */ + /* don't re-map if the window is the virtual desktop - djhjr - 2/28/99 */ + if (Scr->VirtualReceivesMotionEvents && + /* !tmp_win->opaque_resize && */ + tmp_win->w != Scr->VirtualDesktopDisplayOuter) + { + XUnmapWindow(dpy, Scr->VirtualDesktopDisplay); + XMapWindow(dpy, Scr->VirtualDesktopDisplay); + } +#endif + + /* djhjr - 9/5/98 */ + resizing_window = 0; +} + + + +/*********************************************************************** + * + * Procedure: + * AddEndResize - finish the resize operation for AddWindow + * + *********************************************************************** + */ + +void +AddEndResize(tmp_win) +TwmWindow *tmp_win; +{ + +#ifdef DEBUG + fprintf(stderr, "AddEndResize\n"); +#endif + + /* djhjr - 2/22/99 */ + MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); + XUnmapWindow(dpy, Scr->SizeWindow); + + ConstrainSize (tmp_win, &dragWidth, &dragHeight); + AddingX = dragx; + AddingY = dragy; + AddingW = dragWidth + (2 * tmp_win->frame_bw); + AddingH = dragHeight + (2 * tmp_win->frame_bw); + + EndResizeAdjPointer(tmp_win); /* djhjr - 9/13/02 */ + + /* djhjr - 9/19/96 */ + if (dragWidth != tmp_win->frame_width || dragHeight != tmp_win->frame_height) + tmp_win->zoomed = ZOOM_NONE; + +#if 0 /* done in add_window.c:AddMoveAndResize() - djhjr - 10/11/01 */ + /* djhjr - 6/4/98 */ + if (Scr->VirtualReceivesMotionEvents/* && !tmp_win->opaque_resize*/) + { + XUnmapWindow(dpy, Scr->VirtualDesktopDisplay); + XMapWindow(dpy, Scr->VirtualDesktopDisplay); + } +#endif + + /* djhjr - 9/5/98 */ + resizing_window = 0; +} + +/* djhjr - 9/13/02 */ +static void +EndResizeAdjPointer(tmp_win) +TwmWindow *tmp_win; +{ + int x, y, bw = tmp_win->frame_bw + tmp_win->frame_bw3D; + + XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, + &JunkX, &JunkY, &JunkBW, &JunkBW, &JunkBW); + XTranslateCoordinates(dpy, Scr->Root, tmp_win->frame, + JunkX, JunkY, &x, &y, &JunkChild); + + /* for borderless windows */ + if (bw == 0) bw = 4; + + /* (tmp_win->frame_bw) == no 3D borders */ + + if (x <= 0) + { + if (y < tmp_win->title_height) + x = tmp_win->title_x + ((tmp_win->frame_bw) ? (bw / 2) : -(bw / 2)); + else + x = ((tmp_win->frame_bw) ? -(bw / 2) : (bw / 2)); + } + if (x >= tmp_win->frame_width) + { + if (y < tmp_win->title_height) + x = tmp_win->title_x + tmp_win->title_width + (bw / 2); + else + x = tmp_win->frame_width + ((tmp_win->frame_bw) ? (bw / 2) : -(bw / 2)); + } + + if (y <= tmp_win->title_height) + { + if (x >= tmp_win->title_x - ((tmp_win->frame_bw) ? 0 : bw) && + x < tmp_win->title_x + tmp_win->title_width + bw) + { + if (y <= 0) + y = ((tmp_win->frame_bw) ? -(bw / 2) : (bw / 2)); + } + else + y = tmp_win->title_height + ((tmp_win->frame_bw) ? -(bw / 2) : (bw / 2)); + } + if (y >= tmp_win->frame_height) + y = tmp_win->frame_height + ((tmp_win->frame_bw) ? (bw / 2) : -(bw / 2)); + + XWarpPointer(dpy, None, tmp_win->frame, 0, 0, 0, 0, x, y); +} + +/*********************************************************************** + * + * Procedure: + * ConstrainSize - adjust the given width and height to account for the + * constraints imposed by size hints + * + * The general algorithm, especially the aspect ratio stuff, is + * borrowed from uwm's CheckConsistency routine. + * + ***********************************************************************/ + +void ConstrainSize (tmp_win, widthp, heightp) + TwmWindow *tmp_win; + int *widthp, *heightp; +{ +#define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) ) +#define _min(a,b) (((a) < (b)) ? (a) : (b)) + + int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta; + int baseWidth, baseHeight; + int dwidth = *widthp, dheight = *heightp; + + +/* djhjr - 4/24/96 + dheight -= tmp_win->title_height; +*/ + dwidth -= 2 * tmp_win->frame_bw3D; + dheight -= (tmp_win->title_height + 2 * tmp_win->frame_bw3D); + + if (tmp_win->hints.flags & PMinSize) { + minWidth = tmp_win->hints.min_width; + minHeight = tmp_win->hints.min_height; + } else if (tmp_win->hints.flags & PBaseSize) { + minWidth = tmp_win->hints.base_width; + minHeight = tmp_win->hints.base_height; + } else + minWidth = minHeight = 1; + + if (resize_context == C_VIRTUAL_WIN) { + minWidth = SCALE_D(minWidth); + minHeight = SCALE_D(minHeight); + } + + if (tmp_win->hints.flags & PBaseSize) { + baseWidth = tmp_win->hints.base_width; + baseHeight = tmp_win->hints.base_height; + } else if (tmp_win->hints.flags & PMinSize) { + baseWidth = tmp_win->hints.min_width; + baseHeight = tmp_win->hints.min_height; + } else + baseWidth = baseHeight = 0; + + if (resize_context == C_VIRTUAL_WIN) { + baseWidth = SCALE_D(baseWidth); + baseHeight = SCALE_D(baseHeight); + } + + if (tmp_win->hints.flags & PMaxSize) { + maxWidth = _min (Scr->MaxWindowWidth, tmp_win->hints.max_width); + maxHeight = _min (Scr->MaxWindowHeight, tmp_win->hints.max_height); + } else { + maxWidth = Scr->MaxWindowWidth; + maxHeight = Scr->MaxWindowHeight; + } + + if (resize_context == C_VIRTUAL_WIN) { + maxWidth = SCALE_D(maxWidth); + maxHeight = SCALE_D(maxHeight); + } + + if (tmp_win->hints.flags & PResizeInc) { + xinc = tmp_win->hints.width_inc; + yinc = tmp_win->hints.height_inc; + } else + xinc = yinc = 1; + + if (resize_context == C_VIRTUAL_WIN) { + xinc = SCALE_D(xinc); + yinc = SCALE_D(yinc); + } + + /* + * First, clamp to min and max values + */ + if (dwidth < minWidth) dwidth = minWidth; + if (dheight < minHeight) dheight = minHeight; + + if (dwidth > maxWidth) dwidth = maxWidth; + if (dheight > maxHeight) dheight = maxHeight; + + + /* + * Second, fit to base + N * inc + */ + dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth; + dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight; + + + /* + * Third, adjust for aspect ratio + */ +#define maxAspectX tmp_win->hints.max_aspect.x +#define maxAspectY tmp_win->hints.max_aspect.y +#define minAspectX tmp_win->hints.min_aspect.x +#define minAspectY tmp_win->hints.min_aspect.y + /* + * The math looks like this: + * + * minAspectX dwidth maxAspectX + * ---------- <= ------- <= ---------- + * minAspectY dheight maxAspectY + * + * If that is multiplied out, then the width and height are + * invalid in the following situations: + * + * minAspectX * dheight > minAspectY * dwidth + * maxAspectX * dheight < maxAspectY * dwidth + * + */ + + if (tmp_win->hints.flags & PAspect) + { + if (minAspectX * dheight > minAspectY * dwidth) + { + delta = makemult(minAspectX * dheight / minAspectY - dwidth, + xinc); + if (dwidth + delta <= maxWidth) dwidth += delta; + else + { + delta = makemult(dheight - dwidth*minAspectY/minAspectX, + yinc); + if (dheight - delta >= minHeight) dheight -= delta; + } + } + + if (maxAspectX * dheight < maxAspectY * dwidth) + { + delta = makemult(dwidth * maxAspectY / maxAspectX - dheight, + yinc); + if (dheight + delta <= maxHeight) dheight += delta; + else + { + delta = makemult(dwidth - maxAspectX*dheight/maxAspectY, + xinc); + if (dwidth - delta >= minWidth) dwidth -= delta; + } + } + } + + + /* + * Fourth, account for border width and title height + */ +/* djhjr - 4/26/96 + *widthp = dwidth; + *heightp = dheight + tmp_win->title_height; +*/ + *widthp = dwidth + 2 * tmp_win->frame_bw3D; + *heightp = dheight + tmp_win->title_height + 2 * tmp_win->frame_bw3D; + +} + + +/*********************************************************************** + * + * Procedure: + * SetupWindow - set window sizes, this was called from either + * AddWindow, EndResize, or HandleConfigureNotify. + * + * Inputs: + * tmp_win - the TwmWindow pointer + * x - the x coordinate of the upper-left outer corner of the frame + * y - the y coordinate of the upper-left outer corner of the frame + * w - the width of the frame window w/o border + * h - the height of the frame window w/o border + * bw - the border width of the frame window or -1 not to change + * + * Special Considerations: + * This routine will check to make sure the window is not completely + * off the display, if it is, it'll bring some of it back on. + * + * The tmp_win->frame_XXX variables should NOT be updated with the + * values of x,y,w,h prior to calling this routine, since the new + * values are compared against the old to see whether a synthetic + * ConfigureNotify event should be sent. (It should be sent if the + * window was moved but not resized.) + * + *********************************************************************** + */ + +void SetupWindow (tmp_win, x, y, w, h, bw) + TwmWindow *tmp_win; + int x, y, w, h, bw; +{ + SetupFrame (tmp_win, x, y, w, h, bw, False); +} + +void SetupFrame (tmp_win, x, y, w, h, bw, sendEvent) + TwmWindow *tmp_win; + int x, y, w, h, bw; + Bool sendEvent; /* whether or not to force a send */ +{ + XWindowChanges frame_wc, xwc; + unsigned long frame_mask, xwcm; + int title_width, title_height; + int reShape; + +#ifdef DEBUG + fprintf (stderr, "SetupWindow: x=%d, y=%d, w=%d, h=%d, bw=%d\n", + x, y, w, h, bw); +#endif + + if ((tmp_win->virtual_frame_x + tmp_win->frame_width) < 0) + x = 16; /* one "average" cursor width */ + if (x >= Scr->VirtualDesktopWidth) + x = Scr->VirtualDesktopWidth - 16; + if ((tmp_win->virtual_frame_y + tmp_win->frame_height) < 0) + y = 16; /* one "average" cursor width */ + if (y >= Scr->VirtualDesktopHeight) + y = Scr->VirtualDesktopHeight - 16; + + if (bw < 0) + bw = tmp_win->frame_bw; /* -1 means current frame width */ + + if (tmp_win->iconmgr) { +/* djhjr - 4/24/96 + tmp_win->iconmgrp->width = w; + h = tmp_win->iconmgrp->height + tmp_win->title_height; +*/ + tmp_win->iconmgrp->width = w - (2 * tmp_win->frame_bw3D); + h = tmp_win->iconmgrp->height + tmp_win->title_height + (2 * tmp_win->frame_bw3D); + + } + + /* + * According to the July 27, 1988 ICCCM draft, we should send a + * "synthetic" ConfigureNotify event to the client if the window + * was moved but not resized. + */ + if (((x != tmp_win->frame_x || y != tmp_win->frame_y) && + (w == tmp_win->frame_width && h == tmp_win->frame_height)) || + (bw != tmp_win->frame_bw)) + sendEvent = TRUE; + + xwcm = CWWidth; +/* djhjr 8 4/24/96 + title_width = xwc.width = w; +*/ + title_width = xwc.width = w - (2 * tmp_win->frame_bw3D); + title_height = Scr->TitleHeight + bw; + + ComputeWindowTitleOffsets (tmp_win, xwc.width, True); + + reShape = (tmp_win->wShaped ? TRUE : FALSE); + if (tmp_win->squeeze_info) /* check for title shaping */ + { + title_width = tmp_win->rightx + Scr->TBInfo.rightoff; + if (title_width < xwc.width) + { + xwc.width = title_width; + if (tmp_win->frame_height != h || + tmp_win->frame_width != w || + tmp_win->frame_bw != bw || + title_width != tmp_win->title_width) + reShape = TRUE; + } + else + { + if (!tmp_win->wShaped) reShape = TRUE; + title_width = xwc.width; + } + } + + tmp_win->title_width = title_width; + if (tmp_win->title_height) tmp_win->title_height = title_height; + + if (tmp_win->title_w) { + if (bw != tmp_win->frame_bw) { + xwc.border_width = bw; +/* djhjr - 4/24/96 + tmp_win->title_x = xwc.x = -bw; + tmp_win->title_y = xwc.y = -bw; +*/ + tmp_win->title_x = xwc.x = tmp_win->frame_bw3D - bw; + tmp_win->title_y = xwc.y = tmp_win->frame_bw3D - bw; + + xwcm |= (CWX | CWY | CWBorderWidth); + } + + XConfigureWindow(dpy, tmp_win->title_w, xwcm, &xwc); + } + +/* djhjr - 4/24/96 + tmp_win->attr.width = w; + tmp_win->attr.height = h - tmp_win->title_height; +*/ + tmp_win->attr.width = w - (2 * tmp_win->frame_bw3D); + tmp_win->attr.height = h - tmp_win->title_height - (2 * tmp_win->frame_bw3D); + +/* djhjr - 4/25/96 + XMoveResizeWindow (dpy, tmp_win->w, 0, tmp_win->title_height, + w, h - tmp_win->title_height); +*/ + + /* + * fix up frame and assign size/location values in tmp_win + */ + + frame_mask = 0; + if (bw != tmp_win->frame_bw) { + frame_wc.border_width = tmp_win->frame_bw = bw; + frame_mask |= CWBorderWidth; + } + frame_wc.x = tmp_win->frame_x = x; + frame_wc.y = tmp_win->frame_y = y; + frame_wc.width = tmp_win->frame_width = w; + frame_wc.height = tmp_win->frame_height = h; + frame_mask |= (CWX | CWY | CWWidth | CWHeight); + XConfigureWindow (dpy, tmp_win->frame, frame_mask, &frame_wc); + tmp_win->virtual_frame_x = R_TO_V_X(tmp_win->frame_x); + tmp_win->virtual_frame_y = R_TO_V_Y(tmp_win->frame_y); + + /* djhjr - 4/24/96 */ + XMoveResizeWindow (dpy, tmp_win->w, tmp_win->frame_bw3D, + tmp_win->title_height + tmp_win->frame_bw3D, + tmp_win->attr.width, tmp_win->attr.height); + + /* + * fix up highlight window + */ + + if (tmp_win->title_height && tmp_win->hilite_w) + { +/* djhjr - 4/2/98 + xwc.width = (tmp_win->rightx - tmp_win->highlightx); + if (Scr->TBInfo.nright > 0) xwc.width -= Scr->TitlePadding; + + * djhjr - 4/24/96 * + if (Scr->use3Dtitles) xwc.width -= 4; +*/ + xwc.width = ComputeHighlightWindowWidth(tmp_win); + + if (xwc.width <= 0) { + xwc.x = Scr->MyDisplayWidth; /* move offscreen */ + xwc.width = 1; + } else { + xwc.x = tmp_win->highlightx; + } + + xwcm = CWX | CWWidth; + XConfigureWindow(dpy, tmp_win->hilite_w, xwcm, &xwc); + } + + if (HasShape && reShape) { + SetFrameShape (tmp_win); + } + + if (sendEvent) + { + SendConfigureNotify(tmp_win, x, y); + } +} + +/* djhjr - 4/6/98 */ +void +PaintBorderAndTitlebar(tmp_win) +TwmWindow *tmp_win; +{ + if (tmp_win->highlight) + SetBorder(tmp_win, True); + else + { + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (Scr->BorderBevelWidth > 0) PaintBorders(tmp_win, True); + + if (tmp_win->titlebuttons) + { + int i, nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; + TBWindow *tbw; + + for (i = 0, tbw = tmp_win->titlebuttons; i < nb; i++, tbw++) + PaintTitleButton(tmp_win, tbw, 0); + } + } + + PaintTitle(tmp_win); + PaintTitleHighlight(tmp_win, on); /* djhjr - 10/25/02 */ +} + + +/* djhjr - 4/17/98 */ +static void +DoVirtualMoveResize(tmp_win, x, y, w, h) +TwmWindow *tmp_win; +int x, y, w, h; +{ + int fw = tmp_win->frame_width, fh = tmp_win->frame_height; + + tmp_win->virtual_frame_x = R_TO_V_X(x - tmp_win->frame_bw); + tmp_win->virtual_frame_y = R_TO_V_Y(y - tmp_win->frame_bw); + if (!tmp_win->opaque_resize) + { + tmp_win->frame_width = w + 2 * tmp_win->frame_bw; + tmp_win->frame_height = h + 2 * tmp_win->frame_bw; + } + +/* djhjr - 5/27/03 + MoveResizeDesktop(tmp_win, Scr->NoRaiseResize); +*/ + MoveResizeDesktop(tmp_win, TRUE); + + tmp_win->frame_width = fw; tmp_win->frame_height = fh; +} + + +/********************************************************************** + * Rutgers mod #1 - rocky. + * Procedure: + * fullzoom - zooms window to full height of screen or + * to full height and width of screen. (Toggles + * so that it can undo the zoom - even when switching + * between fullzoom and vertical zoom.) + * + * Inputs: + * tmp_win - the TwmWindow pointer + * + * + ********************************************************************** + */ + +void +fullzoom(tmp_win,flag) +TwmWindow *tmp_win; +int flag; +{ + Window junkRoot; + unsigned int junkbw, junkDepth; + int basex, basey; + int frame_bw_times_2; + + XGetGeometry(dpy, (Drawable) tmp_win->frame, &junkRoot, &dragx, &dragy, + (unsigned int *)&dragWidth, (unsigned int *)&dragHeight, &junkbw, + &junkDepth); + + basex = basey = 0; + + if (tmp_win->zoomed == flag) + { + dragHeight = tmp_win->save_frame_height; + dragWidth = tmp_win->save_frame_width; + dragx = tmp_win->save_frame_x; + dragy = tmp_win->save_frame_y; + tmp_win->zoomed = ZOOM_NONE; + } + else + { + if (tmp_win->zoomed == ZOOM_NONE) + { + tmp_win->save_frame_x = dragx; + tmp_win->save_frame_y = dragy; + tmp_win->save_frame_width = dragWidth; + tmp_win->save_frame_height = dragHeight; + } + + tmp_win->zoomed = flag; + + frame_bw_times_2 = 2 * tmp_win->frame_bw; + + switch (flag) + { + case ZOOM_NONE: + break; + case F_ZOOM: + dragx = tmp_win->save_frame_x; + dragy=basey; + dragWidth = tmp_win->save_frame_width; + dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; + break; + case F_HORIZOOM: + dragx = basex; + dragy = tmp_win->save_frame_y; + dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; + dragHeight = tmp_win->save_frame_height; + break; + case F_FULLZOOM: + dragx = basex; + dragy = basey; + dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; + dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; + break; + case F_LEFTZOOM: + dragx = basex; + dragy = basey; + dragWidth = Scr->MyDisplayWidth / 2 - frame_bw_times_2; + dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; + break; + case F_RIGHTZOOM: + dragx = basex + Scr->MyDisplayWidth / 2; + dragy = basey; + dragWidth = Scr->MyDisplayWidth / 2 - frame_bw_times_2; + dragHeight = Scr->MyDisplayHeight - frame_bw_times_2; + break; + case F_TOPZOOM: + dragx = basex; + dragy = basey; + dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; + dragHeight = Scr->MyDisplayHeight / 2 - frame_bw_times_2; + break; + case F_BOTTOMZOOM: + dragx = basex; + dragy = basey + Scr->MyDisplayHeight / 2; + dragWidth = Scr->MyDisplayWidth - frame_bw_times_2; + dragHeight = Scr->MyDisplayHeight / 2 - frame_bw_times_2; + break; + } + } + + if (!Scr->NoRaiseResize) { + XRaiseWindow(dpy, tmp_win->frame); + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); + } + + ConstrainSize(tmp_win, &dragWidth, &dragHeight); + SetupWindow (tmp_win, dragx , dragy , dragWidth, dragHeight, -1); + + /* djhjr - 9/10/99 */ + ResizeTwmWindowContents(tmp_win, dragWidth, dragHeight); + + /* 9/21/96 - djhjr */ + if ((Scr->WarpCursor || LookInList(Scr->WarpCursorL, tmp_win->full_name, &tmp_win->class))) + WarpToWindow (tmp_win); + + XUngrabPointer (dpy, CurrentTime); + XUngrabServer (dpy); +} + +/* + * adjust contents of iconmgrs, doors and the desktop - djhjr - 9/10/99 + */ +void ResizeTwmWindowContents(tmp_win, width, height) + TwmWindow *tmp_win; + int width, height; +{ + TwmDoor *door; + int ncols; + + if (tmp_win->iconmgr) + { + ncols = tmp_win->iconmgrp->cur_columns; + if (ncols == 0) ncols = 1; + +/* djhjr - 4/24/96 + tmp_win->iconmgrp->width = (int) ((width * +*/ + tmp_win->iconmgrp->width = + (int)(((width - 2 * tmp_win->frame_bw3D) * + + (long) tmp_win->iconmgrp->columns) / ncols); + PackIconManager(tmp_win->iconmgrp); + } + else if (tmp_win->w == Scr->VirtualDesktopDisplayOuter) + ResizeDesktopDisplay(width, height); + else if (XFindContext(dpy, tmp_win->w, DoorContext, (caddr_t *)&door) != XCNOENT) + RedoDoorName(tmp_win, door); +} + +void SetFrameShape (tmp) + TwmWindow *tmp; +{ + /* + * see if the titlebar needs to move + */ + if (tmp->title_w) { + int oldx = tmp->title_x, oldy = tmp->title_y; + ComputeTitleLocation (tmp); + if (oldx != tmp->title_x || oldy != tmp->title_y) + XMoveWindow (dpy, tmp->title_w, tmp->title_x, tmp->title_y); + } + + /* + * The frame consists of the shape of the contents window offset by + * title_height or'ed with the shape of title_w (which is always + * rectangular). + */ + if (tmp->wShaped) { + /* + * need to do general case + */ + XShapeCombineShape (dpy, tmp->frame, ShapeBounding, +/* djhjr - 4/24/96 + 0, tmp->title_height, tmp->w, +*/ + tmp->frame_bw3D, tmp->title_height + tmp->frame_bw3D, tmp->w, + + ShapeBounding, ShapeSet); + if (tmp->title_w) { + XShapeCombineShape (dpy, tmp->frame, ShapeBounding, + tmp->title_x + tmp->frame_bw, + tmp->title_y + tmp->frame_bw, + tmp->title_w, ShapeBounding, + ShapeUnion); + } + } else { + /* + * can optimize rectangular contents window + */ + if (tmp->squeeze_info) { + XRectangle newBounding[3]; + XRectangle newClip[3]; + int count = 3, order = YXSorted, fbw2 = 2 * tmp->frame_bw; + int client_width = tmp->attr.width + fbw2 + 2 * tmp->frame_bw3D; + + /* + * Build the border clipping rectangles; one around title, one + * around window. The title_[xy] field already have had frame_bw + * subtracted off them so that they line up properly in the frame. + * + * The frame_width and frame_height do *not* include borders. + */ + /* border */ +/* djhjr - 4/24/96 + newBounding[0].x = tmp->title_x; + newBounding[0].y = tmp->title_y; + newBounding[0].width = tmp->title_width + fbw2; + newBounding[0].height = tmp->title_height; + newBounding[1].x = -tmp->frame_bw; + newBounding[1].y = Scr->TitleHeight; + newBounding[1].width = tmp->attr.width + fbw2; + newBounding[1].height = tmp->attr.height + fbw2; +*/ + newBounding[0].x = tmp->title_x - tmp->frame_bw3D; + newBounding[0].y = tmp->title_y - tmp->frame_bw3D; + newBounding[0].width = tmp->title_width + fbw2 + 2 * tmp->frame_bw3D; + newBounding[0].height = tmp->title_height + tmp->frame_bw3D; + + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (Scr->BorderBevelWidth > 0 && + newBounding[0].width < client_width) + { + /* re-ordered arrays for XYSorted - djhjr - 11/5/03 */ + newBounding[1].x = -tmp->frame_bw3D; + newBounding[1].y = tmp->title_height; + newBounding[1].width = tmp->attr.width + 3 * tmp->frame_bw3D; + newBounding[1].height = tmp->frame_bw3D; + newBounding[2].x = -tmp->frame_bw; + newBounding[2].y = Scr->TitleHeight + tmp->frame_bw3D; + newBounding[2].width = client_width; + newBounding[2].height = tmp->attr.height + fbw2 + tmp->frame_bw3D; + } + else + { + newBounding[1].x = -tmp->frame_bw; + newBounding[1].y = Scr->TitleHeight + tmp->frame_bw3D; + newBounding[1].width = client_width; + newBounding[1].height = tmp->attr.height + fbw2 + tmp->frame_bw3D; + count = 2; + order = YXBanded; + } + + /* insides */ +/* djhjr - 4/24/96 + newClip[0].x = tmp->title_x + tmp->frame_bw; + newClip[0].y = 0; + newClip[0].width = tmp->title_width; + newClip[0].height = Scr->TitleHeight; + newClip[1].x = 0; + newClip[1].y = tmp->title_height; + newClip[1].width = tmp->attr.width; + newClip[1].height = tmp->attr.height; +*/ + newClip[0].x = tmp->title_x + tmp->frame_bw - tmp->frame_bw3D; + newClip[0].y = 0; + newClip[0].width = tmp->title_width + 2 * tmp->frame_bw3D; + newClip[0].height = Scr->TitleHeight + tmp->frame_bw3D; + + if (count == 3) + { + /* re-ordered arrays for XYSorted - djhjr - 11/5/03 */ + newClip[1].x = newBounding[1].x; + newClip[1].y = newBounding[1].y; + newClip[1].width = newBounding[1].width; + newClip[1].height = newBounding[1].height; + newClip[2].x = 0; + newClip[2].y = tmp->title_height + tmp->frame_bw3D; + newClip[2].width = client_width; + newClip[2].height = tmp->attr.height + tmp->frame_bw3D; + } + else + { + newClip[1].x = 0; + newClip[1].y = tmp->title_height + tmp->frame_bw3D; + newClip[1].width = client_width; + newClip[1].height = tmp->attr.height + tmp->frame_bw3D; + } + + XShapeCombineRectangles (dpy, tmp->frame, ShapeBounding, 0, 0, + newBounding, count, ShapeSet, order); + XShapeCombineRectangles (dpy, tmp->frame, ShapeClip, 0, 0, + newClip, count, ShapeSet, order); + } else { + (void) XShapeCombineMask (dpy, tmp->frame, ShapeBounding, 0, 0, + None, ShapeSet); + (void) XShapeCombineMask (dpy, tmp->frame, ShapeClip, 0, 0, + None, ShapeSet); + } + } +} + +/* + * Squeezed Title: + * + * tmp->title_x + * 0 | + * tmp->title_y ........+--------------+......... -+,- tmp->frame_bw + * 0 : ......| +----------+ |....... : -++ + * : : | | | | : : ||-Scr->TitleHeight + * : : | | | | : : || + * +-------+ +----------+ +--------+ -+|-tmp->title_height + * | +---------------------------+ | --+ + * | | | | + * | | | | + * | | | | + * | | | | + * | | | | + * | +---------------------------+ | + * +-------------------------------+ + * + * + * Unsqueezed Title: + * + * tmp->title_x + * | 0 + * tmp->title_y +-------------------------------+ -+,tmp->frame_bw + * 0 | +---------------------------+ | -+' + * | | | | |-Scr->TitleHeight + * | | | | | + * + +---------------------------+ + -+ + * |-+---------------------------+-| + * | | | | + * | | | | + * | | | | + * | | | | + * | | | | + * | +---------------------------+ | + * +-------------------------------+ + * + * + * + * Dimensions and Positions: + * + * frame orgin (0, 0) + * frame upper left border (-tmp->frame_bw, -tmp->frame_bw) + * frame size w/o border tmp->frame_width , tmp->frame_height + * frame/title border width tmp->frame_bw + * extra title height w/o bdr tmp->title_height = TitleHeight + frame_bw + * title window height Scr->TitleHeight + * title origin w/o border (tmp->title_x, tmp->title_y) + * client origin (0, Scr->TitleHeight + tmp->frame_bw) + * client size tmp->attr.width , tmp->attr.height + * + * When shaping, need to remember that the width and height of rectangles + * are really deltax and deltay to lower right handle corner, so they need + * to have -1 subtracted from would normally be the actual extents. + */ diff --git a/resize.h b/resize.h new file mode 100644 index 0000000..4590144 --- /dev/null +++ b/resize.h @@ -0,0 +1,65 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/********************************************************************** + * + * $XConsortium: resize.h,v 1.7 90/03/23 11:42:32 jim Exp $ + * + * resize function externs + * + * 8-Apr-88 Tom LaStrange Initial Version. + * + **********************************************************************/ + +#ifndef _RESIZE_ +#define _RESIZE_ + +extern int resizing_window; + +extern void StartResize(); +extern void AddStartResize(); +extern void DoResize(); +extern void DisplaySize(); +extern void EndResize(); +extern void AddEndResize(); +extern void SetupWindow(); +extern void SetupFrame(); +extern void SetFrameShape(); +extern void ConstrainSize(); +/* depreciated - djhjr - 10/6/02 +extern void MenuDoResize(); +*/ +extern void MenuStartResize(); +extern void MenuEndResize(); + +/* djhjr - 4/6/98 */ +void PaintBorderAndTitlebar(); + +extern void fullzoom(); + +#endif /* _RESIZE_ */ diff --git a/screen.h b/screen.h new file mode 100644 index 0000000..6ba85c2 --- /dev/null +++ b/screen.h @@ -0,0 +1,808 @@ +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/*********************************************************************** + * + * $XConsortium: screen.h,v 1.62 91/05/01 17:33:09 keith Exp $ + * + * twm per-screen data include file + * + * 11-3-88 Dave Payne, Apple Computer File created + * + ***********************************************************************/ + +#ifndef _SCREEN_ +#define _SCREEN_ + +#include +#include +#include +#include "list.h" +#include "menus.h" +#include "iconmgr.h" +#include "doors.h" + +/* djhjr - 5/17/98 */ +#ifndef ORIGINAL_PIXMAPS +#include "util.h" /* for Image structure */ +#endif + +typedef struct _StdCmap { + struct _StdCmap *next; /* next link in chain */ + Atom atom; /* property from which this came */ + int nmaps; /* number of maps below */ + XStandardColormap *maps; /* the actual maps */ +} StdCmap; + +#define SIZE_HINDENT 10 + +#ifdef ORIGINAL_SIZEVINDENT +#define SIZE_VINDENT 2 +#else +#define SIZE_VINDENT 5 +#endif + +typedef struct ScreenInfo +{ + int screen; /* the default screen */ + int d_depth; /* copy of DefaultDepth(dpy, screen) */ + Visual *d_visual; /* copy of DefaultVisual(dpy, screen) */ + int Monochrome; /* is the display monochrome ? */ + int MyDisplayWidth; /* my copy of DisplayWidth(dpy, screen) */ + int MyDisplayHeight; /* my copy of DisplayHeight(dpy, screen) */ + int MaxWindowWidth; /* largest window to allow */ + int MaxWindowHeight; /* ditto */ + + /* djhjr - 5/15/96 */ + int ResizeX; /* coordinate of resize/position window */ + int ResizeY; /* ditto */ + + int VirtualDesktopMaxWidth; /* max width of virtual desktop */ + int VirtualDesktopMaxHeight; /* max height of virtual desktop */ + int VirtualDesktopWidth; /* width of virtual desktop */ + int VirtualDesktopHeight; /* height of virtual desktop */ + int VirtualDesktopX; /* top left x of my screen on the desktop */ + int VirtualDesktopY; /* top left y of my screen on the desktop */ + int VirtualDesktopPanDistanceX; /* distance to pan screen */ + int VirtualDesktopPanDistanceY; /* distance to pan screen */ + + /* these are for the little vd display */ + int VirtualDesktopDScale; /* scale of the virtual desktop display */ + int VirtualDesktopDX; /* position of the vd display */ + int VirtualDesktopDY; /* position of the vd display */ + + /* the autopan stuff */ + int AutoPanX; /* how far should autopan travel */ + /* AutoPanX is also "whether autopan configured". */ + int AutoPanY; /* how far should autopan travel */ + Window VirtualDesktopAutoPan[4]; /* the autopan windows */ + /* 0 = left, 1 = right, 2 = top, 3 = bottom */ + + /* djhjr - 9/8/98 */ + int VirtualDesktopPanResistance; /* how much effort it takes to pan */ + + TwmWindow TwmRoot; /* the head of the twm window list */ + + Window Root; /* the root window */ + Window SizeWindow; /* the resize dimensions window */ + Window InfoWindow; /* the information window */ + Window VirtualDesktopDisplayOuter; /* wrapper for display of the virtual desktop */ + Window VirtualDesktopDisplay; /* display of the virtual desktop */ + Window VirtualDesktopDScreen; /* display of the real screen on the vd */ + TwmWindow *VirtualDesktopDisplayTwin; /* twm window for the above */ + + name_list *ImageCache; /* list of pixmaps */ + name_list *Icons; /* list of icon pixmaps */ + + int pullW, pullH; /* size of pull right menu icon */ + +/* djhjr - 5/17/98 */ +/* added the unknowns - djhjr - 8/13/98 */ +#ifdef ORIGINAL_PIXMAPS + Pixmap UnknownPm; /* the unknown icon pixmap */ + int UnknownWidth; /* width of the unknown icon */ + int UnknownHeight; /* height of the unknown icon */ + Pixmap hilitePm; /* focus highlight window background */ + int hilite_pm_width, hilite_pm_height; /* cache the size */ + Pixmap virtualPm; /* panner background pixmap RFB PIXMAP */ + int virtual_pm_width, virtual_pm_height; /* RFB PIXMAP */ + Pixmap RealScreenPm; /* panner background pixmap RFB PIXMAP */ + int RealScreen_pm_width, RealScreen_pm_height; /* RFB PIXMAP */ +#else /* ORIGINAL_PIXMAPS */ + char *unknownName; /* name of unknown icon pixmap */ + + /* djhjr - 10/25/02 */ + char *hiliteName; /* name of built-in focus highlight pixmap */ + /* two more - djhjr - 10/30/02 */ + char *iconMgrIconName; /* name of built-in iconmgr iconify pixmap */ + char *menuIconName; /* name of built-in pull right menu pixmap */ + +/* depreciated - djhjr - 10/30/02 + Image *siconifyPm; * the icon manager iconify pixmap * + Image *pullPm; * pull right menu icon * +*/ + + Image *hilitePm; /* focus highlight window image structure */ + Image *virtualPm; /* panner background window image structure */ + Image *realscreenPm; /* real screen window image structure */ +#endif /* ORIGINAL_PIXMAPS */ + + MenuRoot *MenuList; /* head of the menu list */ + MenuRoot *LastMenu; /* the last menu (mostly unused?) */ + MenuRoot *Windows; /* the TwmWindows menu */ + + TwmWindow *Ring; /* one of the windows in window ring */ + TwmWindow *RingLeader; /* current winodw in ring */ + + MouseButton Mouse[MAX_BUTTONS+1][NUM_CONTEXTS][MOD_SIZE]; + MouseButton DefaultFunction; + MouseButton WindowFunction; + + struct { + Colormaps *cmaps; /* current list of colormap windows */ + int maxCmaps; /* maximum number of installed colormaps */ + unsigned long first_req; /* seq # for first XInstallColormap() req in + pass thru loading a colortable list */ + int root_pushes; /* current push level to install root + colormap windows */ + TwmWindow *pushed_window; /* saved window to install when pushes drops + to zero */ + } cmapInfo; + + struct { + StdCmap *head, *tail; /* list of maps */ + StdCmap *mru; /* most recently used in list */ + int mruindex; /* index of mru in entry */ + } StdCmapInfo; + + struct { + int nleft, nright; /* numbers of buttons in list */ + TitleButton *head; /* start of list */ + int border; /* button border */ + int pad; /* button-padding */ + int width; /* width of single button & border */ + int leftx; /* start of left buttons */ + int titlex; /* start of title string */ + int rightoff; /* offset back from right edge */ + } TBInfo; + ColorPair BorderTileC; /* border tile colors */ + ColorPair TitleC; /* titlebar colors */ + ColorPair MenuC; /* menu colors */ + ColorPair MenuTitleC; /* menu title colors */ + ColorPair IconC; /* icon colors */ + ColorPair IconManagerC; /* icon manager colors */ + ColorPair DefaultC; /* default colors */ + + /* djhjr - 4/19/96 */ + ColorPair BorderColorC; /* color of window borders */ + + ColorPair VirtualDesktopDisplayC; /* desktop display color */ + ColorPair DoorC; /* default door colors */ + ColorPair VirtualC; /* default virtual colors *//*RFB VCOLOR*/ + ColorPair RealScreenC; /* "real screen" in panner RFB 4/92 */ + Pixel VirtualDesktopDisplayBorder; /* desktop display default border */ + Pixel BorderColor; /* color of window borders */ + Pixel MenuShadowColor; /* menu shadow color */ + Pixel IconBorderColor; /* icon border color */ + Pixel IconManagerHighlight; /* icon manager highlight */ + + /* djhjr - 4/19/96 */ + short ClearBevelContrast; /* The contrast of the clear shadow */ + short DarkBevelContrast; /* The contrast of the dark shadow */ + + Cursor TitleCursor; /* title bar cursor */ + Cursor FrameCursor; /* frame cursor */ + Cursor IconCursor; /* icon cursor */ + Cursor IconMgrCursor; /* icon manager cursor */ + Cursor ButtonCursor; /* title bar button cursor */ + Cursor MoveCursor; /* move cursor */ + Cursor ResizeCursor; /* resize cursor */ + Cursor WaitCursor; /* wait a while cursor */ + Cursor MenuCursor; /* menu cursor */ + Cursor SelectCursor; /* dot cursor for f.move, etc. from menus */ + Cursor DestroyCursor; /* skull and cross bones, f.destroy */ + Cursor DoorCursor;/*RFBCURSOR*/ + Cursor VirtualCursor;/*RFBCURSOR*/ + Cursor DesktopCursor;/*RFBCURSOR*/ + Cursor NoCursor; /* a black cursor - used on desktop display */ + + name_list *BorderColorL; + name_list *IconBorderColorL; + name_list *BorderTileForegroundL; + name_list *BorderTileBackgroundL; + name_list *TitleForegroundL; + name_list *TitleBackgroundL; + name_list *IconForegroundL; + name_list *IconBackgroundL; + name_list *IconManagerFL; + name_list *IconManagerBL; + name_list *IconMgrs; + + /* djhjr - 4/19/96 */ + name_list *NoBorder; /* list of window without borders */ + + /* djhjr - 4/7/98 */ + name_list *OpaqueMoveL; /* list of windows moved as a solid */ + name_list *NoOpaqueMoveL; /* list of windows moved as an outline */ + name_list *OpaqueResizeL; /* list of windows resized as a solid */ + name_list *NoOpaqueResizeL; /* list of windows resized as an outline */ + + name_list *NoTitle; /* list of window names with no title bar */ + name_list *MakeTitle; /* list of window names with title bar */ + name_list *AutoRaise; /* list of window names to auto-raise */ + name_list *IconNames; /* list of window names and icon names */ + name_list *NoHighlight; /* list of windows to not highlight */ + name_list *NoStackModeL; /* windows to ignore stack mode requests */ + name_list *NoTitleHighlight;/* list of windows to not highlight the TB*/ + name_list *DontIconify; /* don't iconify by unmapping */ + name_list *IconMgrNoShow; /* don't show in the icon manager */ + name_list *IconMgrShow; /* show in the icon manager */ + name_list *IconifyByUn; /* windows to iconify by unmapping */ + name_list *StartIconified; /* windows to start iconic */ + name_list *IconManagerHighlightL; /* icon manager highlight colors */ + name_list *SqueezeTitleL; /* windows of which to squeeze title */ + name_list *DontSqueezeTitleL; /* windows of which not to squeeze */ + name_list *WindowRingL; /* windows in ring */ + + /* submitted by Jonathan Paisley - 10/27/02 */ + name_list *NoWindowRingL; /* windows not added to ring */ + + name_list *WarpCursorL; /* windows to warp cursor to on deiconify */ + name_list *NailedDown; /* windows that are nailed down */ + name_list *VirtualDesktopColorFL; /* color of representations on the vd display */ + name_list *VirtualDesktopColorBL; /* color of representations on the vd display */ + name_list *VirtualDesktopColorBoL; /* color of representations on the vd display */ + name_list *DontShowInDisplay; /* don't show these in the desktop display */ + + /* Submitted by Erik Agsjo */ + name_list *DontShowInTWMWindows; /* don't show these in the TWMWindows menu */ + + name_list *DoorForegroundL; /* doors foreground */ + name_list *DoorBackgroundL; /* doors background */ + + /* djhjr - 9/24/02 */ + name_list *UsePPositionL; /* windows with UsePPosition set */ + + GC NormalGC; /* normal GC for everything */ + GC MenuGC; /* gc for menus */ + GC DrawGC; /* GC to draw lines for move and resize */ + + /* djhjr - 4/19/96 */ + GC GreyGC; /* for shadowing on monochrome displays */ + GC ShadGC; /* for shadowing on with patterns */ + + unsigned long Black; + unsigned long White; + unsigned long XORvalue; /* number to use when drawing xor'ed */ + MyFont TitleBarFont; /* title bar font structure */ + MyFont MenuFont; /* menu font structure */ + MyFont IconFont; /* icon font structure */ + MyFont SizeFont; /* resize font structure */ + MyFont IconManagerFont; /* window list font structure */ + MyFont VirtualFont; /* virtual display windows */ + MyFont DoorFont; /* for drawing in doors */ + MyFont MenuTitleFont; /* DSE -- for menu titles */ + MyFont InfoFont; /* for the info window */ + MyFont DefaultFont; + IconMgr iconmgr; /* default icon manager */ + struct RootRegion *FirstIconRegion; /* pointer to icon regions */ + struct RootRegion *LastIconRegion; /* pointer to the last icon region */ + char *IconDirectory; /* icon directory to search */ + + /* djhjr - 4/26/99 */ + struct RootRegion *FirstAppletRegion; /* pointer to applet regions */ + struct RootRegion *LastAppletRegion; /* pointer to the last applet region */ + + /* djhjr - 12/26/98 */ + char *BitmapFilePath; /* local copy of the X database resource */ + + int SizeStringOffset; /* x offset in size window for drawing */ + int SizeStringWidth; /* minimum width of size window */ + int BorderWidth; /* border width of twm windows */ + +/* djhjr - 8/11/98 + * djhjr - 4/18/96 * + int ThreeDBorderWidth; * 3D border width of twm windows * +*/ + + /* widths of the various 3D shadows - djhjr - 5/2/98 */ + int BorderBevelWidth; + int TitleBevelWidth; + int MenuBevelWidth; + int IconMgrBevelWidth; + int InfoBevelWidth; + + /* djhjr - 8/11/98 */ + int IconBevelWidth; + int ButtonBevelWidth; + + /* djhjr - 2/7/99 */ + int DoorBevelWidth; + int VirtualDesktopBevelWidth; + + /* djhjr - 5/22/00 */ + int MenuScrollBorderWidth; /* top and bottom margins for menu scrolling */ + int MenuScrollJump; /* number of entries for menu scroll */ + + int IconBorderWidth; /* border width of icon windows */ + int TitleHeight; /* height of the title bar window */ + TwmWindow *Focus; /* the twm window that has focus */ + TwmWindow *Newest; /* the most newly added twm window -- PF */ + int EntryHeight; /* menu entry height */ + int FramePadding; /* distance between decorations and border */ + int TitlePadding; /* distance between items in titlebar */ + int ButtonIndent; /* amount to shrink buttons on each side */ + int NumAutoRaises; /* number of autoraise windows on screen */ + + short SqueezeTitle; /* make title as small as possible */ + short MoveDelta; /* number of pixels before f.move starts */ + short ZoomCount; /* zoom outline count */ + + /* djhjr - 6/22/01 */ + int PauseOnExit; /* delay before shutting down via Done() */ + int PauseOnQuit; /* delay before shuttind down via f.quit */ + +/* djhjr - 5/17/96 */ +#ifdef ORIGINAL_SHORTS + /* short NoDefaults; - DSE */ + short NoDefaultMouseOrKeyboardBindings; /* do not add default UI mouse and keyboard stuff - DSE */ + short NoDefaultTitleButtons; /* do not add default resize and iconify title buttons - DSE */ + short UsePPosition; /* what do with PPosition, see values below */ + short OldFashionedTwmWindowsMenu; + +/* djhjr - 2/15/99 + short UseRealScreenBorder; +*/ + + short AutoRelativeResize; /* start resize relative to position in quad */ + short FocusRoot; /* is the input focus on the root ? */ + + /* djhjr - 10/16/02 */ + short WarpCentered; /* warp to center of windows? */ + + short WarpCursor; /* warp cursor on de-iconify? */ + short ForceIcon; /* force the icon to the user specified */ + short NoGrabServer; /* don't do server grabs */ + short NoRaiseMove; /* don't raise window following move */ + short NoRaiseResize; /* don't raise window following resize */ + short NoRaiseDeicon; /* don't raise window on deiconify */ + short NoRaiseWarp; /* don't raise window on warp */ + short DontMoveOff; /* don't allow windows to be moved off */ + short DoZoom; /* zoom in and out of icons */ + short TitleFocus; /* focus on window in title bar ? */ + + /* djhjr - 5/27/98 */ + short IconManagerFocus; /* focus on window of the icon manager entry? */ + + /* djhjr - 12/14/98 */ + short StaticIconPositions; /* non-nailed icons stay put */ + + /* djhjr - 10/2/01 */ + short StrictIconManager; /* show only the iconified */ + + /* djhjr - 8/23/02 */ + short NoBorders; /* put borders on windows */ + + short NoTitlebar; /* put title bars on windows */ + short DecorateTransients; /* put title bars on transients */ + short IconifyByUnmapping; /* simply unmap windows when iconifying */ + short ShowIconManager; /* display the window list */ + short IconManagerDontShow; /* show nothing in the icon manager */ + short NoIconifyIconManagers; /* don't iconify the icon manager -- PF */ + short BackingStore; /* use backing store for menus */ + short SaveUnder; /* use save under's for menus */ + short RandomPlacement; /* randomly place windows that no give hints */ + short PointerPlacement; /* place near mouse pointer */ + short OpaqueMove; /* move the window rather than outline */ + + /* djhjr - 4/6/98 */ + short OpaqueResize; /* resize the window rather than outline */ + + short Highlight; /* should we highlight the window borders */ + + /* djhjr - 1/27/98 */ + short IconMgrHighlight; /* should we highlight icon manager entries */ + + short StackMode; /* should we honor stack mode requests */ + short TitleHighlight; /* should we highlight the titlebar */ + short SortIconMgr; /* sort entries in the icon manager */ + short Shadow; /* show the menu shadow */ + short InterpolateMenuColors;/* make pretty menus */ + short NoIconManagers; /* Don't create any icon managers */ + short ClientBorderWidth; /* respect client window border width */ + short HaveFonts; /* set if fonts have been loaded */ + short FirstTime; /* first time we've read .twmrc */ + short CaseSensitive; /* be case-sensitive when sorting names */ + short WarpUnmapped; /* allow warping to unmapped windows */ + short DeIconifyToScreen; /* if deiconified, should this goto the screen ? */ + short WarpWindows; /* should windows or the screen be warped ? */ + short snapRealScreen; /* should the real screen snap to a pandistance grid ? */ + short GeometriesAreVirtual; /* should geometries be interpreted as virtual or real ? */ + short Virtual; /* are we virtual ? (like, hey man....) */ + short NamesInVirtualDesktop;/* show names in virtual desktop display ? */ + short AutoRaiseDefault; /* AutoRaise all windows if true *//*RAISEDELAY*/ + short UseWindowRing; /* put all windows in the ring? */ + short StayUpMenus; + short StayUpOptionalMenus; /* PF */ + short WarpToTransients; /* PF */ + short EnhancedExecResources; /* instead of normal behavior - DSE */ + short RightHandSidePulldownMenus; /* instead of left-right center - DSE */ + short LessRandomZoomZoom; /* makes zoomzoom a better visual bell - DSE */ + short PrettyZoom; /* nicer-looking animation - DSE */ + short StickyAbove; /* sticky windows above other windows - DSE */ + short DontInterpolateTitles; /* menu titles are excluded from color interpolation - DSE */ + + /* djhjr - 1/6/98 */ + short FixManagedVirtualGeometries; /* bug workaround */ + + short FixTransientVirtualGeometries; /* bug workaround - DSE */ + short WarpSnug; /* make sure entire window is on screen when warping - DSE */ + + /* djhjr - 6/25/96 */ + short ShallowReliefWindowButton; + +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 + * djhjr - 4/18/96 * + short use3Dmenus; + short use3Dtitles; + short use3Diconmanagers; + short use3Dborders; +*/ + + short BeNiceToColormap; + +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 + * djhjr - 5/5/98 * + short use3Dicons; +*/ + +/* obsoleted by the ":xpm:*" built-in pixmaps - djhjr - 10/26/02 + * djhjr - 4/25/96 * + short SunkFocusWindowTitle; +*/ + + /* for rader - djhjr - 2/9/99 */ + short NoPrettyTitles; + + /* djhjr - 9/21/96 */ + short ButtonColorIsFrame; + + /* djhjr - 4/17/98 */ + short VirtualReceivesMotionEvents; + short VirtualSendsMotionEvents; + + /* djhjr - 6/22/99 */ + short DontDeiconifyTransients; + + /* submitted by Ugen Antsilevitch - 5/28/00 */ + short WarpVisible; + + /* djhjr - 10/11/01 */ + short ZoomZoom; /* fallback on random zooms on iconify */ + + /* djhjr - 10/20/02 */ + short NoBorderDecorations; + + /* djhjr - 11/3/03 */ + short RaiseOnStart; +#else + struct + { + unsigned int NoDefaultMouseOrKeyboardBindings : 1; + unsigned int NoDefaultTitleButtons : 1; + unsigned int UsePPosition : 2; + unsigned int OldFashionedTwmWindowsMenu : 1; + +/* djhjr - 2/15/99 + unsigned int UseRealScreenBorder : 1; +*/ + + unsigned int AutoRelativeResize : 1; + unsigned int FocusRoot : 1; + + /* djhjr - 10/16/02 */ + unsigned int WarpCentered : 2; + + unsigned int WarpCursor : 1; + unsigned int ForceIcon : 1; + unsigned int NoGrabServer : 1; + unsigned int NoRaiseMove : 1; + unsigned int NoRaiseResize : 1; + unsigned int NoRaiseDeicon : 1; + unsigned int NoRaiseWarp : 1; + unsigned int DontMoveOff : 1; + unsigned int DoZoom : 1; + unsigned int TitleFocus : 1; + + /* djhjr - 5/27/98 */ + unsigned int IconManagerFocus : 1; + + /* djhjr - 12/14/98 */ + unsigned int StaticIconPositions : 1; + + /* djhjr - 10/2/01 */ + unsigned int StrictIconManager : 1; + + /* djhjr - 8/23/02 */ + unsigned int NoBorders : 1; + + unsigned int NoTitlebar : 1; + unsigned int DecorateTransients : 1; + unsigned int IconifyByUnmapping : 1; + unsigned int ShowIconManager : 1; + unsigned int IconManagerDontShow : 1; + unsigned int NoIconifyIconManagers : 1; + unsigned int BackingStore : 1; + unsigned int SaveUnder : 1; + unsigned int RandomPlacement : 1; + unsigned int PointerPlacement : 1; + unsigned int OpaqueMove : 1; + + /* djhjr - 4/6/98 */ + unsigned int OpaqueResize : 1; + + unsigned int Highlight : 1; + + /* djhjr - 1/27/98 */ + unsigned int IconMgrHighlight : 1; + + unsigned int StackMode : 1; + unsigned int TitleHighlight : 1; + unsigned int SortIconMgr : 1; + unsigned int Shadow : 1; + unsigned int InterpolateMenuColors : 1; + unsigned int NoIconManagers : 1; + unsigned int ClientBorderWidth : 1; + unsigned int HaveFonts : 1; + unsigned int FirstTime : 1; + unsigned int CaseSensitive : 1; + unsigned int WarpUnmapped : 1; + unsigned int DeIconifyToScreen : 1; + unsigned int WarpWindows : 1; + unsigned int snapRealScreen : 1; + unsigned int GeometriesAreVirtual : 1; + unsigned int Virtual : 1; + unsigned int NamesInVirtualDesktop : 1; + unsigned int AutoRaiseDefault : 1; + unsigned int UseWindowRing : 1; + unsigned int StayUpMenus : 1; + unsigned int StayUpOptionalMenus : 1; + unsigned int WarpToTransients : 1; + unsigned int EnhancedExecResources : 1; + unsigned int RightHandSidePulldownMenus : 1; + unsigned int LessRandomZoomZoom : 1; + unsigned int PrettyZoom : 1; + unsigned int StickyAbove : 1; + unsigned int DontInterpolateTitles : 1; + + /* djhjr - 1/6/98 */ + unsigned int FixManagedVirtualGeometries : 1; + + unsigned int FixTransientVirtualGeometries : 1; + unsigned int WarpSnug : 1; + unsigned int ShallowReliefWindowButton : 2; + +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 + unsigned int use3Dmenus : 1; + unsigned int use3Dtitles : 1; + unsigned int use3Diconmanagers : 1; + unsigned int use3Dborders : 1; + + * djhjr - 5/5/98 * + unsigned int use3Dicons : 1; +*/ + + unsigned int BeNiceToColormap : 1; + +/* obsoleted by the ":xpm:*" built-in pixmaps - djhjr - 10/26/02 + unsigned int SunkFocusWindowTitle : 1; +*/ + + /* for rader - djhjr - 2/9/99 */ + unsigned int NoPrettyTitles : 1; + + unsigned int ButtonColorIsFrame : 1; + + /* djhjr - 4/17/98 */ + unsigned int VirtualReceivesMotionEvents : 1; + unsigned int VirtualSendsMotionEvents : 1; + + /* djhjr - 6/22/99 */ + unsigned int DontDeiconifyTransients : 1; + + /* submitted by Ugen Antsilevitch - 5/28/00 */ + unsigned int WarpVisible : 1; + + /* djhjr - 10/11/01 */ + unsigned int ZoomZoom : 1; + + /* djhjr - 10/20/02 */ + unsigned int NoBorderDecorations : 1; + + /* djhjr - 11/3/03 */ + unsigned int RaiseOnStart : 1; + } userflags; +#define NoDefaultMouseOrKeyboardBindings userflags.NoDefaultMouseOrKeyboardBindings +#define NoDefaultTitleButtons userflags.NoDefaultTitleButtons +#define UsePPosition userflags.UsePPosition +#define OldFashionedTwmWindowsMenu userflags.OldFashionedTwmWindowsMenu + +/* djhjr - 2/15/99 +#define UseRealScreenBorder userflags.UseRealScreenBorder +*/ + +#define AutoRelativeResize userflags.AutoRelativeResize +#define FocusRoot userflags.FocusRoot + +/* djhjr - 10/16/02 */ +#define WarpCentered userflags.WarpCentered + +#define WarpCursor userflags.WarpCursor +#define ForceIcon userflags.ForceIcon +#define NoGrabServer userflags.NoGrabServer +#define NoRaiseMove userflags.NoRaiseMove +#define NoRaiseResize userflags.NoRaiseResize +#define NoRaiseDeicon userflags.NoRaiseDeicon +#define NoRaiseWarp userflags.NoRaiseWarp +#define DontMoveOff userflags.DontMoveOff +#define DoZoom userflags.DoZoom +#define TitleFocus userflags.TitleFocus + +/* djhjr - 5/27/98 */ +#define IconManagerFocus userflags.IconManagerFocus + +/* djhjr - 12/14/98 */ +#define StaticIconPositions userflags.StaticIconPositions + +/* djhjr - 10/2/01 */ +#define StrictIconManager userflags.StrictIconManager + +/* djhjr - 8/23/02 */ +#define NoBorders userflags.NoBorders + +#define NoTitlebar userflags.NoTitlebar +#define DecorateTransients userflags.DecorateTransients +#define IconifyByUnmapping userflags.IconifyByUnmapping +#define ShowIconManager userflags.ShowIconManager +#define IconManagerDontShow userflags.IconManagerDontShow +#define NoIconifyIconManagers userflags.NoIconifyIconManagers +#define BackingStore userflags.BackingStore +#define SaveUnder userflags.SaveUnder +#define RandomPlacement userflags.RandomPlacement +#define PointerPlacement userflags.PointerPlacement +#define OpaqueMove userflags.OpaqueMove + +/* djhjr - 4/6/98 */ +#define OpaqueResize userflags.OpaqueResize + +#define Highlight userflags.Highlight + +/* djhjr - 1/27/98 */ +#define IconMgrHighlight userflags.IconMgrHighlight + +#define StackMode userflags.StackMode +#define TitleHighlight userflags.TitleHighlight +#define SortIconMgr userflags.SortIconMgr +#define Shadow userflags.Shadow +#define InterpolateMenuColors userflags.InterpolateMenuColors +#define NoIconManagers userflags.NoIconManagers +#define ClientBorderWidth userflags.ClientBorderWidth +#define HaveFonts userflags.HaveFonts +#define FirstTime userflags.FirstTime +#define CaseSensitive userflags.CaseSensitive +#define WarpUnmapped userflags.WarpUnmapped +#define DeIconifyToScreen userflags.DeIconifyToScreen +#define WarpWindows userflags.WarpWindows +#define snapRealScreen userflags.snapRealScreen +#define GeometriesAreVirtual userflags.GeometriesAreVirtual +#define Virtual userflags.Virtual +#define NamesInVirtualDesktop userflags.NamesInVirtualDesktop +#define AutoRaiseDefault userflags.AutoRaiseDefault +#define UseWindowRing userflags.UseWindowRing +#define StayUpMenus userflags.StayUpMenus +#define StayUpOptionalMenus userflags.StayUpOptionalMenus +#define WarpToTransients userflags.WarpToTransients +#define EnhancedExecResources userflags.EnhancedExecResources +#define RightHandSidePulldownMenus userflags.RightHandSidePulldownMenus +#define LessRandomZoomZoom userflags.LessRandomZoomZoom +#define PrettyZoom userflags.PrettyZoom +#define StickyAbove userflags.StickyAbove +#define DontInterpolateTitles userflags.DontInterpolateTitles + +/* djhjr - 1/6/98 */ +#define FixManagedVirtualGeometries userflags.FixManagedVirtualGeometries + +#define FixTransientVirtualGeometries userflags.FixTransientVirtualGeometries +#define WarpSnug userflags.WarpSnug +#define ShallowReliefWindowButton userflags.ShallowReliefWindowButton + +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 +#define use3Dmenus userflags.use3Dmenus +#define use3Dtitles userflags.use3Dtitles +#define use3Diconmanagers userflags.use3Diconmanagers +#define use3Dborders userflags.use3Dborders + +* djhjr - 5/5/98 * +#define use3Dicons userflags.use3Dicons +*/ + +#define BeNiceToColormap userflags.BeNiceToColormap + +/* obsoleted by the ":xpm:*" built-in pixmaps - djhjr - 10/26/02 +#define SunkFocusWindowTitle userflags.SunkFocusWindowTitle +*/ + +/* for rader - djhjr - 2/9/99 */ +#define NoPrettyTitles userflags.NoPrettyTitles + +#define ButtonColorIsFrame userflags.ButtonColorIsFrame + +/* djhjr - 4/17/98 */ +#define VirtualReceivesMotionEvents userflags.VirtualReceivesMotionEvents +#define VirtualSendsMotionEvents userflags.VirtualSendsMotionEvents + +/* djhjr - 6/22/99 */ +#define DontDeiconifyTransients userflags.DontDeiconifyTransients + +/* submitted by Ugen Antsilevitch - 5/28/00 */ +#define WarpVisible userflags.WarpVisible + +/* djhjr - 10/11/01 */ +#define ZoomZoom userflags.ZoomZoom + +/* djhjr - 10/20/02 */ +#define NoBorderDecorations userflags.NoBorderDecorations + +/* djhjr - 11/3/03 */ +#define RaiseOnStart userflags.RaiseOnStart +#endif + + /* djhjr - 9/10/03 */ + int IgnoreModifiers; /* binding modifiers to ignore */ + + FuncKey FuncKeyRoot; + TwmDoor *Doors; /* a list of doors on this screen */ + + int AutoPanBorderWidth; /* of autopan windows, really - DSE */ + int AutoPanExtraWarp; /* # of extra pixels to warp - DSE */ + int RealScreenBorderWidth; /* in virtual desktop - DSE */ + int AutoPanWarpWithRespectToRealScreen; /* percent - DSE */ +} ScreenInfo; + +extern int MultiScreen; +extern int NumScreens; +extern ScreenInfo **ScreenList; +extern ScreenInfo *Scr; +extern int FirstScreen; + +#define PPOS_OFF 0 +#define PPOS_ON 1 +#define PPOS_NON_ZERO 2 +/* may eventually want an option for having the PPosition be the initial + location for the drag lines */ + +/* djhjr - 10/16/02 */ +#define WARPC_OFF 0 +#define WARPC_TITLED 1 +#define WARPC_UNTITLED 2 +#define WARPC_ON 3 + +#endif /* _SCREEN_ */ diff --git a/sound.c b/sound.c new file mode 100644 index 0000000..4a32a7e --- /dev/null +++ b/sound.c @@ -0,0 +1,330 @@ +/* + * Copyright 2001, 2002 David J. Hawkey Jr. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holder or the author not + * be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. The copyright holder + * and the author make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * THE COPYRIGHT HOLDER AND THE AUTHOR DISCLAIM ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR THE AUTHOR BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * sound.c + * + * D. J. Hawkey Jr. - 6/22/01 8/16/01 11/15/02 + */ + +#ifdef NO_SOUND_SUPPORT + +/* stub function for gram.y */ +int +SetSound(function, filename, volume) +char *function, *filename; +int volume; +{ + return (1); +} + +#else /* NO_SOUND_SUPPORT */ + +#include +#include +#include +#include +#include "gram.h" +#include "parse.h" +#include "twm.h" +#include "sound.h" + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif + +extern int parse_keyword(); /* in parse.c */ +extern void twmrc_error_prefix(); /* in gram.y */ + +typedef struct sound_keyword +{ + char *name; + int value; +} sound_keyword; + +static sound_keyword sound_keywords[] = +{ + {"(vtwm start)", S_START}, + {"(vtwm stop)", S_STOP}, + {"(client map)", S_CMAP}, + {"(client unmap)", S_CUNMAP}, + {"(menu map)", S_MMAP}, + {"(menu unmap)", S_MUNMAP}, + {"(info unmap)", S_IUNMAP}, + {"(autopan event)", S_APAN}, + {"(bell event)", S_BELL} +}; + +#define MAX_SOUNDKEYWORDS (sizeof(sound_keywords) / sizeof(sound_keyword)) + +typedef struct sound_entry +{ + int func; + RPLAY *rp; +} sound_entry; + +static sound_entry *sound_entries = NULL; +static int sound_count = 0; +static int sound_size = 0; + +static int sound_fd = -1; +static int sound_vol = 63; /* 1/4 attenuation */ +static int sound_state = 0; +static char sound_host[MAXHOSTNAMELEN + 1] = ""; + +/* for qsort() */ +static int +compare(p, q) +void *p, *q; +{ + sound_entry *pp = (sound_entry *) p, *qq = (sound_entry *) q; + + return (pp->func - qq->func); +} + +static int +adjustVolume(volume) +int volume; +{ + float vol; + + if (volume > 100) + volume = 100; + + /* volume for rplay is 1 to 255, not 1 to 100 */ + vol = (float) volume / 100.0; + volume = vol * 255.0; + + return (volume); +} + +int +OpenSound() +{ + if (sound_fd < 0) + { + if (sound_host[0] == '\0') + { + strncpy(sound_host, rplay_default_host(), MAXHOSTNAMELEN); + sound_host[MAXHOSTNAMELEN] = '\0'; + } + + if ((sound_fd = rplay_open(sound_host)) >= 0) + { + qsort((void *) sound_entries, (size_t) sound_count, + (size_t) sizeof(sound_entry), compare); + + sound_state = 1; + } + } + + return (sound_fd); +} + +void +CloseSound() +{ + int i; + + for (i = 0; i < sound_count; i++) + rplay_destroy(sound_entries[i].rp); + + if (sound_entries != NULL) + free((void *) sound_entries); + + if (sound_fd >= 0) + rplay_close(sound_fd); + + sound_entries = NULL; + sound_count = 0; + sound_size = 0; + + sound_fd = -1; + sound_vol = 63; + sound_state = 0; + sound_host[0] = '\0'; +} + +int +SetSound(function, filename, volume) +char *function, *filename; +int volume; +{ + sound_entry *sptr; + int i, func, subfunc; + + func = parse_keyword(function, &subfunc); + if (func != FKEYWORD && func != FSKEYWORD) + { + XmuCopyISOLatin1Lowered(function, function); + + for (i = 0; i < MAX_SOUNDKEYWORDS; i++) + if (strcmp(function, sound_keywords[i].name) == 0) + { + func = FKEYWORD; + subfunc = sound_keywords[i].value; + break; + } + } + + if (func == FKEYWORD || func == FSKEYWORD) + { + if (sound_count >= sound_size) + { + sound_size += 10; + sptr = (sound_entry *) realloc((sound_entry *) sound_entries, + sound_size * sizeof(sound_entry)); + if (sptr == NULL) + { + twmrc_error_prefix(); + fprintf(stderr, + "unable to allocate %d bytes for sound_entries\n", + sound_size * sizeof(sound_entry)); + Done(); + } + else + sound_entries = sptr; + } + + sptr = &sound_entries[sound_count]; + + sptr->func = subfunc; + if ((sptr->rp = rplay_create(RPLAY_PLAY)) == NULL) + { + twmrc_error_prefix(); + fprintf(stderr, "unable to add to sound list\n"); + Done(); + } + + sound_count++; + + if (volume < 0) + volume = sound_vol; + else + volume = adjustVolume(volume); + + if (rplay_set(sptr->rp, RPLAY_INSERT, 0, RPLAY_SOUND, filename, + RPLAY_VOLUME, volume, NULL) < 0) + { + twmrc_error_prefix(); + fprintf(stderr, "unable to set \"%s\" in sound list\n", + filename); + Done(); + } + + return (1); + } + + twmrc_error_prefix(); + fprintf(stderr, "unknown function \"%s\" for sound_entry\n", function); + + return (0); +} + +int +PlaySound(function) +int function; +{ + register int i, low, mid, high; + + if (sound_fd < 0 || sound_state == 0) + return (1); /* pretend success */ + + low = 0; + high = sound_count - 1; + while (low <= high) + { + mid = (low + high) / 2; + i = sound_entries[mid].func - function; + if (i < 0) + low = mid + 1; + else if (i > 0) + high = mid - 1; + else + { + rplay(sound_fd, sound_entries[mid].rp); + return (1); + } + } + + return (0); +} + +int +PlaySoundAdhoc(filename) +char *filename; +{ + RPLAY *rp; + int i; + + if (sound_fd < 0 || sound_state == 0) + return (1); /* pretend success */ + + if ((rp = rplay_create(RPLAY_PLAY)) == NULL) + { + twmrc_error_prefix(); + fprintf(stderr, "unable to create sound \"%s\"\n", filename); + return (0); + } + + if ((i = rplay_set(rp, RPLAY_INSERT, 0, RPLAY_SOUND, filename, + RPLAY_VOLUME, sound_vol, NULL)) >= 0) + rplay(sound_fd, rp); + + rplay_destroy(rp); + + if (i < 0) + { + twmrc_error_prefix(); + fprintf(stderr, "unable to set sound \"%s\"\n", filename); + return (0); + } + + return (1); +} + +void +SetSoundHost(host) +char *host; +{ + strncpy(sound_host, host, MAXHOSTNAMELEN); + sound_host[MAXHOSTNAMELEN] = '\0'; +} + +void +SetSoundVolume(volume) +int volume; +{ + if (volume < 0) + volume = 0; + + sound_vol = adjustVolume(volume); +} + +int +ToggleSounds() +{ + return ((sound_state ^= 1)); +} + +#endif /* NO_SOUND_SUPPORT */ diff --git a/sound.h b/sound.h new file mode 100644 index 0000000..db05b8b --- /dev/null +++ b/sound.h @@ -0,0 +1,48 @@ +/* + * Copyright 2001, 2002 David J. Hawkey Jr. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holder or the author not + * be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. The copyright holder + * and the author make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * THE COPYRIGHT HOLDER AND THE AUTHOR DISCLAIM ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR THE AUTHOR BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * sound.h + * + * D. J. Hawkey Jr. - 6/22/01 11/15/02 + */ + +#ifndef _SOUND_ +#define _SOUND_ + +/* must not overlap the function defines */ +#define S_START 900 +#define S_STOP 901 +#define S_CMAP 902 +#define S_CUNMAP 903 +#define S_MMAP 904 +#define S_MUNMAP 905 +#define S_IUNMAP 906 +#define S_APAN 907 +#define S_BELL 908 + +extern int OpenSound(), SetSound(), ToggleSounds(); +extern int PlaySound(), PlaySoundAdhoc(); +extern void CloseSound(), SetSoundHost(), SetSoundVolume(); + +#endif /* _SOUND_ */ diff --git a/system.vtwmrc.2D b/system.vtwmrc.2D new file mode 100644 index 0000000..869e527 --- /dev/null +++ b/system.vtwmrc.2D @@ -0,0 +1,250 @@ +# +# system.vtwmrc.2D +# +# Default VTWM configuration file; should be kept small to conserve string +# space in systems whose compilers don't handle medium-sized strings. +# +# Sites should tailor this file, providing any extra title buttons, menus, +# etc., that may be appropriate for their environment. For example, if most +# of the users were accustomed to uwm, the defaults could be set up not to +# decorate any windows and to use meta-keys. +# + +# +# Variables +# + +NoGrabServer +RestartPreviousState +NoDefaults + +ShowIconManager +SortIconManager +IconifyByUnmapping + +RightHandSidePulldownMenus + +NaturalAutoPanBehavior +NotVirtualGeometries +FixManagedVirtualGeometries +FixTransientVirtualGeometries + +MoveDelta 3 + +ResizeRegion "NorthEast" + +FramePadding 2 +ButtonIndent 0 +TitlePadding 5 +TitleButtonBorderWidth 1 + +VirtualDesktop "5x2-0-0" 16 +PanDistanceX 100 +PanDistanceY 100 +PanResistance 750 +AutoPan 100 + +TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +ResizeFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +MenuFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +MenuTitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +DoorFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +IconFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +InfoFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +IconManagerFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +VirtualDesktopFont "-adobe-helvetica-medium-r-normal--*-75-*-*-*-*-*-*" + +# +# Lists +# + +SqueezeTitle + +WarpCursor + +NailedDown +{ + "VTWM *" + "xclock" + "xload" +} + +NoTitle +{ + "VTWM *" + "xclock" + "xload" +} + +DontShowInDisplay +{ + "VTWM *" + "xclock" + "xload" +} + +IconManagerDontShow +{ + "VTWM *" + "xclock" + "xload" +} + +Pixmaps +{ + "MenuIconPixmap" ":rarrow" +} + +Color +{ + DefaultBackground "maroon" + DefaultForeground "gray85" + BorderColor "grey70" + BorderTileBackground "gray60" + BorderTileForeground "gray60" + DoorBackground "maroon" + DoorForeground "gray85" + TitleBackground "maroon" + TitleForeground "gray85" + MenuBackground "maroon" + MenuForeground "gray85" + MenuTitleBackground "gray70" + MenuTitleForeground "maroon" + IconBackground "maroon" + IconForeground "gray85" + IconBorderColor "gray85" + IconManagerBackground "maroon" + IconManagerForeground "gray85" + VirtualBackground "maroon" + VirtualForeground "black" + DesktopDisplayBackground "grey60" + DesktopDisplayForeground "grey85" +} + +Monochrome +{ + DefaultBackground "gray50" + DefaultForeground "gray85" + BorderColor "grey70" + BorderTileBackground "gray60" + BorderTileForeground "gray60" + DoorBackground "gray50" + DoorForeground "gray85" + TitleBackground "gray50" + TitleForeground "gray85" + MenuBackground "gray50" + MenuForeground "gray85" + MenuTitleBackground "gray70" + MenuTitleForeground "gray50" + IconBackground "gray50" + IconForeground "gray85" + IconBorderColor "gray85" + IconManagerBackground "gray50" + IconManagerForeground "gray85" + VirtualBackground "gray50" + VirtualForeground "black" + DesktopDisplayBackground "grey60" + DesktopDisplayForeground "grey85" +} + +# +# Functions and Bindings +# + +Function "move-or-iconify" { f.move f.deltastop f.iconify } + +LeftTitleButton ":darrow" = f.menu "arrange" +RightTitleButton ":dot" = f.iconify +RightTitleButton ":resize" = f.resize + +Button1 = : root : f.version +Button3 = : root : f.menu "main" + +Button1 = : title : f.move +Button2 = : title : f.resize +Button3 = : title : f.raiselower + +Button1 = : frame : f.move +Button2 = : frame : f.resize +Button3 = : frame : f.iconify + +Button1 = : door : f.enterdoor +Button2 = : door : f.namedoor +Button3 = : door : f.deletedoor + +Button1 = : icon : f.function "move-or-iconify" +Button3 = : icon : f.menu "arrange" + +Button1 = : iconmgr : f.iconify +Button3 = : iconmgr : f.warp + +Button1 = : virtual | desktop : f.movescreen + +# +# Menus +# + +menu "main" +{ + " VTWM " f.title + "Applications" f.menu "apps" + "" f.separator + "Operations" f.menu "ops" + "Arrange" f.menu "arrange" + "" f.separator + "Restart" f.restart + "Exit" f.quit +} + +menu "apps" +{ + " Applications " f.title + "xclock" f.exec "xclock &" + "xload" f.exec "xload &" + "xterm" f.exec "xterm &" +} + +menu "ops" +{ + " Operations " f.title + "Auto Pan" f.autopan + "New Door" f.newdoor + "Snap Screen" f.snaprealscreen + "Static Icons" f.staticiconpositions + "Warp Snug" f.warpsnug + "Warp Visible" f.warpvisible + "" f.separator + "Show Icon Mgr" f.showiconmgr + "Hide Icon Mgr" f.hideiconmgr + "Show Desktop" f.showdesktopdisplay + "Hide Desktop" f.hidedesktopdisplay + "" f.separator + "Refresh" f.refresh +} + +menu "arrange" +{ + " Arrange " f.title + "Autoraise" f.autoraise + "Raise" f.raise + "Lower" f.lower + "Nail" f.nail + "" f.separator + "Move" f.move + "Size" f.resize + "Iconify" f.iconify + "" f.separator + "Full Zoom" f.fullzoom + "Horiz Zoom" f.horizoom + "Vert Zoom" f.zoom + "" f.separator + "Left Title" f.squeezeleft + "Center Title" f.squeezecenter + "Right Title" f.squeezeright + "" f.separator + "Identify" f.identify + "" f.separator + "Delete" f.delete + "Destroy" f.destroy +} + diff --git a/system.vtwmrc.3D b/system.vtwmrc.3D new file mode 100644 index 0000000..fa9dcc1 --- /dev/null +++ b/system.vtwmrc.3D @@ -0,0 +1,271 @@ +# +# system.vtwmrc.3D +# +# Default VTWM configuration file; should be kept small to conserve string +# space in systems whose compilers don't handle medium-sized strings. +# +# Sites should tailor this file, providing any extra title buttons, menus, +# etc., that may be appropriate for their environment. For example, if most +# of the users were accustomed to uwm, the defaults could be set up not to +# decorate any windows and to use meta-keys. +# + +# +# Variables +# + +NoGrabServer +RestartPreviousState +NoDefaults + +ShowIconManager +SortIconManager +IconifyByUnmapping + +RightHandSidePulldownMenus + +NaturalAutoPanBehavior +NotVirtualGeometries +FixManagedVirtualGeometries +FixTransientVirtualGeometries + +ButtonColorIsFrame +ShallowReliefWindowButton + +MoveDelta 3 + +ResizeRegion "NorthEast" + +FramePadding 2 +ButtonIndent -2 +TitlePadding 0 +TitleButtonBorderWidth 0 + +BorderWidth 6 +BorderBevelWidth 2 +ButtonBevelWidth 1 +DoorBevelWidth 1 +IconBevelWidth 2 +IconManagerBevelWidth 1 +InfoBevelWidth 2 +MenuBevelWidth 2 +TitleBevelWidth 1 +VirtualDesktopBevelWidth 1 + +ClearBevelContrast 40 +DarkBevelContrast 40 + +VirtualDesktop "5x2-0-0" 16 +PanDistanceX 100 +PanDistanceY 100 +PanResistance 750 +AutoPan 100 + +TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +ResizeFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +MenuFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +MenuTitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*" +DoorFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +IconFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +InfoFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +IconManagerFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*" +VirtualDesktopFont "-adobe-helvetica-medium-r-normal--*-75-*-*-*-*-*-*" + +# +# Lists +# + +NoHighlight + +SqueezeTitle + +WarpCursor + +NailedDown +{ + "VTWM *" + "xclock" + "xload" +} + +NoTitle +{ + "VTWM *" + "xclock" + "xload" +} + +DontShowInDisplay +{ + "VTWM *" + "xclock" + "xload" +} + +IconManagerDontShow +{ + "VTWM *" + "xclock" + "xload" +} + +Pixmaps +{ + TitleHighlight ":xpm:sunkenlines" + MenuIconPixmap ":xpm:rarrow" + IconManagerPixmap ":xpm:box" +} + +Color +{ + DefaultBackground "maroon" + DefaultForeground "gray85" + BorderColor "grey70" + BorderTileBackground "gray60" + BorderTileForeground "gray60" + DoorBackground "maroon" + DoorForeground "gray85" + TitleBackground "maroon" + TitleForeground "gray85" + MenuBackground "maroon" + MenuForeground "gray85" + MenuTitleBackground "gray70" + MenuTitleForeground "maroon" + IconBackground "maroon" + IconForeground "gray85" + IconBorderColor "gray85" + IconManagerBackground "maroon" + IconManagerForeground "gray85" + VirtualBackground "maroon" + VirtualForeground "black" + DesktopDisplayBackground "grey60" + DesktopDisplayForeground "grey85" +} + +Monochrome +{ + DefaultBackground "gray50" + DefaultForeground "gray85" + BorderColor "grey70" + BorderTileBackground "gray60" + BorderTileForeground "gray60" + DoorBackground "gray50" + DoorForeground "gray85" + TitleBackground "gray50" + TitleForeground "gray85" + MenuBackground "gray50" + MenuForeground "gray85" + MenuTitleBackground "gray70" + MenuTitleForeground "gray50" + IconBackground "gray50" + IconForeground "gray85" + IconBorderColor "gray85" + IconManagerBackground "gray50" + IconManagerForeground "gray85" + VirtualBackground "gray50" + VirtualForeground "black" + DesktopDisplayBackground "grey60" + DesktopDisplayForeground "grey85" +} + +# +# Functions and Bindings +# + +Function "move-or-iconify" { f.move f.deltastop f.iconify } + +LeftTitleButton ":xpm:darrow" = f.menu "arrange" +RightTitleButton ":xpm:dot" = f.iconify +RightTitleButton ":xpm:resize" = f.resize + +Button1 = : root : f.version +Button3 = : root : f.menu "main" + +Button1 = : title : f.move +Button2 = : title : f.resize +Button3 = : title : f.raiselower + +Button1 = : frame : f.move +Button2 = : frame : f.resize +Button3 = : frame : f.iconify + +Button1 = : door : f.enterdoor +Button2 = : door : f.namedoor +Button3 = : door : f.deletedoor + +Button1 = : icon : f.function "move-or-iconify" +Button3 = : icon : f.menu "arrange" + +Button1 = : iconmgr : f.iconify +Button3 = : iconmgr : f.warp + +Button1 = : virtual | desktop : f.movescreen + +# +# Menus +# + +menu "main" +{ + " VTWM " f.title + "Applications" f.menu "apps" + "" f.separator + "Operations" f.menu "ops" + "Arrange" f.menu "arrange" + "" f.separator + "Restart" f.restart + "Exit" f.quit +} + +menu "apps" +{ + " Applications " f.title + "xclock" f.exec "xclock &" + "xload" f.exec "xload &" + "xterm" f.exec "xterm &" +} + +menu "ops" +{ + " Operations " f.title + "Auto Pan" f.autopan + "New Door" f.newdoor + "Snap Screen" f.snaprealscreen + "Static Icons" f.staticiconpositions + "Warp Snug" f.warpsnug + "Warp Visible" f.warpvisible + "" f.separator + "Show Icon Mgr" f.showiconmgr + "Hide Icon Mgr" f.hideiconmgr + "Show Desktop" f.showdesktopdisplay + "Hide Desktop" f.hidedesktopdisplay + "" f.separator + "Refresh" f.refresh +} + +menu "arrange" +{ + " Arrange " f.title + "Autoraise" f.autoraise + "Raise" f.raise + "Lower" f.lower + "Nail" f.nail + "" f.separator + "Move" f.move + "Size" f.resize + "Iconify" f.iconify + "" f.separator + "Full Zoom" f.fullzoom + "Horiz Zoom" f.horizoom + "Vert Zoom" f.zoom + "" f.separator + "Left Title" f.squeezeleft + "Center Title" f.squeezecenter + "Right Title" f.squeezeright + "" f.separator + "Identify" f.identify + "" f.separator + "Delete" f.delete + "Destroy" f.destroy +} + diff --git a/twm.c b/twm.c new file mode 100644 index 0000000..1402eee --- /dev/null +++ b/twm.c @@ -0,0 +1,1586 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/*********************************************************************** + * + * $XConsortium: twm.c,v 1.124 91/05/08 11:01:54 dave Exp $ + * + * twm - "Tom's Window Manager" + * + * 27-Oct-87 Thomas E. LaStrange File created + * 10-Oct-90 David M. Sternlicht Storing saved colors on root + ***********************************************************************/ + +#include +#include +#include +#include /* for sleep() */ +#include +#include +#include "twm.h" +#include "add_window.h" +#include "gc.h" +#include "parse.h" +#include "version.h" +#include "menus.h" +#include "events.h" +#include "util.h" +#include "gram.h" +#include "screen.h" +#include "iconmgr.h" +#include "desktop.h" +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +#include "sound.h" +#endif +#include +#include +#include +#include +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT +#include +#endif + +Display *dpy; /* which display are we talking to */ +Window ResizeWindow; /* the window we are resizing */ + +int MultiScreen = TRUE; /* try for more than one screen? */ +int NumScreens; /* number of screens in ScreenList */ +int HasShape; /* server supports shape extension? */ +int ShapeEventBase, ShapeErrorBase; +ScreenInfo **ScreenList; /* structures for each screen */ +ScreenInfo *Scr = NULL; /* the cur and prev screens */ +int PreviousScreen; /* last screen that we were on */ +int FirstScreen; /* TRUE ==> first screen of display */ +Bool PrintPID = False; /* controls PID file - djhjr - 12/2/01 */ +Bool PrintErrorMessages = False; /* controls error messages */ +static int RedirectError; /* TRUE ==> another window manager running */ +static int CatchRedirectError(); /* for settting RedirectError */ +static int TwmErrorHandler(); /* for everything else */ +void InitVariables(); +void InternUsefulAtoms(); + +char Info[INFO_LINES][INFO_SIZE]; /* info strings to print */ +int InfoLines; + +char *InitFile = NULL; +int parseInitFile = TRUE; /* djhjr - 10/7/02 */ + +Cursor UpperLeftCursor; /* upper Left corner cursor */ +Cursor RightButt; +Cursor MiddleButt; +Cursor LeftButt; + +XContext TwmContext; /* context for twm windows */ +XContext MenuContext; /* context for all menu windows */ +XContext IconManagerContext; /* context for all window list windows */ +XContext VirtualContext; /* context for all desktop display windows */ +XContext ScreenContext; /* context to get screen data */ +XContext ColormapContext; /* context for colormap operations */ +XContext DoorContext; /* context for doors */ + +XClassHint NoClass; /* for applications with no class */ + +XGCValues Gcv; + +char *Home; /* the HOME environment variable */ +int HomeLen; /* length of Home */ +int ParseError; /* error parsing the .twmrc file */ + +int HandlingEvents = FALSE; /* are we handling events yet? */ + +Window JunkRoot; /* junk window */ +Window JunkChild; /* junk window */ +int JunkX; /* junk variable */ +int JunkY; /* junk variable */ +unsigned int JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMask; + +char *ProgramName, *PidName = "vtwm.pid"; /* PID file - djhjr - 12/2/01 */ +int Argc; +char **Argv; +char **Environ; + +Bool RestartPreviousState = False; /* try to restart in previous state */ + +unsigned long black, white; + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT +Bool use_fontset; +#endif + +extern void assign_var_savecolor(); + +/* djhjr - 4/26/99 */ +extern void FreeRegions(); + +/*********************************************************************** + * + * Procedure: + * main - start of twm + * + *********************************************************************** + */ + +/* Changes for m4 pre-processing submitted by Jason Gloudon */ +int +main(argc, argv, environ) + int argc; + char **argv; + char **environ; +{ + Window root, parent, *children; + unsigned int nchildren; + int i, j; + char *def, *display_name = NULL; + unsigned long valuemask; /* mask for create windows */ + XSetWindowAttributes attributes; /* attributes for create windows */ + int numManaged, firstscrn, lastscrn, scrnum; + extern ColormapWindow *CreateColormapWindow(); +#ifndef NO_M4_SUPPORT + int m4_preprocess = False; /* filter the *twmrc file through m4 */ + char *m4_option = NULL; /* pass these options to m4 - djhjr - 2/20/98 */ +#endif +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + int sound_state = 0; +#endif + extern char *defTwmrc[]; /* djhjr - 10/7/02 */ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + char *loc; +#endif + + /* djhjr - 7/21/98 */ + SIGNAL_T QueueRestartVtwm(); + + if ((ProgramName = strrchr(argv[0], '/'))) + ProgramName++; + else + ProgramName = argv[0]; + Argc = argc; + Argv = argv; + Environ = environ; + + for (i = 1; i < argc; i++) { + if (argv[i][0] == '-') { + switch (argv[i][1]) { + case 'd': /* -display display */ + if (++i >= argc) goto usage; + display_name = argv[i]; + continue; + case 'f': /* -file [initfile] */ + /* this isn't really right, but hey... - djhjr - 10/7/02 */ + if (i + 1 < argc && + (argv[i + 1][0] != '-' || + (argv[i + 1][0] == '-' && !strchr("dfmpsv", argv[i + 1][1])))) + InitFile = argv[++i]; + else + parseInitFile = FALSE; + continue; +#ifndef NO_M4_SUPPORT + case 'm': /* -m4 [options] */ + m4_preprocess = True; + /* this isn't really right, but hey... - djhjr - 2/20/98 */ + if (i + 1 < argc && + (argv[i + 1][0] != '-' || + (argv[i + 1][0] == '-' && !strchr("dfmpsv", argv[i + 1][1])))) + m4_option = argv[++i]; + continue; +#endif + case 'p': /* -pidfile - djhjr - 12/2/01 */ + PrintPID = True; + continue; + case 's': /* -single */ + MultiScreen = FALSE; + continue; + case 'v': /* -verbose */ + PrintErrorMessages = True; + continue; +#ifdef NEVER /* djhjr - 2/20/99 */ + case 'q': /* -quiet */ + PrintErrorMessages = False; + continue; +#endif + } + } + usage: + fprintf (stderr, +#ifndef NO_M4_SUPPORT + "usage: %s [-d display] [-f [initfile]] [-m [options]] [-p] [-s] [-v]\n", +#else + "usage: %s [-d display] [-f [initfile]] [-p] [-s] [-v]\n", +#endif + ProgramName); + exit (1); + } + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + loc = setlocale(LC_ALL, ""); + if (!loc || !strcmp(loc, "C") || !strcmp(loc, "POSIX") || + !XSupportsLocale()) + use_fontset = False; + else + use_fontset = True; + + if (PrintErrorMessages) + fprintf(stderr, "%s: I18N supported, L10N %sabled\n", + ProgramName, (use_fontset) ? "en" : "dis"); +#endif + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +#define sounddonehandler(sig) \ + if (signal (sig, SIG_IGN) != SIG_IGN) (void) signal (sig, PlaySoundDone) +#else +#define sounddonehandler(sig) \ + if (signal (sig, SIG_IGN) != SIG_IGN) (void) signal (sig, Done) +#endif +#define donehandler(sig) \ + if (signal (sig, SIG_IGN) != SIG_IGN) (void) signal (sig, Done) + + sounddonehandler (SIGINT); + sounddonehandler (SIGHUP); + sounddonehandler (SIGQUIT); + sounddonehandler (SIGTERM); + + /* djhjr - 12/2/01 */ + donehandler (SIGABRT); + donehandler (SIGFPE); + donehandler (SIGSEGV); + donehandler (SIGILL); + donehandler (SIGTSTP); + donehandler (SIGPIPE); +#undef sounddonehandler +#undef donehandler + + /* djhjr - 7/31/98 */ + signal (SIGUSR1, QueueRestartVtwm); + + Home = getenv("HOME"); + if (Home == NULL) + Home = "./"; + + HomeLen = strlen(Home); + + NoClass.res_name = NoName; + NoClass.res_class = NoName; + + if (!(dpy = XOpenDisplay(display_name))) { + fprintf (stderr, "%s: unable to open display \"%s\"\n", + ProgramName, XDisplayName(display_name)); + exit (1); + } + + if (fcntl(ConnectionNumber(dpy), F_SETFD, 1) == -1) { + fprintf (stderr, + "%s: unable to mark display connection as close-on-exec\n", + ProgramName); + exit (1); + } + + HasShape = XShapeQueryExtension (dpy, &ShapeEventBase, &ShapeErrorBase); + TwmContext = XUniqueContext(); + MenuContext = XUniqueContext(); + IconManagerContext = XUniqueContext(); + VirtualContext = XUniqueContext(); + ScreenContext = XUniqueContext(); + ColormapContext = XUniqueContext(); + DoorContext = XUniqueContext(); + + InternUsefulAtoms (); + + + /* Set up the per-screen global information. */ + + NumScreens = ScreenCount(dpy); + + if (MultiScreen) + { + firstscrn = 0; + lastscrn = NumScreens - 1; + } + else + { + firstscrn = lastscrn = DefaultScreen(dpy); + } + + InfoLines = 0; + + /* for simplicity, always allocate NumScreens ScreenInfo struct pointers */ + ScreenList = (ScreenInfo **) calloc (NumScreens, sizeof (ScreenInfo *)); + if (ScreenList == NULL) + { + fprintf (stderr, "%s: Unable to allocate memory for screen list, exiting.\n", + ProgramName); + exit (1); + } + numManaged = 0; + PreviousScreen = DefaultScreen(dpy); + FirstScreen = TRUE; + for (scrnum = firstscrn ; scrnum <= lastscrn; scrnum++) + { + /* Make sure property priority colors is empty */ + XChangeProperty (dpy, RootWindow(dpy, scrnum), _XA_MIT_PRIORITY_COLORS, + XA_CARDINAL, 32, PropModeReplace, NULL, 0); + RedirectError = FALSE; + XSetErrorHandler(CatchRedirectError); + XSelectInput(dpy, RootWindow (dpy, scrnum), + ColormapChangeMask | EnterWindowMask | PropertyChangeMask | + SubstructureRedirectMask | KeyPressMask | + ButtonPressMask | ButtonReleaseMask); + XSync(dpy, 0); + XSetErrorHandler(TwmErrorHandler); + + if (RedirectError) + { + fprintf (stderr, "%s: another window manager is already running", + ProgramName); + if (MultiScreen && NumScreens > 0) + fprintf(stderr, " on screen %d?\n", scrnum); + else + fprintf(stderr, "?\n"); + continue; + } + + numManaged ++; + + /* Note: ScreenInfo struct is calloc'ed to initialize to zero. */ + Scr = ScreenList[scrnum] = + (ScreenInfo *) calloc(1, sizeof(ScreenInfo)); + if (Scr == NULL) + { + fprintf (stderr, "%s: unable to allocate memory for ScreenInfo structure for screen %d.\n", + ProgramName, scrnum); + continue; + } + + /* initialize list pointers, remember to put an initialization + * in InitVariables also + */ + Scr->BorderColorL = NULL; + Scr->IconBorderColorL = NULL; + Scr->BorderTileForegroundL = NULL; + Scr->BorderTileBackgroundL = NULL; + Scr->TitleForegroundL = NULL; + Scr->TitleBackgroundL = NULL; + Scr->IconForegroundL = NULL; + Scr->IconBackgroundL = NULL; + Scr->NoTitle = NULL; + Scr->MakeTitle = NULL; + Scr->AutoRaise = NULL; + Scr->IconNames = NULL; + Scr->NoHighlight = NULL; + Scr->NoStackModeL = NULL; + Scr->NoTitleHighlight = NULL; + Scr->DontIconify = NULL; + Scr->IconMgrNoShow = NULL; + Scr->IconMgrShow = NULL; + Scr->IconifyByUn = NULL; + Scr->IconManagerFL = NULL; + Scr->IconManagerBL = NULL; + Scr->IconMgrs = NULL; + Scr->StartIconified = NULL; + Scr->SqueezeTitleL = NULL; + Scr->DontSqueezeTitleL = NULL; + Scr->WindowRingL = NULL; + + /* submitted by Jonathan Paisley - 10/27/02 */ + Scr->NoWindowRingL = NULL; + + Scr->WarpCursorL = NULL; + + /* djhjr - 4/22/96 */ + Scr->ImageCache = NULL; + + /* djhjr - 4/7/98 */ + Scr->OpaqueMoveL = NULL; + Scr->NoOpaqueMoveL = NULL; + Scr->OpaqueResizeL = NULL; + Scr->NoOpaqueResizeL = NULL; + + /* djhjr - 5/2/98 */ + Scr->NoBorder = NULL; + + /* djhjr - 9/24/02 */ + Scr->UsePPositionL = NULL; + + /* remember to put an initialization in InitVariables also + */ + + Scr->screen = scrnum; + Scr->d_depth = DefaultDepth(dpy, scrnum); + Scr->d_visual = DefaultVisual(dpy, scrnum); + Scr->Root = RootWindow(dpy, scrnum); + XSaveContext (dpy, Scr->Root, ScreenContext, (caddr_t) Scr); + + /* djhjr - 1/31/99 */ + if ((def = XGetDefault(dpy, "*", "bitmapFilePath"))) + Scr->BitmapFilePath = strdup(def); + else + Scr->BitmapFilePath = NULL; + + Scr->TwmRoot.cmaps.number_cwins = 1; + Scr->TwmRoot.cmaps.cwins = + (ColormapWindow **) malloc(sizeof(ColormapWindow *)); + Scr->TwmRoot.cmaps.cwins[0] = + CreateColormapWindow(Scr->Root, True, False); + Scr->TwmRoot.cmaps.cwins[0]->visibility = VisibilityPartiallyObscured; + + Scr->cmapInfo.cmaps = NULL; + Scr->cmapInfo.maxCmaps = + MaxCmapsOfScreen(ScreenOfDisplay(dpy, Scr->screen)); + Scr->cmapInfo.root_pushes = 0; + InstallWindowColormaps(0, &Scr->TwmRoot); + + Scr->StdCmapInfo.head = Scr->StdCmapInfo.tail = + Scr->StdCmapInfo.mru = NULL; + Scr->StdCmapInfo.mruindex = 0; + LocateStandardColormaps(); + + Scr->TBInfo.nleft = Scr->TBInfo.nright = 0; + Scr->TBInfo.head = NULL; + +/* djhjr - 4/19/96 + Scr->TBInfo.border = 1; +*/ + Scr->TBInfo.border = -100; + + Scr->TBInfo.width = 0; + Scr->TBInfo.leftx = 0; + Scr->TBInfo.titlex = 0; + + Scr->MyDisplayWidth = DisplayWidth(dpy, scrnum); + Scr->MyDisplayHeight = DisplayHeight(dpy, scrnum); + Scr->MaxWindowWidth = 32767 - Scr->MyDisplayWidth; + Scr->MaxWindowHeight = 32767 - Scr->MyDisplayHeight; + + Scr->XORvalue = (((unsigned long) 1) << Scr->d_depth) - 1; + + if (DisplayCells(dpy, scrnum) < 3) + Scr->Monochrome = MONOCHROME; + else + Scr->Monochrome = COLOR; + + /* setup default colors */ + Scr->FirstTime = TRUE; + GetColor(Scr->Monochrome, &black, "black"); + Scr->Black = black; + GetColor(Scr->Monochrome, &white, "white"); + Scr->White = white; + + if (FirstScreen) + { + SetFocus ((TwmWindow *)NULL, CurrentTime); + + /* define cursors */ + + NewFontCursor(&UpperLeftCursor, "top_left_corner"); + NewFontCursor(&RightButt, "rightbutton"); + NewFontCursor(&LeftButt, "leftbutton"); + NewFontCursor(&MiddleButt, "middlebutton"); + } + + Scr->iconmgr.x = 0; + Scr->iconmgr.y = 0; + Scr->iconmgr.width = 150; + Scr->iconmgr.height = 5; + Scr->iconmgr.next = NULL; + Scr->iconmgr.prev = NULL; + Scr->iconmgr.lasti = &(Scr->iconmgr); + Scr->iconmgr.first = NULL; + Scr->iconmgr.last = NULL; + Scr->iconmgr.active = NULL; + Scr->iconmgr.scr = Scr; + Scr->iconmgr.columns = 1; + Scr->iconmgr.count = 0; + Scr->iconmgr.name = "VTWM"; + Scr->iconmgr.icon_name = "Icons"; + + Scr->IconDirectory = NULL; + + /* djhjr - 10/30/02 */ + Scr->hiliteName = NULL; + Scr->menuIconName = TBPM_MENU; + Scr->iconMgrIconName = TBPM_XLOGO; + +/* djhjr - 10/30/02 + Scr->siconifyPm = NULL; + Scr->pullPm = NULL; +*/ + +/* djhjr - 5/17/98 */ +#ifdef ORIGINAL_PIXMAPS + Scr->hilitePm = None; + Scr->virtualPm = None; /* RFB PIXMAP */ + Scr->RealScreenPm = None; /* RFB PIXMAP */ +#else /* ORIGINAL_PIXMAPS */ + /* djhjr - 10/25/02 */ + Scr->hiliteName = NULL; + + Scr->hilitePm = NULL; + Scr->virtualPm = NULL; + Scr->realscreenPm = NULL; +#endif /* ORIGINAL_PIXMAPS */ + + if ( Scr->FirstTime ) + { /* retain max size on restart. */ + Scr->VirtualDesktopMaxWidth = 0; + Scr->VirtualDesktopMaxHeight = 0; + } + + InitVariables(); + InitMenus(); + + /* added this 'if (...) else' - djhjr - 10/7/02 */ + if (!parseInitFile) + ParseStringList(defTwmrc); + else + { + /* Parse it once for each screen. */ +#ifndef NO_M4_SUPPORT + /* added 'm4_option' - djhjr - 2/20/99 */ + ParseTwmrc(InitFile, display_name, m4_preprocess, m4_option); +#else + ParseTwmrc(InitFile); +#endif + } + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + OpenSound(); + + if (PlaySound(S_START)) + { + /* + * Save setting from resource file, and turn sound off + */ + sound_state = ToggleSounds(); + sound_state ^= 1; + if (sound_state == 0) ToggleSounds(); + } +#endif + + assign_var_savecolor(); /* storeing pixels for twmrc "entities" */ + +/* djhjr - 10/17/02 */ +#if 0 + /* djhjr - 4/19/96 */ + /* was 'Scr->use3Dtitles' - djhjr - 8/11/98 */ + if (Scr->TitleBevelWidth > 0) { +/* djhjr - 10/17/02 + if (Scr->TBInfo.border == -100) Scr->TBInfo.border = 0; +*/ + +/* djhjr - 3/12/97 + if (Scr->ButtonIndent == -100) Scr->ButtonIndent = 0; + if (Scr->FramePadding == -100) Scr->FramePadding = 0; + if (Scr->TitlePadding == -100) Scr->TitlePadding = 0; +*/ + Scr->ButtonIndent = 0; + Scr->FramePadding = 0; + Scr->TitlePadding = 0; + +/* djhjr - 4/3/98 + * djhjr - 4/26/96 * + if (Scr->SunkFocusWindowTitle) Scr->TitleHighlight = FALSE; +*/ + } + else { + /* djhjr - 4/5/98 */ + Scr->SunkFocusWindowTitle = FALSE; + } +#endif + + /* was only if Scr->TitleBevelWidth == 0 - djhjr - 10/17/02 */ + if (Scr->FramePadding == -100) Scr->FramePadding = 2; /* values that look */ + if (Scr->TitlePadding == -100) Scr->TitlePadding = 8; /* "nice" on */ + if (Scr->ButtonIndent == -100) Scr->ButtonIndent = 1; /* 75 and 100dpi displays */ + if (Scr->TBInfo.border == -100) Scr->TBInfo.border = 1; + + /* was 'Scr->use3D*' - djhjr - 8/11/98 */ + /* rem'd 'Scr->*BevelWidth > 0' - djhjr - 10/30/02 */ + if (/*Scr->TitleBevelWidth > 0 && */!Scr->BeNiceToColormap) GetShadeColors (&Scr->TitleC); + if (/*Scr->MenuBevelWidth > 0 && */!Scr->BeNiceToColormap) GetShadeColors (&Scr->MenuC); + if (Scr->MenuBevelWidth > 0 && !Scr->BeNiceToColormap) GetShadeColors (&Scr->MenuTitleC); + if (Scr->BorderBevelWidth > 0 && !Scr->BeNiceToColormap) GetShadeColors (&Scr->BorderColorC); + + /* djhjr - 2/7/99 */ + if (Scr->DoorBevelWidth > 0 && !Scr->BeNiceToColormap) GetShadeColors (&Scr->DoorC); + if (Scr->VirtualDesktopBevelWidth > 0 && !Scr->BeNiceToColormap) GetShadeColors (&Scr->VirtualC); + +/* djhjr - 8/11/98 + * was 'Scr->use3Dborders' - djhjr - 8/11/98 * + if (Scr->BorderBevelWidth == 0) + Scr->ThreeDBorderWidth = 0; + else +*/ + { +/* djhjr - 8/11/98 + * djhjr - 4/29/98 * + if (2 * Scr->BorderBevelWidth > Scr->ThreeDBorderWidth) + Scr->ThreeDBorderWidth = 2 * Scr->BorderBevelWidth; +*/ + if (2 * Scr->BorderBevelWidth > Scr->BorderWidth) + Scr->BorderWidth = 2 * Scr->BorderBevelWidth; + + if (!Scr->BeNiceToColormap) + GetShadeColors(&Scr->DefaultC); + } + + /* djhjr - 5/5/98 */ + /* was 'Scr->use3Dicons' - djhjr - 8/11/98 */ + if (Scr->IconBevelWidth > 0) + Scr->IconBorderWidth = 0; + + if (Scr->SqueezeTitle == -1) Scr->SqueezeTitle = FALSE; + if (!Scr->HaveFonts) CreateFonts(); + CreateGCs(); + MakeMenus(); + +/* djhjr - 10/18/02 */ +#if 0 + /* + * Set titlebar height from font height and padding, + * then adjust to titlebutton height - djhjr - 12/10/98 + */ + Scr->TitleBarFont.y += Scr->FramePadding; + i = Scr->TitleBarFont.height; + do + { + Scr->TitleBarFont.y += (i - Scr->TitleBarFont.height) / 2; + Scr->TitleHeight = i + Scr->FramePadding * 2; + +/* djhjr - 4/29/98 + * djhjr - 4/19/96 * + if (Scr->use3Dtitles) Scr->TitleHeight += 4; +*/ +/* djhjr - 10/18/02 + * was 'Scr->use3Dtitles' - djhjr - 8/11/98 * + if (Scr->TitleBevelWidth > 0) + Scr->TitleHeight += 2 * Scr->TitleBevelWidth + 2; +*/ + + /* make title height be odd so buttons look nice and centered */ + if (!(Scr->TitleHeight & 1)) Scr->TitleHeight++; + } while ((i = InitTitlebarButtons()) > Scr->TitleHeight - Scr->FramePadding * 2); +#else + /* set titlebar height to font height plus frame padding */ + Scr->TitleHeight = Scr->TitleBarFont.height + Scr->FramePadding * 2; + if (!(Scr->TitleHeight & 1)) Scr->TitleHeight++; + + i = InitTitlebarButtons(); /* returns the button height */ + + /* adjust titlebar height to button height */ + if (i > Scr->TitleHeight) Scr->TitleHeight = i + Scr->FramePadding * 2; + if (!(Scr->TitleHeight & 1)) Scr->TitleHeight++; + + /* adjust font baseline */ + Scr->TitleBarFont.y += ((Scr->TitleHeight - Scr->TitleBarFont.height) / 2); +#endif + + XGrabServer(dpy); + XSync(dpy, 0); + + JunkX = 0; + JunkY = 0; + + XQueryTree(dpy, Scr->Root, &root, &parent, &children, &nchildren); + CreateIconManagers(); + if (!Scr->NoIconManagers) + Scr->iconmgr.twm_win->icon = TRUE; + + if (Scr->VirtualDesktopWidth > 0) + CreateDesktopDisplay(); + + /* create all of the door windows */ + door_open_all(); + + /* + * weed out icon windows + */ + for (i = 0; i < nchildren; i++) { + if (children[i]) { + XWMHints *wmhintsp = XGetWMHints (dpy, children[i]); + + if (wmhintsp) { + if (wmhintsp->flags & IconWindowHint) { + for (j = 0; j < nchildren; j++) { + if (children[j] == wmhintsp->icon_window) { + children[j] = None; + break; + } + } + } + XFree ((char *) wmhintsp); + } + } + } + + /* + * map all of the non-override windows + */ + for (i = 0; i < nchildren; i++) + { + if (children[i] && MappedNotOverride(children[i])) + { + XUnmapWindow(dpy, children[i]); + SimulateMapRequest(children[i]); + } + } + + if (Scr->ShowIconManager && !Scr->NoIconManagers) + { + Scr->iconmgr.twm_win->icon = FALSE; + if (Scr->iconmgr.count) + { + SetMapStateProp (Scr->iconmgr.twm_win, NormalState); + XMapWindow(dpy, Scr->iconmgr.w); + XMapWindow(dpy, Scr->iconmgr.twm_win->frame); + } + } + + /* djhjr - 5/9/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (!Scr->BorderBevelWidth > 0) + attributes.border_pixel = Scr->DefaultC.fore; + + attributes.background_pixel = Scr->DefaultC.back; + attributes.event_mask = (ExposureMask | ButtonPressMask | + KeyPressMask | ButtonReleaseMask); + attributes.backing_store = NotUseful; + +#ifdef ORIGINAL_INFOCURSOR + attributes.cursor = XCreateFontCursor (dpy, Scr->WaitCursor); + + /* djhjr - 5/9/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (!Scr->BorderBevelWidth > 0) + valuemask = (CWBorderPixel | CWBackPixel | CWEventMask | + CWBackingStore | CWCursor); + else + valuemask = (CWBackPixel | CWEventMask | CWBackingStore | CWCursor); +#else + + /* djhjr - 5/9/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (!Scr->BorderBevelWidth > 0) + valuemask = (CWBorderPixel | CWBackPixel | CWEventMask | + CWBackingStore); + else + valuemask = (CWBackPixel | CWEventMask | CWBackingStore); +#endif + + Scr->InfoWindow = XCreateWindow (dpy, Scr->Root, 0, 0, + (unsigned int) 5, (unsigned int) 5, + + /* djhjr - 5/9/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + (unsigned int) (Scr->InfoBevelWidth > 0) ? 0 : BW, 0, + + (unsigned int) CopyFromParent, + (Visual *) CopyFromParent, + valuemask, &attributes); + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + Scr->SizeStringWidth = MyFont_TextWidth (&Scr->SizeFont, +#else + Scr->SizeStringWidth = XTextWidth (Scr->SizeFont.font, +#endif +/* djhjr - 5/9/96 + " 8888 x 8888 ", 13); +*/ +/* djhjr - 4/29/98 + "nnnnnnnnnnnnn", 13); +*/ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + "nnnnnnnnnnnnn", 13) + ((Scr->InfoBevelWidth > 0) ? 2 * Scr->InfoBevelWidth : 0); + + /* djhjr - 5/9/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + if (!Scr->InfoBevelWidth > 0) + valuemask = (CWBorderPixel | CWBackPixel | CWBitGravity); + else + valuemask = (CWBackPixel | CWBitGravity); + + /* djhjr - 5/15/96 */ + switch (Scr->ResizeX) + { + case R_NORTHWEST: + Scr->ResizeX = 20; + Scr->ResizeY = 20; + break; + case R_NORTHEAST: + Scr->ResizeX = (Scr->MyDisplayWidth - Scr->SizeStringWidth) - 20; + Scr->ResizeY = 20; + break; + case R_SOUTHWEST: + Scr->ResizeX = 20; + Scr->ResizeY = (Scr->MyDisplayHeight - (Scr->SizeFont.height + SIZE_VINDENT*2)) - 20; + break; + case R_SOUTHEAST: + Scr->ResizeX = (Scr->MyDisplayWidth - Scr->SizeStringWidth) - 20; + Scr->ResizeY = (Scr->MyDisplayHeight - (Scr->SizeFont.height + SIZE_VINDENT*2)) - 20; + break; + case R_CENTERED: + Scr->ResizeX = (Scr->MyDisplayWidth - Scr->SizeStringWidth) / 2; + Scr->ResizeY = (Scr->MyDisplayHeight - (Scr->SizeFont.height + SIZE_VINDENT*2)) / 2; + break; + } + + attributes.bit_gravity = NorthWestGravity; + Scr->SizeWindow = XCreateWindow (dpy, Scr->Root, + +/* djhjr - 5/15/96 + 0,0, +*/ + Scr->ResizeX, Scr->ResizeY, + + (unsigned int) Scr->SizeStringWidth, + +/* djhjr - 4/29/98 + (unsigned int) (Scr->SizeFont.height + SIZE_VINDENT*2), +*/ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + (unsigned int) (Scr->SizeFont.height + SIZE_VINDENT*2) + + ((Scr->InfoBevelWidth > 0) ? 2 * Scr->InfoBevelWidth : 0), + + /* djhjr - 5/9/96 */ + /* was 'Scr->use3Dborders' - djhjr - 8/11/98 */ + (unsigned int) (Scr->InfoBevelWidth > 0) ? 0 : BW, 0, + + (unsigned int) CopyFromParent, + (Visual *) CopyFromParent, + valuemask, &attributes); + + XUngrabServer(dpy); + + FirstScreen = FALSE; + Scr->FirstTime = FALSE; + } /* for */ + + if (numManaged == 0) { + if (MultiScreen && NumScreens > 0) + fprintf (stderr, "%s: unable to find any unmanaged screens\n", + ProgramName); + exit (1); + + } + + RestartPreviousState = False; + HandlingEvents = TRUE; + + RaiseStickyAbove(); /* DSE */ + RaiseAutoPan(); /* autopan windows should have been raised + after [re]starting vtwm -- DSE */ + + InitEvents(); + + /* profile function stuff by DSE */ +#define VTWM_PROFILE "VTWM Profile" + if (FindMenuRoot (VTWM_PROFILE)) { + ExecuteFunction (F_FUNCTION, VTWM_PROFILE, Event.xany.window, + &Scr->TwmRoot, &Event, C_NO_CONTEXT, FALSE); + } + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT + /* restore setting from resource file */ + if (sound_state == 1) ToggleSounds(); +#endif + + + /* write out a PID file - djhjr - 12/2/01 */ + if (PrintPID) + { + int fd, err = 0; + char buf[10], *fn = malloc(HomeLen + strlen(PidName) + 2); + + /* removed group and other permissions - djhjr - 10/20/02 */ + sprintf(fn, "%s/%s", Home, PidName); + if ((fd = open(fn, + O_WRONLY|O_EXCL|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR)) != -1) + { + sprintf(buf, "%d\n", getpid()); + err = write(fd, buf, strlen(buf)); + close(fd); + } + + if (fd == -1 || err == -1) + { + fprintf(stderr, "%s: cannot write to %s\n", ProgramName, fn); + DoAudible(); + } + + free(fn); + } + + HandleEvents(); + + return (0); +} + +/*********************************************************************** + * + * Procedure: + * InitVariables - initialize twm variables + * + *********************************************************************** + */ + +void InitVariables() +{ + FreeList(&Scr->BorderColorL); + FreeList(&Scr->IconBorderColorL); + FreeList(&Scr->BorderTileForegroundL); + FreeList(&Scr->BorderTileBackgroundL); + FreeList(&Scr->TitleForegroundL); + FreeList(&Scr->TitleBackgroundL); + FreeList(&Scr->IconForegroundL); + FreeList(&Scr->IconBackgroundL); + FreeList(&Scr->IconManagerFL); + FreeList(&Scr->IconManagerBL); + FreeList(&Scr->IconMgrs); + FreeList(&Scr->NoTitle); + FreeList(&Scr->MakeTitle); + FreeList(&Scr->AutoRaise); + FreeList(&Scr->IconNames); + FreeList(&Scr->NoHighlight); + FreeList(&Scr->NoStackModeL); + FreeList(&Scr->NoTitleHighlight); + FreeList(&Scr->DontIconify); + FreeList(&Scr->IconMgrNoShow); + FreeList(&Scr->IconMgrShow); + FreeList(&Scr->IconifyByUn); + FreeList(&Scr->StartIconified); + FreeList(&Scr->IconManagerHighlightL); + FreeList(&Scr->SqueezeTitleL); + FreeList(&Scr->DontSqueezeTitleL); + FreeList(&Scr->WindowRingL); + + /* submitted by Jonathan Paisley - 10/27/02 */ + FreeList(&Scr->NoWindowRingL); + + FreeList(&Scr->WarpCursorL); + FreeList(&Scr->NailedDown); + FreeList(&Scr->VirtualDesktopColorFL); + FreeList(&Scr->VirtualDesktopColorBL); + FreeList(&Scr->VirtualDesktopColorBoL); + FreeList(&Scr->DontShowInDisplay); + + /* Submitted by Erik Agsjo */ + FreeList(&Scr->DontShowInTWMWindows); + + FreeList(&Scr->DoorForegroundL); + FreeList(&Scr->DoorBackgroundL); + + /* djhjr - 4/22/96 */ + FreeList(&Scr->ImageCache); + + /* djhjr - 4/7/98 */ + FreeList(&Scr->OpaqueMoveL); + FreeList(&Scr->NoOpaqueMoveL); + FreeList(&Scr->OpaqueResizeL); + FreeList(&Scr->NoOpaqueResizeL); + + /* djhjr - 5/2/98 */ + FreeList(&Scr->NoBorder); + + /* djhjr - 9/24/02 */ + FreeList(&Scr->UsePPositionL); + + NewFontCursor(&Scr->FrameCursor, "top_left_arrow"); + NewFontCursor(&Scr->TitleCursor, "top_left_arrow"); + NewFontCursor(&Scr->IconCursor, "top_left_arrow"); + NewFontCursor(&Scr->IconMgrCursor, "top_left_arrow"); + NewFontCursor(&Scr->MoveCursor, "fleur"); + NewFontCursor(&Scr->ResizeCursor, "fleur"); + NewFontCursor(&Scr->MenuCursor, "sb_left_arrow"); + NewFontCursor(&Scr->ButtonCursor, "hand2"); + NewFontCursor(&Scr->WaitCursor, "watch"); + NewFontCursor(&Scr->SelectCursor, "dot"); + NewFontCursor(&Scr->DestroyCursor, "pirate"); + NewFontCursor(&Scr->DoorCursor, "exchange");/*RFBCURSOR*/ + NewFontCursor(&Scr->VirtualCursor, "rtl_logo");/*RFBCURSOR*/ + NewFontCursor(&Scr->DesktopCursor, "dotbox");/*RFBCURSOR*/ + Scr->NoCursor = NoCursor(); + + Scr->Ring = NULL; + Scr->RingLeader = NULL; + + Scr->DefaultC.fore = black; + Scr->DefaultC.back = white; + Scr->BorderColor = black; + Scr->BorderTileC.fore = black; + Scr->BorderTileC.back = white; + Scr->TitleC.fore = black; + Scr->TitleC.back = white; + Scr->MenuC.fore = black; + Scr->MenuC.back = white; + Scr->MenuTitleC.fore = black; + Scr->MenuTitleC.back = white; + Scr->MenuShadowColor = black; + Scr->IconC.fore = black; + Scr->IconC.back = white; + Scr->IconBorderColor = black; + Scr->IconManagerC.fore = black; + Scr->IconManagerC.back = white; + Scr->IconManagerHighlight = black; + + /* djhjr - 4/19/96 */ + Scr->FramePadding = -100; + Scr->TitlePadding = -100; + Scr->ButtonIndent = -100; + +/* djhjr - 8/11/98 + Scr->ThreeDBorderWidth = 6; +*/ + + /* djhjr - 5/15/96 */ + Scr->ResizeX = Scr->ResizeY = 0; + + Scr->VirtualC.fore = black;/*RFB VCOLOR*/ + Scr->VirtualC.back = white;/*RFB VCOLOR*/ + Scr->RealScreenC.back = black;/*RFB 4/92 */ + Scr->RealScreenC.fore = white;/*RFB 4/92 */ + Scr->VirtualDesktopDisplayC.fore = black; + Scr->VirtualDesktopDisplayC.back = white; + Scr->VirtualDesktopDisplayBorder = black; + Scr->DoorC.fore = black; + Scr->DoorC.back = white; + + Scr->AutoRaiseDefault = FALSE;/*RAISEDELAY*/ + Scr->FramePadding = 2; /* values that look "nice" on */ + Scr->TitlePadding = 8; /* 75 and 100dpi displays */ + Scr->ButtonIndent = 1; + Scr->SizeStringOffset = 0; + Scr->BorderWidth = BW; + Scr->IconBorderWidth = BW; + +/* djhjr - 8/13/98 */ +#ifdef ORIGINAL_PIXMAPS + Scr->UnknownWidth = 0; + Scr->UnknownHeight = 0; +#else + Scr->unknownName = NULL; +#endif + + Scr->NumAutoRaises = 0; +/* Scr->NoDefaults = FALSE; */ + Scr->NoDefaultMouseOrKeyboardBindings = FALSE; /* DSE */ + Scr->NoDefaultTitleButtons = FALSE; /* DSE */ + Scr->UsePPosition = PPOS_OFF; + Scr->FocusRoot = TRUE; + Scr->Newest = NULL; /* PF */ + Scr->Focus = NULL; + + /* djhjr - 9/10/03 */ + Scr->IgnoreModifiers = 0; + + /* djhjr - 10/16/02 */ + Scr->WarpCentered = WARPC_OFF; + + Scr->WarpCursor = FALSE; + Scr->ForceIcon = FALSE; + Scr->NoGrabServer = FALSE; + Scr->NoRaiseMove = FALSE; + Scr->NoRaiseResize = FALSE; + Scr->NoRaiseDeicon = FALSE; + Scr->NoRaiseWarp = FALSE; + Scr->DontMoveOff = FALSE; + Scr->DoZoom = FALSE; + Scr->TitleFocus = TRUE; + + /* djhjr - 5/27/98 */ + Scr->IconManagerFocus = TRUE; + + /* djhjr - 12/14/98 */ + Scr->StaticIconPositions = FALSE; + + /* djhjr - 10/2/01 */ + Scr->StrictIconManager = FALSE; + + /* djhjr - 8/23/02 */ + Scr->NoBorders = FALSE; + + Scr->NoTitlebar = FALSE; + Scr->DecorateTransients = FALSE; + Scr->IconifyByUnmapping = FALSE; + Scr->ShowIconManager = FALSE; + Scr->IconManagerDontShow =FALSE; + Scr->BackingStore = TRUE; + Scr->SaveUnder = TRUE; + Scr->RandomPlacement = FALSE; + Scr->PointerPlacement = FALSE; + Scr->OpaqueMove = FALSE; + + /* djhjr - 4/6/98 */ + Scr->OpaqueResize = FALSE; + + Scr->Highlight = TRUE; + + /* djhjr - 1/27/98 */ + Scr->IconMgrHighlight = TRUE; + + Scr->StackMode = TRUE; + Scr->TitleHighlight = TRUE; + Scr->MoveDelta = 1; /* so that f.deltastop will work */ + Scr->ZoomCount = 8; + Scr->SortIconMgr = FALSE; + Scr->Shadow = TRUE; + Scr->InterpolateMenuColors = FALSE; + Scr->NoIconManagers = FALSE; + Scr->NoIconifyIconManagers = FALSE; /* PF */ + Scr->ClientBorderWidth = FALSE; + Scr->SqueezeTitle = -1; + +/* djhjr - 4/26/99 + Scr->FirstIconRegion = NULL; + Scr->LastIconRegion = NULL; +*/ + FreeRegions(Scr->FirstIconRegion, Scr->LastIconRegion); + + /* djhjr - 4/26/99 */ + FreeRegions(Scr->FirstAppletRegion, Scr->LastAppletRegion); + + Scr->FirstTime = TRUE; + Scr->HaveFonts = FALSE; /* i.e. not loaded yet */ + Scr->CaseSensitive = TRUE; + Scr->WarpUnmapped = FALSE; + Scr->DeIconifyToScreen = FALSE; + Scr->WarpWindows = FALSE; + Scr->WarpToTransients = FALSE; /* PF */ + + /* djhjr - 6/25/96 */ + Scr->ShallowReliefWindowButton = 2; + +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 + * djhjr - 4/19/96 * + Scr->use3Diconmanagers = FALSE; + Scr->use3Dmenus = FALSE; + Scr->use3Dtitles = FALSE; + Scr->use3Dborders = FALSE; +*/ + + Scr->ClearBevelContrast = 50; + Scr->DarkBevelContrast = 40; + Scr->BeNiceToColormap = FALSE; + +/* obsoleted by the *BevelWidth resources - djhjr - 8/11/98 + * djhjr - 5/5/98 * + Scr->use3Dicons = FALSE; +*/ + +/* obsoleted by the ":xpm:*" built-in pixmaps - djhjr - 10/26/02 + * djhjr - 4/26/96 * + Scr->SunkFocusWindowTitle = FALSE; +*/ + + /* for rader - djhjr - 2/9/99 */ + Scr->NoPrettyTitles = FALSE; + + /* djhjr - 9/21/96 */ + Scr->ButtonColorIsFrame = FALSE; + + Scr->snapRealScreen = FALSE; + Scr->OldFashionedTwmWindowsMenu = FALSE; + Scr->GeometriesAreVirtual = TRUE; + Scr->UseWindowRing = FALSE; + + /* setup default fonts; overridden by defaults from system.twmrc */ +#define DEFAULT_NICE_FONT "variable" +#define DEFAULT_FAST_FONT "fixed" +#define DEFAULT_SMALL_FONT "5x8" + + Scr->TitleBarFont.font = NULL; + Scr->TitleBarFont.name = DEFAULT_NICE_FONT; + Scr->MenuFont.font = NULL; + Scr->MenuFont.name = DEFAULT_NICE_FONT; + Scr->MenuTitleFont.font = NULL; /* DSE */ + Scr->MenuTitleFont.name = NULL; /* uses MenuFont unless set -- DSE */ + Scr->IconFont.font = NULL; + Scr->IconFont.name = DEFAULT_NICE_FONT; + Scr->SizeFont.font = NULL; + Scr->SizeFont.name = DEFAULT_FAST_FONT; + + /* djhjr - 5/10/96 */ + Scr->InfoFont.font = NULL; + Scr->InfoFont.name = DEFAULT_FAST_FONT; + + Scr->IconManagerFont.font = NULL; + Scr->IconManagerFont.name = DEFAULT_NICE_FONT; + Scr->VirtualFont.font = NULL; + Scr->VirtualFont.name = DEFAULT_SMALL_FONT; + Scr->DoorFont.font = NULL; + Scr->DoorFont.name = DEFAULT_NICE_FONT; + Scr->DefaultFont.font = NULL; + Scr->DefaultFont.name = DEFAULT_FAST_FONT; + + /* no names unless they say so */ + Scr->NamesInVirtualDesktop = FALSE; + + /* by default we emulate the old twm - ie. no virtual desktop */ + Scr->Virtual = FALSE; + + /* this makes some of the algorithms for checking if windows + * are on the screen simpler */ + Scr->VirtualDesktopWidth = Scr->MyDisplayWidth; + Scr->VirtualDesktopHeight = Scr->MyDisplayHeight; + + /* start at the top left of the virtual desktop */ + Scr->VirtualDesktopX = 0; + Scr->VirtualDesktopY = 0; + + /* pan defaults to half screen size */ + Scr->VirtualDesktopPanDistanceX = 50; + Scr->VirtualDesktopPanDistanceY = 50; + + /* djhjr - 9/8/98 */ + Scr->VirtualDesktopPanResistance = 0; + + /* default scale is 1:25 */ + Scr->VirtualDesktopDScale = 25; + + /* and the display should appear at 0, 0 */ + Scr->VirtualDesktopDX = 0; + Scr->VirtualDesktopDY = 0; + + /* by default no autopan */ + Scr->AutoPanX = 0; + Scr->StayUpMenus = FALSE; + Scr->StayUpOptionalMenus = FALSE; /* PF */ + + Scr->AutoPanWarpWithRespectToRealScreen = 0; /* DSE */ + Scr->AutoPanBorderWidth = 5; /* DSE */ + Scr->AutoPanExtraWarp = 2; /* DSE */ + Scr->EnhancedExecResources = FALSE; /* DSE */ + Scr->RightHandSidePulldownMenus = FALSE; /* DSE */ + + /* was '2' for when UseRealScreenBorderWidth existed - djhjr - 2/15/99 */ + Scr->RealScreenBorderWidth = 0; /* DSE */ + + /* djhjr - 10/11/01 */ + Scr->ZoomZoom = FALSE; + + Scr->LessRandomZoomZoom = FALSE; /* DSE */ + Scr->PrettyZoom = FALSE; /* DSE */ + Scr->StickyAbove = FALSE; /* DSE */ + Scr->DontInterpolateTitles = FALSE; /* DSE */ + + /* djhjr - 1/6/98 */ + Scr->FixManagedVirtualGeometries = FALSE; + + Scr->FixTransientVirtualGeometries = FALSE; /* DSE */ + Scr->WarpSnug = FALSE; /* DSE */ + + /* djhjr - 4/17/98 */ + Scr->VirtualReceivesMotionEvents = FALSE; + Scr->VirtualSendsMotionEvents = FALSE; + + /* djhjr - 5/2/98 */ + Scr->BorderBevelWidth = 0; + Scr->TitleBevelWidth = 0; + Scr->MenuBevelWidth = 0; + Scr->IconMgrBevelWidth = 0; + Scr->InfoBevelWidth = 0; + + /* djhjr - 8/11/98 */ + Scr->IconBevelWidth = 0; + Scr->ButtonBevelWidth = 0; + + /* djhjr - 2/7/99 */ + Scr->DoorBevelWidth = 0; + Scr->VirtualDesktopBevelWidth = 0; + + /* djhjr - 5/22/00 */ + Scr->MenuScrollBorderWidth = 2; + Scr->MenuScrollJump = 3; + + /* djhjr - 6/22/99 */ + Scr->DontDeiconifyTransients = FALSE; + + /* submitted by Ugen Antsilevitch - 5/28/00 */ + Scr->WarpVisible = FALSE; + + /* djhjr - 6/22/01 */ + Scr->PauseOnExit = 0; + Scr->PauseOnQuit = 0; + + /* djhjr - 11/3/03 */ + Scr->RaiseOnStart = FALSE; +} + + +void CreateFonts () +{ + GetFont(&Scr->TitleBarFont); + GetFont(&Scr->MenuFont); + GetFont(&Scr->IconFont); + GetFont(&Scr->SizeFont); + + /* djhjr - 5/10/96 */ + GetFont(&Scr->InfoFont); + + GetFont(&Scr->IconManagerFont); + GetFont(&Scr->VirtualFont); + GetFont(&Scr->DoorFont); + GetFont(&Scr->DefaultFont); + GetFont(&Scr->MenuTitleFont); /* DSE */ + Scr->HaveFonts = TRUE; +} + + +void RestoreWithdrawnLocation (tmp) + TwmWindow *tmp; +{ + int gravx, gravy; + unsigned int bw, mask; + XWindowChanges xwc; + + if (XGetGeometry (dpy, tmp->w, &JunkRoot, &xwc.x, &xwc.y, + &JunkWidth, &JunkHeight, &bw, &JunkDepth)) { + + GetGravityOffsets (tmp, &gravx, &gravy); + if (gravy < 0) xwc.y -= tmp->title_height; + + /* djhjr - 4/19/96 */ + xwc.x += gravx * tmp->frame_bw3D; + xwc.y += gravy * tmp->frame_bw3D; + + if (bw != tmp->old_bw) { + int xoff, yoff; + + if (!Scr->ClientBorderWidth) { + xoff = gravx; + yoff = gravy; + } else { + xoff = 0; + yoff = 0; + } + + xwc.x -= (xoff + 1) * tmp->old_bw; + xwc.y -= (yoff + 1) * tmp->old_bw; + } + if (!Scr->ClientBorderWidth) { + xwc.x += gravx * tmp->frame_bw; + xwc.y += gravy * tmp->frame_bw; + } + + mask = (CWX | CWY); + if (bw != tmp->old_bw) { + xwc.border_width = tmp->old_bw; + mask |= CWBorderWidth; + } + + XConfigureWindow (dpy, tmp->w, mask, &xwc); + + if (tmp->wmhints && (tmp->wmhints->flags & IconWindowHint)) { + XUnmapWindow (dpy, tmp->wmhints->icon_window); + } + + } +} + + +void Reborder (time) +Time time; +{ + TwmWindow *tmp; /* temp twm window structure */ + int scrnum; + + /* put a border back around all windows */ + + XGrabServer (dpy); + for (scrnum = 0; scrnum < NumScreens; scrnum++) + { + if ((Scr = ScreenList[scrnum]) == NULL) + continue; + + InstallWindowColormaps (0, &Scr->TwmRoot); /* force reinstall */ + for (tmp = Scr->TwmRoot.next; tmp != NULL; tmp = tmp->next) + { + RestoreWithdrawnLocation (tmp); + XMapWindow (dpy, tmp->w); + } + } + + XUngrabServer (dpy); + SetFocus ((TwmWindow*)NULL, time); +} + +/* delete the PID file - djhjr - 12/2/01 */ +void delete_pidfile() +{ + char *fn; + + if (PrintPID) + { + fn = malloc(HomeLen + strlen(PidName) + 2); + sprintf(fn, "%s/%s", Home, PidName); + unlink(fn); + free(fn); + } +} + + +/* + * Exit handlers. Clean up and exit VTWM. + * + * PlaySoundDone() + * Done() + * QueueRestartVtwm() + */ + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +SIGNAL_T PlaySoundDone() +{ + if (PlaySound(S_STOP)) + { + /* allow time to emit */ + if (Scr->PauseOnExit) sleep(Scr->PauseOnExit); + } + + Done(); + SIGNAL_RETURN; +} + +void Done() +{ + CloseSound(); + + SetRealScreen(0,0); + Reborder (CurrentTime); + XCloseDisplay(dpy); + + delete_pidfile(); /* djhjr - 12/2/01 */ + + exit(0); +} +#else +SIGNAL_T Done() +{ + SetRealScreen(0,0); + Reborder (CurrentTime); + XCloseDisplay(dpy); + + delete_pidfile(); /* djhjr - 12/2/01 */ + + exit(0); + SIGNAL_RETURN; +} +#endif + +/* djhjr - 7/31/98 */ +SIGNAL_T +QueueRestartVtwm() +{ + XClientMessageEvent ev; + + delete_pidfile(); /* djhjr - 12/2/01 */ + + ev.type = ClientMessage; + ev.window = Scr->Root; + ev.message_type = _XA_TWM_RESTART; + ev.format = 32; + ev.data.b[0] = (char)0; + + XSendEvent (dpy, Scr->VirtualDesktopDisplay, False, 0L, (XEvent *) &ev); + XFlush(dpy); + SIGNAL_RETURN; +} + + +/* + * Error Handlers. If a client dies, we'll get a BadWindow error (except for + * GetGeometry which returns BadDrawable) for most operations that we do before + * manipulating the client's window. + */ + +Bool ErrorOccurred = False; +XErrorEvent LastErrorEvent; + +static int TwmErrorHandler(dpy, event) + Display *dpy; + XErrorEvent *event; +{ + LastErrorEvent = *event; + ErrorOccurred = True; + + if (PrintErrorMessages && /* don't be too obnoxious */ + event->error_code != BadWindow && /* watch for dead puppies */ + (event->request_code != X_GetGeometry && /* of all styles */ + event->error_code != BadDrawable)) + XmuPrintDefaultErrorMessage (dpy, event, stderr); + return 0; +} + + +/* ARGSUSED*/ +static int CatchRedirectError(dpy, event) + Display *dpy; + XErrorEvent *event; +{ + RedirectError = TRUE; + LastErrorEvent = *event; + ErrorOccurred = True; + return 0; +} + +Atom _XA_MIT_PRIORITY_COLORS; +Atom _XA_WM_CHANGE_STATE; +Atom _XA_WM_STATE; +Atom _XA_WM_COLORMAP_WINDOWS; +Atom _XA_WM_PROTOCOLS; +Atom _XA_WM_TAKE_FOCUS; +Atom _XA_WM_SAVE_YOURSELF; +Atom _XA_WM_DELETE_WINDOW; + +/* djhjr - 7/31/98 */ +Atom _XA_TWM_RESTART; + +void InternUsefulAtoms () +{ + /* + * Create priority colors if necessary. + */ + _XA_MIT_PRIORITY_COLORS = XInternAtom(dpy, "_MIT_PRIORITY_COLORS", False); + _XA_WM_CHANGE_STATE = XInternAtom (dpy, "WM_CHANGE_STATE", False); + _XA_WM_STATE = XInternAtom (dpy, "WM_STATE", False); + _XA_WM_COLORMAP_WINDOWS = XInternAtom (dpy, "WM_COLORMAP_WINDOWS", False); + _XA_WM_PROTOCOLS = XInternAtom (dpy, "WM_PROTOCOLS", False); + _XA_WM_TAKE_FOCUS = XInternAtom (dpy, "WM_TAKE_FOCUS", False); + _XA_WM_SAVE_YOURSELF = XInternAtom (dpy, "WM_SAVE_YOURSELF", False); + _XA_WM_DELETE_WINDOW = XInternAtom (dpy, "WM_DELETE_WINDOW", False); + + /* djhjr - 7/31/98 */ + _XA_TWM_RESTART = XInternAtom (dpy, "_TWM_RESTART", False); +} diff --git a/twm.h b/twm.h new file mode 100644 index 0000000..4038cba --- /dev/null +++ b/twm.h @@ -0,0 +1,580 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/*********************************************************************** + * + * $XConsortium: twm.h,v 1.74 91/05/31 17:38:30 dave Exp $ + * + * twm include file + * + * 28-Oct-87 Thomas E. LaStrange File created + * 10-Oct-90 David M. Sternlicht Storeing saved colors on root + ***********************************************************************/ + +#ifndef _TWM_ +#define _TWM_ + +#include +#include +#include +#include +#ifdef NEVER /* stay X11R4 compatable; X11R5,6 doesn't seem to mind! */ +#include +#endif + +/* + * This accomodates systems that simply cannot handle the + * duplicate typedef declaration of 'Pixel'. On the other hand, + * if your make halts with complaints of an unknown datatype + * 'Pixel', add "EXTRA_DEFINES=-DNEED_PIXEL_T" to the make + * command. Submitted by Nelson H. F. Beebe + */ +#include +#ifdef NEED_PIXEL_T +typedef unsigned long Pixel; +#endif +#define PIXEL_ALREADY_TYPEDEFED /* for Xmu/Drawing.h */ + +#include "util.h" + +#ifndef WithdrawnState +#define WithdrawnState 0 +#endif + +#ifdef SIGNALRETURNSINT +#define SIGNAL_T int +#define SIGNAL_RETURN return 0 +#else +#define SIGNAL_T void +#define SIGNAL_RETURN return +#endif + +typedef SIGNAL_T (*SigProc)(); /* type of function returned by signal() */ + +#define BW 2 /* border width */ +#define BW2 4 /* border width * 2 */ + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#define NULLSTR ((char *) NULL) + +#define MAX_BUTTONS 5 /* max mouse buttons supported */ + +/* info stings defines */ +#define INFO_LINES 30 +#define INFO_SIZE 200 + +/* contexts for button presses */ +#define C_NO_CONTEXT -1 +#define C_WINDOW 0 +#define C_TITLE 1 +#define C_ICON 2 +#define C_ROOT 3 +#define C_FRAME 4 +#define C_ICONMGR 5 +#define C_NAME 6 +#define C_IDENTIFY 7 +#define C_VIRTUAL 8 +#define C_VIRTUAL_WIN 9 +#define C_DOOR 10 +#define NUM_CONTEXTS 11 + +#define C_WINDOW_BIT (1 << C_WINDOW) +#define C_TITLE_BIT (1 << C_TITLE) +#define C_ICON_BIT (1 << C_ICON) +#define C_ROOT_BIT (1 << C_ROOT) +#define C_FRAME_BIT (1 << C_FRAME) +#define C_ICONMGR_BIT (1 << C_ICONMGR) +#define C_NAME_BIT (1 << C_NAME) +#define C_VIRTUAL_BIT (1 << C_VIRTUAL) +#define C_VIRTUAL_WIN_BIT (1 << C_VIRTUAL_WIN) +#define C_DOOR_BIT (1 << C_DOOR) + +#define C_ALL_BITS (C_WINDOW_BIT | C_TITLE_BIT | C_ICON_BIT |\ + C_ROOT_BIT | C_FRAME_BIT | C_ICONMGR_BIT |\ + C_VIRTUAL_BIT | C_VIRTUAL_WIN_BIT | C_DOOR_BIT) + +/* modifiers for button presses */ +/* added "LockMask" - djhjr - 9/10/03 */ +#define MOD_SIZE ((ShiftMask | LockMask | ControlMask | Mod1Mask \ + | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask) + 1) + +/* definitions from MwmUtil.h - submitted by Jonathan Paisley - 11/8/02 */ +#define MWM_HINTS_FUNCTIONS (1L << 0) +#define MWM_HINTS_DECORATIONS (1L << 1) +#define MWM_HINTS_INPUT_MODE (1L << 2) +#define MWM_HINTS_STATUS (1L << 3) + +#define MWM_FUNC_ALL (1L << 0) +#define MWM_FUNC_RESIZE (1L << 1) +#define MWM_FUNC_MOVE (1L << 2) +#define MWM_FUNC_MINIMIZE (1L << 3) +#define MWM_FUNC_MAXIMIZE (1L << 4) +#define MWM_FUNC_CLOSE (1L << 5) + +#define MWM_DECOR_ALL (1L << 0) +#define MWM_DECOR_BORDER (1L << 1) +#define MWM_DECOR_RESIZEH (1L << 2) +#define MWM_DECOR_TITLE (1L << 3) +#define MWM_DECOR_MENU (1L << 4) +#define MWM_DECOR_MINIMIZE (1L << 5) +#define MWM_DECOR_MAXIMIZE (1L << 6) + +#define MWM_INPUT_MODELESS 0 +#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 +#define MWM_INPUT_SYSTEM_MODAL 2 +#define MWM_INPUT_FULL_APPLICATION_MODAL 3 +#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL + +#define MWM_TEAROFF_WINDOW (1L<<0) + +/* submitted by Jonathan Paisley - 11/8/02 */ +typedef struct +{ + long flags; + long functions; + long decorations; + long input_mode; + long state; +} MotifWmHints; + +#define TITLE_BAR_SPACE 1 /* 2 pixel space bordering chars */ +#define TITLE_BAR_FONT_HEIGHT 15 /* max of 15 pixel high chars */ +#define TITLE_BAR_HEIGHT (TITLE_BAR_FONT_HEIGHT+(2*TITLE_BAR_SPACE)) + +/* defines for zooming/unzooming */ +#define ZOOM_NONE 0 + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT +#define FBF(fix_fore, fix_back, fix_font)\ + MyFont_ChangeGC(fix_fore, fix_back, &fix_font) +#else +#define FBF(fix_fore, fix_back, fix_font)\ + Gcv.foreground = fix_fore;\ + Gcv.background = fix_back;\ + Gcv.font = fix_font.font->fid;\ + XChangeGC(dpy, Scr->NormalGC, GCFont|GCForeground|GCBackground,&Gcv) +#endif + +#define FB(fix_fore, fix_back)\ + Gcv.foreground = fix_fore;\ + Gcv.background = fix_back;\ + XChangeGC(dpy, Scr->NormalGC, GCForeground|GCBackground,&Gcv) + +typedef enum {on, off} ButtonState; + +typedef struct MyFont +{ + char *name; /* name of the font */ + XFontStruct *font; /* font structure */ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + XFontSet fontset; +#endif + int height; /* height of the font */ + int y; /* Y coordinate to draw characters */ + int ascent; + int descent; +} MyFont; + +typedef struct ColorPair +{ + Pixel fore, back; + + /* djhjr - 4/19/96 */ + Pixel shadc, shadd; +} ColorPair; + +typedef struct _TitleButton { + struct _TitleButton *next; /* next link in chain */ + char *name; /* bitmap name in case of deferal */ + +/* don't need either anymore - djhjr - 10/30/02 + * might not need 'bitmap anymore... djhjr - 4/19/96 * + Image *image; * image to display in button * + *Pixmap bitmap;* * image to display in button * +*/ + + int srcx, srcy; /* from where to start copying */ + unsigned int width, height; /* size of pixmap */ + int dstx, dsty; /* to where to start copying */ + int func; /* function to execute */ + char *action; /* optional action arg */ + struct MenuRoot *menuroot; /* menu to pop on F_MENU */ + Bool rightside; /* t: on right, f: on left */ +} TitleButton; + +typedef struct _TBWindow { + Window window; /* which window in this frame */ + +/* djhjr - 4/19/96 + Image *image; * image to display in button * +*/ + + TitleButton *info; /* description of this window */ +} TBWindow; + +typedef struct _SqueezeInfo { + int justify; /* left, center, right */ + int num; /* signed pixel count or numerator */ + int denom; /* 0 for pix count or denominator */ +} SqueezeInfo; + +#define J_LEFT 1 +#define J_CENTER 2 +#define J_RIGHT 3 + +/* Colormap window entry for each window in WM_COLORMAP_WINDOWS + * ICCCM property. + */ +typedef struct TwmColormap +{ + Colormap c; /* Colormap id */ + int state; /* install(ability) state */ + unsigned long install_req; /* request number which installed it */ + Window w; /* window causing load of color table */ + int refcnt; +} TwmColormap; + +#define CM_INSTALLABLE 1 +#define CM_INSTALLED 2 +#define CM_INSTALL 4 + +typedef struct ColormapWindow +{ + Window w; /* Window id */ + TwmColormap *colormap; /* Colormap for this window */ + int visibility; /* Visibility of this window */ + int refcnt; +} ColormapWindow; + +typedef struct Colormaps +{ + ColormapWindow **cwins; /* current list of colormap windows */ + int number_cwins; /* number of elements in current list */ + char *scoreboard; /* conflicts between installable colortables */ +} Colormaps; + +#define ColormapsScoreboardLength(cm) ((cm)->number_cwins * \ + ((cm)->number_cwins - 1) / 2) + +/* for each window that is on the display, one of these structures + * is allocated and linked into a list + */ +typedef struct TwmWindow +{ + struct TwmWindow *next; /* next twm window */ + struct TwmWindow *prev; /* previous twm window */ + Window w; /* the child window */ + Window VirtualDesktopDisplayWindow; /* the representation of this window in the vd display */ + int old_bw; /* border width before reparenting */ + Window frame; /* the frame window */ + Window title_w; /* the title bar window */ + Window hilite_w; /* the hilite window */ + Pixmap gray; + Window icon_w; /* the icon window */ + Window icon_bm_w; /* the icon bitmap window */ + int frame_x; /* x position of frame */ + int frame_y; /* y position of frame */ + int virtual_frame_x; /* virtual x position of frame */ + int virtual_frame_y; /* virtual y position of frame */ + int frame_width; /* width of frame */ + int frame_height; /* height of frame */ + int frame_bw; /* borderwidth of frame */ + + /* djhjr - 4/18/96 */ + int frame_bw3D; /* 3D borderwidth of frame */ + + int title_x; + int title_y; + int virtual_title_x; /* virtual x position of title */ + int virtual_title_y; /* virtual y position of title */ + int icon_x; /* icon text x coordinate */ + int icon_y; /* icon text y coordiante */ + int virtual_icon_x; /* virtual x position of icon */ + int virtual_icon_y; /* virtual y position of icon */ + int icon_w_width; /* width of the icon window */ + int icon_w_height; /* height of the icon window */ + int icon_width; /* width of the icon bitmap */ + int icon_height; /* height of the icon bitmap */ + int title_height; /* height of the title bar */ + int title_width; /* width of the title bar */ + char *full_name; /* full name of the window */ + char *name; /* name of the window */ + char *icon_name; /* name of the icon */ + int name_width; /* width of name text */ + int highlightx; /* start of highlight window */ + int rightx; /* start of right buttons */ + XWindowAttributes attr; /* the child window attributes */ + XSizeHints hints; /* normal hints */ + XWMHints *wmhints; /* WM hints */ + MotifWmHints mwmhints; /* MWM hints - by Jonathan Paisley - 11/8/02 */ + Window group; /* group ID */ + XClassHint class; + struct WList *list; + /*********************************************************************** + * color definitions per window + **********************************************************************/ + Pixel icon_border; /* border color */ + +/* djhjr - 4/19/96 + Pixel border; * border color * +*/ + ColorPair border; /* border color */ + + ColorPair border_tile; + ColorPair title; + ColorPair iconc; + ColorPair virtual; + + short mapped; /* is the window mapped ? */ + short zoomed; /* is the window zoomed? */ + short highlight; /* should highlight this window */ + short iconmgr; /* this is an icon manager window */ + short icon; /* is the window an icon now ? */ + +/* 5/17/96 - djhjr */ +#ifdef ORIGINAL_SHORTS + short iconified; /* has the window ever been iconified? */ + short icon_on; /* is the icon visible */ + short auto_raise; /* should we auto-raise this window ? */ + short forced; /* has had an icon forced upon it */ + short icon_not_ours; /* icon pixmap or window supplied to us */ + short icon_moved; /* user explicitly moved the icon */ + short stackmode; /* honor stackmode requests */ + short iconify_by_unmapping; /* unmap window to iconify it */ + short transient; /* this is a transient window */ + short titlehighlight; /* should I highlight the title bar */ + short wShaped; /* this window has a bounding shape */ + short nailed; /* is this window nailed ? */ + short showindesktopdisplay; /* should i show this in the desktop display ? */ + + /* djhjr - 4/6/98 */ + short opaque_move; + short opaque_resize; + +#else + struct + { + unsigned int iconified : 1; + unsigned int icon_on : 1; + unsigned int auto_raise : 1; + unsigned int forced : 1; + unsigned int icon_not_ours : 1; + unsigned int icon_moved : 1; + unsigned int stackmode : 1; + unsigned int iconify_by_unmapping : 1; + unsigned int transient : 1; + unsigned int titlehighlight : 1; + unsigned int wShaped : 1; + unsigned int nailed : 1; + unsigned int showindesktopdisplay : 1; + + /* djhjr - 4/6/98 */ + unsigned int opaque_move : 1; + unsigned int opaque_resize : 1; + + } twmflags; +#define iconified twmflags.iconified +#define icon_on twmflags.icon_on +#define auto_raise twmflags.auto_raise +#define forced twmflags.forced +#define icon_not_ours twmflags.icon_not_ours +#define icon_moved twmflags.icon_moved +#define stackmode twmflags.stackmode +#define iconify_by_unmapping twmflags.iconify_by_unmapping +#define transient twmflags.transient +#define titlehighlight twmflags.titlehighlight +#define wShaped twmflags.wShaped +#define nailed twmflags.nailed +#define showindesktopdisplay twmflags.showindesktopdisplay + +/* djhjr - 4/6/98 */ +#define opaque_move twmflags.opaque_move +#define opaque_resize twmflags.opaque_resize + +#endif + + Window transientfor; /* window contained in XA_XM_TRANSIENT_FOR */ + struct IconMgr *iconmgrp; /* pointer to it if this is an icon manager */ + int save_frame_x; /* x position of frame */ + int save_frame_y; /* y position of frame */ + int save_frame_width; /* width of frame */ + int save_frame_height; /* height of frame */ + unsigned long protocols; /* which protocols this window handles */ + Colormaps cmaps; /* colormaps for this application */ + TBWindow *titlebuttons; + SqueezeInfo *squeeze_info; /* should the title be squeezed? */ + struct { + struct TwmWindow *next, *prev; +#ifdef ORIGINAL_WARPRINGCOORDINATES /* djhjr - 5/11/98 */ + Bool cursor_valid; + int curs_x, curs_y; +#endif + } ring; +} TwmWindow; + +#define DoesWmTakeFocus (1L << 0) +#define DoesWmSaveYourself (1L << 1) +#define DoesWmDeleteWindow (1L << 2) + +#define TBPM_DOT ":dot" /* name of titlebar pixmap for dot */ +#define TBPM_ICONIFY ":iconify" /* same image as dot */ +#define TBPM_RESIZE ":resize" /* name of titlebar pixmap for resize button */ +#define TBPM_XLOGO ":xlogo" /* name of titlebar pixmap for xlogo */ +#define TBPM_DELETE ":delete" /* same image as xlogo */ +#define TBPM_MENU ":menu" /* name of titlebar pixmap for menus */ +#define TBPM_QUESTION ":question" /* name of unknown titlebar pixmap */ + +/* djhjr - 6/4/00 */ +#define TBPM_RARROW ":rarrow" /* name of right arrow pixmap */ +#define TBPM_DARROW ":darrow" /* name of down arrow pixmap */ + +/* djhjr - 4/18/96 */ +#define TBPM_3DDOT ":xpm:dot" /* name of titlebar pixmap for dot */ +#define TBPM_3DRESIZE ":xpm:resize" /* name of titlebar pixmap for resize button */ +#define TBPM_3DMENU ":xpm:menu" /* name of titlebar pixmap for menus */ +#define TBPM_3DZOOM ":xpm:zoom" +#define TBPM_3DBAR ":xpm:bar" + +/* djhjr - 6/4/00 */ +#define TBPM_3DRARROW ":xpm:rarrow" /* name of right arrow pixmap */ +#define TBPM_3DDARROW ":xpm:darrow" /* name of down arrow pixmap */ + +/* djhjr - 10/25/02 */ +#define TBPM_3DRAISEDBOX ":xpm:raisedbox" /* name of raised box highlight pixmap */ +#define TBPM_3DSUNKENBOX ":xpm:sunkenbox" /* name of sunken box highlight pixmap */ +#define TBPM_3DRAISEDLINES ":xpm:raisedlines" /* name of raised lines highlight pixmap */ +#define TBPM_3DSUNKENLINES ":xpm:sunkenlines" /* name of sunken lines highlight pixmap */ + +/* djhjr - 10/30/02 */ +#define TBPM_3DBOX ":xpm:box" /* name of box pixmap */ +#define TBPM_3DLINES ":xpm:lines" /* name of lines pixmap */ + +#ifdef NEVER /* stay X11R4 compatable; X11R5,6 doesn't seem to mind! */ +#include +#endif +#ifndef X_NOT_STDC_ENV +#include +#else +extern char *malloc(), *calloc(), *realloc(), *getenv(); +extern void free(); +#endif +extern void Reborder(); + +/* djhjr - 6/22/01 */ +#ifndef NO_SOUND_SUPPORT +extern SIGNAL_T PlaySoundDone(); +void Done(); +#else +extern SIGNAL_T Done(); +#endif + +void ComputeCommonTitleOffsets(); +void ComputeWindowTitleOffsets(), ComputeTitleLocation(); + +extern char *ProgramName; +extern Display *dpy; +extern Window ResizeWindow; /* the window we are resizing */ +extern int HasShape; /* this server supports Shape extension */ + +extern int PreviousScreen; + +extern Cursor UpperLeftCursor; +extern Cursor RightButt; +extern Cursor MiddleButt; +extern Cursor LeftButt; + +extern XClassHint NoClass; + +extern XContext TwmContext; +extern XContext MenuContext; +extern XContext IconManagerContext; +extern XContext VirtualContext; +extern XContext ScreenContext; +extern XContext ColormapContext; +extern XContext DoorContext; + +extern char *Home; +extern int HomeLen; +extern int ParseError; + +extern int HandlingEvents; + +extern Window JunkRoot; +extern Window JunkChild; +extern int JunkX; +extern int JunkY; +extern unsigned int JunkWidth, JunkHeight, JunkBW, JunkDepth, JunkMask; +extern XGCValues Gcv; +extern int InfoLines; +extern char Info[][INFO_SIZE]; +extern int Argc; +extern char **Argv; +extern char **Environ; + +extern void NewFontCursor(); +extern Pixmap CreateMenuIcon(); +extern void RestoreWithdrawnLocation(); +extern void CreateFonts(); + +/* djhjr - 4/18/96 */ +extern Pixmap Create3DMenuIcon(); +extern Pixmap Create3DIconManagerIcon(); +extern void Draw3DBorder(); + +extern Bool ErrorOccurred; +extern XErrorEvent LastErrorEvent; + +#define ResetError() (ErrorOccurred = False) + +extern Bool RestartPreviousState; +extern Bool GetWMState(); + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT +extern Bool use_fontset; +#endif + +extern Atom _XA_MIT_PRIORITY_COLORS; +extern Atom _XA_WM_CHANGE_STATE; +extern Atom _XA_WM_STATE; +extern Atom _XA_WM_COLORMAP_WINDOWS; +extern Atom _XA_WM_PROTOCOLS; +extern Atom _XA_WM_TAKE_FOCUS; +extern Atom _XA_WM_SAVE_YOURSELF; +extern Atom _XA_WM_DELETE_WINDOW; + +/* djhjr - 7/31/98 */ +extern Atom _XA_TWM_RESTART; + +#endif /* _TWM_ */ diff --git a/util.c b/util.c new file mode 100644 index 0000000..41947df --- /dev/null +++ b/util.c @@ -0,0 +1,3419 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + +/* + +Portions Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + + +/*********************************************************************** + * + * $XConsortium: util.c,v 1.47 91/07/14 13:40:37 rws Exp $ + * + * utility routines for twm + * + * 28-Oct-87 Thomas E. LaStrange File created + * + ***********************************************************************/ + +#include "twm.h" +#include "util.h" +#include "gram.h" +#include "screen.h" +#include "list.h" +#include +#include +#include +#include +#ifndef NO_XPM_SUPPORT +#include +#endif + +#include +#include + +/* see Zoom() - djhjr - 10/11/01 */ +#ifdef NEED_SELECT_H +#include +#else +#include +#include +#endif +#ifndef ZOOMSLEEP +#define ZOOMSLEEP 50000 /* arbitrary, but pleasing, msec value */ +#endif + +#define strdup Strdup /* avoid conflict with system header files */ +extern char *strdup(char *); + +/* + * All instances of Scr->TitleBevelWidth and Scr->BorderBevelWidth + * were a hard value of 2 - djhjr - 4/29/98 + */ + +/* djhjr - 4/18/96 10/29/02 */ +static void Draw3DMenuImage(); +static void Draw3DDotImage(); +static void Draw3DResizeImage(); +static void Draw3DZoomImage(); +static void Draw3DBarImage(); + +/* djhjr - 6/4/00 10/29/02 */ +static void Draw3DRArrowImage(); +static void Draw3DDArrowImage(); + +/* djhjr - 1/13/98 10/20/02 */ +void setBorderGC(); +#ifdef USE_ORIGINAL_CORNERS +void Draw3DCorner(); +#else +GC setBevelGC(); +void Draw3DBevel(); +void Draw3DNoBevel(); +#endif + +/* djhjr - 4/19/96 */ +static GC rootGC = (GC) 0; + +/* for trying to clean up BeNiceToColormap - djhjr - 10/20/02 */ +static int borderdashoffset; + +int HotX, HotY; + +#define questionmark_width 8 +#define questionmark_height 8 +static unsigned char questionmark_bits[] = { + 0x38, 0x7c, 0x64, 0x30, 0x18, 0x00, 0x18, 0x18}; + +/*********************************************************************** + * + * Procedure: + * MoveOutline - move a window outline + * + * Inputs: + * root - the window we are outlining + * x - upper left x coordinate + * y - upper left y coordinate + * width - the width of the rectangle + * height - the height of the rectangle + * bw - the border width of the frame + * th - title height + * + *********************************************************************** + */ + +/* ARGSUSED */ +void MoveOutline(root, x, y, width, height, bw, th) + Window root; + int x, y, width, height, bw, th; +{ + static int lastx = 0; + static int lasty = 0; + static int lastWidth = 0; + static int lastHeight = 0; + static int lastBW = 0; + static int lastTH = 0; + int xl, xr, yt, yb, xinnerl, xinnerr, yinnert, yinnerb; + int xthird, ythird; + XSegment outline[18]; + register XSegment *r; + + if (x == lastx && y == lasty && width == lastWidth && height == lastHeight + && lastBW == bw && th == lastTH) + return; + + r = outline; + +#ifdef ORIGINAL_DRAWIT +#define DRAWIT() \ + if (lastWidth || lastHeight) \ + { \ + xl = lastx; \ + xr = lastx + lastWidth - 1; \ + yt = lasty; \ + yb = lasty + lastHeight - 1; \ + xinnerl = xl + lastBW; \ + xinnerr = xr - lastBW; \ + yinnert = yt + lastTH + lastBW; \ + yinnerb = yb - lastBW; \ + xthird = (xinnerr - xinnerl) / 3; \ + ythird = (yinnerb - yinnert) / 3; \ + \ + /* frame outline */ \ + r->x1 = xl; \ + r->y1 = yt; \ + r->x2 = xr; \ + r->y2 = yt; \ + r++; \ + \ + r->x1 = xl; \ + r->y1 = yb; \ + r->x2 = xr; \ + r->y2 = yb; \ + r++; \ + \ + r->x1 = xl; \ + r->y1 = yt; \ + r->x2 = xl; \ + r->y2 = yb; \ + r++; \ + \ + r->x1 = xr; \ + r->y1 = yt; \ + r->x2 = xr; \ + r->y2 = yb; \ + r++; \ + \ + /* left vertical */ \ + r->x1 = xinnerl + xthird; \ + r->y1 = yinnert; \ + r->x2 = r->x1; \ + r->y2 = yinnerb; \ + r++; \ + \ + /* right vertical */ \ + r->x1 = xinnerl + (2 * xthird); \ + r->y1 = yinnert; \ + r->x2 = r->x1; \ + r->y2 = yinnerb; \ + r++; \ + \ + /* top horizontal */ \ + r->x1 = xinnerl; \ + r->y1 = yinnert + ythird; \ + r->x2 = xinnerr; \ + r->y2 = r->y1; \ + r++; \ + \ + /* bottom horizontal */ \ + r->x1 = xinnerl; \ + r->y1 = yinnert + (2 * ythird); \ + r->x2 = xinnerr; \ + r->y2 = r->y1; \ + r++; \ + \ + /* title bar */ \ + if (lastTH != 0) { \ + r->x1 = xl; \ + r->y1 = yt + lastTH; \ + r->x2 = xr; \ + r->y2 = r->y1; \ + r++; \ + } \ + } + + /* undraw the old one, if any */ + DRAWIT (); + + lastx = x; + lasty = y; + lastWidth = width; + lastHeight = height; + lastBW = bw; + lastTH = th; + + /* draw the new one, if any */ + DRAWIT (); +#else +#define DRAWIT() \ + if (lastWidth || lastHeight) \ + { \ + xl = lastx; \ + xr = lastx + lastWidth - 1; \ + yt = lasty; \ + yb = lasty + lastHeight - 1; \ + xinnerl = xl + lastBW; \ + xinnerr = xr - lastBW; \ + yinnert = yt + lastTH + lastBW; \ + yinnerb = yb - lastBW; \ + xthird = (xinnerr - xinnerl) / 3; \ + ythird = (yinnerb - yinnert) / 3; \ + \ + /* frame outline */ \ + r->x1 = xl; \ + r->y1 = yt; \ + r->x2 = xr; \ + r->y2 = yt; \ + r++; \ + \ + r->x1 = xl; \ + r->y1 = yb; \ + r->x2 = xr; \ + r->y2 = yb; \ + r++; \ + \ + r->x1 = xl; \ + r->y1 = yt; \ + r->x2 = xl; \ + r->y2 = yb; \ + r++; \ + \ + r->x1 = xr; \ + r->y1 = yt; \ + r->x2 = xr; \ + r->y2 = yb; \ + r++; \ + \ + /* top-left to bottom-right */ \ + r->x1 = xinnerl; \ + r->y1 = yinnert; \ + r->x2 = xinnerr; \ + r->y2 = yinnerb; \ + r++; \ + \ + /* bottom-left to top-right */ \ + r->x1 = xinnerl; \ + r->y1 = yinnerb; \ + r->x2 = xinnerr; \ + r->y2 = yinnert; \ + r++; \ + \ + /* title bar */ \ + if (lastTH != 0) { \ + r->x1 = xl; \ + r->y1 = yt + lastTH; \ + r->x2 = xr; \ + r->y2 = r->y1; \ + r++; \ + } \ + } + + /* undraw the old one, if any */ + DRAWIT (); + + lastx = x; + lasty = y; + lastWidth = width; + lastHeight = height; + lastBW = bw; + lastTH = th; + + /* draw the new one, if any */ + DRAWIT (); +#endif + +#undef DRAWIT + + if (r != outline) + { + XDrawSegments(dpy, root, Scr->DrawGC, outline, r - outline); + } +} + +/*********************************************************************** + * + * Procedure: + * Zoom - zoom in or out of an icon + * + * Inputs: + * wf - window to zoom from + * ipf - icon manager of window to zoom from + * wt - window to zoom to + * ipt - icon manager of window to zoom to + * + * Patched to make sure a "None" window generates coordinates *INSIDE* + * the screen. -- DSE + * + * Added args to icon managers so zooms from and to the window's + * entry use that icon manager's coordinates - djhjr - 10/11/01 + * + *********************************************************************** + */ + +void +Zoom(wf, ipf, wt, ipt) + Window wf, wt; + IconMgr *ipf, *ipt; +{ + int fx, fy, tx, ty; /* from, to */ + unsigned int fw, fh, tw, th; /* from, to */ + long dx, dy, dw, dh; + long z; + int j; + + /* djhjr - 10/11/01 */ + static struct timeval timeoutval = {0, ZOOMSLEEP}; + struct timeval timeout; + + void draw_rect(); /* DSE */ + + if (!Scr->DoZoom || Scr->ZoomCount < 1) return; + +#if (0) + if (wf == None || wt == None) return; + + XGetGeometry (dpy, wf, &JunkRoot, &fx, &fy, &fw, &fh, &JunkBW, &JunkDepth); + XGetGeometry (dpy, wt, &JunkRoot, &tx, &ty, &tw, &th, &JunkBW, &JunkDepth); +#else + + /* if (wf == None && wt == None) return; */ + + if ( wt == None) + { + if (Scr->LessRandomZoomZoom) /* DSE */ + { + int temp,x1,y1,x2,y2; + x1 = ( (int)rand() % (Scr->MyDisplayWidth >> 3) ); + x2 = Scr->MyDisplayWidth - + ( (int)rand() % (Scr->MyDisplayWidth >> 3) ); + y1 = ( (int)rand() % (Scr->MyDisplayHeight >> 3) ); + y2 = Scr->MyDisplayHeight - + ( (int)rand() % (Scr->MyDisplayHeight >> 3) ); + if(x1>x2){temp=x1;x1=x2;x2=temp;} + if(y1>y2){temp=y1;y1=y2;y2=temp;} + tx = x1; ty = y1; + tw = x2 - x1; th = y2 - y1; + } + else + { + /* Zoom from nowhere, RFBZOOM */ + tx = ( (int)rand() % Scr->MyDisplayWidth ); + tw = ( (int)rand() % Scr->MyDisplayWidth ); + ty = ( (int)rand() % Scr->MyDisplayWidth ); + th = ( (int)rand() % Scr->MyDisplayWidth ); + } + } + else + { /* Normal. */ + XGetGeometry (dpy, wt, &JunkRoot, + &tx, &ty, &tw, &th, &JunkBW, &JunkDepth); + + if (ipt) + { + tx += (ipt->twm_win->frame_x + ipt->twm_win->title_x); + ty += (ipt->twm_win->frame_y + ipt->twm_win->title_y + + ipt->twm_win->title_height); + } + } + + if ( wf == None ) + { + if (Scr->LessRandomZoomZoom) /* DSE */ + { + /* zoom from somewhere on the screen, DSE */ + int temp,x1,y1,x2,y2; + do + { + x1 = ( (int)rand() % Scr->MyDisplayWidth ); + x2 = ( (int)rand() % Scr->MyDisplayWidth ); + y1 = ( (int)rand() % Scr->MyDisplayHeight ); + y2 = ( (int)rand() % Scr->MyDisplayHeight ); + if(x1>x2){temp=x1;x1=x2;x2=temp;} + if(y1>y2){temp=y1;y1=y2;y2=temp;} + fx = x1; fy = y1; + fw = x2 - x1; fh = y2 - y1; + } + while ( fw > (Scr->MyDisplayWidth >> 2) || fh > (Scr->MyDisplayHeight >> 2) ); + } + else + { + /* Zoom from nowhere, RFB */ + /* fx = ( rand() & 1 ) * Scr->MyDisplayWidth; */ + fx = ( (int)rand() % Scr->MyDisplayWidth ); + fw = ( (int)rand() % Scr->MyDisplayWidth ); + fy = ( (int)rand() % Scr->MyDisplayWidth ); + fh = ( (int)rand() % Scr->MyDisplayWidth ); + } + } + + else + { /* Normal. */ + XGetGeometry (dpy, wf, &JunkRoot, + &fx, &fy, &fw, &fh, &JunkBW, &JunkDepth); + + if (ipf) + { + fx += (ipf->twm_win->frame_x + ipf->twm_win->title_x); + fy += (ipf->twm_win->frame_y + ipf->twm_win->title_y + + ipf->twm_win->title_height); + } + } +#endif + + dx = ((long) (tx - fx)); /* going from -> to */ + dy = ((long) (ty - fy)); /* going from -> to */ + dw = ((long) (tw - fw)); /* going from -> to */ + dh = ((long) (th - fh)); /* going from -> to */ + z = (long) (Scr->ZoomCount + 1); + + for (j = 0; j < 2; j++) { + long i; + + draw_rect (dpy, Scr->Root, Scr->DrawGC, fx, fy, fw, fh); /* DSE */ + for (i = 1; i < z; i++) + { + int x = fx + (int) ((dx * i) / z); + int y = fy + (int) ((dy * i) / z); + unsigned width = (unsigned) (((long) fw) + (dw * i) / z); + unsigned height = (unsigned) (((long) fh) + (dh * i) / z); + + draw_rect (dpy, Scr->Root, Scr->DrawGC, x, y, width, height); /* DSE */ + } + draw_rect (dpy, Scr->Root, Scr->DrawGC, tx, ty, tw, th); /* DSE */ + + /* djhjr - 10/11/01 */ + timeout = timeoutval; + select(0, 0, 0, 0, &timeout); + } +} + + +/* + * Use any routine to draw your own rectangles here. -- DSE + */ +void draw_rect (display,drawable,gc,x,y,width,height) /* DSE */ + Display *display; + Drawable drawable; + GC gc; + int x,y; + unsigned int width,height; + { + void draw_scaled_rect(); + draw_scaled_rect (display,drawable,gc,x,y,width,height, 20,20); + if (Scr->PrettyZoom) + { + draw_scaled_rect (display,drawable,gc,x,y,width,height, 18,20); + draw_scaled_rect (display,drawable,gc,x,y,width,height, 16,20); + } + } +void draw_scaled_rect (display,drawable,gc,x,y, + width,height,scale,over) /* DSE */ + Display *display; + Drawable drawable; + GC gc; + int x,y; + unsigned int width,height; + unsigned int scale,over; + { + XDrawRectangle(dpy,drawable,gc, + x + ( over + width * (over - scale) ) / (2 * over), + y + ( over + width * (over - scale) ) / (2 * over), + ( (over / 2) + width * scale ) / over, + ( (over / 2) + height * scale ) / over + ); + } + +/*********************************************************************** + * + * Procedure: + * ExpandFilename - expand the tilde character to HOME + * if it is the first character of the filename + * + * Returned Value: + * a pointer to the new name + * + * Inputs: + * name - the filename to expand + * + *********************************************************************** + */ + +char * +ExpandFilename(name) +char *name; +{ + char *newname; + + if (name[0] != '~') return name; + + newname = (char *) malloc (HomeLen + strlen(name) + 2); + if (!newname) { + fprintf (stderr, + "%s: unable to allocate %d bytes to expand filename %s/%s\n", + ProgramName, HomeLen + strlen(name) + 2, Home, &name[1]); + } else { + (void) sprintf (newname, "%s/%s", Home, &name[1]); + } + + return newname; +} + +/*********************************************************************** + * + * Procedure: + * GetUnknownIcon - read in the bitmap file for the unknown icon + * + * Inputs: + * name - the filename to read + * + *********************************************************************** + */ + +void +GetUnknownIcon(name) +char *name; +{ +/* djhjr - 8/13/98 */ +#ifdef ORIGINAL_PIXMAPS + if ((Scr->UnknownPm = GetBitmap(name)) != None) + { + XGetGeometry(dpy, Scr->UnknownPm, &JunkRoot, &JunkX, &JunkY, + (unsigned int *)&Scr->UnknownWidth, (unsigned int *)&Scr->UnknownHeight, &JunkBW, &JunkDepth); + } +#else + Scr->unknownName = name; +#endif +} + +/*********************************************************************** + * + * Procedure: + * FindBitmap - read in a bitmap file and return size + * + * Returned Value: + * the pixmap associated with the bitmap + * widthp - pointer to width of bitmap + * heightp - pointer to height of bitmap + * + * Inputs: + * name - the filename to read + * + *********************************************************************** + */ + +Pixmap FindBitmap (name, widthp, heightp) + char *name; + unsigned int *widthp, *heightp; +{ + char *bigname; + Pixmap pm; + + if (!name) return None; + + /* + * Generate a full pathname if any special prefix characters (such as ~) + * are used. If the bigname is different from name, bigname will need to + * be freed. + */ + bigname = ExpandFilename (name); + if (!bigname) return None; + + /* + * look along bitmapFilePath resource same as toolkit clients + */ + pm = XmuLocateBitmapFile (ScreenOfDisplay(dpy, Scr->screen), bigname, NULL, + 0, (int *)widthp, (int *)heightp, &HotX, &HotY); + if (pm == None && Scr->IconDirectory && bigname[0] != '/') { + if (bigname != name) free (bigname); + /* + * Attempt to find icon in old IconDirectory (now obsolete) + */ + bigname = (char *) malloc (strlen(name) + strlen(Scr->IconDirectory) + + 2); + if (!bigname) { + fprintf (stderr, + "%s: unable to allocate memory for \"%s/%s\"\n", + ProgramName, Scr->IconDirectory, name); + return None; + } + (void) sprintf (bigname, "%s/%s", Scr->IconDirectory, name); + if (XReadBitmapFile (dpy, Scr->Root, bigname, widthp, heightp, &pm, + &HotX, &HotY) != BitmapSuccess) { + pm = None; + } + } + if (bigname != name) free (bigname); + +#ifdef DEBUG + if (pm == None) { + fprintf (stderr, "%s: unable to find bitmap \"%s\"\n", + ProgramName, name); + } +#endif + + return pm; +} + +Pixmap GetBitmap (name) + char *name; +{ + return FindBitmap (name, &JunkWidth, &JunkHeight); +} + +#ifndef NO_XPM_SUPPORT +/* + * Submitted by Jason Gloudon + * added color argument - djhjr - 9/28/99 + */ +Image *FindImage (name, color) + char *name; + Pixel color; +{ + char *bigname; + Pixmap pixmap,mask; + Image *newimage = None; /* added intialization - djhjr - 3/21/98 */ + XpmAttributes attributes; + XpmColorSymbol xpmcolor[1]; /* djhjr - 9/28/99 */ + int ErrorStatus; + + /* + * Generate a full pathname if any special prefix characters (such as ~) + * are used. If the bigname is different from name, bigname will need to + * be freed. + */ + bigname = ExpandFilename (name); + if (!bigname) return None; + + /* was 'XpmReturnAllocPixels' - Submitted by Takeharu Kato */ + attributes.valuemask = XpmReturnPixels; + + /* djhjr - 5/10/99 */ + attributes.valuemask |= XpmCloseness; + attributes.closeness = 32768; + + /* djhjr - 9/28/99 */ + if (color) + { + xpmcolor[0].name = NULL; + xpmcolor[0].value = "none"; + xpmcolor[0].pixel = color; + + attributes.colorsymbols = xpmcolor; + attributes.numsymbols = 1; + attributes.valuemask |= XpmColorSymbols; + } + + /* + * By default, the XPM library assumes screen 0, so we have + * to pass in the real values. Submitted by Caveh Frank Jalali + */ + attributes.valuemask |= XpmVisual | XpmColormap | XpmDepth; + attributes.visual = Scr->d_visual; + attributes.colormap = XDefaultColormap(dpy, Scr->screen); + attributes.depth = Scr->d_depth; + + if( (ErrorStatus = XpmReadFileToPixmap(dpy, Scr->Root, bigname, &pixmap, + &mask, &attributes)) != XpmSuccess){ + pixmap = None; + } + + /* + * Do for pixmaps what XmuLocateBitmapFile() does for bitmaps, + * because, apparently, XmuLocatePixmapFile() doesn't! + * + * djhjr - 12/26/98 + */ + if (pixmap == None && Scr->BitmapFilePath && bigname[0] != '/') + { + char *path = Scr->BitmapFilePath, *term; + + do + { + if ((term = strchr(path, ':'))) *term = 0; + + if (bigname != name) free(bigname); + if (!(bigname = (char *)malloc(strlen(name) + strlen(path) + 2))) + fprintf(stderr, "%s: unable to allocate memory for \"%s/%s\"\n", + ProgramName, path, name); + else + { + (void)sprintf(bigname, "%s/%s", path, name); + +#ifdef NEVER /* once, at the top, is enough? - djhjr - 12/26/98 */ + /* was 'XpmReturnAllocPixels' - Submitted by Takeharu Kato */ + attributes.valuemask = XpmReturnPixels; + + /* djhjr - 5/10/99 */ + attributes.valuemask |= XpmCloseness; + attributes.closeness = 32768; + + /* djhjr - 9/28/99 */ + if (color) + { + xpmcolor[0].name = NULL; + xpmcolor[0].value = "none"; + xpmcolor[0].pixel = color; + + attributes.colorsymbols = xpmcolor; + attributes.numsymbols = 1; + attributes.valuemask |= XpmColorSymbols; + } + + /* + * By default, the XPM library assumes screen 0, so we have + * to pass in the real values. Submitted by Caveh Frank Jalali + */ + attributes.valuemask |= XpmVisual | XpmColormap | XpmDepth; + attributes.visual = Scr->d_visual; + attributes.colormap = XDefaultColormap(dpy, Scr->screen); + attributes.depth = Scr->d_depth; +#endif /* NEVER */ + + ErrorStatus = XpmReadFileToPixmap(dpy, Scr->Root, bigname, + &pixmap, &mask, &attributes); + } + + if (term) + { + *term = ':'; + path = term + 1; + } + else + path = NULL; + + if (ErrorStatus != XpmSuccess) + pixmap = None; + else + break; + + } while (path); + } + + if (pixmap == None && Scr->IconDirectory && bigname[0] != '/') { + if (bigname != name) free (bigname); + /* + * Attempt to find icon pixmap in old IconDirectory (now obsolete) + */ + bigname = (char *) malloc (strlen(name) + strlen(Scr->IconDirectory) + 2); + if (!bigname) { + fprintf (stderr, + "%s: unable to allocate memory for \"%s/%s\"\n", + ProgramName, Scr->IconDirectory, name); + return None; + } + (void) sprintf (bigname, "%s/%s", Scr->IconDirectory, name); + +#ifdef NEVER /* once, at the top, is enough? - djhjr - 12/26/98 */ + /* was 'XpmReturnAllocPixels' - Submitted by Takeharu Kato */ + attributes.valuemask = XpmReturnPixels; + + /* djhjr - 5/10/99 */ + attributes.valuemask |= XpmCloseness; + attributes.closeness = 32768; + + /* + * By default, the XPM library assumes screen 0, so we have + * to pass in the real values. Submitted by Caveh Frank Jalali + */ + attributes.valuemask |= XpmVisual | XpmColormap | XpmDepth; + attributes.visual = Scr->d_visual; + attributes.colormap = XDefaultColormap(dpy, Scr->screen); + attributes.depth = Scr->d_depth; +#endif /* NEVER */ + + ErrorStatus = XpmReadFileToPixmap(dpy, Scr->Root, bigname, &pixmap, + &mask, &attributes); + } + + if(ErrorStatus == XpmSuccess){ + newimage = (Image *)malloc(sizeof(Image)); + newimage->pixmap = pixmap; + newimage->mask = mask; + newimage->height = attributes.height; + newimage->width = attributes.width; + } + else { + fprintf (stderr, "%s: unable to find pixmap \"%s\"\n", + ProgramName, name); + } + + if (bigname != name) free (bigname); + return newimage; +} +#endif /* NO_XPM_SUPPORT */ + +void InsertRGBColormap (a, maps, nmaps, replace) + Atom a; + XStandardColormap *maps; + int nmaps; + Bool replace; +{ + StdCmap *sc = NULL; + + if (replace) { /* locate existing entry */ + for (sc = Scr->StdCmapInfo.head; sc; sc = sc->next) { + if (sc->atom == a) break; + } + } + + if (!sc) { /* no existing, allocate new */ + sc = (StdCmap *) malloc (sizeof (StdCmap)); + if (!sc) { + fprintf (stderr, "%s: unable to allocate %d bytes for StdCmap\n", + ProgramName, sizeof (StdCmap)); + return; + } + } + + if (replace) { /* just update contents */ + if (sc->maps) XFree ((char *) maps); + if (sc == Scr->StdCmapInfo.mru) Scr->StdCmapInfo.mru = NULL; + } else { /* else appending */ + sc->next = NULL; + sc->atom = a; + if (Scr->StdCmapInfo.tail) { + Scr->StdCmapInfo.tail->next = sc; + } else { + Scr->StdCmapInfo.head = sc; + } + Scr->StdCmapInfo.tail = sc; + } + sc->nmaps = nmaps; + sc->maps = maps; + + return; +} + +/* + * SetPixmapsPixmap - load the Image structure for the Pixmaps resource images + * + * djhjr - 5/17/98 + */ +Image *SetPixmapsPixmap(filename) +char *filename; +{ + Pixmap bm; + Image *image = NULL; + + bm = FindBitmap(filename, &JunkWidth, &JunkHeight); + if (bm != None) + { + image = (Image *)malloc(sizeof(Image)); + + image->width = JunkWidth; + image->height = JunkHeight; + image->mask = None; + + image->pixmap = bm; + } +#ifndef NO_XPM_SUPPORT + else /* Try to find a pixmap file with this name */ + + /* added color argument - djhjr - 9/28/99 */ + image = FindImage(filename, 0); +#endif + + return image; +} + +/* + * SetPixmapsBackground - set the background for the Pixmaps resource images + * + * djhjr - 5/23/98 + * used to receive (int *)numcolors and return (Image *)image - djhjr - 9/2/98 + */ +#ifndef NO_XPM_SUPPORT +int SetPixmapsBackground(image, drawable, color) +Image *image; +Drawable drawable; +Pixel color; +{ + XpmImage xpmimage; + XpmAttributes xpmattr; + XpmColorSymbol xpmcolor[1]; + unsigned int i; + + /* djhjr - 5/10/99 */ + xpmattr.valuemask = XpmCloseness; + xpmattr.closeness = 32768; + + /* + * By default, the XPM library assumes screen 0, so we have + * to pass in the real values. Submitted by Caveh Frank Jalali + */ + xpmattr.valuemask |= XpmVisual | XpmColormap | XpmDepth; + xpmattr.visual = Scr->d_visual; + xpmattr.colormap = XDefaultColormap(dpy, Scr->screen); + xpmattr.depth = Scr->d_depth; + + if (XpmCreateXpmImageFromPixmap(dpy, image->pixmap, image->mask, + &xpmimage, &xpmattr) != XpmSuccess) + return (0); + + for (i = 0; i < xpmimage.ncolors; i++) + if (!strcmp(xpmimage.colorTable[i].c_color, "None")) + break; + + if (i < xpmimage.ncolors) + { + /* djhjr - 9/2/98 */ + XFreePixmap(dpy, image->pixmap); + XFreePixmap(dpy, image->mask); + + xpmcolor[0].name = NULL; + xpmcolor[0].value = "none"; + xpmcolor[0].pixel = color; + +#ifdef NEVER /* once, at the top, is enough? - djhjr - 2/13/99 */ + xpmattr.colorsymbols = xpmcolor; + xpmattr.numsymbols = 1; + xpmattr.valuemask = XpmColorSymbols; + + /* djhjr - 5/10/99 */ + xpmattr.valuemask |= XpmCloseness; + xpmattr.closeness = 32768; + + /* + * By default, the XPM library assumes screen 0, so we have + * to pass in the real values. Submitted by Caveh Frank Jalali + */ + xpmattr.valuemask |= XpmVisual | XpmColormap | XpmDepth; + xpmattr.visual = Scr->d_visual; + xpmattr.colormap = XDefaultColormap(dpy, Scr->screen); + xpmattr.depth = Scr->d_depth; +#else + xpmattr.colorsymbols = xpmcolor; + xpmattr.numsymbols = 1; + xpmattr.valuemask |= XpmColorSymbols; +#endif /* NEVER */ + + XpmCreatePixmapFromXpmImage(dpy, drawable, &xpmimage, + &image->pixmap, &image->mask, &xpmattr); + } + + i = xpmimage.ncolors; + XpmFreeXpmImage(&xpmimage); + + return (i); +} +#endif /* NO_XPM_SUPPORT */ + +void RemoveRGBColormap (a) + Atom a; +{ + StdCmap *sc, *prev; + + prev = NULL; + for (sc = Scr->StdCmapInfo.head; sc; sc = sc->next) { + if (sc->atom == a) break; + prev = sc; + } + if (sc) { /* found one */ + if (sc->maps) XFree ((char *) sc->maps); + if (prev) prev->next = sc->next; + if (Scr->StdCmapInfo.head == sc) Scr->StdCmapInfo.head = sc->next; + if (Scr->StdCmapInfo.tail == sc) Scr->StdCmapInfo.tail = prev; + if (Scr->StdCmapInfo.mru == sc) Scr->StdCmapInfo.mru = NULL; + } + return; +} + +void LocateStandardColormaps() +{ + Atom *atoms; + int natoms; + int i; + + atoms = XListProperties (dpy, Scr->Root, &natoms); + for (i = 0; i < natoms; i++) { + XStandardColormap *maps = NULL; + int nmaps; + + if (XGetRGBColormaps (dpy, Scr->Root, &maps, &nmaps, atoms[i])) { + /* if got one, then append to current list */ + InsertRGBColormap (atoms[i], maps, nmaps, False); + } + } + if (atoms) XFree ((char *) atoms); + return; +} + +void GetColor(kind, what, name) +int kind; +Pixel *what; +char *name; +{ + XColor color, junkcolor; + Status stat = 0; + Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c; + +#ifndef TOM + if (!Scr->FirstTime) return; +#endif + + if (Scr->Monochrome != kind) return; + +#if ( XlibSpecificationRelease < 5 ) + /* eyckmans@imec.be */ + if ( ! ( ( name[0] == '#') + ? ( (stat = XParseColor (dpy, cmap, name, &color)) + && XAllocColor (dpy, cmap, &color)) + : XAllocNamedColor (dpy, cmap, name, &color, &junkcolor))) +#else + if (!XAllocNamedColor (dpy, cmap, name, &color, &junkcolor)) +#endif + { + /* if we could not allocate the color, let's see if this is a + * standard colormap + */ + XStandardColormap *stdcmap = NULL; + + /* parse the named color */ + if (name[0] != '#') + stat = XParseColor (dpy, cmap, name, &color); + if (!stat) + { + fprintf (stderr, "%s: invalid color name \"%s\"\n", + ProgramName, name); + return; + } + + /* + * look through the list of standard colormaps (check cache first) + */ + if (Scr->StdCmapInfo.mru && Scr->StdCmapInfo.mru->maps && + (Scr->StdCmapInfo.mru->maps[Scr->StdCmapInfo.mruindex].colormap == + cmap)) { + stdcmap = &(Scr->StdCmapInfo.mru->maps[Scr->StdCmapInfo.mruindex]); + } else { + StdCmap *sc; + + for (sc = Scr->StdCmapInfo.head; sc; sc = sc->next) { + int i; + + for (i = 0; i < sc->nmaps; i++) { + if (sc->maps[i].colormap == cmap) { + Scr->StdCmapInfo.mru = sc; + Scr->StdCmapInfo.mruindex = i; + stdcmap = &(sc->maps[i]); + goto gotit; + } + } + } + } + + gotit: + if (stdcmap) { + color.pixel = (stdcmap->base_pixel + + ((Pixel)(((float)color.red / 65535.0) * + stdcmap->red_max + 0.5) * + stdcmap->red_mult) + + ((Pixel)(((float)color.green /65535.0) * + stdcmap->green_max + 0.5) * + stdcmap->green_mult) + + ((Pixel)(((float)color.blue / 65535.0) * + stdcmap->blue_max + 0.5) * + stdcmap->blue_mult)); + } else { + fprintf (stderr, "%s: unable to allocate color \"%s\"\n", + ProgramName, name); + return; + } + } + + *what = color.pixel; +} + +void GetShadeColors (cp) +ColorPair *cp; +{ + XColor xcol; + Colormap cmap = Scr->TwmRoot.cmaps.cwins[0]->colormap->c; + int save; + float clearfactor; + float darkfactor; + char clearcol [32], darkcol [32]; + + clearfactor = (float) Scr->ClearBevelContrast / 100.0; + darkfactor = (100.0 - (float) Scr->DarkBevelContrast) / 100.0; + xcol.pixel = cp->back; + XQueryColor (dpy, cmap, &xcol); + + sprintf (clearcol, "#%04x%04x%04x", + xcol.red + (unsigned short) ((65535 - xcol.red) * clearfactor), + xcol.green + (unsigned short) ((65535 - xcol.green) * clearfactor), + xcol.blue + (unsigned short) ((65535 - xcol.blue) * clearfactor)); + sprintf (darkcol, "#%04x%04x%04x", + (unsigned short) (xcol.red * darkfactor), + (unsigned short) (xcol.green * darkfactor), + (unsigned short) (xcol.blue * darkfactor)); + + save = Scr->FirstTime; + Scr->FirstTime = True; + GetColor (Scr->Monochrome, &cp->shadc, clearcol); + GetColor (Scr->Monochrome, &cp->shadd, darkcol); + Scr->FirstTime = save; +} + +/* + * The following I18N-oriented functions are adapted from TWM + * as distributed with XFree86 4.2.0 - djhjr - 9/14/03 + */ + +/* + * The following functions are sensible to 'use_fontset'. + * When 'use_fontset' is True, + * - XFontSet-related internationalized functions are used + * so as multibyte languages can be displayed. + * When 'use_fontset' is False, + * - XFontStruct-related conventional functions are used + * so as 8-bit characters can be displayed even when + * locale is not set properly. + */ +void +GetFont(font) +MyFont *font; +{ +#ifndef NO_I18N_SUPPORT + char **missing_charset_list_return; + int missing_charset_count_return; + char *def_string_return; + XFontSetExtents *font_extents; + XFontStruct **xfonts; + char **font_names; + register int i; + int ascent; + int descent; + int fnum; + char *basename2, *basename3 = NULL; + + if (use_fontset) + { + if (font->fontset != NULL) + XFreeFontSet(dpy, font->fontset); + + if (!font->name) + font->name = Scr->DefaultFont.name; + if ((basename2 = (char *)malloc(strlen(font->name) + 3))) + sprintf(basename2, "%s,*", font->name); + else + basename2 = font->name; + if ((font->fontset = XCreateFontSet(dpy, basename2, + &missing_charset_list_return, + &missing_charset_count_return, + &def_string_return)) == NULL) + { + /* idea from Seth Robertson - djhjr - 9/17/03 */ + + if ((basename3 = (char *)realloc(basename2, + strlen(Scr->DefaultFont.name) + 3))) + sprintf(basename3, "%s,*", Scr->DefaultFont.name); + else + { + basename3 = Scr->DefaultFont.name; + if (basename2 != font->name) + free(basename2); + } + if ((font->fontset = XCreateFontSet(dpy, basename3, + &missing_charset_list_return, + &missing_charset_count_return, + &def_string_return)) == NULL) + { + fprintf(stderr, + "%s: unable to open fontsets \"%s\" or \"%s\"\n", + ProgramName, font->name, Scr->DefaultFont.name); + if (basename3 != Scr->DefaultFont.name) + free(basename3); + exit(1); + } + basename2 = basename3; + } + + if (basename2 != ((basename3) ? Scr->DefaultFont.name : font->name)) + free(basename2); + + for (i = 0; i < missing_charset_count_return; i++) + fprintf(stderr, "%s: font for charset %s is lacking\n", + ProgramName, missing_charset_list_return[i]); + + font_extents = XExtentsOfFontSet(font->fontset); + fnum = XFontsOfFontSet(font->fontset, &xfonts, &font_names); + for (i = 0, ascent = 0, descent = 0; iascent) + ascent = (*xfonts)->ascent; + if (descent < (*xfonts)->descent) + descent = (*xfonts)->descent; + xfonts++; + } + + font->height = font_extents->max_logical_extent.height; + font->y = ascent; + font->ascent = ascent; + font->descent = descent; + return; + } +#endif + + if (font->font != NULL) + XFreeFont(dpy, font->font); + + if ((font->font = XLoadQueryFont(dpy, font->name)) == NULL) + if ((font->font = XLoadQueryFont(dpy, Scr->DefaultFont.name)) == NULL) + { + fprintf(stderr, "%s: unable to open fonts \"%s\" or \"%s\"\n", + ProgramName, font->name, Scr->DefaultFont.name); + exit(1); + } + + font->height = font->font->ascent + font->font->descent; + font->y = font->font->ascent; + font->ascent = font->font->ascent; + font->descent = font->font->descent; +} + +#ifndef NO_I18N_SUPPORT +int +MyFont_TextWidth(font, string, len) + MyFont *font; + char *string; + int len; +{ + XRectangle ink_rect; + XRectangle logical_rect; + + if (use_fontset) { + XmbTextExtents(font->fontset, string, len, &ink_rect, &logical_rect); + return logical_rect.width; + } + return XTextWidth(font->font, string, len); +} + +void +MyFont_DrawImageString(dpy, d, font, gc, x, y, string, len) + Display *dpy; + Drawable d; + MyFont *font; + GC gc; + int x,y; + char *string; + int len; +{ + if (use_fontset) { + XmbDrawImageString(dpy, d, font->fontset, gc, x, y, string, len); + return; + } + XDrawImageString (dpy, d, gc, x, y, string, len); +} + +void +MyFont_DrawString(dpy, d, font, gc, x, y, string, len) + Display *dpy; + Drawable d; + MyFont *font; + GC gc; + int x,y; + char *string; + int len; +{ + if (use_fontset) { + XmbDrawString(dpy, d, font->fontset, gc, x, y, string, len); + return; + } + XDrawString (dpy, d, gc, x, y, string, len); +} + +void +MyFont_ChangeGC(fix_fore, fix_back, fix_font) + unsigned long fix_fore, fix_back; + MyFont *fix_font; +{ + Gcv.foreground = fix_fore; + Gcv.background = fix_back; + if (use_fontset) { + XChangeGC(dpy, Scr->NormalGC, GCForeground|GCBackground, &Gcv); + return; + } + Gcv.font = fix_font->font->fid; + XChangeGC(dpy, Scr->NormalGC, GCFont|GCForeground|GCBackground,&Gcv); +} + +/* + * The following functions are internationalized substitutions + * for XFetchName and XGetIconName using XGetWMName and + * XGetWMIconName. + * + * Please note that the third arguments have to be freed using free(), + * not XFree(). + */ +Status +I18N_FetchName(dpy, w, winname) + Display *dpy; + Window w; + char ** winname; +{ + int status; + XTextProperty text_prop; + char **list; + int num; + + status = XGetWMName(dpy, w, &text_prop); + if (!status || !text_prop.value || !text_prop.nitems) { + *winname = NULL; + return 0; + } + *winname = (char *)strdup(text_prop.value); + status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); + if (status < Success || !num || !*list) { + *winname = NULL; + return 0; + } + XFree(text_prop.value); + *winname = (char *)strdup(*list); + XFreeStringList(list); + return 1; +} + +Status +I18N_GetIconName(dpy, w, iconname) + Display *dpy; + Window w; + char ** iconname; +{ + int status; + XTextProperty text_prop; + char **list; + int num; + + status = XGetWMIconName(dpy, w, &text_prop); + if (!status || !text_prop.value || !text_prop.nitems) return 0; + *iconname = (char *)strdup(text_prop.value); + status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); + if (status < Success || !num || !*list) return 0; + XFree(text_prop.value); + *iconname = (char *)strdup(*list); + XFreeStringList(list); + return 1; +} +#endif + + +/* + * SetFocus - separate routine to set focus to make things more understandable + * and easier to debug + */ +void SetFocus (tmp_win, time) + TwmWindow *tmp_win; + Time time; +{ + Window w = (tmp_win ? tmp_win->w : PointerRoot); + +#ifdef TRACE + if (tmp_win) { + printf ("Focusing on window \"%s\"\n", tmp_win->full_name); + } else { + printf ("Unfocusing; Scr->Focus was \"%s\"\n", + Scr->Focus ? Scr->Focus->full_name : "(nil)"); + } +#endif + + XSetInputFocus (dpy, w, RevertToPointerRoot, time); +} + + +#ifdef NEED_PUTENV_F +/* + * define our own putenv() if the system doesn't have one. + * putenv(s): place s (a string of the form "NAME=value") in + * the environment; replacing any existing NAME. s is placed in + * environment, so if you change s, the environment changes (like + * putenv on a sun). Binding removed if you putenv something else + * called NAME. + */ +int +putenv(s) +/* djhjr - 4/22/98 +char *s; +*/ +const char *s; +{ + char *v; + int varlen, idx; + extern char **environ; + char **newenv; + static int virgin = 1; /* true while "environ" is a virgin */ + + v = index(s, '='); + if(v == 0) + return 0; /* punt if it's not of the right form */ + varlen = (v + 1) - s; + + for (idx = 0; environ[idx] != 0; idx++) { + if (strncmp(environ[idx], s, varlen) == 0) { + if(v[1] != 0) { /* true if there's a value */ + environ[idx] = (char *)s; + return 0; + } else { + do { + environ[idx] = environ[idx+1]; + } while(environ[++idx] != 0); + return 0; + } + } + } + + /* add to environment (unless no value; then just return) */ + if(v[1] == 0) + return 0; + if(virgin) { + register i; + + newenv = (char **) malloc((unsigned) ((idx + 2) * sizeof(char*))); + if(newenv == 0) + return -1; + for(i = idx-1; i >= 0; --i) + newenv[i] = environ[i]; + virgin = 0; /* you're not a virgin anymore, sweety */ + } else { + newenv = (char **) realloc((char *) environ, + (unsigned) ((idx + 2) * sizeof(char*))); + if (newenv == 0) + return -1; + } + + environ = newenv; + environ[idx] = (char *)s; + environ[idx+1] = 0; + + return 0; +} +#endif /* NEED_PUTENV_F */ + + +/* Returns a blank cursor */ +Cursor NoCursor() +{ + static Cursor blank = (Cursor) NULL; + Pixmap nopixmap; + XColor nocolor; + + if (!blank) { + nopixmap = XCreatePixmap(dpy, Scr->Root, 1, 1, 1); + nocolor.red = nocolor.blue = nocolor.green = 0; + blank = XCreatePixmapCursor(dpy, nopixmap, nopixmap, &nocolor, &nocolor, 1, 1); + } + return(blank); +} + +/* djhjr - 10/30/02 */ +static void DrawDotImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + XPoint points[5]; + int wb, hb, ws, hs, lw; + + lw = (w > h) ? h / 16 : w / 16; + if (lw == 1) lw = 0; + XSetForeground(dpy, rootGC, cp.fore); + XSetLineAttributes(dpy, rootGC, lw, LineSolid, CapButt, JoinMiter); + + ws = x + (w / 2) - 2; + hs = y + (h / 2) - 2; + wb = ws + 4; + hb = hs + 4; + + points[0].x = points[3].x = points[4].x = ws; + points[0].y = points[1].y = points[4].y = hs; + points[1].x = points[2].x = wb; + points[2].y = points[3].y = hb; + XDrawLines(dpy, d, rootGC, points, 5, CoordModeOrigin); +} + +/* djhjr - 10/30/02 */ +static void DrawResizeImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + XPoint points[3]; + int wb, hb, ws, hs, lw; + + lw = (w > h) ? h / 16 : w / 16; + if (lw == 1) lw = 0; + XSetForeground(dpy, rootGC, cp.fore); + XSetLineAttributes(dpy, rootGC, lw, LineSolid, CapButt, JoinMiter); + + y--; + wb = w / 4; /* bigger width */ + hb = h / 4; /* bigger width */ + ws = w / 2; /* smaller width */ + hs = h / 2; /* smaller width */ + + points[0].x = x; + points[0].y = points[1].y = y + hb; + points[1].x = points[2].x = x + w - wb - 1; + points[2].y = y + h; + XDrawLines(dpy, d, rootGC, points, 3, CoordModeOrigin); + + points[0].x = x; + points[0].y = points[1].y = y + hs; + points[1].x = points[2].x = x + ws; + points[2].y = y + h; + XDrawLines(dpy, d, rootGC, points, 3, CoordModeOrigin); +} + +/* djhjr - 10/30/02 */ +static void DrawMenuImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + int ih, iw; + int ix, iy; + int mh, mw; + int tw, th; + int lw, lh; + int lx, ly; + int lines, dly; + /*int off;*/ + int bw; + + if (h < 1) h = 1; + if (w < 1) w = 1; + + ix = iy = pad + 1; + ih = h - iy * 2; + iw = w - ix * 2; + /*off = ih / 8;*/ + mh = ih - ih / 8/*off*/; + mw = iw - iw / 8/*off*/; + bw = mh / 16; + if (bw == 0 && mw > 2) bw = 1; + tw = mw - bw * 2; + th = mh - bw * 2; + ix += x; + iy += y; + XSetForeground(dpy, rootGC, cp.fore); + XFillRectangle(dpy, d, rootGC, ix, iy, mw, mh); + XFillRectangle(dpy, d, rootGC, ix + iw - mw, iy + ih - mh, mw, mh); + XSetForeground(dpy, rootGC, cp.back); + XFillRectangle(dpy, d, rootGC, ix + bw, iy + bw, tw, th); + + lw = tw / 2; + if ((tw & 1) ^ (lw & 1)) lw++; + lx = ix + bw + (tw - lw) / 2; + lh = th / 2 - bw; + if ((lh & 1) ^ ((th - bw) & 1)) lh++; + ly = iy + bw + (th - bw - lh) / 2; + lines = 3; + if ((lh & 1) && lh < 6) lines--; + dly = lh / (lines - 1); + XSetForeground(dpy, rootGC, cp.fore); + while (lines--) + { + XFillRectangle(dpy, d, rootGC, lx, ly, lw, bw); + ly += dly; + } +} + +/* djhjr - 10/30/02 */ +static void DrawXLogoImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + GC gcBack; + XGCValues gcvalues; + int lw; + + gcBack = XCreateGC(dpy, Scr->Root, 0, &gcvalues); + gcvalues.background = cp.back; + gcvalues.foreground = cp.fore; + XChangeGC(dpy, gcBack, GCForeground | GCBackground, &gcvalues); + + lw = (w > h) ? h / 16 : w / 16; + if (lw < 3) lw = 3; + XSetLineAttributes(dpy, gcBack, lw, LineSolid, CapButt, JoinMiter); + + /* + * Draw the logo large so that it gets as dense as possible, + * then blank out the edges so that they look crisp. + */ + + x += pad; + y += pad; + w -= pad * 2; + h -= pad * 2; + XSetForeground(dpy, rootGC, cp.fore); + XSetForeground(dpy, gcBack, cp.back); + XmuDrawLogo(dpy, d, rootGC, gcBack, x - 1, y - 1, w + 2, h + 2); + XDrawRectangle(dpy, d, gcBack, x - 1, y - 1, w + 1, h + 1); + + XFreeGC(dpy, gcBack); +} + +/* djhjr - 10/30/02 */ +static void DrawQuestionImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + Pixmap p; + + p = XCreateBitmapFromData(dpy, Scr->Root, questionmark_bits, + questionmark_width, questionmark_height); + + XSetForeground(dpy, rootGC, cp.fore); + XCopyPlane(dpy, p, d, rootGC, 0, 0, + questionmark_width, questionmark_height, + x + (w - questionmark_width) / 2, + y + (h - questionmark_height) / 2, + (unsigned long)1); + + XFreePixmap(dpy, p); +} + +/* djhjr - 10/30/02 */ +static void DrawRArrowImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + XPoint points[4]; + int lw, mw, mh; + + if (!(h & 1)) h--; + if (h < 1) h = 1; + + lw = (w > h) ? h / 16 : w / 16; + if (lw == 1) lw = 0; + XSetForeground(dpy, rootGC, cp.fore); + XSetLineAttributes(dpy, rootGC, lw, LineSolid, CapButt, JoinMiter); + + mw = w / 3; + mh = h / 3; + points[0].x = w - mw; + points[0].y = h / 2; + points[1].x = mw - 1; + points[1].y = mh - 1; + points[2].x = mw - 1; + points[2].y = h - mh; + points[3] = points[0]; + XDrawLines(dpy, d, rootGC, points, 4, CoordModeOrigin); +} + +/* djhjr - 10/30/02 */ +static void DrawDArrowImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + XPoint points[4]; + int lw, mw, mh; + + if (!(h & 1)) h--; + if (h < 1) h = 1; + + lw = (w > h) ? h / 16 : w / 16; + if (lw == 1) lw = 0; + XSetForeground(dpy, rootGC, cp.fore); + XSetLineAttributes(dpy, rootGC, lw, LineSolid, CapButt, JoinMiter); + + mw = h / 3; + mh = h / 3; + points[0].x = w / 2; + points[0].y = h - mh; + points[1].x = w - mw; + points[1].y = mh - 1; + points[2].x = mw - 1; + points[2].y = mh - 1; + points[3] = points[0]; + XDrawLines(dpy, d, rootGC, points, 4, CoordModeOrigin); +} + +/* djhjr - 4/19/96 */ +/* added d, x, y, w, h, state - djhjr - 10/29/02 */ +static void Draw3DDotImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + Draw3DBorder(d, x + (w / 2) - 2, y + (h / 2) - 2, 5, 5, + Scr->ShallowReliefWindowButton, cp, state, True, False); +} + +/* djhjr - 4/19/96 */ +/* added d, x, y, w, h, state - djhjr - 10/29/02 */ +static void Draw3DBarImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + /* was 'Scr->TitleBevelWidth' - djhjr - 8/11/98 */ + Draw3DBorder (d, x + pad + 1, y + (h - 5) / 2, + w - pad * 2 - 2, 5, + Scr->ShallowReliefWindowButton, cp, state, True, False); +} + +/* djhjr - 4/19/96 */ +/* added d, x, y, w, h, state - djhjr - 10/29/02 */ +static void Draw3DMenuImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + int i, lines, width, height; + + height = Scr->ShallowReliefWindowButton * 2; + + /* count the menu lines */ + lines = (h - pad * 2 - 2) / height; + /* center 'em */ + y += (h - lines * height) / 2; + if (!(y & 1)) y += 1; + /* now draw 'em */ + x += pad + 1; + lines = y + lines * height; + width = w - pad * 2 - 2; + for (i = y; i < lines; i += height) + Draw3DBorder(d, x, i, width, height, + Scr->ShallowReliefWindowButton, + cp, state, True, False); +} + +/* djhjr - 4/19/96 */ +/* added d, x, y, w, h, state - djhjr - 10/29/02 */ +static void Draw3DResizeImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + int i, j; + + /* djhjr - 4/29/98 */ + /* was 'Scr->TitleBevelWidth' - djhjr - 8/11/98 */ + i = w - Scr->ButtonBevelWidth * 2; + + /* + * Extend the left and bottom "off-window" by the + * line width for "thick" boxes on "thin" buttons. + */ + + /* was 'Scr->TitleBevelWidth' - djhjr - 8/11/98 */ + j = Scr->ButtonBevelWidth + (i / 4); + Draw3DBorder(d, + x + -Scr->ShallowReliefWindowButton, y + j - 1, + x + w - j + 1 + Scr->ShallowReliefWindowButton, + y + h - j + 1 + Scr->ShallowReliefWindowButton, + Scr->ShallowReliefWindowButton, cp, state, True, False); + + j = Scr->ButtonBevelWidth + (i / 2); + Draw3DBorder(d, + x + -Scr->ShallowReliefWindowButton, y + j, + x + w - j + Scr->ShallowReliefWindowButton, + y + h - j + Scr->ShallowReliefWindowButton, + Scr->ShallowReliefWindowButton, cp, state, True, False); +} + +/* djhjr - 4/19/96 */ +/* added d, x, y, w, h, state - djhjr - 10/29/02 */ +static void Draw3DZoomImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + /* was 'Scr->TitleBevelWidth' - djhjr - 8/11/98 */ + Draw3DBorder (d, + x + pad + 1, y + pad + 1, + w - 2 * pad - 2, + h - 2 * pad - 2, + Scr->ShallowReliefWindowButton, cp, state, True, False); +} + +/* djhjr - 6/4/00 */ +/* added d, x, y, w, h, state - djhjr - 10/29/02 */ +static void Draw3DRArrowImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + int i, mw, mh; + + mw = w / 3; + mh = h / 3; + + if (Scr->Monochrome != COLOR) + { + /* draw highlights */ + setBorderGC(1, Scr->GreyGC, cp, state, False); + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + { + XDrawLine(dpy, d, Scr->GreyGC, + x + w - mw - i, y + h / 2, + x + mw - 1 + i, y + mh - 1 + i); + XDrawLine (dpy, d, Scr->GreyGC, + x + mw - 1 + i, y + mh - 1 + i, + x + mw - 1 + i, y + h - mh - i); + } + + /* draw shadows */ + setBorderGC(2, Scr->GreyGC, cp, state, False); + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + XDrawLine (dpy, d, Scr->GreyGC, + x + mw - 1 + i, y + h - mh - i, + x + w - mw - i, y + h / 2); + } + else if (Scr->BeNiceToColormap) + { + int dashoffset = 0; + + setBorderGC(3, Scr->ShadGC, cp, state, False); + + /* draw highlights */ + XSetForeground (dpy, Scr->ShadGC, Scr->White); + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + { + XDrawLine(dpy, d, Scr->ShadGC, + x + w - mw - i, y + h / 2, + x + mw - 1 + i, y + mh - 1 + i); + XDrawLine (dpy, d, Scr->ShadGC, + x + mw - 1 + i, y + mh - 1 + i, + x + mw - 1 + i, y + h - mh - i); + } + + /* draw shadows */ + XSetForeground (dpy, Scr->ShadGC, Scr->Black); + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + { + XDrawLine (dpy, d, Scr->ShadGC, + x + mw - 1 + i, y + h - mh - i + dashoffset, + x + w - mw - i, y + h / 2 + dashoffset); + dashoffset = 1 - dashoffset; + } + } + else + { + /* draw highlights */ + if (state) + { FB (cp.shadc, cp.shadd); } + else + { FB (cp.shadd, cp.shadc); } + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + { + XDrawLine(dpy, d, Scr->NormalGC, + x + w - mw - i, y + h / 2, + x + mw - 1 + i, y + mh - 1 + i); + XDrawLine (dpy, d, Scr->NormalGC, + x + mw - 1 + i, y + mh - 1 + i, + x + mw - 1 + i, y + h - mh - i); + } + + /* draw shadows */ + if (state) + { FB (cp.shadd, cp.shadc); } + else + { FB (cp.shadc, cp.shadd); } + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + XDrawLine (dpy, d, Scr->NormalGC, + x + mw - 1 + i, y + h - mw - i, + x + w - mw - i, y + h / 2); + } +} + +/* djhjr - 6/4/00 */ +/* added d, x, y, w, h, state - djhjr - 10/29/02 */ +static void Draw3DDArrowImage(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + int i, mw, mh; + + mw = w / 3; + mh = h / 3; + + if (Scr->Monochrome != COLOR) + { + /* draw highlights */ + setBorderGC(1, Scr->GreyGC, cp, state, False); + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + { + XDrawLine(dpy, d, Scr->GreyGC, + x + w - mw - i, y + mh - 1 + i, + x + mw - 1 + i, y + mh - 1 + i); + XDrawLine (dpy, d, Scr->GreyGC, + x + mw - 1 + i, y + mh - 1 + i, + x + w / 2, y + mh - 1 - i + h / 2); + } + + /* draw shadows */ + setBorderGC(2, Scr->GreyGC, cp, state, False); + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + XDrawLine (dpy, d, Scr->GreyGC, + x + w / 2, y + mh - 1 - i + h / 2, + x + w - mw - i, y + mh + i); + } + else if (Scr->BeNiceToColormap) + { + int dashoffset = 0; + + setBorderGC(3, Scr->ShadGC, cp, state, False); + + /* draw highlights */ + XSetForeground (dpy, Scr->ShadGC, Scr->White); + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + { + XDrawLine(dpy, d, Scr->ShadGC, + x + w - mw - i, y + mh - 1 + i, + x + mw - 1 + i, y + mh - 1 + i); + XDrawLine (dpy, d, Scr->ShadGC, + x + mw - 1 + i, y + mh - 1 + i + dashoffset, + x + w / 2, y + mh - 1 - i + h / 2 + dashoffset); + dashoffset = 1 - dashoffset; + } + + /* draw shadows */ + XSetForeground (dpy, Scr->ShadGC, Scr->Black); + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + XDrawLine (dpy, d, Scr->ShadGC, + x + w / 2, y + mh - 1 - i + h / 2, + x + w - mw - i, y + mh + i); + } + else + { + /* draw highlights */ + if (state) + { FB (cp.shadc, cp.shadd); } + else + { FB (cp.shadd, cp.shadc); } + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + { + XDrawLine(dpy, d, Scr->NormalGC, + x + w - mw - i, y + mh - 1 + i, + x + mw - 1 + i, y + mh - 1 + i); + XDrawLine (dpy, d, Scr->NormalGC, + x + mw - 1 + i, y + mh - 1 + i, + x + w / 2, y + mh - 1 - i + h / 2); + } + + /* draw shadows */ + if (state) + { FB (cp.shadd, cp.shadc); } + else + { FB (cp.shadc, cp.shadd); } + for (i = 0; i < Scr->ShallowReliefWindowButton; i++) + XDrawLine (dpy, d, Scr->NormalGC, + x + w / 2, y + mh - 1 - i + h / 2, + x + w - mw - i, y + mh + i); + } +} + +/* djhjr - 10/25/02 */ +static void Draw3DBoxHighlight(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + Draw3DBorder(d, x, y, w, h, + Scr->ShallowReliefWindowButton, cp, + state, True, False); +} + +/* djhjr - 10/25/02 */ +static void Draw3DLinesHighlight(d, x, y, w, h, pad, cp, state) +Drawable d; +int x, y, w, h, pad; +ColorPair cp; +int state; +{ + int p; + + p = (Scr->ShallowReliefWindowButton & 1) ? 3 : 2; + p = (h - Scr->ShallowReliefWindowButton * p - 2) / 2; + + y += h / 2 - 1; + y -= (Scr->ShallowReliefWindowButton & 1) ? 0 : 1; + y += (state == on) ? 0 : 1; + + h = Scr->ShallowReliefWindowButton * 2; + + Draw3DBorder(d, x, y - p, w, h, + Scr->ShallowReliefWindowButton, cp, + state, False, False); + + if ((Scr->ShallowReliefWindowButton & 1)) + Draw3DBorder(d, x, y, w, h, + Scr->ShallowReliefWindowButton, cp, + state, False, False); + + Draw3DBorder(d, x, y + p, w, h, + Scr->ShallowReliefWindowButton, cp, + state, False, False); +} + +/* ick - djhjr - 10/30/02 */ +static void DrawBackground(d, x, y, w, h, cp, use_rootGC) +Drawable d; +int x, y, w, h; +ColorPair cp; +int use_rootGC; +{ + XGCValues gcvalues; + + if (use_rootGC) + { + if (rootGC == (GC)0) + rootGC = XCreateGC(dpy, Scr->Root, 0, &gcvalues); + + gcvalues.background = cp.back; + gcvalues.foreground = cp.fore; + XChangeGC(dpy, rootGC, GCForeground | GCBackground, &gcvalues); + + XSetForeground(dpy, rootGC, cp.back); + XFillRectangle(dpy, d, rootGC, x, y, w, h); + } + else + { + FB(cp.back, cp.fore); + XFillRectangle(dpy, d, Scr->NormalGC, x, y, w, h); + } +} + +/* djhjr - 10/25/02 */ +static void DrawTitleHighlight(t, state) +TwmWindow *t; +int state; +{ + static const struct { + char *name; + void (*proc)(); + Bool use_rootGC; + int state; + } pmtab[] = { + /* djhjr - 10/30/02 */ + { TBPM_DOT, DrawDotImage, True, off }, + { TBPM_ICONIFY, DrawDotImage, True, off }, + { TBPM_RESIZE, DrawResizeImage, True, off }, + { TBPM_MENU, DrawMenuImage, True, off }, + { TBPM_XLOGO, DrawXLogoImage, True, off }, + { TBPM_DELETE, DrawXLogoImage, True, off }, + { TBPM_QUESTION, DrawQuestionImage, True, off }, + + { TBPM_3DDOT, Draw3DDotImage, False, off }, + { TBPM_3DRESIZE, Draw3DResizeImage, False, off }, + { TBPM_3DMENU, Draw3DMenuImage, False, off }, + { TBPM_3DZOOM, Draw3DZoomImage, False, off }, + { TBPM_3DBAR, Draw3DBarImage, False, off }, + + /* djhjr - 10/30/02 */ + { TBPM_3DBOX, Draw3DBoxHighlight, False, off }, + { TBPM_3DLINES, Draw3DLinesHighlight, False, off }, + + { TBPM_3DRAISEDBOX, Draw3DBoxHighlight, False, off }, + { TBPM_3DSUNKENBOX, Draw3DBoxHighlight, False, on }, + { TBPM_3DRAISEDLINES, Draw3DLinesHighlight, False, off }, + { TBPM_3DSUNKENLINES, Draw3DLinesHighlight, False, on }, + }; + + XGCValues gcvalues; + ColorPair cp; + register int i; + int h, w; + + cp = t->title; + w = ComputeHighlightWindowWidth(t); + h = Scr->TitleHeight - 2 * Scr->FramePadding - 2; + + for (i = 0; i < sizeof(pmtab) / sizeof(pmtab[0]); i++) + { + if (XmuCompareISOLatin1(pmtab[i].name, Scr->hiliteName) == 0) + { + if (state == off) + { + DrawBackground(t->title_w, + t->highlightx, + Scr->FramePadding + 1, + w, h, cp, + pmtab[i].use_rootGC | (Scr->Monochrome != COLOR)); + } + else + { + /* ick - djhjr - 10/30/02 */ + if (pmtab[i].use_rootGC) + { + if (rootGC == (GC)0) + rootGC = XCreateGC(dpy, + Scr->Root, + 0, + &gcvalues); + + gcvalues.background = cp.back; + gcvalues.foreground = cp.fore; + XChangeGC(dpy, rootGC, + GCForeground | GCBackground, + &gcvalues); + } + + (*pmtab[i].proc)(t->title_w, + t->highlightx, + Scr->FramePadding + 1, + w, h, 0, cp, pmtab[i].state); + } + + break; + } + } +} + +/* djhjr - 1/13/98 */ +void setBorderGC(type, gc, cp, state, forcebw) +int type, state, forcebw; +GC gc; +ColorPair cp; +{ + XGCValues gcv; + unsigned long gcm; + + switch (type) + { + case 0: /* Monochrome main */ + gcm = GCFillStyle; + gcv.fill_style = FillOpaqueStippled; + break; + case 1: /* Monochrome highlight */ + gcm = 0; + gcm |= GCLineStyle; + gcv.line_style = (state == on) ? LineSolid : LineDoubleDash; + gcm |= GCFillStyle; + gcv.fill_style = FillSolid; + break; + case 2: /* Monochrome shadow */ + gcm = 0; + gcm |= GCLineStyle; + gcv.line_style = (state == on) ? LineDoubleDash : LineSolid; + gcm |= GCFillStyle; + gcv.fill_style = FillSolid; + break; + case 3: /* BeNiceToColormap */ + gcm = 0; + gcm |= GCLineStyle; + gcv.line_style = (forcebw) ? LineSolid : LineDoubleDash; + gcm |= GCBackground; + gcv.background = cp.back; + break; + default: + return; + } + + XChangeGC (dpy, gc, gcm, &gcv); +} + +/* djhjr - 4/19/96 */ +void Draw3DBorder (w, x, y, width, height, bw, cp, state, fill, forcebw) +Drawable w; +int x, y, width, height, bw; +ColorPair cp; +int state, fill, forcebw; +{ + int i; + + if (width < 1 || height < 1) return; + + if (Scr->Monochrome != COLOR) + { + /* set main color */ + if (fill) + { + setBorderGC(0, Scr->GreyGC, cp, state, forcebw); + XFillRectangle (dpy, w, Scr->GreyGC, x, y, width, height); + } + + /* draw highlights */ + setBorderGC(1, Scr->GreyGC, cp, state, forcebw); + for (i = 0; i < bw; i++) + { + XDrawLine (dpy, w, Scr->GreyGC, x, y + i, + x + width - i - 1, y + i); + XDrawLine (dpy, w, Scr->GreyGC, x + i, y, + x + i, y + height - i - 1); + } + + /* draw shadows */ + setBorderGC(2, Scr->GreyGC, cp, state, forcebw); + for (i = 0; i < bw; i++) + { + XDrawLine (dpy, w, Scr->GreyGC, x + width - i - 1, y + i, + x + width - i - 1, y + height - 1); + XDrawLine (dpy, w, Scr->GreyGC, x + i, y + height - i - 1, + x + width - 1, y + height - i - 1); + } + + return; + } + + /* set main color */ + if (fill) + { + FB (cp.back, cp.fore); + XFillRectangle (dpy, w, Scr->NormalGC, x, y, width, height); + } + + if (Scr->BeNiceToColormap) + { + setBorderGC(3, Scr->ShadGC, cp, state, forcebw); + + /* draw highlights */ + if (state == on) + XSetForeground (dpy, Scr->ShadGC, Scr->Black); + else + XSetForeground (dpy, Scr->ShadGC, Scr->White); + for (i = 0; i < bw; i++) + { + XDrawLine (dpy, w, Scr->ShadGC, + x + i, y + borderdashoffset, + x + i, y + height - i - 1); + XDrawLine (dpy, w, Scr->ShadGC, + x + borderdashoffset, y + i, + x + width - i - 1, y + i); + borderdashoffset = 1 - borderdashoffset; + } + + /* draw shadows */ + if (state == on) + XSetForeground (dpy, Scr->ShadGC, Scr->White); + else + XSetForeground (dpy, Scr->ShadGC, Scr->Black); + for (i = 0; i < bw; i++) + { + XDrawLine (dpy, w, Scr->ShadGC, x + i, y + height - i - 1, + x + width - 1, y + height - i - 1); + XDrawLine (dpy, w, Scr->ShadGC, x + width - i - 1, y + i, + x + width - i - 1, y + height - 1); + } + + return; + } + + /* draw highlights */ + if (state == on) + { FB (cp.shadd, cp.shadc); } + else + { FB (cp.shadc, cp.shadd); } + for (i = 0; i < bw; i++) + { + XDrawLine (dpy, w, Scr->NormalGC, x, y + i, + x + width - i - 1, y + i); + XDrawLine (dpy, w, Scr->NormalGC, x + i, y, + x + i, y + height - i - 1); + } + + /* draw shadows */ + if (state == on) + { FB (cp.shadc, cp.shadd); } + else + { FB (cp.shadd, cp.shadc); } + for (i = 0; i < bw; i++) + { + XDrawLine (dpy, w, Scr->NormalGC, x + width - i - 1, y + i, + x + width - i - 1, y + height - 1); + XDrawLine (dpy, w, Scr->NormalGC, x + i, y + height - i - 1, + x + width - 1, y + height - i - 1); + } +} + +#ifdef USE_ORIGINAL_CORNERS +/* djhjr - 4/19/96 */ +void Draw3DCorner (w, x, y, width, height, thick, bw, cp, type) +Window w; +int x, y, width, height, thick, bw; +ColorPair cp; +int type; +{ + Draw3DBorder (w, x, y, width, height, bw, cp, off, True, False); + + switch (type) + { + /* upper left */ + case 0 : + Draw3DBorder (w, x + thick - bw, y + thick - bw, + width - thick + 2 * bw, height - thick + 2 * bw, + bw, cp, on, True, False); + break; + /* upper right */ + case 1 : + Draw3DBorder (w, x - bw, y + thick - bw, + width - thick + 2 * bw, height - thick + 2 * bw, + bw, cp, on, True, False); + break; + /* lower right */ + case 2 : + Draw3DBorder (w, x - bw, y - bw, + width - thick + 2 * bw, height - thick + 2 * bw, + bw, cp, on, True, False); + break; + /* lower left */ + case 3 : + Draw3DBorder (w, x + thick - bw, y - bw, + width - thick + 2 * bw, height - thick + 2 * bw, + bw, cp, on, True, False); + break; + } +} +#else /* USE_ORIGINAL_CORNERS */ +/* djhjr - 1/14/98 */ +GC setBevelGC(type, state, cp) +int type, state; +ColorPair cp; +{ + GC gc; + + if (Scr->Monochrome != COLOR) + { + gc = Scr->GreyGC; + setBorderGC(type, gc, cp, state, False); + } + else if (Scr->BeNiceToColormap) + { + gc = Scr->ShadGC; + setBorderGC(3, gc, cp, state, False); + if (state == on) + XSetForeground (dpy, gc, Scr->Black); + else + XSetForeground (dpy, gc, Scr->White); + } + else + { + gc = Scr->NormalGC; + if (state == on) + { FB (cp.shadc, cp.shadd); } + else + { FB (cp.shadd, cp.shadc); } + } + + return (gc); +} + +/* djhjr - 1/12/98 */ +void Draw3DBevel (w, x, y, bw, cp, state, type) +Drawable w; +int x, y, bw; +ColorPair cp; +int state, type; +{ + int i; + GC gc; + + switch (type) + { + /* vertical */ + case 1 : + case 11 : + gc = setBevelGC(1, state, cp); + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x - i - 1, y + i, + x - i - 1, y + bw - 2 * i + i); + if (type == 11) break; + case 111 : + gc = setBevelGC(2, !state, cp); + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x + i, y + i - 1, + x + i, y + bw - 2 * i + i - 1); + break; + /* horizontal */ + case 2 : + case 22 : + gc = setBevelGC(1, state, cp); + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x + i, y - i - 1, + x + bw - 2 * i + i, y - i - 1); + if (type == 22) break; + case 222 : + gc = setBevelGC(2, !state, cp); + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x + i - 1, y + i, + x + bw - 2 * i + i - 1, y + i); + break; + /* ulc to lrc */ + case 3 : + if (Scr->Monochrome != COLOR) + { + gc = Scr->GreyGC; + setBorderGC(0, gc, cp, state, False); + } + else + { + gc = Scr->NormalGC; + FB (cp.back, cp.fore); + } + XFillRectangle (dpy, w, gc, x, y, bw, bw); + gc = setBevelGC(1, (Scr->BeNiceToColormap) ? state : !state, cp); + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x + i, y, + x + i, y + Scr->BorderBevelWidth - 1); + gc = setBevelGC(2, (Scr->BeNiceToColormap) ? !state : state, cp); + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x, y + bw - i - 1, + x + bw - 1, y + bw - i - 1); + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x + bw - i - 1, y, + x + bw - i - 1, y + bw - 1); + break; + /* urc to llc */ + case 4 : + if (Scr->Monochrome != COLOR) + { + gc = Scr->GreyGC; + setBorderGC(0, gc, cp, state, False); + } + else + { + gc = Scr->NormalGC; + FB (cp.back, cp.fore); + } + XFillRectangle (dpy, w, gc, x, y, bw, bw); + gc = setBevelGC(1, (Scr->BeNiceToColormap) ? state : !state, cp); + /* top light */ + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x + i, y, + x + i, y + bw - i); + /* bottom light */ + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x + bw - 1, y + i, + x + bw - i - 1, y + i); + gc = setBevelGC(2, (Scr->BeNiceToColormap) ? !state : state, cp); + /* top dark */ + for (i = 0; i < Scr->BorderBevelWidth - 1; i++) + XDrawLine (dpy, w, gc, x + bw - Scr->BorderBevelWidth, y + i, + x + bw - i - 2, y + i); + /* bottom dark */ + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, gc, x + i, y + bw - i - 1, + x + bw + 1, y + bw - i - 1); + break; + } +} + +/* djhjr - 10/20/02 */ +void Draw3DNoBevel(w, x, y, bw, cp, state, forcebw) +Drawable w; +int x, y, bw; +ColorPair cp; +int state, forcebw; +{ + int i, upr, lwr; + + if (bw < 1) return; + + upr = y - 2 * Scr->BorderBevelWidth; + if ((upr & 1)) upr--; + lwr = y + 2 * Scr->BorderBevelWidth; + if ((lwr & 1)) lwr++; + + if (Scr->Monochrome != COLOR) + { + /* set main color */ + setBorderGC(0, Scr->GreyGC, cp, state, forcebw); + XFillRectangle (dpy, w, Scr->GreyGC, + x + Scr->BorderBevelWidth, upr, + (unsigned int)(bw - Scr->BorderBevelWidth * 2), + (unsigned int)(upr * 2)); + + /* draw highlight */ + setBorderGC(1, Scr->GreyGC, cp, state, forcebw); + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, Scr->GreyGC, + x + i, upr, x + i, lwr); + + /* draw shadow */ + setBorderGC(2, Scr->GreyGC, cp, state, forcebw); + for (i = bw - Scr->BorderBevelWidth; i < bw; i++) + XDrawLine (dpy, w, Scr->GreyGC, + x + i, upr, x + i, lwr); + + return; + } + + /* set main color */ + FB (cp.back, cp.fore); + XFillRectangle (dpy, w, Scr->NormalGC, + x + Scr->BorderBevelWidth, upr, + (unsigned int)(bw - Scr->BorderBevelWidth * 2), + (unsigned int)(upr * 2)); + + if (Scr->BeNiceToColormap) + { + int dashoffset; + + setBorderGC(3, Scr->ShadGC, cp, state, forcebw); + + /* draw highlight */ + if (state == on) + XSetForeground (dpy, Scr->ShadGC, Scr->Black); + else + XSetForeground (dpy, Scr->ShadGC, Scr->White); + dashoffset = 0; + for (i = 0; i < Scr->BorderBevelWidth; i++) + { + XDrawLine (dpy, w, Scr->ShadGC, + x + i, upr + dashoffset, x + i, lwr); + dashoffset = 1 - dashoffset; + } + + /* draw shadow */ + if (state == on) + XSetForeground (dpy, Scr->ShadGC, Scr->White); + else + XSetForeground (dpy, Scr->ShadGC, Scr->Black); + dashoffset = 0; + for (i = bw - Scr->BorderBevelWidth; i < bw; i++) + { + XDrawLine (dpy, w, Scr->ShadGC, + x + i, upr + dashoffset, x + i, lwr); + dashoffset = 1 - dashoffset; + } + + return; + } + + /* draw highlight */ + if (state == on) + { FB (cp.shadc, cp.shadd); } + else + { FB (cp.shadd, cp.shadc); } + for (i = 0; i < Scr->BorderBevelWidth; i++) + XDrawLine (dpy, w, Scr->NormalGC, + x + i, upr, x + i, lwr); + + /* draw shadow */ + if (state == on) + { FB (cp.shadd, cp.shadc); } + else + { FB (cp.shadc, cp.shadd); } + for (i = bw - Scr->BorderBevelWidth; i < bw; i++) + XDrawLine (dpy, w, Scr->NormalGC, + x + i, upr, x + i, lwr); +} +#endif /* USE_ORIGINAL_CORNERS */ + +/* djhjr - 4/19/96 */ +static Image *LoadBitmapImage (name, cp) +char *name; +ColorPair cp; +{ + Image *image; + Pixmap bm; + int width, height; + XGCValues gcvalues; + + if (rootGC == (GC) 0) rootGC = XCreateGC (dpy, Scr->Root, 0, &gcvalues); + bm = FindBitmap (name, (unsigned int *) &width, (unsigned int *) &height); + if (bm == None) return (None); + + image = (Image*) malloc (sizeof (struct _Image)); + image->pixmap = XCreatePixmap (dpy, Scr->Root, width, height, Scr->d_depth); + gcvalues.background = cp.back; + gcvalues.foreground = cp.fore; + XChangeGC (dpy, rootGC, GCForeground | GCBackground, &gcvalues); + XCopyPlane (dpy, bm, image->pixmap, rootGC, 0, 0, width, height, 0, 0, (unsigned long) 1); + XFreePixmap (dpy, bm); + image->mask = None; + image->width = width; + image->height = height; + image->next = None; + return (image); +} + +/* djhjr - 10/30/02 */ +static Image *CreateImagePixmap(name, w, h, depth) +char *name; +int w, h, depth; +{ + Image *image; + + image = (Image *)malloc(sizeof(struct _Image)); + if (!image) + { + fprintf(stderr, "%s: cannot allocate %d bytes for Image \"%s\"\n", + ProgramName, sizeof(struct _Image), name); + return (None); + } + + image->pixmap = XCreatePixmap(dpy, Scr->Root, w, h, depth); + if (image->pixmap == None) + { + fprintf(stderr, "%s: cannot allocate %d bytes for pixmap \"%s\"\n", + ProgramName, sizeof(image->pixmap), name); + free((void *)image); + return (None); + } + + return (image); +} + +/* djhjr - 4/19/96 10/30/02 */ +static Image *ReallyGetImage(name, w, h, pad, cp) +char *name; +int w, h, pad; +ColorPair cp; +{ + static const struct { + char *name; + void (*proc)(); + Bool use_rootGC; + int state; + } pmtab[] = { + { TBPM_DOT, DrawDotImage, True, off }, + { TBPM_ICONIFY, DrawDotImage, True, off }, + { TBPM_RESIZE, DrawResizeImage, True, off }, + { TBPM_MENU, DrawMenuImage, True, off }, + { TBPM_XLOGO, DrawXLogoImage, True, off }, + { TBPM_DELETE, DrawXLogoImage, True, off }, + { TBPM_QUESTION, DrawQuestionImage, True, off }, + + /* djhjr - 6/4/00 */ + { TBPM_RARROW, DrawRArrowImage, True, off }, + { TBPM_DARROW, DrawDArrowImage, True, off }, + + { TBPM_3DDOT, Draw3DDotImage, False, off }, + { TBPM_3DRESIZE, Draw3DResizeImage, False, off }, + { TBPM_3DMENU, Draw3DMenuImage, False, off }, + { TBPM_3DZOOM, Draw3DZoomImage, False, off }, + { TBPM_3DBAR, Draw3DBarImage, False, off }, + + /* djhjr - 6/4/00 */ + { TBPM_3DRARROW, Draw3DRArrowImage, False, off }, + { TBPM_3DDARROW, Draw3DDArrowImage, False, off }, + + /* djhjr - 10/30/02 */ + { TBPM_3DBOX, Draw3DBoxHighlight, False, off }, + { TBPM_3DLINES, Draw3DLinesHighlight, False, off }, + }; + + Image *image = NULL; + name_list **list; + register int i; + char fullname [256]; + + if (name == NULL) return (NULL); + + list = &Scr->ImageCache; + + if (name[0] == ':') + { + /* probably need '"%d", Scr->screen' - Caveh Frank Jalali */ + sprintf(fullname, "%s.%dx%d.%Xx%X", name, + w, h, (int)cp.fore, (int)cp.back); + if ((image = (Image *)LookInNameList(*list, fullname)) == NULL) + { + for (i = 0; i < sizeof(pmtab) / sizeof(pmtab[0]); i++) + { + if (XmuCompareISOLatin1(pmtab[i].name, name) == 0) + { + if (!(image = CreateImagePixmap(name, w, h, Scr->d_depth))) + return (None); + + DrawBackground(image->pixmap, 0, 0, w, h, cp, + pmtab[i].use_rootGC | (Scr->Monochrome != COLOR)); + + /* added d, x, y, w, h, pad, state - djhjr - 10/29/02 */ + (*pmtab[i].proc)(image->pixmap, 0, 0, w, h, pad, + cp, pmtab[i].state); + + image->mask = None; + image->width = w; + image->height = h; + image->next = None; + break; + } + } + + if (!image) + { + fprintf(stderr, "%s: no such built-in pixmap \"%s\"\n", + ProgramName, name); + return (NULL); + } + } + else + return (image); + } + else + { + /* + * Need screen number in fullname since screens may have different GCs. + * Submitted by Caveh Frank Jalali + */ + sprintf(fullname, "%s.%Xx%X.%d", + name, (int)cp.fore, (int)cp.back, (int)Scr->screen); + if ((image = (Image *)LookInNameList(*list, fullname)) == NULL) + { + if ((image = LoadBitmapImage(name, cp)) == NULL) +#ifndef NO_XPM_SUPPORT + /* djhjr - 3/20/98 */ + /* added color argument - djhjr - 9/28/99 */ + image = FindImage(name, cp.back); +#else + ; +#endif + + if (!image) return (NULL); + } + else + return (image); + } + + /* added 'type' argument - djhjr - 10/20/01 */ + AddToList(list, fullname, LTYPE_EXACT_NAME, (char *)image); + + return (image); +} + +/* + * Wrapper to guarantee something is returned - djhjr - 10/30/02 + */ +Image *GetImage(name, w, h, pad, cp) +char *name; +int w, h, pad; +ColorPair cp; +{ + Image *image = NULL; + + if (!(image = ReallyGetImage(name, w, h, pad, cp))) + image = ReallyGetImage(TBPM_QUESTION, w, h, pad, cp); + + return (image); +} + +/* djhjr - 4/21/96 */ +/* djhjr - 1/12/98 */ +void PaintBorders (tmp_win, focus) +TwmWindow *tmp_win; +Bool focus; +{ + GC gc; + ColorPair cp; + int i, j, cw, ch, cwbw, chbw; +#ifdef USE_ORIGINAL_CORNERS + int THbw, fhbwchbw, fhTHchbw; +#endif + + cp = (focus && tmp_win->highlight) ? tmp_win->border : tmp_win->border_tile; + + /* no titlebar, no corners */ + if (tmp_win->title_height == 0) + { + Draw3DBorder (tmp_win->frame, + 0, + 0, + tmp_win->frame_width, + tmp_win->frame_height, + Scr->BorderBevelWidth, cp, off, True, False); + Draw3DBorder (tmp_win->frame, + tmp_win->frame_bw3D - Scr->BorderBevelWidth, + tmp_win->frame_bw3D - Scr->BorderBevelWidth, + tmp_win->frame_width - 2 * tmp_win->frame_bw3D + 2 * Scr->BorderBevelWidth, + tmp_win->frame_height - 2 * tmp_win->frame_bw3D + 2 * Scr->BorderBevelWidth, + Scr->BorderBevelWidth, cp, on, True, False); + + return; + } + + cw = ch = Scr->TitleHeight; + if (cw * 2 > tmp_win->attr.width) cw = tmp_win->attr.width / 2; + if (ch * 2 > tmp_win->attr.height) ch = tmp_win->attr.height / 2; + cwbw = cw + tmp_win->frame_bw3D; + chbw = ch + tmp_win->frame_bw3D; + +#ifdef USE_ORIGINAL_CORNERS + THbw = Scr->TitleHeight + tmp_win->frame_bw3D; + fhbwchbw = tmp_win->frame_height + tmp_win->frame_bw3D - 3 * chbw; + fhTHchbw = tmp_win->frame_height - (Scr->TitleHeight + ch + 2 * tmp_win->frame_bw3D); + + /* client upper left corner */ + if (tmp_win->squeeze_info && tmp_win->title_x > tmp_win->frame_bw3D) + Draw3DCorner (tmp_win->frame, + 0, + Scr->TitleHeight, + cwbw, + chbw, + tmp_win->frame_bw3D, Scr->BorderBevelWidth, cp, 0); + /* client top bar */ + if (tmp_win->squeeze_info) + Draw3DBorder (tmp_win->frame, + THbw, + tmp_win->title_height, + tmp_win->frame_width - 2 * cwbw, + tmp_win->frame_bw3D, + Scr->BorderBevelWidth, cp, off, True, False); + /* client upper right corner */ + if (tmp_win->squeeze_info && tmp_win->title_x + tmp_win->title_width + tmp_win->frame_bw3D < tmp_win->frame_width) + Draw3DCorner (tmp_win->frame, + tmp_win->frame_width - cwbw, + Scr->TitleHeight, + cwbw, + chbw, + tmp_win->frame_bw3D, Scr->BorderBevelWidth, cp, 1); + /* client left bar */ + if (tmp_win->squeeze_info && tmp_win->title_x > tmp_win->frame_bw3D) + Draw3DBorder (tmp_win->frame, + 0, + THbw + ch, + tmp_win->frame_bw3D, + fhbwchbw, + Scr->BorderBevelWidth, cp, off, True, False); + else + Draw3DBorder (tmp_win->frame, + 0, + THbw, + tmp_win->frame_bw3D, + fhTHchbw, + Scr->BorderBevelWidth, cp, off, True, False); + /* client right bar */ + if (tmp_win->squeeze_info && tmp_win->title_x + tmp_win->title_width + tmp_win->frame_bw3D < tmp_win->frame_width) + Draw3DBorder (tmp_win->frame, + tmp_win->frame_width - tmp_win->frame_bw3D, + THbw + ch, + tmp_win->frame_bw3D, + fhbwchbw, + Scr->BorderBevelWidth, cp, off, True, False); + else + Draw3DBorder (tmp_win->frame, + tmp_win->frame_width - tmp_win->frame_bw3D, + THbw, + tmp_win->frame_bw3D, + fhTHchbw, + Scr->BorderBevelWidth, cp, off, True, False); + /* client lower left corner */ + Draw3DCorner (tmp_win->frame, + 0, + tmp_win->frame_height - chbw, + cwbw, + chbw, + tmp_win->frame_bw3D, Scr->BorderBevelWidth, cp, 3); + /* client bottom bar */ + Draw3DBorder (tmp_win->frame, + THbw, + tmp_win->frame_height - tmp_win->frame_bw3D, + tmp_win->frame_width - 2 * cwbw, + tmp_win->frame_bw3D, + Scr->BorderBevelWidth, cp, off, True, False); + /* client lower right corner */ + Draw3DCorner (tmp_win->frame, + tmp_win->frame_width - cwbw, + tmp_win->frame_height - chbw, + cwbw, + chbw, + tmp_win->frame_bw3D, Scr->BorderBevelWidth, cp, 2); + + /* titlebar upper left corner */ + Draw3DCorner (tmp_win->frame, + tmp_win->title_x - tmp_win->frame_bw3D, + 0, + cwbw, + THbw, + tmp_win->frame_bw3D, Scr->BorderBevelWidth, cp, 0); + /* titlebar top bar */ + Draw3DBorder (tmp_win->frame, + tmp_win->title_x + cw, + 0, + tmp_win->title_width - 2 * cw, + tmp_win->frame_bw3D, + Scr->BorderBevelWidth, cp, off, True, False); + /* titlebar upper right corner */ + Draw3DCorner (tmp_win->frame, + (tmp_win->title_width > 2 * Scr->TitleHeight) + ? tmp_win->title_x + tmp_win->title_width - Scr->TitleHeight + : tmp_win->frame_width - cwbw, + 0, + cwbw, + THbw, + tmp_win->frame_bw3D, Scr->BorderBevelWidth, cp, 1); +#else /* USE_ORIGINAL_CORNERS */ + /* client */ + borderdashoffset = 1; + Draw3DBorder (tmp_win->frame, + 0, + Scr->TitleHeight, + tmp_win->frame_width, + tmp_win->frame_height - Scr->TitleHeight, + Scr->BorderBevelWidth, cp, off, True, False); + borderdashoffset = 1; + Draw3DBorder (tmp_win->frame, + tmp_win->frame_bw3D - Scr->BorderBevelWidth, + Scr->TitleHeight + tmp_win->frame_bw3D - Scr->BorderBevelWidth, + tmp_win->frame_width - 2 * tmp_win->frame_bw3D + 2 * Scr->BorderBevelWidth, + tmp_win->frame_height - 2 * tmp_win->frame_bw3D + 2 * Scr->BorderBevelWidth - Scr->TitleHeight, + Scr->BorderBevelWidth, cp, on, True, False); + if (!Scr->NoBorderDecorations) /* djhjr - 10/20/02 */ + { + /* upper left corner */ + if (tmp_win->title_x == tmp_win->frame_bw3D) + Draw3DBevel (tmp_win->frame, + 0, Scr->TitleHeight + tmp_win->frame_bw3D, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 222); + else + { + if (tmp_win->title_x > tmp_win->frame_bw3D + cwbw) + Draw3DBevel (tmp_win->frame, + cwbw, Scr->TitleHeight, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 1); + Draw3DBevel (tmp_win->frame, + 0, Scr->TitleHeight + chbw, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 2); + } + } + /* upper right corner */ + if ((i = tmp_win->title_x + tmp_win->title_width + tmp_win->frame_bw3D) == tmp_win->frame_width) + Draw3DBevel (tmp_win->frame, + tmp_win->frame_width - tmp_win->frame_bw3D, Scr->TitleHeight + tmp_win->frame_bw3D, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 222); + else + { + if (!Scr->NoBorderDecorations) /* djhjr - 10/20/02 */ + { + if (i < tmp_win->frame_width - cwbw) + Draw3DBevel (tmp_win->frame, + tmp_win->frame_width - cwbw, Scr->TitleHeight, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 1); + Draw3DBevel (tmp_win->frame, + tmp_win->frame_width - tmp_win->frame_bw3D, + Scr->TitleHeight + chbw, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 2); + } + } + if (!Scr->NoBorderDecorations) /* djhjr - 10/20/02 */ + { + /* lower left corner */ + Draw3DBevel (tmp_win->frame, + cwbw, tmp_win->frame_height - tmp_win->frame_bw3D, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 1); + Draw3DBevel (tmp_win->frame, + 0, tmp_win->frame_height - chbw, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 2); + /* lower right corner */ + Draw3DBevel (tmp_win->frame, + tmp_win->frame_width - cwbw, + tmp_win->frame_height - tmp_win->frame_bw3D, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 1); + Draw3DBevel (tmp_win->frame, + tmp_win->frame_width - tmp_win->frame_bw3D, + tmp_win->frame_height - chbw, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 2); + } + /* title */ + borderdashoffset = 0; + Draw3DBorder (tmp_win->frame, + tmp_win->title_x - tmp_win->frame_bw3D, + tmp_win->title_y - tmp_win->frame_bw3D, + tmp_win->title_width + 2 * tmp_win->frame_bw3D, + Scr->TitleHeight + tmp_win->frame_bw3D, + Scr->BorderBevelWidth, cp, off, True, False); + borderdashoffset = 0; + Draw3DBorder (tmp_win->frame, + tmp_win->title_x - Scr->BorderBevelWidth, + tmp_win->title_y - Scr->BorderBevelWidth, + tmp_win->title_width + 2 * Scr->BorderBevelWidth, + Scr->TitleHeight, + Scr->BorderBevelWidth, cp, on, True, False); + /* upper left corner */ + if (tmp_win->title_x == tmp_win->frame_bw3D) + { + /* this 'if (...) else' - djhjr - 10/20/02 */ + if (Scr->NoBorderDecorations) + { + Draw3DNoBevel(tmp_win->frame, + tmp_win->title_x - tmp_win->frame_bw3D, + Scr->TitleHeight + tmp_win->frame_bw3D, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? off : on, False); + } + else + { + gc = setBevelGC(2, (Scr->BeNiceToColormap) ? on : off, cp); + +/* djhjr - 4/29/98 + XDrawLine (dpy, tmp_win->frame, gc, + tmp_win->title_x - 2, Scr->TitleHeight + tmp_win->frame_bw3D - 4, + tmp_win->title_x - 2, Scr->TitleHeight + tmp_win->frame_bw3D - 1); + XDrawLine (dpy, tmp_win->frame, gc, + tmp_win->title_x - 1, Scr->TitleHeight + tmp_win->frame_bw3D - 4, + tmp_win->title_x - 1, Scr->TitleHeight + tmp_win->frame_bw3D - 1); +*/ + for (j = 1; j <= Scr->BorderBevelWidth; j++) + XDrawLine (dpy, tmp_win->frame, gc, + tmp_win->title_x - j, + Scr->TitleHeight + tmp_win->frame_bw3D - 2 * Scr->BorderBevelWidth, + tmp_win->title_x - j, + Scr->TitleHeight + tmp_win->frame_bw3D - Scr->BorderBevelWidth - 1); + + Draw3DBevel (tmp_win->frame, + tmp_win->title_x + cw, 0, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 1); + } + } + else + { + Draw3DBevel (tmp_win->frame, + tmp_win->title_x - tmp_win->frame_bw3D, Scr->TitleHeight, + tmp_win->frame_bw3D, cp, off, 3); + } + /* upper right corner */ + if (i == tmp_win->frame_width) + { + /* this 'if (...) else' - djhjr - 10/20/02 */ + if (Scr->NoBorderDecorations) + { + Draw3DNoBevel(tmp_win->frame, + tmp_win->frame_width - tmp_win->frame_bw3D, + Scr->TitleHeight + tmp_win->frame_bw3D, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? off : on, False); + } + else + { + gc = setBevelGC(1, (Scr->BeNiceToColormap) ? off : on, cp); + +/* djhjr - 4/29/98 + gc = setBevelGC(1, on, cp); + XDrawLine (dpy, tmp_win->frame, gc, + tmp_win->title_x + tmp_win->title_width, Scr->TitleHeight + tmp_win->frame_bw3D - 2, + tmp_win->title_x + tmp_win->title_width, Scr->TitleHeight + tmp_win->frame_bw3D - 2); +*/ + for (j = 0; j < Scr->BorderBevelWidth; j++) + XDrawLine (dpy, tmp_win->frame, gc, + tmp_win->title_x + tmp_win->title_width - 1, + Scr->TitleHeight + tmp_win->frame_bw3D - Scr->BorderBevelWidth + j - 1, + tmp_win->title_x + tmp_win->title_width + Scr->BorderBevelWidth - j - 1, + Scr->TitleHeight + tmp_win->frame_bw3D - Scr->BorderBevelWidth + j - 1); + + Draw3DBevel (tmp_win->frame, + tmp_win->title_x + tmp_win->title_width - cw, 0, + tmp_win->frame_bw3D, cp, + (Scr->BeNiceToColormap) ? on : off, 1); + } + } + else + { + Draw3DBevel (tmp_win->frame, + tmp_win->title_x + tmp_win->title_width, Scr->TitleHeight, + tmp_win->frame_bw3D, cp, off, 4); + } +#endif /* USE_ORIGINAL_CORNERS */ +} + +/* djhjr - 4/21/96 */ +void PaintIcon (tmp_win) +TwmWindow *tmp_win; +{ +/* djhjr - 5/5/98 + if (Scr->use3Diconmanagers) { +*/ + /* was 'Scr->use3Dicons' - djhjr - 8/11/98 */ + if (Scr->IconBevelWidth > 0) { + +/* + Draw3DBorder (tmp_win->icon_w, 0, tmp_win->icon_height, + tmp_win->icon_w_width, Scr->IconFont.height + 6, + Scr->BorderBevelWidth, tmp_win->iconc, off, False, False); +*/ + /* was 'Scr->BorderBevelWidth' - djhjr - 8/11/98 */ + Draw3DBorder (tmp_win->icon_w, 0, 0, + tmp_win->icon_w_width, tmp_win->icon_w_height, + Scr->IconBevelWidth, tmp_win->iconc, off, False, False); + } + + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(tmp_win->iconc.fore, tmp_win->iconc.back, Scr->IconFont); + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString (dpy, tmp_win->icon_w, &Scr->IconFont, +#else + XDrawString (dpy, tmp_win->icon_w, +#endif + Scr->NormalGC, tmp_win->icon_x, tmp_win->icon_y, + tmp_win->icon_name, strlen(tmp_win->icon_name)); +} + +/* djhjr - 4/20/96 */ +void PaintTitle (tmp_win) +TwmWindow *tmp_win; +{ + /* made static - djhjr - 6/18/99 */ + static int en = 0, dots = 0; + + int bwidth = Scr->TBInfo.width + Scr->TBInfo.pad; + int left = (Scr->TBInfo.nleft) ? Scr->TBInfo.leftx + + (Scr->TBInfo.nleft * bwidth) - Scr->TBInfo.pad : + 0; + int right = (Scr->TBInfo.nright) ? + (Scr->TBInfo.nright * bwidth) - Scr->TBInfo.pad : + 0; + + /* djhjr - 3/29/98 */ + int i, j, slen = strlen(tmp_win->name); + char *a = NULL; + +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (!en) en = MyFont_TextWidth(&Scr->TitleBarFont, "n", 1); +#else + if (!en) en = XTextWidth(Scr->TitleBarFont.font, "n", 1); +#endif + + /* + * clip the title a couple of characters less than the width of + * the titlebar plus padding, and tack on ellipses - this is a + * little different than the icon manager's... + * + * djhjr - 3/29/98 + */ + if (Scr->NoPrettyTitles == FALSE) /* for rader - djhjr - 2/9/99 */ + { +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + i = MyFont_TextWidth(&Scr->TitleBarFont, tmp_win->name, slen); +#else + i = XTextWidth(Scr->TitleBarFont.font, tmp_win->name, slen); +#endif + +/* DUH! - djhjr - 6/18/99 + j = tmp_win->title_width - 2 * Scr->TBInfo.rightoff; +*/ +/* djhjr - 10/18/02 + if (!dots) dots = XTextWidth(Scr->TitleBarFont.font, "...", 3) + en; + j = tmp_win->title_width - Scr->TBInfo.titlex - Scr->TBInfo.rightoff - dots; +*/ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (!dots) dots = MyFont_TextWidth(&Scr->TitleBarFont, "...", 3); +#else + if (!dots) dots = XTextWidth(Scr->TitleBarFont.font, "...", 3); +#endif + j = tmp_win->title_width - Scr->TBInfo.titlex - Scr->TBInfo.rightoff - en; + +/* djhjr - 10/18/02 + * djhjr - 5/5/98 * + * was 'Scr->use3Dtitles' - djhjr - 8/11/98 * + if (Scr->TitleBevelWidth > 0) + j -= Scr->TitleBevelWidth; +*/ + /* reworked this stuff - djhjr - 10/18/02 */ + if (dots >= j) + slen = 0; + else if (i > j) + { + while (i >= 0) + { +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + if (MyFont_TextWidth(&Scr->TitleBarFont, +#else + if (XTextWidth(Scr->TitleBarFont.font, +#endif + tmp_win->name, i) + dots < j) + { + slen = i; + break; + } + + i--; + } + + a = (char *)malloc(slen + 4); + memcpy(a, tmp_win->name, slen); + strcpy(a + slen, "..."); + slen += 3; + } + } + + /* font was font.font->fid - djhjr - 9/14/03 */ + FBF(tmp_win->title.fore, tmp_win->title.back, Scr->TitleBarFont); + +/* djhjr - 10/18/02 */ +#if 0 + /* was 'Scr->use3Dtitles' - djhjr - 8/11/98 */ + if (Scr->TitleBevelWidth > 0) + { +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString (dpy, tmp_win->title_w, &Scr->TitleBarFont, +#else + XDrawString (dpy, tmp_win->title_w, +#endif + Scr->NormalGC, +/* djhjr - 4/29/98 + Scr->TBInfo.titlex + en, Scr->TitleBarFont.y + 2, +*/ +/* djhjr - 5/5/98 + Scr->TBInfo.titlex + en, Scr->TitleBarFont.y + Scr->TitleBevelWidth + 1, +*/ + Scr->TBInfo.titlex + Scr->TitleBevelWidth + en, Scr->TitleBarFont.y, + + (a) ? a : tmp_win->name, slen); + } + else +#endif +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + MyFont_DrawString (dpy, tmp_win->title_w, &Scr->TitleBarFont, +#else + XDrawString (dpy, tmp_win->title_w, +#endif + Scr->NormalGC, Scr->TBInfo.titlex, Scr->TitleBarFont.y, + (a) ? a : tmp_win->name, slen); + + /* free the clipped title - djhjr - 3/29/98 */ + if (a) free(a); + + /* was 'Scr->use3Dtitles' - djhjr - 8/11/98 */ + if (Scr->TitleBevelWidth > 0) + { +/* + Draw3DBorder (tmp_win->title_w, Scr->TBInfo.titlex, 0, + tmp_win->title_width - Scr->TBInfo.titlex - Scr->TBInfo.rightoff, + Scr->TitleHeight, Scr->TitleBevelWidth, tmp_win->title, off, True, False); +*/ +/* djhjr - 3/12/97 + Draw3DBorder (tmp_win->title_w, Scr->TBInfo.rightoff, Scr->FramePadding, + tmp_win->title_width - 2 * Scr->TBInfo.rightoff, + Scr->TitleHeight - 2 * Scr->FramePadding, Scr->TitleBevelWidth, tmp_win->title, off, True, False); +*/ +/* djhjr - 10/17/02 + Draw3DBorder (tmp_win->title_w, Scr->TBInfo.leftx + left, + Scr->FramePadding, tmp_win->title_width - (left + right), + Scr->TitleHeight - 2 * Scr->FramePadding, Scr->TitleBevelWidth, tmp_win->title, off, False, False); +*/ + if (Scr->FramePadding + Scr->ButtonIndent > 0) + { + Draw3DBorder(tmp_win->title_w, 0, 0, + tmp_win->title_width, Scr->TitleHeight, + Scr->TitleBevelWidth, tmp_win->title, + off, False, False); + } + else + { + Draw3DBorder(tmp_win->title_w, left, 0, + tmp_win->title_width - (left + right), + Scr->TitleHeight, + Scr->TitleBevelWidth, tmp_win->title, + off, False, False); + } + } +} + +/* djhjr - 11/17/97 */ +/* collapsed the two functions PTB() and PTBH() - djhjr - 8/10/98 */ +/* djhjr - 10/30/02 */ +void PaintTitleButton(tmp_win, tbw, onoroff) +TwmWindow *tmp_win; +TBWindow *tbw; +int onoroff; /* 0 = no hilite 1 = hilite off 2 = hilite on */ +{ + Image *image; + TitleButton *tb; + /* djhjr - 5/23/98 8/10/98 */ + ColorPair cp; + + if (!tbw->window) return; + + tb = tbw->info; + + /* djhjr - 5/23/98 8/10/98 */ + if (Scr->ButtonColorIsFrame) + cp = (onoroff == 2) ? tmp_win->border : tmp_win->border_tile; + else + cp = tmp_win->title; + cp.fore = tmp_win->title.fore; + + image = GetImage(tb->name, tb->width, tb->height, + Scr->ButtonBevelWidth * 2, cp); + + XCopyArea(dpy, image->pixmap, tbw->window, Scr->NormalGC, + tb->srcx, tb->srcy, tb->width, tb->height, tb->dstx, tb->dsty); + + /* djhjr - 8/10/98 8/18/98 */ + /* was 'Scr->TitleBevelWidth' - djhjr - 8/11/98 */ + if (Scr->ButtonBevelWidth > 0) + Draw3DBorder(tbw->window, 0, 0, tb->width, tb->height, + Scr->ButtonBevelWidth, cp, off, False, False); +} + +/* djhjr - 4/19/96 */ +/* re-arranged - djhjr - 4/5/98 */ +void PaintTitleHighlight(tmp_win, onoroff) +TwmWindow *tmp_win; +Bool onoroff; +{ + /* djhjr - 4/3/98 */ + if (!tmp_win->titlehighlight) return; + + if (tmp_win->hilite_w) + { + if (onoroff == on) + XMapWindow (dpy, tmp_win->hilite_w); + else + XUnmapWindow (dpy, tmp_win->hilite_w); + } + else if (Scr->hiliteName && tmp_win->title_height != 0) + DrawTitleHighlight(tmp_win, onoroff); /* djhjr - 10/25/02 */ +} + +/* djhjr - 4/2/98 10/18/02 */ +int ComputeHighlightWindowWidth(tmp_win) +TwmWindow *tmp_win; +{ +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT + int en = MyFont_TextWidth(&Scr->TitleBarFont, "n", 1); +#else + int en = XTextWidth(Scr->TitleBarFont.font, "n", 1); +#endif + + return (tmp_win->rightx - tmp_win->highlightx - en); +} + diff --git a/util.h b/util.h new file mode 100644 index 0000000..21a1a50 --- /dev/null +++ b/util.h @@ -0,0 +1,108 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + + +/*********************************************************************** + * + * $XConsortium: util.h,v 1.10 89/12/10 17:47:04 jim Exp $ + * + * utility routines header file + * + * 28-Oct-87 Thomas E. LaStrange File created + * + ***********************************************************************/ + +#ifndef _UTIL_ +#define _UTIL_ + +typedef struct _Image { + Pixmap pixmap; + Pixmap mask; + int width; + int height; + struct _Image *next; +} Image; + +extern void Zoom(); +extern void MoveOutline(); +extern Pixmap GetBitmap(), FindBitmap(); +#ifndef NO_XPM_SUPPORT +extern Image *FindImage(); +#endif +extern void GetUnknownIcon(); +extern char *ExpandFilename(); +extern void GetColor(); +extern Cursor NoCursor(); + +extern Image *GetImage (); +extern void Draw3DBorder(); +extern void GetShadeColors(); +extern void PaintBorders(); +extern void PaintIcon(); +extern void PaintTitle(); +extern void PaintTitleButton(); +extern void InsertRGBColormap(); +extern void RemoveRGBColormap(); +extern void SetFocus(); +extern void LocateStandardColormaps(); +extern void GetFont(); +/* djhjr - 9/14/03 */ +#ifndef NO_I18N_SUPPORT +extern int MyFont_TextWidth(); +extern void MyFont_DrawImageString(); +extern void MyFont_DrawString(); +extern void MyFont_ChangeGC(); +extern Status I18N_FetchName(); +extern Status I18N_GetIconName(); +#endif + +/* djhjr - 1/13/98 */ +void setBorderGC(); +#ifdef USE_ORIGINAL_CORNERS +void Draw3DCorner(); +#else +GC setBevelGC(); +void Draw3DBevel(); +#endif + +/* djhjr - 4/25/96 */ +void PaintTitleHighlight(); + +/* djhjr - 4/2/98 */ +int ComputeHighlightWindowWidth(); + +/* djhjr - 5/17/98 */ +extern Image *SetPixmapsPixmap(); + +/* djhjr - 5/23/98 */ +#ifndef NO_XPM_SUPPORT +extern int SetPixmapsBackground(); +#endif + +extern int HotX, HotY; + +#endif /* _UTIL_ */ diff --git a/version.c b/version.c new file mode 100644 index 0000000..0f62085 --- /dev/null +++ b/version.c @@ -0,0 +1,71 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + +/* djhjr - 4/23/96 +char *Version = "Virtual Desktop TWM (VTWM) - R5 Release (5.3)"; +*/ +/* djhjr - 9/10/96 +char *Version = "Virtual Desktop TWM (VTWM) - R5 Release 5.4"; +*/ +/* djhjr - 3/12/97 +char *Version = "Virtual Desktop TWM (VTWM) - R5 Release 5.4.1"; +*/ +/* djhjr - 11/17/97 +char *Version = "Virtual Desktop TWM (VTWM) - R5 Release 5.4.2"; +*/ +/* djhjr - 1/1/98 +char *Version = "Virtual Desktop TWM (VTWM) - R5 Release 5.4.3"; +*/ +/* djhjr - 2/5/98 +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.4"; +*/ +/* djhjr - 3/14/98 +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.4a"; +*/ +/* djhjr - 3/20/98 +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.4b"; +*/ +/* djhjr - 8/11/98 +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.4c"; +*/ +/* djhjr - 9/27/98 +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.5"; +*/ +/* djhjr - 1/30/99 +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.5a"; +*/ +/* djhjr - 11/8/01 +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.6"; +*/ +/* djhjr - 10/1/04 +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.6a"; +*/ +/* djhjr - 10/2/04 +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.6b"; +*/ +char *Version = "Virtual Desktop TWM (VTWM) - X11R4-6 Release 5.4.7"; + diff --git a/version.h b/version.h new file mode 100644 index 0000000..012bad9 --- /dev/null +++ b/version.h @@ -0,0 +1,46 @@ +/*****************************************************************************/ +/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ +/** Salt Lake City, Utah **/ +/** Portions Copyright 1989 by the Massachusetts Institute of Technology **/ +/** Cambridge, Massachusetts **/ +/** **/ +/** All Rights Reserved **/ +/** **/ +/** Permission to use, copy, modify, and distribute this software and **/ +/** its documentation for any purpose and without fee is hereby **/ +/** granted, provided that the above copyright notice appear in all **/ +/** copies and that both that copyright notice and this permis- **/ +/** sion notice appear in supporting documentation, and that the **/ +/** names of Evans & Sutherland and M.I.T. not be used in advertising **/ +/** in publicity pertaining to distribution of the software without **/ +/** specific, written prior permission. **/ +/** **/ +/** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/ +/** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/ +/** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/ +/** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/ +/** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/ +/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/ +/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ +/** OR PERFORMANCE OF THIS SOFTWARE. **/ +/*****************************************************************************/ + +/********************************************************************** + * + * $XConsortium: version.h,v 1.7 89/10/27 14:01:42 jim Exp $ + * + * TWM version externs + * + * 8-Apr-88 Tom LaStrange Initial Version. + * + **********************************************************************/ + +#ifndef _VERSION_ +#define _VERSION_ + +extern char *Version; + +/* djhjr - 9/19/96 */ +extern char *lastmake[]; + +#endif /* _VERSION_ */