home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume16 / xlax / part01 < prev    next >
Encoding:
Text File  |  1992-03-02  |  40.6 KB  |  1,374 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
  3. From: frank@cis.ohio-state.edu (Frank Adelstein)
  4. Subject: v16i097: xlax - send keyboard input to multiple windows, Part01/01
  5. Message-ID: <1992Mar3.154048.7436@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. Date: Tue, 3 Mar 1992 15:40:48 GMT
  10. Approved: dcmartin@msi.com
  11.  
  12. Submitted-by: frank@cis.ohio-state.edu (Frank Adelstein)
  13. Posting-number: Volume 16, Issue 97
  14. Archive-name: xlax/part01
  15.  
  16. # This is a shell archive (produced by shar 3.49)
  17. # To extract the files from this archive, save it to a file, remove
  18. # everything above the "!/bin/sh" line above, and type "sh file_name".
  19. #
  20. # made 03/03/1992 15:38 UTC by dcmartin@fascet
  21. # Source directory /home/fascet/csx/src/xlax
  22. #
  23. # existing files will NOT be overwritten unless -c is specified
  24. #
  25. #                                                                          
  26. #                                                                          
  27. #
  28. # This shar contains:
  29. # length  mode       name
  30. # ------ ---------- ------------------------------------------
  31. #    522 -rw-r--r-- README
  32. #    273 -rw-r--r-- Imakefile
  33. #  10508 -rw-r--r-- Makefile
  34. #   2325 -rw-r--r-- xlax.man
  35. #   2132 -rw-r--r-- xlax.h
  36. #  14414 -rw-r--r-- xlax.c
  37. #     21 -rw-r--r-- patchlevel.h
  38. #   5056 -rw-r--r-- vroot.h
  39. #
  40. if test -r _shar_seq_.tmp; then
  41.     echo 'Must unpack archives in sequence!'
  42.     echo Please unpack part `cat _shar_seq_.tmp` next
  43.     exit 1
  44. fi
  45. # ============= README ==============
  46. if test -f 'README' -a X"$1" != X"-c"; then
  47.     echo 'x - skipping README (File already exists)'
  48.     rm -f _shar_wnt_.tmp
  49. else
  50. > _shar_wnt_.tmp
  51. echo 'x - extracting README (Text)'
  52. sed 's/^X//' << 'SHAR_EOF' > 'README' &&
  53. xlax is a program that allows output to
  54. be sent to several windows (via SendEvent()).
  55. X
  56. It can be useful for some tasks that require almost
  57. the same thing to be done on different machines.
  58. X
  59. Send questions, comments or whatever to 
  60. frank@cis.ohio-state.edu.
  61. X
  62. Author: Frank Adelstein, with code for window selection
  63. taken from "dsimple" in MIT clients, and "vroot.h" used
  64. so it'll work under tvtwm.
  65. X
  66. Standard X copying policies apply (see the copyright notice
  67. at the beginning of code for full details).
  68. X
  69. --Frank Adelstein.
  70. X
  71. SHAR_EOF
  72. chmod 0644 README ||
  73. echo 'restore of README failed'
  74. Wc_c="`wc -c < 'README'`"
  75. test 522 -eq "$Wc_c" ||
  76.     echo 'README: original size 522, current size' "$Wc_c"
  77. rm -f _shar_wnt_.tmp
  78. fi
  79. # ============= Imakefile ==============
  80. if test -f 'Imakefile' -a X"$1" != X"-c"; then
  81.     echo 'x - skipping Imakefile (File already exists)'
  82.     rm -f _shar_wnt_.tmp
  83. else
  84. > _shar_wnt_.tmp
  85. echo 'x - extracting Imakefile (Text)'
  86. sed 's/^X//' << 'SHAR_EOF' > 'Imakefile' &&
  87. #Imakefile for xlax
  88. X
  89. #   EXTRA_LOAD_FLAGS = -Bstatic
  90. #        CDEBUGFLAGS = -g
  91. #            DEFINES = -DDEBUG
  92. X            DEPLIBS = XawClientDepLibs
  93. X    LOCAL_LIBRARIES = XawClientLibs
  94. X               SRCS = xlax.c
  95. X               OBJS = xlax.o
  96. X
  97. ComplexProgramTarget(xlax)
  98. X
  99. X
  100. SHAR_EOF
  101. chmod 0644 Imakefile ||
  102. echo 'restore of Imakefile failed'
  103. Wc_c="`wc -c < 'Imakefile'`"
  104. test 273 -eq "$Wc_c" ||
  105.     echo 'Imakefile: original size 273, current size' "$Wc_c"
  106. rm -f _shar_wnt_.tmp
  107. fi
  108. # ============= Makefile ==============
  109. if test -f 'Makefile' -a X"$1" != X"-c"; then
  110.     echo 'x - skipping Makefile (File already exists)'
  111.     rm -f _shar_wnt_.tmp
  112. else
  113. > _shar_wnt_.tmp
  114. echo 'x - extracting Makefile (Text)'
  115. sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
  116. # Makefile generated by imake - do not edit!
  117. # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
  118. #
  119. # The cpp used on this machine replaces all newlines and multiple tabs and
  120. # spaces in a macro expansion with a single space.  Imake tries to compensate
  121. # for this, but is not always successful.
  122. #
  123. X
  124. # -------------------------------------------------------------------------
  125. # Makefile generated from "Imake.tmpl" and </tmp/IIf.a16697>
  126. # $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
  127. #
  128. # Platform-specific parameters may be set in the appropriate <vendor>.cf
  129. # configuration files.  Site-specific parameters should be set in the file
  130. # site.def.  Full rebuilds are recommended if any parameters are changed.
  131. #
  132. # If your C preprocessor does not define any unique symbols, you will need
  133. # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  134. # "make World" the first time).
  135. #
  136. X
  137. # -------------------------------------------------------------------------
  138. # site-specific configuration parameters that need to come before
  139. # the platform-specific parameters - edit site.def to change
  140. X
  141. # site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  142. X
  143. # -------------------------------------------------------------------------
  144. # platform-specific configuration parameters - edit sun.cf to change
  145. X
  146. # platform:  $XConsortium: sun.cf,v 1.68 91/07/30 11:34:39 rws Exp $
  147. X
  148. # operating system:  SunOS 4.1.1
  149. X
  150. # $XConsortium: sunLib.rules,v 1.6 91/03/24 17:55:58 rws Exp $
  151. X
  152. # -------------------------------------------------------------------------
  153. # site-specific configuration parameters that go after
  154. # the platform-specific parameters - edit site.def to change
  155. X
  156. # site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  157. X
  158. X            SHELL = /bin/sh
  159. X
  160. X              TOP = .
  161. X      CURRENT_DIR = .
  162. X
  163. X               AR = ar clq
  164. X  BOOTSTRAPCFLAGS =
  165. X               CC = cc
  166. X               AS = as
  167. X
  168. X         COMPRESS = compress
  169. X              CPP = /lib/cpp $(STD_CPP_DEFINES)
  170. X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
  171. X          INSTALL = install
  172. X               LD = ld
  173. X             LINT = lint
  174. X      LINTLIBFLAG = -C
  175. X         LINTOPTS = -axz
  176. X               LN = ln -s
  177. X             MAKE = make
  178. X               MV = mv
  179. X               CP = cp
  180. X
  181. X           RANLIB = ranlib
  182. X  RANLIBINSTFLAGS =
  183. X
  184. X               RM = rm -f
  185. X            TROFF = psroff
  186. X         MSMACROS = -ms
  187. X              TBL = tbl
  188. X              EQN = eqn
  189. X     STD_INCLUDES =
  190. X  STD_CPP_DEFINES =
  191. X      STD_DEFINES =
  192. X EXTRA_LOAD_FLAGS =
  193. X  EXTRA_LIBRARIES =
  194. X             TAGS = ctags
  195. X
  196. X    SHAREDCODEDEF = -DSHAREDCODE
  197. X         SHLIBDEF = -DSUNSHLIB
  198. X
  199. X    PROTO_DEFINES =
  200. X
  201. X     INSTPGMFLAGS =
  202. X
  203. X     INSTBINFLAGS = -m 0755
  204. X     INSTUIDFLAGS = -m 4755
  205. X     INSTLIBFLAGS = -m 0644
  206. X     INSTINCFLAGS = -m 0444
  207. X     INSTMANFLAGS = -m 0444
  208. X     INSTDATFLAGS = -m 0444
  209. X    INSTKMEMFLAGS = -m 4755
  210. X
  211. X      PROJECTROOT = /usr/X11/R5
  212. X
  213. X     TOP_INCLUDES = -I$(INCROOT)
  214. X
  215. X      CDEBUGFLAGS = -O
  216. X        CCOPTIONS = -pipe
  217. X
  218. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  219. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  220. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  221. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  222. X
  223. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  224. X
  225. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
  226. X
  227. X   LDCOMBINEFLAGS = -X -r
  228. X      DEPENDFLAGS =
  229. X
  230. X        MACROFILE = sun.cf
  231. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  232. X
  233. X    IMAKE_DEFINES =
  234. X
  235. X         IRULESRC = $(CONFIGDIR)
  236. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  237. X
  238. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  239. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  240. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  241. X
  242. # -------------------------------------------------------------------------
  243. # X Window System Build Parameters
  244. # $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  245. X
  246. # -------------------------------------------------------------------------
  247. # X Window System make variables; this need to be coordinated with rules
  248. X
  249. X          PATHSEP = /
  250. X        USRLIBDIR = /usr/X11/R5/lib
  251. X           BINDIR = /usr/X11/R5/bin
  252. X          INCROOT = /usr/X11/R5/include
  253. X     BUILDINCROOT = $(TOP)
  254. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  255. X      BUILDINCTOP = ..
  256. X           INCDIR = $(INCROOT)/X11
  257. X           ADMDIR = /usr/adm
  258. X           LIBDIR = $(USRLIBDIR)/X11
  259. X        CONFIGDIR = $(LIBDIR)/config
  260. X       LINTLIBDIR = $(USRLIBDIR)/lint
  261. X
  262. X          FONTDIR = $(LIBDIR)/fonts
  263. X         XINITDIR = $(LIBDIR)/xinit
  264. X           XDMDIR = $(LIBDIR)/xdm
  265. X           TWMDIR = $(LIBDIR)/twm
  266. X          MANPATH = /usr/X11/R5/man
  267. X    MANSOURCEPATH = $(MANPATH)/man
  268. X        MANSUFFIX = n
  269. X     LIBMANSUFFIX = 3
  270. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  271. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  272. X           NLSDIR = $(LIBDIR)/nls
  273. X        PEXAPIDIR = $(LIBDIR)/PEX
  274. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  275. X       FONTCFLAGS = -t
  276. X
  277. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  278. X
  279. X            IMAKE = imake
  280. X           DEPEND = makedepend
  281. X              RGB = rgb
  282. X
  283. X            FONTC = bdftopcf
  284. X
  285. X        MKFONTDIR = mkfontdir
  286. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
  287. X
  288. X        CONFIGSRC = $(TOP)/config
  289. X       DOCUTILSRC = $(TOP)/doc/util
  290. X        CLIENTSRC = $(TOP)/clients
  291. X          DEMOSRC = $(TOP)/demos
  292. X           LIBSRC = $(TOP)/lib
  293. X          FONTSRC = $(TOP)/fonts
  294. X       INCLUDESRC = $(TOP)/X11
  295. X        SERVERSRC = $(TOP)/server
  296. X          UTILSRC = $(TOP)/util
  297. X        SCRIPTSRC = $(UTILSRC)/scripts
  298. X       EXAMPLESRC = $(TOP)/examples
  299. X       CONTRIBSRC = $(TOP)/../contrib
  300. X           DOCSRC = $(TOP)/doc
  301. X           RGBSRC = $(TOP)/rgb
  302. X        DEPENDSRC = $(UTILSRC)/makedepend
  303. X         IMAKESRC = $(CONFIGSRC)
  304. X         XAUTHSRC = $(LIBSRC)/Xau
  305. X          XLIBSRC = $(LIBSRC)/X
  306. X           XMUSRC = $(LIBSRC)/Xmu
  307. X       TOOLKITSRC = $(LIBSRC)/Xt
  308. X       AWIDGETSRC = $(LIBSRC)/Xaw
  309. X       OLDXLIBSRC = $(LIBSRC)/oldX
  310. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  311. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  312. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  313. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  314. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  315. X         FSLIBSRC = $(FONTSRC)/lib/fs
  316. X    FONTSERVERSRC = $(FONTSRC)/server
  317. X     EXTENSIONSRC = $(TOP)/extensions
  318. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  319. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  320. X
  321. # $XConsortium: sunLib.tmpl,v 1.11 91/07/31 11:32:08 rws Exp $
  322. X
  323. SHLIBLDFLAGS = -assert pure-text
  324. PICFLAGS = -pic
  325. X
  326. X  DEPEXTENSIONLIB =
  327. X     EXTENSIONLIB = -lXext
  328. X
  329. X          DEPXLIB = $(DEPEXTENSIONLIB)
  330. X             XLIB = $(EXTENSIONLIB) -lX11
  331. X
  332. X        DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
  333. X           XMULIB = -lXmu
  334. X
  335. X       DEPOLDXLIB =
  336. X          OLDXLIB = -loldX
  337. X
  338. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
  339. X         XTOOLLIB = -lXt
  340. X
  341. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
  342. X           XAWLIB = -lXaw
  343. X
  344. X        DEPXILIB =
  345. X           XILIB = -lXi
  346. X
  347. X        SOXLIBREV = 4.10
  348. X          SOXTREV = 4.10
  349. X         SOXAWREV = 5.0
  350. X        SOOLDXREV = 4.10
  351. X         SOXMUREV = 4.10
  352. X        SOXEXTREV = 4.10
  353. X      SOXINPUTREV = 4.10
  354. X
  355. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  356. X         XAUTHLIB =  -lXau
  357. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  358. X         XDMCPLIB =  -lXdmcp
  359. X
  360. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  361. X           PHIGSLIB =  -lphigs
  362. X
  363. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  364. X          XBSDLIB =  -lXbsd
  365. X
  366. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  367. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  368. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  369. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  370. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  371. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  372. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  373. X
  374. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  375. X
  376. X         DEPLIBS1 = $(DEPLIBS)
  377. X         DEPLIBS2 = $(DEPLIBS)
  378. X         DEPLIBS3 = $(DEPLIBS)
  379. X
  380. # -------------------------------------------------------------------------
  381. # Imake rules for building libraries, programs, scripts, and data files
  382. # rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  383. X
  384. # -------------------------------------------------------------------------
  385. # start of Imakefile
  386. X
  387. #Imakefile for xlax
  388. X
  389. #   EXTRA_LOAD_FLAGS = -Bstatic
  390. #        CDEBUGFLAGS = -g
  391. #            DEFINES = -DDEBUG
  392. X            DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  393. X    LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  394. X               SRCS = xlax.c
  395. X               OBJS = xlax.o
  396. X
  397. X PROGRAM = xlax
  398. X
  399. all:: xlax
  400. X
  401. xlax: $(OBJS) $(DEPLIBS)
  402. X    $(RM) $@
  403. X    $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
  404. X
  405. saber_xlax:: $(SRCS)
  406. X    # load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  407. X
  408. osaber_xlax:: $(OBJS)
  409. X    # load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  410. X
  411. install:: xlax
  412. X    @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
  413. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
  414. X    $(INSTALL) -c $(INSTPGMFLAGS)  xlax $(DESTDIR)$(BINDIR)
  415. X
  416. install.man:: xlax.man
  417. X    @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
  418. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
  419. X    $(INSTALL) -c $(INSTMANFLAGS) xlax.man $(DESTDIR)$(MANDIR)/xlax.$(MANSUFFIX)
  420. X
  421. depend::
  422. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  423. X
  424. lint:
  425. X    $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
  426. lint1:
  427. X    $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  428. X
  429. clean::
  430. X    $(RM) $(PROGRAM)
  431. X
  432. # -------------------------------------------------------------------------
  433. # common rules for all Makefiles - do not edit
  434. X
  435. emptyrule::
  436. X
  437. clean::
  438. X    $(RM_CMD) "#"*
  439. X
  440. Makefile::
  441. X    -@if [ -f Makefile ]; then set -x; \
  442. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  443. X    else exit 0; fi
  444. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  445. X
  446. tags::
  447. X    $(TAGS) -w *.[ch]
  448. X    $(TAGS) -xw *.[ch] > TAGS
  449. X
  450. saber:
  451. X    # load $(ALLDEFINES) $(SRCS)
  452. X
  453. osaber:
  454. X    # load $(ALLDEFINES) $(OBJS)
  455. X
  456. # -------------------------------------------------------------------------
  457. # empty rules for directories that do not have SUBDIRS - do not edit
  458. X
  459. install::
  460. X    @echo "install in $(CURRENT_DIR) done"
  461. X
  462. install.man::
  463. X    @echo "install.man in $(CURRENT_DIR) done"
  464. X
  465. Makefiles::
  466. X
  467. includes::
  468. X
  469. # -------------------------------------------------------------------------
  470. # dependencies generated by makedepend
  471. X
  472. SHAR_EOF
  473. chmod 0644 Makefile ||
  474. echo 'restore of Makefile failed'
  475. Wc_c="`wc -c < 'Makefile'`"
  476. test 10508 -eq "$Wc_c" ||
  477.     echo 'Makefile: original size 10508, current size' "$Wc_c"
  478. rm -f _shar_wnt_.tmp
  479. fi
  480. # ============= xlax.man ==============
  481. if test -f 'xlax.man' -a X"$1" != X"-c"; then
  482.     echo 'x - skipping xlax.man (File already exists)'
  483.     rm -f _shar_wnt_.tmp
  484. else
  485. > _shar_wnt_.tmp
  486. echo 'x - extracting xlax.man (Text)'
  487. sed 's/^X//' << 'SHAR_EOF' > 'xlax.man' &&
  488. .TH XLAX 1 "Release 5" "X Version 11"
  489. .SH NAME
  490. xlax - X window system program to send keyboard input to multiple windows
  491. .SH SYNOPSIS
  492. .B "xlax"
  493. [-\fItoolkit options\fP]
  494. .SH DESCRIPTION
  495. .PP
  496. .I Xlax
  497. is an X Window System program that will send keyboard input it
  498. receives to multiple selected windows.  When run, 
  499. .I Xlax
  500. will bring up its main window.  There will be four buttons on it,
  501. "quit", "add window", "send string" and "kill window."
  502. X
  503. Quit will terminate 
  504. .I xlax
  505. and add window will change the cursor to a cross-hair and allow the
  506. user to select any window on the screen by pressing a mouse button.
  507. The user will be able to continue selecting windows until either the 
  508. .I xlax
  509. window or a window that has already been selected, is selected.
  510. X
  511. When a window is selected, its name will appear in the 
  512. .I xlax
  513. window.  Clicking the mouse on the window name will toggle whether
  514. that window should receive input.  When the user types anywhere in the
  515. .I xlax 
  516. window, those keystrokes will be sent to all selected windows.
  517. X
  518. Kill window will allow the user to select a window and remove it from
  519. .I xlax's 
  520. list (note: the user must click on the actual window, not the name that
  521. appears in 
  522. .I xlax).
  523. X
  524. There is a window to the right of each name.  The user can type 
  525. into it.  When Send String is selected, the specific string associated 
  526. with each window will be sent to those windows.  Clicking the first
  527. mouse button in that text area will clear that string and allow the 
  528. user to re-enter the string.  Up to 150 characters are allowed.
  529. X
  530. This tool tends to be useful for system administration tasks that
  531. require almost the same thing to be done in several different 
  532. windows, but require some human intervention (e.g. some tape backups
  533. or building multiple servers).  The string area is useful for machine
  534. or platform specific strings (such as machine names or machine type).
  535. X
  536. .SH ENVIRONMENT
  537. .PP
  538. .TP 8
  539. .B DISPLAY
  540. To get default host and display number.
  541. X
  542. .SH CAVEATS
  543. For 
  544. .I xlax 
  545. to work on an xterm, "allowSendEvents" must be enabled on the 
  546. xterm.  Note that this means that anyone can send keystrokes
  547. to that xterm, so this should not be run in an insecure or
  548. unmonitored environment.
  549. X
  550. .SH BUGS
  551. Probably something, but nothing that comes to mind.
  552. .SH SEE ALSO
  553. xterm(1)
  554. .SH COPYRIGHT
  555. Copyright 1992, Frank Adelstein.
  556. .br
  557. SHAR_EOF
  558. chmod 0644 xlax.man ||
  559. echo 'restore of xlax.man failed'
  560. Wc_c="`wc -c < 'xlax.man'`"
  561. test 2325 -eq "$Wc_c" ||
  562.     echo 'xlax.man: original size 2325, current size' "$Wc_c"
  563. rm -f _shar_wnt_.tmp
  564. fi
  565. # ============= xlax.h ==============
  566. if test -f 'xlax.h' -a X"$1" != X"-c"; then
  567.     echo 'x - skipping xlax.h (File already exists)'
  568.     rm -f _shar_wnt_.tmp
  569. else
  570. > _shar_wnt_.tmp
  571. echo 'x - extracting xlax.h (Text)'
  572. sed 's/^X//' << 'SHAR_EOF' > 'xlax.h' &&
  573. /*
  574. X * Copyright 1992 by Frank Adelstein.  All Rights Reserved.
  575. X *
  576. X * Permission to use, copy, modify, and distribute this software and its
  577. X * documentation for any purpose is hereby granted without fee, provided that
  578. X * the above copyright notice appear in all copies and that both that
  579. X * copyright notice and this permission notice appear in supporting
  580. X * documentation, and that the authors name not be used in advertising or
  581. X * publicity pertaining to distribution of the software without specific,
  582. X * written prior permission.  The author makes no representations about the
  583. X * suitability of this software for any purpose.  It is provided "as is"
  584. X * without express or implied warranty.
  585. X *
  586. X * THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  587. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  588. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT
  589. X * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  590. X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  591. X * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  592. X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  593. X */
  594. X
  595. X
  596. /************/
  597. /* INCLUDES */
  598. /************/
  599. X
  600. #include <X11/Intrinsic.h>
  601. #include <X11/StringDefs.h>
  602. #include <X11/Shell.h>
  603. X
  604. #include <X11/Xaw/AsciiText.h>
  605. #include <X11/Xaw/Command.h>
  606. #include <X11/Xaw/Form.h>
  607. #include <X11/Xaw/Label.h>
  608. #include <X11/Xaw/Scrollbar.h>
  609. #include <X11/Xaw/Toggle.h>
  610. #include <X11/Xaw/Viewport.h>
  611. X
  612. #include <X11/cursorfont.h>
  613. X
  614. #include <stdio.h>
  615. #include <errno.h>
  616. #include <math.h>
  617. #include <signal.h>
  618. X
  619. /*************/
  620. /* DEFINES   */
  621. /*************/
  622. X
  623. #define TITLE     "xlax"
  624. #define CLASS     "Xlax"
  625. #define MAXEVENTS 150
  626. X
  627. /*************/
  628. /* types     */
  629. /*************/
  630. X
  631. typedef struct {
  632. X  Window wind;
  633. X  int    active;
  634. X  XKeyEvent events[MAXEVENTS];
  635. X  int    eventindex;
  636. X  Widget button;
  637. X  Widget text;
  638. } Windows_t;
  639. X
  640. /*************/
  641. /* GLOBALS   */
  642. /*************/
  643. X
  644. void SetupInterface();
  645. void selectCB();
  646. void killCB();
  647. void keyboardCB();
  648. void toggleCB();
  649. void quitCB();
  650. void senditCB();
  651. void togglestringCB();
  652. void stringinputCB();
  653. SHAR_EOF
  654. chmod 0644 xlax.h ||
  655. echo 'restore of xlax.h failed'
  656. Wc_c="`wc -c < 'xlax.h'`"
  657. test 2132 -eq "$Wc_c" ||
  658.     echo 'xlax.h: original size 2132, current size' "$Wc_c"
  659. rm -f _shar_wnt_.tmp
  660. fi
  661. # ============= xlax.c ==============
  662. if test -f 'xlax.c' -a X"$1" != X"-c"; then
  663.     echo 'x - skipping xlax.c (File already exists)'
  664.     rm -f _shar_wnt_.tmp
  665. else
  666. > _shar_wnt_.tmp
  667. echo 'x - extracting xlax.c (Text)'
  668. sed 's/^X//' << 'SHAR_EOF' > 'xlax.c' &&
  669. /*
  670. X * Copyright 1992 by Frank Adelstein.  All Rights Reserved.
  671. X *
  672. X * Permission to use, copy, modify, and distribute this software and its
  673. X * documentation for any purpose is hereby granted without fee, provided that
  674. X * the above copyright notice appear in all copies and that both that
  675. X * copyright notice and this permission notice appear in supporting
  676. X * documentation, and that the authors name not be used in advertising or
  677. X * publicity pertaining to distribution of the software without specific,
  678. X * written prior permission.  The author makes no representations about the
  679. X * suitability of this software for any purpose.  It is provided "as is"
  680. X * without express or implied warranty.
  681. X *
  682. X * THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  683. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  684. X * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT
  685. X * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  686. X * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  687. X * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  688. X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  689. X */
  690. X
  691. X
  692. /*
  693. X * Neat program to send typed text to multiple windows.
  694. X *
  695. X * by Frank Adelstein
  696. X *
  697. X */
  698. X
  699. #include "xlax.h"
  700. #include "vroot.h"
  701. X
  702. XXtAppContext
  703. X  Appcon;
  704. X
  705. Widget
  706. X  Toplevel;
  707. X
  708. GC
  709. X  drawGC,
  710. X  xorGC;
  711. X
  712. Windows_t
  713. X  Windows[50];
  714. X  
  715. int 
  716. X  WindowIndex;
  717. X
  718. void DoNothing() {
  719. X  /* stupid, but used to override button click default actions */
  720. X  return;
  721. }
  722. X
  723. void ErrorHandler(mydisp, myerr) 
  724. Display *mydisp;
  725. XXErrorEvent *myerr;
  726. X
  727. {
  728. X  char msg[80];
  729. X  XGetErrorText(mydisp, myerr->error_code, msg, 80);
  730. X  (void) fprintf(stderr, "%s\n", msg);
  731. X  if (myerr->error_code == BadWindow) {
  732. X    return;
  733. X  } else {
  734. X    (void) fprintf(stderr, 
  735. X               "Fatal!!  We got errors: error [%d] request [%d] minor [%d]\n",
  736. X               myerr->error_code, myerr->request_code, myerr->minor_code); 
  737. X    exit(1); 
  738. X  } 
  739. }
  740. X
  741. main (argc, argv)
  742. int    argc;
  743. char **argv;
  744. X
  745. {
  746. X
  747. X  void DoNothing();
  748. X  static XtActionsRec TextActions[] = {
  749. X    {"DoNothing", DoNothing},
  750. X    {NULL, NULL}
  751. X  };
  752. X
  753. X  /* initialize toolkit */
  754. X  Toplevel = XtAppInitialize (&Appcon, TITLE, NULL, 0, &argc, argv,
  755. X                  NULL, NULL, 0);
  756. X
  757. X  XtAppAddActions(Appcon, TextActions, XtNumber(TextActions));
  758. X  XSetErrorHandler(ErrorHandler);
  759. X
  760. X  /* do all the dirty work */
  761. X  SetupInterface();
  762. X
  763. X  /* sit back and process events */
  764. X  XtAppMainLoop(Appcon);
  765. }
  766. X
  767. void
  768. SetupInterface()
  769. X
  770. {
  771. X  int cnt;
  772. X
  773. X  Arg args[15];
  774. X
  775. X  Widget
  776. X    Frame,
  777. X    thing,
  778. X    quit,
  779. X    sendit,
  780. X    view,
  781. X    draw;
  782. X
  783. X  Display
  784. X    *display;
  785. X
  786. X  /* create a frame widget to hold things */
  787. X  cnt = 0;
  788. X  Frame = XtCreateManagedWidget ("Frame", formWidgetClass, 
  789. X                 Toplevel, args, cnt);
  790. X
  791. X  XtAddEventHandler (Frame, KeyPressMask, False, keyboardCB, NULL);
  792. X
  793. X  cnt = 0;
  794. X  XtSetArg (args[cnt], XtNborder, 2);                       cnt++;
  795. X  XtSetArg (args[cnt], XtNlabel, "Add Windows");            cnt++;
  796. X
  797. X  thing = XtCreateManagedWidget ("addbutton", 
  798. X                 commandWidgetClass,
  799. X                 Frame, args, cnt);
  800. X  XtAddCallback (thing, XtNcallback, selectCB, NULL);
  801. X
  802. X  cnt = 0;
  803. X  XtSetArg (args[cnt], XtNborder, 2);                       cnt++;
  804. X  XtSetArg (args[cnt], XtNfromVert, thing);                 cnt++;
  805. X  XtSetArg (args[cnt], XtNlabel, "Send String");            cnt++;
  806. X
  807. X  sendit = XtCreateManagedWidget ("senditbutton", 
  808. X                  commandWidgetClass,
  809. X                  Frame, args, cnt);
  810. X  XtAddCallback (sendit, XtNcallback, senditCB, NULL);
  811. X
  812. X  cnt = 0;
  813. X  XtSetArg (args[cnt], XtNborder, 2);                       cnt++;
  814. X  XtSetArg (args[cnt], XtNlabel, "Kill Window");            cnt++;
  815. X  XtSetArg (args[cnt], XtNfromVert, sendit);                cnt++;
  816. X
  817. X  thing = XtCreateManagedWidget ("killbutton", 
  818. X                 commandWidgetClass,
  819. X                 Frame, args, cnt);
  820. X  XtAddCallback (thing, XtNcallback, killCB, NULL);
  821. X
  822. X  cnt = 0;
  823. X  XtSetArg (args[cnt], XtNborder, 2);                       cnt++;
  824. X  XtSetArg (args[cnt], XtNfromVert, thing);                 cnt++;
  825. X  XtSetArg (args[cnt], XtNlabel, "Quit");                   cnt++;
  826. X
  827. X  quit = XtCreateManagedWidget ("quitbutton", 
  828. X                 commandWidgetClass,
  829. X                 Frame, args, cnt);
  830. X  XtAddCallback (quit, XtNcallback, quitCB, NULL);
  831. X
  832. X  /* create a viewport widget and a frame widget to hold things */
  833. X  cnt = 0;
  834. X  XtSetArg (args[cnt], XtNfromHoriz, sendit);                 cnt++;
  835. X  XtSetArg (args[cnt], XtNborder, 2);                         cnt++;
  836. X  XtSetArg(args[cnt], XtNwidth,  400);                        cnt++;
  837. X  XtSetArg(args[cnt], XtNheight,  150);                       cnt++;
  838. X  XtSetArg(args[cnt], XtNallowHoriz, True);  cnt++;
  839. X  XtSetArg(args[cnt], XtNallowVert,  True);  cnt++;
  840. X  view = XtCreateManagedWidget("View", viewportWidgetClass,
  841. X                               Frame, args, cnt);
  842. X
  843. X  /* I don't understand why I need to do this, but...*/
  844. X  cnt = 0;
  845. X  XtSetArg(args[cnt], XtNwidth,  10);                         cnt++;
  846. X  XtSetArg(args[cnt], XtNheight, 10);                         cnt++;
  847. X  XtSetValues(XtNameToWidget(Toplevel, "*clip"), args, cnt);
  848. X
  849. X  cnt = 0;
  850. X
  851. X  XtSetArg (args[cnt], XtNborder, 2);                         cnt++;
  852. X  XtSetArg(args[cnt], XtNwidth,  200);                        cnt++;
  853. X  XtSetArg(args[cnt], XtNheight,  150);                       cnt++;
  854. X  draw = XtCreateWidget ("drawingarea", formWidgetClass,
  855. X             view, args, cnt);
  856. X
  857. X  XtRealizeWidget (Toplevel);
  858. X
  859. X  return;
  860. X
  861. }
  862. X
  863. X
  864. /*
  865. X * Routine to let user select a window using the mouse
  866. X * (taken from dsimple.c from xwd)
  867. X */
  868. X
  869. Window Select_Window(dpy)
  870. X     Display *dpy;
  871. {
  872. X  int status;
  873. X  Cursor cursor;
  874. X  XEvent event;
  875. X  Window target_win = None, root = RootWindow(dpy,DefaultScreen(dpy));
  876. X  int buttons = 0;
  877. X
  878. X  /* Make the target cursor */
  879. X  cursor = XCreateFontCursor(dpy, XC_crosshair);
  880. X
  881. X  /* Grab the pointer using target cursor, letting it room all over */
  882. X  status = XGrabPointer(dpy, root, False,
  883. X                        ButtonPressMask|ButtonReleaseMask, GrabModeSync,
  884. X                        GrabModeAsync, root, cursor, CurrentTime);
  885. X  if (status != GrabSuccess) {
  886. X    fprintf(stderr, "Can't grab the mouse.");
  887. X    exit (2);
  888. X  }
  889. X
  890. X  /* Let the user select a window... */
  891. X  while ((target_win == None) || (buttons != 0)) {
  892. X    /* allow one more event */
  893. X    XAllowEvents(dpy, SyncPointer, CurrentTime);
  894. X    XWindowEvent(dpy, root, ButtonPressMask|ButtonReleaseMask, &event);
  895. X    switch (event.type) {
  896. X    case ButtonPress:
  897. X      if (target_win == None) {
  898. X        target_win = event.xbutton.subwindow; /* window selected */
  899. X        if (target_win == None)  {
  900. X      fprintf(stderr, "target win = None\n");
  901. X      target_win = root;
  902. X    }
  903. X      }
  904. X      buttons++;
  905. X      break;
  906. X    case ButtonRelease:
  907. X      if (buttons > 0) /* there may have been some down before we started */
  908. X        buttons--;
  909. X       break;
  910. X    }
  911. X  }
  912. X
  913. X  XUngrabPointer(dpy, CurrentTime);      /* Done with pointer */
  914. X
  915. X  return(target_win);
  916. }
  917. X
  918. void
  919. selectCB (w, client_data, call_data)
  920. Widget w;
  921. caddr_t  client_data;
  922. caddr_t  call_data;
  923. X
  924. {
  925. X  Display *dpy;
  926. X  Window target;
  927. X  Widget frame;
  928. X  int x, y;
  929. X  char *name;
  930. X
  931. X  XtTranslations text_trans;
  932. X  static String text_trans_str =
  933. X    "<Btn1Down>: DoNothing() \n\
  934. X     <Btn2Down>: DoNothing() \n\
  935. X     <Btn3Down>: DoNothing() \n\
  936. X     <Key>Return: insert-string(\"^M\") \n\
  937. X     <Key>BackSpace: insert-string(\"^H\") \n\
  938. X     <Key>Delete: insert-string(\"^?\")";
  939. X
  940. X  int cnt;
  941. X  Arg args[15];
  942. X  
  943. X  cnt = 0;
  944. X  XtSetArg (args[cnt], XtNlabel, "Adding...");            cnt++;
  945. X  XtSetValues(w, args, cnt);
  946. X  do {
  947. X    XtAppProcessEvent (Appcon, XtIMAll);
  948. X  } while (XtAppPending(Appcon));
  949. X
  950. X
  951. X  dpy = XtDisplay(w);
  952. X  while (1) {
  953. X    /* keep selecting windows until the xlax window is selected */
  954. X    target = Select_Window(dpy);
  955. X
  956. X    /* stupid undocumented kludge */
  957. X    target = XmuClientWindow (dpy, target);
  958. X
  959. X    if (target == XmuClientWindow(dpy, XtWindow(Toplevel))) {
  960. X       /* we just clicked on ourself...let's avoid an endless loop */
  961. X       cnt = 0;
  962. X       XtSetArg (args[cnt], XtNlabel, "Add Windows");            cnt++;
  963. X       XtSetValues(w, args, cnt);
  964. X       return;
  965. X    }
  966. X    /* just return if we've already got that window yet */
  967. X    for (x = 0; x < WindowIndex; x++) 
  968. X      {
  969. X        if (Windows[x].wind == target) 
  970. X      {
  971. X            cnt = 0;
  972. X            XtSetArg (args[cnt], XtNlabel, "Add Windows");            cnt++;
  973. X            XtSetValues(w, args, cnt);
  974. X        return;
  975. X      }
  976. X      }
  977. X
  978. X    XFlush(dpy);
  979. X    x = XFetchName(dpy, target, &name);
  980. X
  981. X    /* add a toggle button */
  982. X    frame = XtNameToWidget (Toplevel, "*drawingarea");
  983. X
  984. X    cnt = 0;
  985. X    XtSetArg (args[cnt], XtNborder, 2);                       cnt++;
  986. X    XtSetArg (args[cnt], XtNlabel, name);                     cnt++;
  987. X    XtSetArg (args[cnt], XtNfromVert, 
  988. X          (WindowIndex)?Windows[WindowIndex - 1].button:NULL);  cnt++;
  989. X    XtSetArg (args[cnt], XtNtop, XtChainTop);                 cnt++;
  990. X    XtSetArg (args[cnt], XtNbottom, XtChainTop);              cnt++;
  991. X    XtSetArg (args[cnt], XtNleft, XtChainLeft);               cnt++;
  992. X    XtSetArg (args[cnt], XtNright, XtChainLeft);              cnt++;
  993. X    XtSetArg (args[cnt], XtNwidth, 190);                      cnt++;
  994. X    XtSetArg (args[cnt], XtNheight, 20);                      cnt++;
  995. X    XtSetArg (args[cnt], XtNstate, True);                     cnt++;
  996. X    Windows[WindowIndex].button = XtCreateManagedWidget ("togglebutton", 
  997. X                                 toggleWidgetClass,
  998. X                                 frame, args, cnt);
  999. X    /* add a toggle button */
  1000. X    frame = XtNameToWidget (Toplevel, "*drawingarea");
  1001. X
  1002. X    text_trans = XtParseTranslationTable(text_trans_str);
  1003. X    cnt = 0;
  1004. X    XtSetArg (args[cnt], XtNborder, 2);                       cnt++;
  1005. X    XtSetArg (args[cnt], XtNlabel, name);                     cnt++;
  1006. X    XtSetArg (args[cnt], XtNfromVert, 
  1007. X          (WindowIndex)?Windows[WindowIndex - 1].text:NULL);  cnt++;
  1008. X    XtSetArg (args[cnt], XtNfromHoriz, 
  1009. X          Windows[WindowIndex].button);                   cnt++;
  1010. X    XtSetArg (args[cnt], XtNtop, XtChainTop);                 cnt++;
  1011. X    XtSetArg (args[cnt], XtNbottom, XtChainTop);              cnt++;
  1012. X    XtSetArg (args[cnt], XtNleft, XtChainLeft);               cnt++;
  1013. X    XtSetArg (args[cnt], XtNright, XtChainLeft);              cnt++;
  1014. X    XtSetArg (args[cnt], XtNwidth, 190);                      cnt++;
  1015. X    XtSetArg (args[cnt], XtNheight, 20);                      cnt++;
  1016. X    XtSetArg (args[cnt], XtNeditType, XawtextEdit);           cnt++;
  1017. X    Windows[WindowIndex].text = XtCreateManagedWidget ("toggletext", 
  1018. X                               asciiTextWidgetClass,
  1019. X                               frame, args, cnt);
  1020. X
  1021. X    XtOverrideTranslations(Windows[WindowIndex].text, text_trans);
  1022. X
  1023. X    XtAddCallback (Windows[WindowIndex].button, XtNcallback, 
  1024. X           toggleCB, WindowIndex);
  1025. X
  1026. X    XtAddEventHandler (Windows[WindowIndex].text, ButtonPressMask,
  1027. X               False, togglestringCB, WindowIndex);
  1028. X
  1029. X    XtAddEventHandler (Windows[WindowIndex].text, KeyPressMask,
  1030. X               False, stringinputCB, WindowIndex);
  1031. X
  1032. X    XtUnmanageChild(frame);
  1033. X    XtManageChild(frame);
  1034. X
  1035. X    Windows[WindowIndex].wind = target;
  1036. X    Windows[WindowIndex].eventindex = 0;
  1037. X    Windows[WindowIndex++].active = 1;
  1038. X
  1039. X  }      /* end while (1) */  
  1040. }
  1041. X
  1042. X
  1043. void
  1044. killCB (w, client_data, call_data)
  1045. Widget w;
  1046. caddr_t  client_data;
  1047. caddr_t  call_data;
  1048. X
  1049. {
  1050. X  Display *dpy;
  1051. X  Window  target;
  1052. X  Widget  frame;
  1053. X  int     x, length;
  1054. X
  1055. X  Arg     args[10];
  1056. X  int     cnt;
  1057. X
  1058. X  dpy = XtDisplay(w);
  1059. X  /* get the selection */
  1060. X  target = Select_Window(XtDisplay(w));
  1061. X
  1062. X  /* tell me what that really means */
  1063. X  target = XmuClientWindow(dpy, target);
  1064. X
  1065. X  if (target == XmuClientWindow(dpy, XtWindow(Toplevel))) {
  1066. X    /* it's us..don't bother */
  1067. X    return;
  1068. X  } 
  1069. X
  1070. X  /* otherwise see if that window is in our list */
  1071. X  for (x = 0; x < WindowIndex; x++) {
  1072. X    if (Windows[x].wind == target) {
  1073. X      /* remove it from our list then */
  1074. X      XtDestroyWidget(Windows[x].button);
  1075. X      XtDestroyWidget(Windows[x].text);
  1076. X      frame = XtNameToWidget (Toplevel, "*drawingarea");
  1077. X      if (x+1 < WindowIndex) {
  1078. X        cnt = 0;
  1079. X        XtSetArg(args[cnt], XtNfromVert, 
  1080. X                 (x) ? Windows[x-1].button : NULL); cnt++;
  1081. X        XtSetValues(Windows[x+1].button, args, cnt);
  1082. X        cnt = 0;
  1083. X        XtSetArg(args[cnt], XtNfromVert, 
  1084. X                 (x) ? Windows[x-1].text : NULL);   cnt++;
  1085. X        XtSetValues(Windows[x+1].text, args, cnt);
  1086. X
  1087. X        length = sizeof(Windows_t) * (WindowIndex-x-1);
  1088. X        bcopy(&Windows[x+1], &Windows[x], length);
  1089. X      }
  1090. X      WindowIndex--;
  1091. X      XtUnmanageChild(frame);
  1092. X      XtManageChild(frame);
  1093. X      break;
  1094. X    }
  1095. X  }
  1096. }
  1097. X
  1098. void
  1099. keyboardCB (w, client_data, event)
  1100. Widget w;
  1101. caddr_t  client_data;
  1102. XXKeyEvent *event;
  1103. X
  1104. {
  1105. X  int x;
  1106. X
  1107. X  /* send the keys to every active window that's been selected */
  1108. X  for (x = 0; x < WindowIndex; x++)
  1109. X    {
  1110. X      if (Windows[x].active == 1)
  1111. X    {
  1112. X      event->window = Windows[x].wind;
  1113. X      XSendEvent(XtDisplay(w), Windows[x].wind, True, KeyPressMask, event);
  1114. X    }
  1115. X    }
  1116. X  return;
  1117. }
  1118. X
  1119. void
  1120. stringinputCB (w, index, event)
  1121. Widget w;
  1122. int  index;
  1123. XXKeyEvent *event;
  1124. X
  1125. {
  1126. X  if (Windows[index].eventindex == MAXEVENTS) {
  1127. X    /* if we've reached the max, just beep and return */
  1128. X    XBell(XtDisplay(w), 0);
  1129. X    return;
  1130. X  }
  1131. X
  1132. X  /* save each key event for that window and bump up the counter */
  1133. X  bcopy (event, 
  1134. X     &Windows[index].events[Windows[index].eventindex], 
  1135. X     sizeof (XKeyEvent));
  1136. X
  1137. X  Windows[index].events[Windows[index].eventindex].window 
  1138. X    = Windows[index].wind;
  1139. X  Windows[index].eventindex++;
  1140. X  
  1141. }
  1142. X
  1143. void
  1144. togglestringCB (w, index, event)
  1145. Widget w;
  1146. int  index;
  1147. XXButtonEvent *event;
  1148. X
  1149. {
  1150. X  Arg args[10];
  1151. X  int cnt ;
  1152. X  char text[500];
  1153. X
  1154. X  /* clear the text widget if button 1 was pressed */
  1155. X  if (event->button == 1) {
  1156. X    Windows[index].eventindex = 0;
  1157. X    cnt = 0;
  1158. X    XtSetArg(args[cnt], XtNstring, "");    cnt++;
  1159. X    XtSetValues(w, args, cnt);
  1160. X  }
  1161. X  return;
  1162. }
  1163. X
  1164. void
  1165. toggleCB (w, windex, state)
  1166. Widget w;
  1167. int  windex;
  1168. int  state;
  1169. X
  1170. {
  1171. X  Windows[windex].active = state;
  1172. X  return;
  1173. }
  1174. X
  1175. void 
  1176. senditCB (w, client_data, call_data)
  1177. Widget w;        /* unused */
  1178. caddr_t  client_data;    /* unused */
  1179. caddr_t  call_data;    /* unused */
  1180. X
  1181. {
  1182. X  int x, y;
  1183. X
  1184. X  for (x = 0; x < WindowIndex; x++) {
  1185. X    if (Windows[x].active == 1) {
  1186. X      for (y = 0; y < Windows[x].eventindex; y++) {
  1187. X    XSendEvent(XtDisplay(w), Windows[x].wind, True, 
  1188. X           KeyPressMask, &Windows[x].events[y]);
  1189. X      }
  1190. X    }
  1191. X  }
  1192. X  return;
  1193. }
  1194. X
  1195. void 
  1196. quitCB (w, client_data, call_data)
  1197. Widget w;        /* unused */
  1198. caddr_t  client_data;    /* unused */
  1199. caddr_t  call_data;    /* unused */
  1200. X
  1201. {
  1202. X  exit (0);
  1203. }
  1204. SHAR_EOF
  1205. chmod 0644 xlax.c ||
  1206. echo 'restore of xlax.c failed'
  1207. Wc_c="`wc -c < 'xlax.c'`"
  1208. test 14414 -eq "$Wc_c" ||
  1209.     echo 'xlax.c: original size 14414, current size' "$Wc_c"
  1210. rm -f _shar_wnt_.tmp
  1211. fi
  1212. # ============= patchlevel.h ==============
  1213. if test -f 'patchlevel.h' -a X"$1" != X"-c"; then
  1214.     echo 'x - skipping patchlevel.h (File already exists)'
  1215.     rm -f _shar_wnt_.tmp
  1216. else
  1217. > _shar_wnt_.tmp
  1218. echo 'x - extracting patchlevel.h (Text)'
  1219. sed 's/^X//' << 'SHAR_EOF' > 'patchlevel.h' &&
  1220. #define PATCHLEVEL 0
  1221. SHAR_EOF
  1222. chmod 0644 patchlevel.h ||
  1223. echo 'restore of patchlevel.h failed'
  1224. Wc_c="`wc -c < 'patchlevel.h'`"
  1225. test 21 -eq "$Wc_c" ||
  1226.     echo 'patchlevel.h: original size 21, current size' "$Wc_c"
  1227. rm -f _shar_wnt_.tmp
  1228. fi
  1229. # ============= vroot.h ==============
  1230. if test -f 'vroot.h' -a X"$1" != X"-c"; then
  1231.     echo 'x - skipping vroot.h (File already exists)'
  1232.     rm -f _shar_wnt_.tmp
  1233. else
  1234. > _shar_wnt_.tmp
  1235. echo 'x - extracting vroot.h (Text)'
  1236. sed 's/^X//' << 'SHAR_EOF' > 'vroot.h' &&
  1237. /*****************************************************************************/
  1238. /**                   Copyright 1991 by Andreas Stolcke                     **/
  1239. /**               Copyright 1990 by Solbourne Computer Inc.                 **/
  1240. /**                          Longmont, Colorado                             **/
  1241. /**                                                                         **/
  1242. /**                           All Rights Reserved                           **/
  1243. /**                                                                         **/
  1244. /**    Permission to use, copy, modify, and distribute this software and    **/
  1245. /**    its documentation  for  any  purpose  and  without  fee is hereby    **/
  1246. /**    granted, provided that the above copyright notice appear  in  all    **/
  1247. /**    copies and that both  that  copyright  notice  and  this  permis-    **/
  1248. /**    sion  notice appear in supporting  documentation,  and  that  the    **/
  1249. /**    name of Solbourne not be used in advertising                         **/
  1250. /**    in publicity pertaining to distribution of the  software  without    **/
  1251. /**    specific, written prior permission.                                  **/
  1252. /**                                                                         **/
  1253. /**    ANDREAS STOLCKE AND SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES **/
  1254. /**    WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF    **/
  1255. /**    MERCHANTABILITY  AND  FITNESS,  IN  NO  EVENT SHALL ANDREAS STOLCKE  **/
  1256. /**    OR SOLBOURNE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL    **/
  1257. /**    DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA   **/
  1258. /**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
  1259. /**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
  1260. /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1261. /*****************************************************************************/
  1262. /*
  1263. X * vroot.h -- Virtual Root Window handling header file
  1264. X *
  1265. X * This header file redefines the X11 macros RootWindow and DefaultRootWindow,
  1266. X * making them look for a virtual root window as provided by certain `virtual'
  1267. X * window managers like swm and tvtwm. If none is found, the ordinary root
  1268. X * window is returned, thus retaining backward compatibility with standard
  1269. X * window managers.
  1270. X * The function implementing the virtual root lookup remembers the result of
  1271. X * its last invocation to avoid overhead in the case of repeated calls
  1272. X * on the same display and screen arguments. 
  1273. X * The lookup code itself is taken from Tom LaStrange's ssetroot program.
  1274. X *
  1275. X * Most simple root window changing X programs can be converted to using
  1276. X * virtual roots by just including
  1277. X *
  1278. X * #include <X11/vroot.h>
  1279. X *
  1280. X * after all the X11 header files.  It has been tested on such popular
  1281. X * X clients as xphoon, xfroot, xloadimage, and xaqua.
  1282. X * It also works with the core clients xprop, xwininfo, xwd, and editres
  1283. X * (and is necessary to get those clients working under tvtwm).
  1284. X * It does NOT work with xsetroot; get the xsetroot replacement included in
  1285. X * the tvtwm distribution instead.
  1286. X *
  1287. X * Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>, 9/7/90
  1288. X * - replaced all NULL's with properly cast 0's, 5/6/91
  1289. X * - free children list (suggested by Mark Martin <mmm@cetia.fr>), 5/16/91
  1290. X * - include X11/Xlib.h and support RootWindowOfScreen, too 9/17/91
  1291. X */
  1292. X
  1293. #ifndef _VROOT_H_
  1294. #define _VROOT_H_
  1295. X
  1296. #if !defined(lint) && !defined(SABER)
  1297. static char vroot_rcsid[] = "$Id: vroot.h,v 1.1 92/02/25 11:41:45 frank Exp $";
  1298. #endif
  1299. X
  1300. #include <X11/X.h>
  1301. #include <X11/Xatom.h>
  1302. #include <X11/Xlib.h>
  1303. X
  1304. static Window
  1305. VirtualRootWindowOfScreen(screen)
  1306. X    Screen *screen;
  1307. {
  1308. X    static Screen *save_screen = (Screen *)0;
  1309. X    static Window root = (Window)0;
  1310. X
  1311. X    if (screen != save_screen) {
  1312. X        Display *dpy = DisplayOfScreen(screen);
  1313. X        Atom __SWM_VROOT = None;
  1314. X        int i;
  1315. X        Window rootReturn, parentReturn, *children;
  1316. X        unsigned int numChildren;
  1317. X
  1318. X        root = RootWindowOfScreen(screen);
  1319. X
  1320. X        /* go look for a virtual root */
  1321. X        __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
  1322. X        if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
  1323. X                 &children, &numChildren)) {
  1324. X            for (i = 0; i < numChildren; i++) {
  1325. X                Atom actual_type;
  1326. X                int actual_format;
  1327. X                unsigned long nitems, bytesafter;
  1328. X                Window *newRoot = (Window *)0;
  1329. X
  1330. X                if (XGetWindowProperty(dpy, children[i],
  1331. X                    __SWM_VROOT, 0, 1, False, XA_WINDOW,
  1332. X                    &actual_type, &actual_format,
  1333. X                    &nitems, &bytesafter,
  1334. X                    (unsigned char **) &newRoot) == Success
  1335. X                    && newRoot) {
  1336. X                    root = *newRoot;
  1337. X                    break;
  1338. X                }
  1339. X            }
  1340. X            if (children)
  1341. X                XFree((char *)children);
  1342. X        }
  1343. X
  1344. X        save_screen = screen;
  1345. X    }
  1346. X
  1347. X    return root;
  1348. }
  1349. X
  1350. #undef RootWindowOfScreen
  1351. #define RootWindowOfScreen(s) VirtualRootWindowOfScreen(s)
  1352. X
  1353. #undef RootWindow
  1354. #define RootWindow(dpy,screen) VirtualRootWindowOfScreen(ScreenOfDisplay(dpy,screen))
  1355. X
  1356. #undef DefaultRootWindow
  1357. #define DefaultRootWindow(dpy) VirtualRootWindowOfScreen(DefaultScreenOfDisplay(dpy))
  1358. X
  1359. #endif /* _VROOT_H_ */
  1360. SHAR_EOF
  1361. chmod 0644 vroot.h ||
  1362. echo 'restore of vroot.h failed'
  1363. Wc_c="`wc -c < 'vroot.h'`"
  1364. test 5056 -eq "$Wc_c" ||
  1365.     echo 'vroot.h: original size 5056, current size' "$Wc_c"
  1366. rm -f _shar_wnt_.tmp
  1367. fi
  1368. exit 0
  1369. -- 
  1370. --
  1371. Molecular Simulations, Inc.            mail: dcmartin@msi.com
  1372. 796 N. Pastoria Avenue                uucp: uunet!dcmartin
  1373. Sunnyvale, California 94086            at&t: 408/522-9236
  1374.