tlastran@esunix.UUCP (Tom LaStrange) (06/04/88)
#! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting test in a file # 3. Execute the file with /bin/sh (not csh) to create the files: # #Makefile #README #Sample.twmrc #twm.man #lex.l # # Created by tlastran (Tom LaStrange) on Fri Jun 3 11:32:20 MDT 1988 # if test -f 'Makefile' then echo shar: will not over-write existing file "Makefile" else echo extracting "Makefile" sed 's/^X//' >Makefile <<'SHAR_EOF' X#********************************************************************** X# X# twm Makefile X# X#********************************************************************** X X.SUFFIXES: .y .o X X.y.o: X yacc -d $*.y X mv y.tab.c $*.c X mv y.tab.h $*.h X $(CC) -c $(CFLAGS) $*.c X X# X# If you are running X11R1, then you must use the resource manager X# library in addition to libX11.a X# X#LIBS= -lX11 -lXrm XLIBS= -lX11 X X# X# -DNOFOCUS causes the focus button in the title bar to be compiled out X# XCFLAGS= -O XLDFLAGS= X XO_FILES=\ X gram.o\ X lex.o\ X add_window.o\ X gc.o\ X list.o\ X twm.o\ X parse.o\ X menus.o\ X events.o\ X resize.o\ X util.o\ X version.o X X Xall: twm mytitle X Xtwm: $(O_FILES) X cc $(LDFLAGS) -o twm $(O_FILES) $(LIBS) X Xmytitle: X cc $(LDFLAGS) -o mytitle mytitle.c X X# X# Dependencies X# Xgram.o: \ X twm.h \ X menus.h \ X list.h \ X util.h Xlex.o: \ X gram.h Xutil.o: \ X twm.h \ X util.h \ X gram.h Xparse.o: \ X twm.h \ X menus.h \ X util.h Xlist.o: \ X twm.h \ X gram.h Xresize.o: \ X twm.h \ X util.h \ X resize.h \ X add_window.h \ X resize.bm \ X focus.bm Xmenus.o: \ X twm.h \ X gc.h \ X menus.h \ X events.h \ X util.h \ X gram.h \ X pull.bm Xevents.o: \ X twm.h \ X add_window.h \ X menus.h \ X events.h \ X resize.h \ X gram.h \ X twm.bm Xtwm.o: \ X twm.h \ X add_window.h \ X gc.h \ X parse.h \ X version.h \ X menus.h \ X events.h \ X util.h \ X gram.h \ X twm.bm \ X gray.bm Xgc.o: \ X twm.h Xadd_window.o: \ X twm.h \ X add_window.h \ X util.h \ X resize.h \ X gram.h \ X list.h \ X events.h \ X menus.h \ X iconify.bm \ X resize.bm \ X focus.bm \ X hilite.bm Xlex.o: \ X gram.h Xgram.o: \ X twm.h \ X menus.h \ X list.h \ X util.h SHAR_EOF if test 1641 -ne "`wc -c < Makefile`" then echo shar: error transmitting "Makefile" '(should have been 1641 characters)' fi fi if test -f 'README' then echo shar: will not over-write existing file "README" else echo extracting "README" sed 's/^X//' >README <<'SHAR_EOF' XThe following things have been fixed/added since Revision 2.7 X X1. Window moves and resizes now work VERY good on slower machines X such as the Vaxstation II we have here. I poll the pointer X position rather than getting motion events. X X2. Initial window positioning incorrectly used the window size hints X rather than the window position hints in determining if the window X had a geometry specified. X X3. Multiple button presses in the root window causes multiple menus X to be popped up. X X4. I now center the font in the title bar even if it is too big to fit. X It looks better. X X5. I finally handle PropertyNotify events so the title and the icon of X the window now change. X X6. I fixed the problem with windows being the wrong size if twm handles X the initial position. X X7. You can no longer "resize" the icon window. If you haven't seen this, X select f.resize from a menu and pick an icon to resize. X X8. Hopefully twm won't crash (fingers crossed) when applications die X unexpectantly. X X9. I now pull windows back on the display a bit if they are started X with a geometry that would position them off the screen. I do the X same with icons that are positioned off the display. X X10. New variables have been added: X NoRaiseOnMove X NoRaiseOnResize X NoRaiseOnDeiconify X DontMoveOff X ForceIcons X IconDirectory X Icons { list of icon bitmaps } X Zoom X Color { list of colors } X Monochrome { list of colors } X BorderColor X TitleForeground X TitleBackground X MenuForeground X MenuBackground X MenuTitleForeground X MenuTitleBackground X MenuShadowColor X IconForeground X IconBackground X IconBorderColor X X See the man page for a complete description. X X11. I no longer provide an icon bitmap for xterms. The file "xterm.bm" X that used to be compiled in, is now supplied as "xterm.icon". You can put X X Icons { xterm "xterm.icon" } X X in your .twmrc file and you will get the xterm icon for all xterms X just as in previous versions of twm. This assumes that xterm.icon is X in the directory you run twm from or you have an IconDirectory set up, X or you put xterm.icon in /usr/include/X11/bitmaps. X X12. An f.winrefresh function has been added. This is similar to f.refresh, X but refreshes a window as opposed to the whole display. X X13. Please note that I have not fully tested the color additions. They have X been run on a Sun 386, and a mutant we have here. Twm tries to allocate X colors from the default colormap and uses the default visual, so some X changes may be needed if your default visual is not color. X X14. I now recognize the tilde (~) character as meaning your HOME directory X if it is the first character of a filename. X X15. A new long form of pointer button assignments is supported which X allows you to pull down menus in conjunction with shift-meta-control X keys. X X16. You may compile twm with a -DSUN386 option. This fixes a bug which X Daisy Systems was seeing related to resizing windows. If you have X a Sun 386 and see windows not being repainted properly following a X resize operation, you may want to try compiling with this option. X You actually only need to do resize.c. X X17. If twm is killed and restarted, windows should stay where they were X when twm was stopped. However, windows that were iconified will X not be started up iconic. X X18. I have included a little program called mytitle.c. This program X gets your current host and working directory and spits out the X xterm escape sequences to change the window name and icon name. X This program checks your TERM environment vairable to ensure it is X set to xterm before doing anything. I have the following alias in X my .cshrc file. X X alias cd 'chdir \!*; mytitle' X X Every time I change directories my xterm title bar will reflect my X current directory. I also have similar aliases for pushd and popd. X It most likely will not work under System V. X XProblems: X X1. DO NOT EXECUTE f.iconify from a pull down menu with a context other X than root. This causes the infamous "sequence lost!" error. This is X exactly what you X server people can do to create the problem. X X2. AutoRaise still does not work correctly all the time. Specifically X when you move the mouse fast. I know what the problem is but I'm not X sure how to fix it and make AutoRaise work. X X3. There is still a latency problem. You can move the mouse and begin X typing and the first few characters will appear in the window the X cursor was moved out of. X X4. The ReverseVideo variable is almost meaningless now that you can X specify individual colors. X XFuture: X XI would like to implement the concept of window groups so that when you Xiconify the "master" window in a group, one icon appears and all windows Xin the group become unmapped. I already have some suggestions on what Xpeople would like to see, anyone else care to comment? X XAlong the same lines as groups, I have thought what may be useful is for twm Xto implement a "virtual display" concept. A client could open a window Xand set the class to something like "root". Any child windows created Xinside this window would be under control of twm. You would be able to Xmove windows around inside this virtual display, open other virtual displays Xon top of this one, move it or even iconify it. Any thoughts? I don't think Xit would be too hard to implement. X X XSpecial thanks to Daisy Systems Inc., Mtn. View, Ca., for their help in Xgetting color working. X XOnce again, thanks for the bug reports and suggestions. X X-- XTom LaStrange XEvans & Sutherland Computer Corporation X XUUCP Address: {ihnp4,seismo}!utah-cs!utah-gr!uplherc!esunix!tlastran XAlternate: {ihnp4,decvax}!decwrl!esunix!tlastran SHAR_EOF if test 5801 -ne "`wc -c < README`" then echo shar: error transmitting "README" '(should have been 5801 characters)' fi fi if test -f 'Sample.twmrc' then echo shar: will not over-write existing file "Sample.twmrc" else echo extracting "Sample.twmrc" sed 's/^X//' >Sample.twmrc <<'SHAR_EOF' X#********************************************************************** X# X# .twmrc X# X#********************************************************************** X XWarpCursor XBorderWidth 2 XTitleFont "8x13" XMenuFont "8x13" XIconFont "8x13" XResizeFont "fg-22" X XColor X{ X BorderColor "red" X TitleForeground "white" X TitleBackground "blue" X MenuForeground "yellow" X MenuBackground "darkgreen" X MenuTitleForeground "red" X MenuTitleBackground "blue" X IconForeground "darkgreen" X IconBackground "cadetblue" X IconBorderColor "green" X} X X#Button = KEYS : CONTEXT : FUNCTION X#---------------------------------- XButton1 = : root : f.menu "button1" XButton2 = : root : f.menu "button2" XButton3 = : root : f.menu "button3" XButton1 = m : window : f.menu "button1" XButton2 = m : window : f.menu "button2" XButton3 = m : window : f.menu "button3" XButton1 = m : title : f.menu "button1" XButton2 = m : title : f.menu "button2" XButton3 = m : title : f.menu "button3" XButton1 = : title : f.raise XButton2 = : title : f.move XButton3 = : title : t.lower X XForceIcons XIconDirectory "~/icons" XIcons X{ X "xterm" "xterm.icon" # obtained from IconDirectory X "xfd" "xfd_icon" # obtained from /usr/include/X11/bitmaps X} XUnknownIcon "default.icon" X XNoTitle X{ X "xclock" X "xckmail" X} X XAutoRaise X{ X "xterm" X} X Xmenu "button1" X{ X"Other Logins" f.title X"iguana 24" !"xterm -T iguana_24 =80x24+100+100 -e rlogin iguana &" X"iguana 48" !"xterm -T iguana_48 =80x48+50+50 -e rlogin iguana &" X"worm 24" !"xterm -T worm_24 =80x24+100+100 &" X"worm 48" !"xterm -T worm_48 =80x48+50+50 &" X"shiva" !"xterm -T shiva =80x24+200+200 -e rlogin shiva &" X"tegus" !"xterm -T tegus =80x24+200+200 -e rlogin tegus &" X"shade" !"xterm -T shade =80x24+200+200 -e rlogin shade &" X"bilbo" !"xterm -T bilbo =80x24+250+250 -e rlogin bilbo &" X"frodo" !"xterm -T frodo =80x24+300+300 -e rlogin frodo &" X"esunix" !"xterm -T esunix =80x24+350+350 -e rlogin esunix &" X"lynx8" !"xterm -T lynx8 =80x24+370+370 -e rlogin lynx8 &" X"lynx13" !"xterm -T lynx13 =80x24+390+390 -e rlogin lynx13 &" X"zephyr" !"xterm -T zephyr =80x24+390+390 -e rlogin zephyr &" X} X Xmenu "button2" X{ X"Window Ops" f.title X"Refresh" f.refresh X"Focus on Root" f.unfocus X"Source .twmrc" f.twmrc X"Source blob" f.source "blob" X"Cut File" f.cutfile X"twm Version" f.version X"(De)Iconify" f.iconify X"Move Window" f.move X"Resize Window" f.resize X"Raise Window" f.raise X"Lower Window" f.lower X"Focus on Window" f.focus X"Destroy Window" f.destroy X"Kill twm" f.quit X} X Xmenu "button3" X{ X"Cut Buffer" f.title X"Procedure Header" f.file "~/src/proc.twm" X"File Header" f.file "~/src/file.twm" X"pull right" f.menu "blob" X} X Xmenu "blob" X{ X"pull right" f.menu "final" X"another" ^"some text" X} X Xmenu "final" X{ X"Cut Buffer" f.title X"Procedure Header" f.file "~/src/proc.twm" X"File Header" f.file "~/src/file.twm" X} X Xmenu "one" X{ X"refresh" f.refresh X} SHAR_EOF if test 2958 -ne "`wc -c < Sample.twmrc`" then echo shar: error transmitting "Sample.twmrc" '(should have been 2958 characters)' fi fi if test -f 'twm.man' then echo shar: will not over-write existing file "twm.man" else echo extracting "twm.man" sed 's/^X//' >twm.man <<'SHAR_EOF' X.de EX \"Begin example X.ne 5 X.if n .sp 1 X.if t .sp .5 X.nf X.in +.5i X.. X.de EE X.fi X.in -.5i X.if n .sp 1 X.if t .sp .5 X.. X.TH TWM 1 "3 June 1988" "X Version 11" X.SH NAME X.PP Xtwm - a window manager for X11 (Tom's Window Manager) X.PP X.SH SYNTAX X.PP X\fBtwm \fP[-display \fIdisplay\fP] X.PP X.SH DESCRIPTION X.PP XThe \fItwm\fP program is a window manager client Xapplication of the window Xserver. X.PP XThe \fItwm\fP program was written to try and incorporate some of the Xdesirable features of both the \fBwm\fP and \fBuwm\fP window managers. X\fITwm\fP puts a title bar on and re-parents each window. XThe title bar contains the Xwindow's name and three "buttons". When a pointer button press event Xis detected in any of these title bar "buttons" a certain action is Xperformed. The left-most title bar button that looks like a window pane Xcauses the window to be iconified. The right-most title bar button with Xthe right-angles is the re-size button. The resize function is identical Xto the window resize function of the \fBwm\fP window manager. The other Xtitle bar button is supposed to represent a keyboard, a button click here Xcauses the input focus to be directed to this window until the \fBf.unfocus\fP Xfunction is executed or another window is selected to get input focus. XThe title bar has the additional feature of becoming highlighted if the Xwindow has the input focus. X.PP XWhen \fItwm\fP is invoked, it attempts to read a \fItwm\fP startup file. XThe name of the \fItwm\fP startup file is: X.sp X $HOME/.twmrc\fP X.PP XThe \fItwm\fP startup file can be thought of as having three logical Xsections: the variables section, the buttons section, and the menus Xsection. The variables section must come first, followed by either the Xbuttons section or the menus section. X.PP XAll variables and keywords may be Xentered in any combination of upper and lower case letters. Title Xfunctions and Root functions must be entered in lower case. A Xpound sign (#) character in the startup file indicates a comment Xwhich is terminated by the newline character. A \fIstring\fP in Xthe startup file is a series of characters enclosed by double quotes. X.PP X.SH VARIABLES SECTION X.PP XVariables must be entered first, at the top of the startup Xfile. Variables are initialized once when \fItwm\fP begins Xexecution, they will not be effected when a \fBf.twmrc\fP Xfunction is executed. X.PP XSeveral variables take filenames as arguments. XFilenames are processed as follows. \fITwm\fP checks to see if the Xfirst character in the filename is a tilde (~), if it is, \fItwm\fP Xprepends the user's \fBHOME\fP environment variable to the filename. XIn the case of variables requiring bitmap files, if the above expansion Xdoes not produce a path to a valid bitmap file, the following steps Xare taken. If the \fBIconDirectory\fP variable has been set, and the Xfilename does not start with a slash (/), the \fBIconDirectory\fP Xvariable is prepended to the filename. If that path does not produce Xa valid bitmap file, the string "/usr/include/X11/bitmaps/" is prepended Xto the original filename. X.PP XThe following describes the \fItwm\fP variables: X X.IP "\fBAutoRaise\fP { \fIlist\fP }" 20 XThis variable is a list of window names that will automatically Xraise to the top of the stacking order whenever the pointer enters Xthe window. The window names in the list are the first characters Xin the window name to check for. For example: X.EX 0 X\fBAutoRaise\fP X{ X "xterm" X "xclock" X} X.EE XThe above list contains two names which will match window names beginning Xwith the string "xterm" or "xclock". The following window names will match Xand be in auto-raise mode: "xterm", "xterm_iguana", "xclock". X.IP "\fBBorderColor\fP \fIstring\fP" 20 XThis variable sets the color of the border to placed around all non-iconified Xwindows. It can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. XThe default is "black". X.IP "\fBBorderWidth\fP \fIpixels\fP" 20 XThis variable specifies the width in pixels of of the border surrounding all Xwindows. The default is 2. X.IP "\fBColor\fP { \fIcolors\fP }" 20 XThis variable is a list of color assignments to be made if the default Xdisplay has a depth greater than one, or in other words, has the ability Xto display more than black and white. XFor example: X.EX 0 X\fBColor\fP X{ X BorderColor "red" X TitleForeground "yellow" X TitleBackground "blue" X} X.EE XThe various color variables may be found in this section of the manual Xpage. There is also a \fBMonochrome\fP list of colors that may be specified. XThis enables you to use the same initialization file on a color or Xmonochrome display. X.IP "\fBDontMoveOff\fP" 20 XIf this variable is set, windows will not be allowed to be moved off the Xdisplay. X.IP "\fBForceIcons\fP" 20 XThis variable is only meaningful if a \fBIcons\fP list is defined. XIt forces the icon bitmaps listed in the \fBIcons\fP list to be Xused as window icons even if client programs supply their own icons. XThe default is to not force icons. X.IP "\fBIcons\fP { \fIlist\fP }" 20 XThis variable is a list of window names and bitmap filenames to be Xused as icons. XFor example: X.EX 0 X\fBIcons\fP X{ X "xterm" "xterm.icon" X "xfd" "xfd_icon" X} X.EE XThe names "xterm" and "xfd" are added to a list that is searched Xwhen the client window is reparented by \fItwm\fP. The window names Xspecified are just the first portion of the name to match. In the Xabove example, "xterm" would match "xtermfred" and also "xterm blob". XThe client window names are checked against those specified in this Xlist in addition to the class name of the client if it is specified. XBy using the class name, all xterm windows can be given the same icon Xby the method used above even though the names of the windows may be Xdifferent. X.IP "\fBIconBackground\fP \fIstring\fP" 20 XThis variable sets the background color of icons. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. XThe default is "white". X.IP "\fBIconBorderColor\fP \fIstring\fP" 20 XThis variable sets the color of the border around icons. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. XThe default is "black". X.IP "\fBIconDirectory\fP \fIstring\fP" 20 XThis variable names the directory in which to search for icon bitmap Xfiles. This variable is described under the \fBVARIABLES SECTION\fP Xheading. The default is to have no icon directory. X.IP "\fBIconFont\fP \fIstring\fP" 20 XThis variable names the font to be displayed within icons. The default Xis "8x13". X.IP "\fBIconForeground\fP \fIstring\fP" 20 XThis variable sets the foreground color of icons. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. XThe default is "black". X.IP "\fBMenuBackground\fP \fIstring\fP" 20 XThis variable sets the background color of menus. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. XThe default is "white". X.IP "\fBMenuFont\fP \fIstring\fP" 20 XThis variable names the font to be displayed within menus. The default Xis "8x13". X.IP "\fBMenuForeground\fP \fIstring\fP" 20 XThis variable sets the foreground color of menus. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. The default is "black". X.IP "\fBMenuShadowColor\fP \fIstring\fP" 20 XThis variable sets the color of the shadow behind pull-down menus. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. The default is "black". X.IP "\fBMenuTitleBackground\fP \fIstring\fP" 20 XThis variable sets the background color for \fBf.title\fP entries in Xmenus. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. The default is "white". X.IP "\fBMenuTitleForeground\fP \fIstring\fP" 20 XThis variable sets the foreground color for \fBf.title\fP entries in Xmenus. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. The default is "black". X.IP "\fBMonochrome\fP { \fIcolors\fP }" 20 XThis variable is a list of color assignments to be made if the default Xdisplay has a depth equal to one, or in other words can only display Xblack and white pixels. XFor example: X.EX 0 X\fBMonochrome\fP X{ X BorderColor "black" X TitleForeground "black" X TitleBackground "white" X} X.EE XThe various color variables may be found in this section of the manual Xpage. There is also a \fBColor\fP list of colors that may be specified. XThis enables you to use the same initialization file on a color or Xmonochrome display. X.IP "\fBNoTitle\fP { \fIlist\fP }" 20 XThis variable is a list of window names that will NOT have a title Xbar created for them. If the client does not get ButtonPress events, X\fItwm\fP will get them and all Title functions currently in effect Xwill work when pointer buttons are pressed in the client window. The list Xof windows and how they match window names is exactly like the X\fBAutoRaise\fP variable described above. X.IP "\fBNoRaiseOnDeiconify\fP" 20 XIf this variable is specified, windows will not be raised to the top of Xthe stacking order when de-iconified. X.IP "\fBNoRaiseOnMove\fP" 20 XIf this variable is specified, windows will not be raised to the top of Xthe stacking order following a move. X.IP "\fBNoRaiseOnResize\fP" 20 XIf this variable is specified, windows will not be raised to the top of Xthe stacking order following a resize. X.IP "\fBResizeFont\fP \fIstring\fP" 20 XThis variable names the font to be displayed in the dimensions window Xduring window resize operations. XThe default is "fg-22". X.IP "\fBTitleFont\fP \fIstring\fP" 20 XThis variable names the font to be displayed within Xthe window title bar. Note that the title bar is only 17 pixels in height, Xso the largest practical font would be something like "9x15". The default Xis "8x13". X.IP "\fBReverseVideo\fP" 20 XThis variable causes \fItwm\fP to display white characters Xon a black background, Xrather than black characters on white. This variable doesn't really do Xmuch now that you can specify individual colors. X.IP "\fBTitleBackground\fP \fIstring\fP" 20 XThis variable sets the background color for the title bars. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. XThe default is "white". X.IP "\fBTitleForeground\fP \fIstring\fP" 20 XThis variable sets the foreground color for the title bars. XIt can only be specified inside of a X\fBColor\fP or \fBMonochrome\fP list. XThe default is "black". X.IP "\fBUnknownIcon\fP \fIstring\fP" 20 XThis variable specifies the file name of a bitmap format file to be Xused as the default icon. This bitmap will be used for the icon of all Xclients which do not provide an icon bitmap and are not listed Xint the \fBIcons\fP list. The default is to use Xno bitmap. X.IP "\fBWarpCursor\fP" 20 XThis variable causes the pointer cursor to be warped to a window which Xis being deiconified. The default is to not warp the cursor. X.IP "\fBZoom\fP" 20 XThis variable causes a series of outlines to be drawn when a window is Xiconified or deiconified. The default is to not draw the outlines. X.PP X.SH BUTTONS SECTION X.PP XThis section deals with assignment of window manager functions to mouse Xbuttons. The discussion of Root functions and Title functions is included Xhere for historical reasons and to maintain compatibility with versions Xof \fItwm\fP prior to Revision 2.15. The section titled \fBNew Button XSpecifications\fP describes the new syntax for defining pointer Xbutton sequences. The older syntaxes described in the following paragraphs Xare still supported. X.PP XThe buttons section of the startup file contains definitions of functions Xto perform when pointer buttons are pressed. There are two classes of functions Xthat can be tied to a pointer button: Title functions, which will be Xexecuted if a pointer button is pressed while the pointer is in Xthe title bar of a window; and Root functions, which will be executed Xwhile the pointer is in the root window or if the client program is Xnot processing pointer button events. X.PP XTitle functions are assigned as follows: X.IP "\fBTitleButton\fP\fIn\fP \fIt.function\fP" 20 X\fBTitleButton\fP is a startup file keyword. The \fIn\fP following X\fBTitleButton\fP can be a number between 1 and 5 to indicate which pointer Xbutton the function is to be tied to. \fIt.function\fP may be any one of the Xfollowing title functions. X.PP X.SH Title Functions X.PP XThe following title functions are still included for compatibility reasons. XSince Revision 2.15, \tItwm\fP can execute any root function tied to a Xtitle bar pointer button press. X.PP X.IP \fBt.lower\fP 20 XThis function lowers the window to the bottom of the stacking order. X.IP \fBt.move\fP 20 XThis function causes a grid to appear over the window which can be moved Xto where you want the window to be moved. Double clicking the pointer Xbutton tied to this function causes a constrained move function to be Xexecuted. The pointer will be warped to the center of the grid. XMoving the pointer to one of the grid lines will cause the window Xto begin moving in either an up-down motion or a left-right motion Xdepending on which grid line the pointer was moved across. X.IP \fBt.nop\fP 20 XThis function does nothing. X.IP \fBt.raise\fP 20 XThis function raises the window to the top of the stacking order. X.PP XThe defaults for title functions are as follows: X.PP X.IP X\fBTitleButton1 t.raise\fP X.IP X\fBTitleButton2 t.move\fP X.IP X\fBTitleButton3 t.lower\fP X.IP X\fBTitleButton4 t.nop\fP X.IP X\fBTitleButton5 t.nop\fP X.PP XRoot functions are assigned either to a pointer button or a menu entry. XThe \fBf.title\fP function is the only one that doesn't really make Xsense to use as just a button function. It was designed to be used in Xa pull-down menu. Root functions are assigned to pointer buttons Xas follows: X.PP X.IP "\fBButton\fP\fIn\fP \fIfunction\fP" 20 X\fBButton\fP is a startup file keyword. The \fIn\fP following X\fBButton\fP can be a number between 1 and 5 to indicate which pointer Xbutton the function is to be tied to. \fIfunction\fP may be any one of the Xfollowing root functions. X.PP X.SH New Button Specifications X.PP XVersions of \fItwm\fP newer or equal to Revision 2.15 support the Xnew pointer button specification syntax which allows functions and menus Xto be tied to buttons with a variety of modifier keys being pressed in Xconjunction with pointer buttons. The syntax of the new button specification Xis: X.EX 0 X\fBButton\fP\fIn\fP = \fIkeys\fP : \fIcontext\fP : \fIfunction\fP X.EE XThe \fIn\fP following X\fBButton\fP can be a number between 1 and 5 to indicate which pointer Xbutton the function is to be tied to. The \fBkeys\fP field is used to specify Xwhich modifier keys must be pressed in conjunction with the pointer Xbutton. The \fBkeys\fP field may contain any combination of the letters X\fBs\fP, \fBc\fP, and \fBm\fP, which stand for Shift, Control, and Meta, Xrespectively. The \fBcontext\fP field specifies the context in which to Xlook for the button press. Valid contexts are: \fBicon\fP, X\fBroot\fP, \fBtitle\fP, and \fBwindow\fP. The \fBfunction\fP field Xspecifies what window manager function to perform. The old \fBButton\fP Xand \fBTitleButton\fP specifications are simple cases of the new syntax. XNow for some examples: X.EX 0 XButton2 = : title : f.move # 1 XButton1 = : root : f.menu "menu 1" # 2 XButton1 = m : icon : f.menu "icon menu 1" # 3 XButton3 = msc : window : f.menu "menu3 1" # 4 X.EE XLine 1 specifies that when pointer button 2 is pressed in the title bar Xwith no modifier keys pressed, the \fBf.move\fP function is to be executed. XThis is exactly the same as \fBTitleButton2 t.move\fP. XLine 2 specifies that when pointer button 1 is pressed in the root window Xwith no modifier keys pressed, the menu "menu 1" is popped up. XThis is exactly the same as \fBButton2 f.menu "menu 1"\fP. XLine 3 specifies that when pointer button 1 is pressed in an icon window Xwith the meta key pressed, the menu "icon menu 1" is popped up. XLine 4 specifies that when pointer button 3 is pressed in a client window Xwith the shift, control, and meta keys pressed, Xthe menu "menu 3" is popped up. X.PP X.SH Root Functions X.PP X.IP "\fB!\fP \fIstring\fP" 20 XThis function causes \fIstring\fP to be sent to /bin/sh for execution. X.IP "\fB^\fP \fIstring\fP" 20 XThis function causes \fIstring\fP followed by a new line character Xto be placed in the window server's cut buffer. X.IP "\fBf.circledown\fP" 20 XThis function causes the top window that is obscuring another window to Xdrop to the bottom of the stack of windows. X.IP "\fBf.circleup\fP" 20 XThis function raises the lowest window that is obscured by other windows. X.IP "\fBf.cutfile\fP" 20 XThis function takes the contents of the window server's cut buffer Xand uses it as a filename to read into the server's cut buffer. X.IP "\fBf.destroy\fP" 20 XThis function allows you to destroy a window client. The cursor Xis changed to a skull and crossbones and the next window Xto receive a button press Xwill be destroyed. X.IP "\fBf.file\fP \fIstring\fP" 20 XThis function assumes \fIstring\fP is a file name. This file is read into Xthe window server's cut buffer. X.IP "\fBf.focus\fP" 20 XThis function implements the same function as the keyboard focus button in Xthe title bar. The cursor is changed to a dot and the next window Xto receive a button press will gain the input focus. X.IP "\fBf.iconify\fP" 20 XThis function implements the same function as the iconify button in the Xtitle bar. The cursor is changed to a dot and the next window to Xreceive a button press will be iconified or de-iconified depending on Xthe current state of the window. X.IP "\fBf.lower\fP" 20 XThis function implements the window lower function of \fBt.lower\fP, Xbut lets you get to it from a menu selection. The cursor is changed to Xa dot and the next window that receives a button press will be Xthe window that is lowered. X.IP "\fBf.menu\fP \fIstring\fP" 20 XThis function assigns the pull-down menu named \fIstring\fP to a pointer Xbutton. If this function is used as an entry in a pull-down menu a Xpull-right menu will be assigned to the menu entry. X.IP "\fBf.move\fP" 20 XThis function implements the window move function of \fBt.move\fP, Xbut lets you get to it from a menu selection. The cursor is changed to Xa double arrow and the next window that receives a button press will be Xthe window that is moved. X.IP "\fBf.nop\fP" 20 XThis function does nothing. X.IP "\fBf.quit\fP" 20 XThis function causes \fItwm\fP to exit. X.IP "\fBf.raise\fP" 20 XThis function implements the window raise function of \fBt.raise\fP, Xbut lets you get to it from a menu selection. The cursor is changed to Xa dot and the next window that receives a button press will be Xthe window that is raised. X.IP "\fBf.refresh\fP" 20 XThis function causes all windows to be refreshed. X.IP "\fBf.resize\fP" 20 XThis function implements the window resize function of the resize button Xin the title bar. XThe cursor is changed to Xa double arrow and the next window that receives a button press will be Xthe window that is resized. X.IP "\fBf.source\fP \fIstring\fP" 20 XThis function assumes \fIstring\fP is a file name. The file is read Xand parsed as a \fItwm\fP startup file. XThis Xfunction is intended to be used only to re-build pull-down menus. None Xof the \fItwm\fP variables are changed. X.IP "\fBf.title\fP" 20 XThis function is to be used as an entry in a pull-down menu. It centers Xthe menu entry string in a menu entry and outlines Xit with a border. This function Xmay be used more than once in a pull-down menu. X.IP "\fBf.twmrc\fP" 20 XThis function causes the \fI$HOME/.twmrc\fP file to be re-read. This Xfunction is exactly like the \fBf.source\fP function without having to Xspecify the filename. X.IP "\fBf.unfocus\fP" 20 XThis function assigns input focus to the root window. X.IP "\fBf.version\fI" 20 XThis function causes the \fItwm\fP version window to be displayed. This Xwindow will be displayed until a pointer button is pressed or the Xpointer is moved from one window to another. X.IP "\fBf.winrefresh\fP" 20 XThis function is similar to the \fBf.refresh\fP function, but Xallows you to refresh a single window. The cursor is changed to Xa dot and the next window that receives a button press will be Xthe window that is refreshed. X.PP X.SH MENUS SECTION X.PP XThe menus section is where pull-down menus are defined. Entries in Xmenus consist of Root functions as described in the Buttons Section. XThe syntax to define a menu is: X.EX 0 X\fBMenu\fP "\fImenu name\fP" X{ X \fIstring\fP \fIfunction\fP X \fIstring\fP \fIfunction\fP X . X . X \fIstring\fP \fIfunction\fP X} X.EE X.PP XThe \fImenu name\fP should be an identical string to one being Xused with an \fBf.menu\fP Root function. XNote that the \fImenu name\fP is case sensative. The \fIstring\fP portion Xof each menu entry will be the text which will appear in the menu. XThe \fIfunction\fP portion of the menu entry is one of the Root functions Xdescribed in the previous section. X.PP X.SH WINDOW STARTUP X.PP XWhen a client is started, \fItwm\fP allows you to position Xand change the size of the window if the client has not specified Xan initial geometry. XIf the client has not specified both \fBUser Specified Size\fP hints Xand \fBUser Specified Position\fP hints, \fItwm\fP will put up Xa rubberband box indicating the initial window size. If pointer Xbutton one is pressed, the client window is created with the window Xposition equal to the current pointer position. If pointer button two Xis pressed, \fItwm\fP allows the window to be resized. The resizing Xoperation takes place until button two is released. While the initial Xpositioning of the window is taking place, \fItwm\fP will place a window Xin the upper-left corner of the display showing the window's name. If Xresizing is taking place, \fItwm\fP will also place a window in the Xupper-left corner, indicating the current window size. X.PP X.SH EXAMPLES X.PP XThe following is an example \fItwm\fP startup file: X.EX 0 X X#********************************************************************** X# X# .twmrc X# X#********************************************************************** X XWarpCursor XBorderWidth 2 XTitleFont "8x13" XMenuFont "8x13" XIconFont "8x13" X XColor X{ X BorderColor "red" X TitleForeground "white" X TitleBackground "blue" X MenuForeground "yellow" X MenuBackground "darkgreen" X MenuTitleForeground "red" X MenuTitleBackground "blue" X IconForeground "darkgreen" X IconBackground "cadetblue" X IconBorderColor "green" X} X X#Button = KEYS : CONTEXT : FUNCTION X#---------------------------------- XButton1 = : root : f.menu "button1" XButton2 = : root : f.menu "button2" XButton3 = : root : f.menu "button3" XButton1 = m : window : f.menu "button1" XButton2 = m : window : f.menu "button2" XButton3 = m : window : f.menu "button3" XButton1 = m : title : f.menu "button1" XButton2 = m : title : f.menu "button2" XButton3 = m : title : f.menu "button3" XButton1 = : title : f.raise XButton2 = : title : f.move XButton3 = : title : t.lower X XForceIcons XIconDirectory "~/icons" XIcons X{ X "xterm" "xterm.icon" # obtained from IconDirectory X "xfd" "xfd_icon" # obtained from /usr/include/X11/bitmaps X} XUnknownIcon "default.icon" X XAutoRaise X{ X "xterm" # all of my xterm windows will auto-raise X} X XNoTitle X{ X "xclock" # don't need a title bar on this ... X "xckmail" # or this X} X Xmenu "button1" X{ X"Sun Systems" f.title X"iguana" !"xterm -T iguana =80x24+100+100 -e rlogin iguana &" X"worm" !"xterm -T worm =80x24+100+100 &" X"shiva" !"xterm -T shiva =80x24+200+200 -e rlogin shiva &" X"tegus" !"xterm -T tegus =80x24+200+200 -e rlogin tegus &" X"Vax Systems" f.title X"shade" !"xterm -T shade =80x24+200+200 -e rlogin shade &" X"bilbo" !"xterm -T bilbo =80x24+250+250 -e rlogin bilbo &" X"frodo" !"xterm -T frodo =80x24+300+300 -e rlogin frodo &" X"esunix" !"xterm -T esunix =80x24+350+350 -e rlogin esunix &" X"lynx8" !"xterm -T lynx8 =80x24+390+390 -e rlogin lynx8 &" X} X Xmenu "button2" X{ X"Window Ops" f.title X"Refresh" f.refresh X"Focus on Root" f.unfocus X"Source .twmrc" f.twmrc X"Source something" f.source "something" X"twm Version" f.version X"(De)Iconify" f.iconify X"Move Window" f.move X"Resize Window" f.resize X"Raise Window" f.raise X"Lower Window" f.lower X"Focus on Window" f.focus X"Destroy Window" f.destroy X} X Xmenu "button3" X{ X"Cut Buffer" f.title X"Procedure Header" f.file "/usr/ias_soft/tlastrange/src/proc.twm" X"File Header" f.file "/usr/ias_soft/tlastrange/src/file.twm" X"pull right" f.menu "blob" X} X Xmenu "blob" X{ X"pull right" f.menu "final" X"another" ^"some text" X} X Xmenu "final" X{ X"entry 1" f.nop X"entry 2" f.nop X"entry 3" f.nop X"entry 4" f.nop X} X.EE X.PP X.SH BUGS X.PP XPull-right menus may still have some problems. They may sometimes Xstay around when all pointer buttons have been released. X.PP XDouble clicking very fast to get the constrained move function will sometimes Xcause the window to move, even though the pointer is not moved. X.PP XThe window auto-raise feature does not work consistently when the mouse Xis moved very fast over auto-raise windows. X.PP XThere is a latency problem. You can move the mouse and begin Xtyping and the first few characters will appear in the window the Xcursor was moved out of. X.SH FILES X.PP X $HOME/.twmrc X.PP X.SH SEE ALSO X.PP XX(1), Xserver(1) X.SH COPYRIGHT X.ce 4 XCOPYRIGHT 1988 XEvans & Sutherland Computer Corporation XSalt Lake City, Utah XAll Rights Reserved. X.LP XTHE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND XSHOULD NOT BE CONSTRUED AS A COMMITMENT BY EVANS & SUTHERLAND. XEVANS & SUTHERLAND MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY XOF THIS SOFTWARE FOR XANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. X.LP XIF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, XAPPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT XSET FORTH ABOVE. X.LP XPermission to use, copy, modify, and distribute this software and its Xdocumentation for any purpose and without fee is hereby granted, provided Xthat the above copyright notice appear in all copies and that both the Xcopyright notice and this permission notice appear in supporting documentation, Xand that the name of Evans & Sutherland not be used in advertising Xor publicity pertaining to distribution of the software without specific, Xwritten prior permission. X.SH AUTHOR XThomas E. LaStrange, XEvans & Sutherland, Interactive Systems Division, Salt Lake City, Utah. X.LP X{ihnp4,decvax}!decwrl!esunix!tlastran X.br X{cbosgd,ulysses}!utah-cs!esunix!tlastran X SHAR_EOF if test 26552 -ne "`wc -c < twm.man`" then echo shar: error transmitting "twm.man" '(should have been 26552 characters)' fi fi if test -f 'lex.l' then echo shar: will not over-write existing file "lex.l" else echo extracting "lex.l" sed 's/^X//' >lex.l <<'SHAR_EOF' X%{ X/*****************************************************************************/ X/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ X/** Salt Lake City, Utah **/ X/** **/ X/** All Rights Reserved **/ X/** **/ X/** Permission to use, copy, modify, and distribute this software and **/ X/** its documentation for any purpose and without fee is hereby **/ X/** granted, provided that the above copyright notice appear in all **/ X/** copies and that both that copyright notice and this permis- **/ X/** sion notice appear in supporting documentation, and that the **/ X/** name of Evans & Sutherland not be used in advertising or publi- **/ X/** city pertaining to distribution of the software without specif- **/ X/** ic, written prior permission. **/ X/** **/ X/** EVANS & SUTHERLAND DISCLAIMS ALL WARRANTIES WITH REGARD TO **/ X/** THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILI- **/ X/** TY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND BE LIABLE **/ X/** FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAM- **/ X/** AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, **/ X/** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS **/ X/** ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER- **/ X/** FORMANCE OF THIS SOFTWARE. **/ X/*****************************************************************************/ X X/*********************************************************************** X * X * $Header: lex.l,v 1.29 88/06/03 10:45:41 tlastran Exp $ X * X * .twmrc lex file X * X * 12-Nov-87 Thomas E. LaStrange File created X * X ***********************************************************************/ X Xstatic char RCSinfo[]= X"$Header: lex.l,v 1.29 88/06/03 10:45:41 tlastran Exp $"; X X#include <stdio.h> X#include "gram.h" X Xextern int ParseError; X X%} X%k 2000 X%e 2000 X%p 4000 X Xqstring \"[^"]*\" Xnumber [0-9]+ Xbutton [Bb][Uu][Tt][Tt][Oo][Nn] Xtbutton [Tt][Ii][Tt][Ll][Ee][Bb][Uu][Tt][Tt][Oo][Nn] Xnoraise [Nn][Oo][Rr][Aa][Ii][Ss][Ee][Oo][Nn] X%% X"{" { return (LB); } X"}" { return (RB); } X"=" { return (EQUALS); } X":" { return (COLON); } X X{button}{number} { (void)sscanf(&yytext[6], "%d", &yylval.num); X return (BUTTON); X } X{tbutton}{number} { (void)sscanf(&yytext[11], "%d", &yylval.num); X return (TBUTTON); X } X[Mm][Ee][Nn][Uu] { return MENU; } X Xm { return (META); } Xs { return (SHIFT); } Xc { return (CONTROL); } X Xwindow { return (WINDOW); } Xicon { return (ICON); } Xtitle { return (TITLE); } Xroot { return (ROOT); } X Xf.nop { return F_NOP; } Xf.quit { return F_QUIT; } Xf.title { return F_TITLE ; } Xf.menu { return F_MENU; } Xf.unfocus { return F_UNFOCUS; } Xf.refresh { return F_REFRESH; } Xf.winrefresh { return F_WINREFRESH; } Xf.file { return F_FILE; } Xf.twmrc { return F_TWMRC; } Xf.version { return F_VERSION; } Xf.circleup { return F_CIRCLEUP; } Xf.circledown { return F_CIRCLEDOWN; } Xf.source { return F_SOURCE; } Xf.cutfile { return F_CUTFILE; } X"!" { return F_EXEC; } X"^" { return F_CUT; } X Xf.move { return F_MOVE; } Xf.iconify { return F_ICONIFY; } Xf.focus { return F_FOCUS; } Xf.resize { return F_RESIZE; } Xf.raise { return F_RAISE; } Xf.lower { return F_LOWER; } Xf.destroy { return F_DESTROY; } X Xt.nop { return F_NOP; } Xt.raise { return F_RAISE; } Xt.lower { return F_LOWER; } Xt.move { return F_MOVE; } X X{noraise}[Mm][Oo][Vv][Ee] { return NO_RAISE_ON_MOVE; } X{noraise}[Dd][Ee][Ii][Cc][Oo][Nn][Ii][Ff][Yy] { return NO_RAISE_ON_DEICONIFY; } X{noraise}[Rr][Ee][Ss][Ii][Zz][Ee] { return NO_RAISE_ON_RESIZE; } X[Cc][Oo][Ll][Oo][Rr] { return (COLOR); } X[Mm][Oo][Nn][Oo][Cc][Hh][Rr][Oo][Mm][Ee] { return (MONOCHROME); } X[Zz][Oo][Oo][Mm] { return (ZOOM); } X[Uu][Nn][Kk][Nn][Oo][Ww][Nn][Ii][Cc][Oo][Nn] { return UNKNOWN_ICON; } X[Ww][Aa][Rr][Pp][Cc][Uu][Rr][Ss][Oo][Rr] { return WARPCURSOR; } X[Bb][Oo][Rr][Dd][Ee][Rr][Ww][Ii][Dd][Tt][Hh] { return BORDERWIDTH; } X[Tt][Ii][Tt][Ll][Ee][Ff][Oo][Nn][Tt] { return (TITLE_FONT); } X[Mm][Ee][Nn][Uu][Ff][Oo][Nn][Tt] { return (MENU_FONT); } X[Ii][Cc][Oo][Nn][Ff][Oo][Nn][Tt] { return (ICON_FONT); } X[Rr][Ee][Ss][Ii][Zz][Ee][Ff][Oo][Nn][Tt] { return (RESIZE_FONT); } X[Rr][Ee][Vv][Ee][Rr][Ss][Ee][Vv][Ii][Dd][Ee][Oo] { return (REVERSE_VIDEO); } X[Nn][Oo][Tt][Ii][Tt][Ll][Ee] { return (NO_TITLE); } X[Aa][Uu][Tt][Oo][Rr][Aa][Ii][Ss][Ee] { return (AUTO_RAISE); } X[Ff][Oo][Rr][Cc][Ee][Ii][Cc][Oo][Nn][Ss] { return (FORCE_ICON); } X[Ii][Cc][Oo][Nn][Ss] { return (ICONS); } X[Ii][Cc][Oo][Nn][Dd][Ii][Rr][Ee][Cc][Tt][Oo][Rr][Yy] {return (ICON_DIRECTORY);} X[Bb][Oo][Rr][Dd][Ee][Rr][Cc][Oo][Ll][Oo][Rr] { return (BORDER_COLOR); } X[Tt][Ii][Tt][Ll][Ee][Ff][Oo][Rr][Ee][Gg][Rr][Oo][Uu][Nn][Dd] { X return (TITLE_FOREGROUND); } X[Tt][Ii][Tt][Ll][Ee][Bb][Aa][Cc][Kk][Gg][Rr][Oo][Uu][Nn][Dd] { X return (TITLE_BACKGROUND); } X[Mm][Ee][Nn][Uu][Ff][Oo][Rr][Ee][Gg][Rr][Oo][Uu][Nn][Dd] { X return (MENU_FOREGROUND); } X[Mm][Ee][Nn][Uu][Bb][Aa][Cc][Kk][Gg][Rr][Oo][Uu][Nn][Dd] { X return (MENU_BACKGROUND); } X[Mm][Ee][Nn][Uu][Tt][Ii][Tt][Ll][Ee][Ff][Oo][Rr][Ee][Gg][Rr][Oo][Uu][Nn][Dd] { X return (MENU_TITLE_FOREGROUND); } X[Mm][Ee][Nn][Uu][Tt][Ii][Tt][Ll][Ee][Bb][Aa][Cc][Kk][Gg][Rr][Oo][Uu][Nn][Dd] { X return (MENU_TITLE_BACKGROUND); } X[Mm][Ee][Nn][Uu][Ss][Hh][Aa][Dd][Oo][Ww][Cc][Oo][Ll][Oo][Rr] { X return (MENU_SHADOW_COLOR); } X[Ii][Cc][Oo][Nn][Ff][Oo][Rr][Ee][Gg][Rr][Oo][Uu][Nn][Dd] { X return (ICON_FOREGROUND); } X[Ii][Cc][Oo][Nn][Bb][Aa][Cc][Kk][Gg][Rr][Oo][Uu][Nn][Dd] { X return (ICON_BACKGROUND); } X[Ii][Cc][Oo][Nn][Bb][Oo][Rr][Dd][Ee][Rr][Cc][Oo][Ll][Oo][Rr] { X return (ICON_BORDER_COLOR); } X[Dd][Oo][Nn][Tt][Mm][Oo][Vv][Ee][Oo][Ff][Ff] return (DONT_MOVE_OFF); } X X{qstring} { yylval.ptr = yytext; return STRING; } X{number} { (void)sscanf(yytext, "%d", &yylval.num); X return (NUMBER); X } X\#[^\n]*\n {;} X[\n\t ] {;} X. { X fprintf(stderr, X "twm: bad character `%s', line %d\n", X yytext, yylineno); X ParseError = 1; X } X%% Xyywrap() { return(1);} X X#define unput(c) TwmUnput(c) X#define input() TwmInput() X#define output(c) TwmOutput(c) SHAR_EOF if test 6643 -ne "`wc -c < lex.l`" then echo shar: error transmitting "lex.l" '(should have been 6643 characters)' fi fi # end of shell archive exit 0