home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume5 / dwim / part01 next >
Encoding:
Internet Message Format  |  1993-04-28  |  43.8 KB

  1. From: kent@ssbell.IMD.Sterling.COM (Kent Landfield)
  2. Newsgroups: comp.sources.x
  3. Subject: v05i066: dwim (Do What I Mean) patch for X11R4 TWM, Part01/01
  4. Message-ID: <647@ssbell.IMD.Sterling.COM>
  5. Date: 4 Feb 90 08:04:18 GMT
  6. Approved: kent@ssbell.IMD.Sterling.COM (Kent Landfield)
  7.  
  8. Submitted-by: uunet!helios.TN.CORNELL.EDU!davidra
  9. Posting-number: Volume 5, Issue 66
  10. Archive-name: dwim/part01
  11.  
  12.  
  13. Here is the DWIM patch to TWM for X11R4; it requires the X11R4 distribution 
  14. twm source and the well-known "patch" program.
  15.  
  16. DWIM is an unofficial patch to TWM that seeks to make mice impotent and
  17. obsolete (to quote a former president).  It does the following awful things
  18. to the "tab" ("Tom's") window manager:
  19.  
  20.     * xterm titles become numbers
  21.     * it uses a .dwimrc* file instead of .twmrc*
  22.     * if set up correctly (control-digit must be bound to f.nop), dwim
  23.       lets the user go from one window to another by hitting control-digit.
  24.       (For instance, control-4 causes the mouse to warp to near the upper
  25.       right-hand corner of window 4, moves the focus to window 4, and
  26.       raises window 4).
  27.     * it draws fewer box outlines in the icon manager
  28.     * it can generate artificial mouse button events.  Unfortunately, it
  29.       seems that almost all clients ignore artificial mouse button events.
  30.       I know of one client on which these events work: xplot.  Because
  31.       this may not work on other clients, I have documented this feature
  32.       only in the source code.
  33.  
  34.  
  35. Note that the old dwim (X11R3) works perfectly well on an X11R4 server and
  36. vice versa.  (There may be one problem, but it's in the server, not
  37. twm/dwim -- black and white are reversed on BorderColor for a monochrome
  38. display).
  39.  
  40. Note one bug fix in TWM X11R4 that of course carries over to DWIM: previously,
  41. to bind a key or mouse button with two modifiers, one gave the two modifier
  42. characters without a vertical bar between them:
  43.  
  44.     "f" = cm : window : f.dwimpress "right"
  45.  
  46. Now, the vertical bar is required syntax:
  47.  
  48.     "f" = c|m : window : f.dwimpress "right"
  49.  
  50.  
  51. Compilation note: people with antsy compilers may have to use -traditional
  52. (see the Makefile and Imakefile).
  53.  
  54. David Rabson
  55. davidra@helios.tn.cornell.edu
  56. Laboratory of Atomic and Solid State Physics, Cornell University
  57.  
  58. -----------------------------------------------------------------------------
  59. #! /bin/sh
  60. # This is a shell archive.  Remove anything before this line, then unpack
  61. # it by saving it into a file and typing "sh file".  To overwrite existing
  62. # files, type "sh file -c".  You can also feed this as standard input via
  63. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  64. # will see the following message at the end:
  65. #        "End of shell archive."
  66. # Contents:  dwim.patch
  67. # Wrapped by kent@ssbell on Sun Feb  4 01:56:59 1990
  68. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  69. if test -f 'dwim.patch' -a "${1}" != "-c" ; then 
  70.   echo shar: Will not clobber existing file \"'dwim.patch'\"
  71. else
  72. echo shar: Extracting \"'dwim.patch'\" \(40231 characters\)
  73. sed "s/^X//" >'dwim.patch' <<'END_OF_FILE'
  74. Xdiff -c twm/Imakefile dwim/Imakefile
  75. X*** twm/Imakefile    Thu Jan 18 12:51:00 1990
  76. X--- dwim/Imakefile    Sat Jan  6 01:47:33 1990
  77. X***************
  78. X*** 1,5 ****
  79. X  /**/#
  80. X! /**/#Here is an Imakefile for twm.  It depends on having TWMDIR defined
  81. X  /**/#in Imake.tmpl.  I like to use Imakefiles for everything, and I am sure
  82. X  /**/#other people do also, so perhaps you could do us all a favor and
  83. X  /**/#distribute this one.
  84. X--- 1,7 ----
  85. X+ /**/# DWIM MODIFICATIONS David Rabson 1/90
  86. X+ 
  87. X  /**/#
  88. X! /**/#Here is an Imakefile for dwim.  It depends on having TWMDIR defined
  89. X  /**/#in Imake.tmpl.  I like to use Imakefiles for everything, and I am sure
  90. X  /**/#other people do also, so perhaps you could do us all a favor and
  91. X  /**/#distribute this one.
  92. X***************
  93. X*** 9,14 ****
  94. X--- 11,18 ----
  95. X  #if !HasPutenv
  96. X        PUTENVDEF = -DNOPUTENV
  97. X  #endif
  98. X+              CC = gcc
  99. X+       CCOPTIONS = -O -finline-functions
  100. X  
  101. X           YFLAGS = -d
  102. X          DEPLIBS = $(DEPXMULIB) $(DEPEXTENSIONLIB) $(DEPXLIB)
  103. X***************
  104. X*** 18,34 ****
  105. X  
  106. X             SRCS = gram.c lex.c deftwmrc.c add_window.c gc.c list.c twm.c \
  107. X          parse.c menus.c events.c resize.c util.c version.c iconmgr.c \
  108. X!         cursor.c icons.c
  109. X  
  110. X             OBJS = gram.o lex.o deftwmrc.o add_window.o gc.o list.o twm.o \
  111. X          parse.o menus.o events.o resize.o util.o version.o iconmgr.o \
  112. X!         cursor.o icons.o
  113. X  
  114. X! AllTarget(twm)
  115. X  
  116. X  depend:: lex.c gram.c deftwmrc.c 
  117. X  
  118. X! ComplexProgramTarget(twm)
  119. X  
  120. X  gram.h gram.c: gram.y
  121. X      yacc $(YFLAGS) gram.y
  122. X--- 22,38 ----
  123. X  
  124. X             SRCS = gram.c lex.c deftwmrc.c add_window.c gc.c list.c twm.c \
  125. X          parse.c menus.c events.c resize.c util.c version.c iconmgr.c \
  126. X!         cursor.c icons.c dwim.c
  127. X  
  128. X             OBJS = gram.o lex.o deftwmrc.o add_window.o gc.o list.o twm.o \
  129. X          parse.o menus.o events.o resize.o util.o version.o iconmgr.o \
  130. X!         cursor.o icons.o dwim.o
  131. X  
  132. X! AllTarget(dwim)
  133. X  
  134. X  depend:: lex.c gram.c deftwmrc.c 
  135. X  
  136. X! ComplexProgramTarget(dwim)
  137. X  
  138. X  gram.h gram.c: gram.y
  139. X      yacc $(YFLAGS) gram.y
  140. X***************
  141. X*** 38,52 ****
  142. X  clean::
  143. X      $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c 
  144. X  
  145. X! deftwmrc.c:  system.twmrc
  146. X!     $(RM) $@
  147. X!     echo '/* ' >>$@
  148. X!     echo ' * This file is generated automatically from the default' >>$@
  149. X!     echo ' * twm bindings file system.twmrc by the twm Imakefile.' >>$@
  150. X!     echo ' */' >>$@
  151. X!     echo '' >>$@
  152. X!     echo 'char *defTwmrc[] = {' >>$@
  153. X!     sed -e '/^#/d' -e 's/"/\\"/g' -e 's/^/    "/' -e 's/$$/",/' \
  154. X!         system.twmrc >>$@
  155. X!     echo '    (char *) 0 };' >>$@
  156. X  
  157. X--- 42,59 ----
  158. X  clean::
  159. X      $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c 
  160. X  
  161. X! dwim.o: dwim.c
  162. X!     $(CC) $(CFLAGS) -traditional -c dwim.c
  163. X  
  164. X+ /**/#deftwmrc.c:  system.twmrc
  165. X+ #    $(RM) $@
  166. X+ #    echo '/* ' >>$@
  167. X+ #    echo ' * This file is generated automatically from the default' >>$@
  168. X+ #    echo ' * twm bindings file system.twmrc by the twm Imakefile.' >>$@
  169. X+ #    echo ' */' >>$@
  170. X+ #    echo '' >>$@
  171. X+ #    echo 'char *defTwmrc[] = {' >>$@
  172. X+ #    sed -e '/^#/d' -e 's/"/\\"/g' -e 's/^/    "/' -e 's/$$/",/' \
  173. X+ #        system.twmrc >>$@
  174. X+ #    echo '    (char *) 0 };' >>$@
  175. X+ #
  176. Xdiff -c twm/Makefile dwim/Makefile
  177. X*** twm/Makefile    Thu Jan 18 12:50:55 1990
  178. X--- dwim/Makefile    Sat Jan  6 01:15:29 1990
  179. X***************
  180. X*** 7,13 ****
  181. X  #
  182. X  
  183. X  ###########################################################################
  184. X! # Makefile generated from "Imake.tmpl" and <Imakefile>
  185. X  # $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
  186. X  #
  187. X  # Platform-specific parameters may be set in the appropriate .cf
  188. X--- 7,13 ----
  189. X  #
  190. X  
  191. X  ###########################################################################
  192. X! # Makefile generated from "Imake.tmpl" and </tmp/IIf.a13037>
  193. X  # $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
  194. X  #
  195. X  # Platform-specific parameters may be set in the appropriate .cf
  196. X***************
  197. X*** 27,33 ****
  198. X  # platform-specific configuration parameters - edit sun.cf to change
  199. X  
  200. X  # platform:  $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $
  201. X! # operating system:   SunOS 3.5
  202. X  
  203. X  ###########################################################################
  204. X  # site-specific configuration parameters - edit site.def to change
  205. X--- 27,33 ----
  206. X  # platform-specific configuration parameters - edit sun.cf to change
  207. X  
  208. X  # platform:  $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $
  209. X! # operating system:  SunOS 3.5
  210. X  
  211. X  ###########################################################################
  212. X  # site-specific configuration parameters - edit site.def to change
  213. X***************
  214. X*** 34,51 ****
  215. X  
  216. X  # site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
  217. X  
  218. X!             SHELL =  /bin/sh
  219. X  
  220. X!               TOP = ../../.
  221. X        CURRENT_DIR = ./clients/twm
  222. X  
  223. X                 AR = ar cq
  224. X    BOOTSTRAPCFLAGS =
  225. X!                CC = gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -finline-functions
  226. X  
  227. X           COMPRESS = compress
  228. X                CPP = /lib/cpp $(STD_CPP_DEFINES)
  229. X!     PREPROCESSCMD = gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -finline-functions -E $(STD_CPP_DEFINES)
  230. X            INSTALL = install
  231. X                 LD = ld
  232. X               LINT = lint
  233. X--- 34,51 ----
  234. X  
  235. X  # site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
  236. X  
  237. X!             SHELL = /bin/sh
  238. X  
  239. X!               TOP = /u4/arthur/XR4
  240. X        CURRENT_DIR = ./clients/twm
  241. X  
  242. X                 AR = ar cq
  243. X    BOOTSTRAPCFLAGS =
  244. X!                CC = gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -fwritable-strings -traditional
  245. X  
  246. X           COMPRESS = compress
  247. X                CPP = /lib/cpp $(STD_CPP_DEFINES)
  248. X!     PREPROCESSCMD = gcc -DNOSTDHDRS -fstrength-reduce -fpcc-struct-return -fwritable-strings -traditional -E $(STD_CPP_DEFINES)
  249. X            INSTALL = install
  250. X                 LD = ld
  251. X               LINT = lint
  252. X***************
  253. X*** 81,87 ****
  254. X  
  255. X            DESTDIR =
  256. X  
  257. X!      TOP_INCLUDES = -I$(TOP)
  258. X  
  259. X        CDEBUGFLAGS = -O
  260. X          CCOPTIONS =
  261. X--- 81,87 ----
  262. X  
  263. X            DESTDIR =
  264. X  
  265. X!      TOP_INCLUDES = -I$(INCROOT)
  266. X  
  267. X        CDEBUGFLAGS = -O
  268. X          CCOPTIONS =
  269. X***************
  270. X*** 100,107 ****
  271. X  
  272. X      IMAKE_DEFINES =
  273. X  
  274. X!          IRULESRC = $(CONFIGSRC)
  275. X!         IMAKE_CMD = $(NEWTOP)$(IMAKE) -I$(NEWTOP)$(IRULESRC) $(IMAKE_DEFINES)
  276. X  
  277. X       ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  278. X              $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  279. X--- 100,107 ----
  280. X  
  281. X      IMAKE_DEFINES =
  282. X  
  283. X!          IRULESRC = $(CONFIGDIR)
  284. X!         IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  285. X  
  286. X       ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  287. X              $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  288. X***************
  289. X*** 117,123 ****
  290. X  
  291. X            PATHSEP = /
  292. X          USRLIBDIR = /usr/contrib/lib/libX
  293. X!            BINDIR = /usr/contrib/bin/X11R4
  294. X            INCROOT = /usr/contrib/lib/include
  295. X       BUILDINCROOT = $(TOP)
  296. X        BUILDINCDIR = $(BUILDINCROOT)/X11
  297. X--- 117,123 ----
  298. X  
  299. X            PATHSEP = /
  300. X          USRLIBDIR = /usr/contrib/lib/libX
  301. X!            BINDIR = /usr/contrib/bin/X11
  302. X            INCROOT = /usr/contrib/lib/include
  303. X       BUILDINCROOT = $(TOP)
  304. X        BUILDINCDIR = $(BUILDINCROOT)/X11
  305. X***************
  306. X*** 144,155 ****
  307. X  
  308. X       INSTAPPFLAGS = $(INSTDATFLAGS)
  309. X  
  310. X!             IMAKE = $(IMAKESRC)/imake
  311. X!            DEPEND = $(DEPENDSRC)/makedepend
  312. X!               RGB = $(RGBSRC)/rgb
  313. X!             FONTC = $(BDFTOSNFSRC)/bdftosnf
  314. X!         MKFONTDIR = $(MKFONTDIRSRC)/mkfontdir
  315. X!         MKDIRHIER =  /bin/sh $(SCRIPTSRC)/mkdirhier.sh
  316. X  
  317. X          CONFIGSRC = $(TOP)/config
  318. X          CLIENTSRC = $(TOP)/clients
  319. X--- 144,155 ----
  320. X  
  321. X       INSTAPPFLAGS = $(INSTDATFLAGS)
  322. X  
  323. X!             IMAKE = imake
  324. X!            DEPEND = makedepend
  325. X!               RGB = rgb
  326. X!             FONTC = bdftosnf
  327. X!         MKFONTDIR = mkfontdir
  328. X!         MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh
  329. X  
  330. X          CONFIGSRC = $(TOP)/config
  331. X          CLIENTSRC = $(TOP)/clients
  332. X***************
  333. X*** 177,208 ****
  334. X       MKFONTDIRSRC = $(FONTSRC)/mkfontdir
  335. X       EXTENSIONSRC = $(TOP)/extensions
  336. X  
  337. X!   DEPEXTENSIONLIB =  $(EXTENSIONSRC)/lib/libXext.a
  338. X!      EXTENSIONLIB =    $(DEPEXTENSIONLIB)
  339. X  
  340. X!           DEPXLIB = $(DEPEXTENSIONLIB)  $(XLIBSRC)/libX11.a
  341. X!              XLIB = $(EXTENSIONLIB)   $(XLIBSRC)/libX11.a
  342. X  
  343. X!       DEPXAUTHLIB =  $(XAUTHSRC)/libXau.a
  344. X!          XAUTHLIB =   $(DEPXAUTHLIB)
  345. X  
  346. X!         DEPXMULIB =  $(XMUSRC)/libXmu.a
  347. X!            XMULIB =   $(DEPXMULIB)
  348. X  
  349. X!        DEPOLDXLIB =  $(OLDXLIBSRC)/liboldX.a
  350. X!           OLDXLIB =   $(DEPOLDXLIB)
  351. X  
  352. X!       DEPXTOOLLIB =  $(TOOLKITSRC)/libXt.a
  353. X!          XTOOLLIB =   $(DEPXTOOLLIB)
  354. X  
  355. X!         DEPXAWLIB =  $(AWIDGETSRC)/libXaw.a
  356. X!            XAWLIB =   $(DEPXAWLIB)
  357. X  
  358. X!  LINTEXTENSIONLIB =  $(EXTENSIONSRC)/lib/llib-lXext.ln
  359. X!          LINTXLIB =  $(XLIBSRC)/llib-lX11.ln
  360. X!           LINTXMU =  $(XMUSRC)/llib-lXmu.ln
  361. X!         LINTXTOOL =  $(TOOLKITSRC)/llib-lXt.ln
  362. X!           LINTXAW =  $(AWIDGETSRC)/llib-lXaw.ln
  363. X  
  364. X            DEPLIBS = $(LOCAL_LIBRARIES)
  365. X  
  366. X--- 177,208 ----
  367. X       MKFONTDIRSRC = $(FONTSRC)/mkfontdir
  368. X       EXTENSIONSRC = $(TOP)/extensions
  369. X  
  370. X!   DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
  371. X!      EXTENSIONLIB =  -lXext
  372. X  
  373. X!           DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a
  374. X!              XLIB = $(EXTENSIONLIB)  -lX11
  375. X  
  376. X!       DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  377. X!          XAUTHLIB =  -lXau
  378. X  
  379. X!         DEPXMULIB = $(USRLIBDIR)/libXmu.a
  380. X!            XMULIB =  -lXmu
  381. X  
  382. X!        DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
  383. X!           OLDXLIB =  -loldX
  384. X  
  385. X!       DEPXTOOLLIB = $(USRLIBDIR)/libXt.a
  386. X!          XTOOLLIB =  -lXt
  387. X  
  388. X!         DEPXAWLIB = $(USRLIBDIR)/libXaw.a
  389. X!            XAWLIB =  -lXaw
  390. X  
  391. X!  LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln
  392. X!          LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
  393. X!           LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
  394. X!         LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
  395. X!           LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
  396. X  
  397. X            DEPLIBS = $(LOCAL_LIBRARIES)
  398. X  
  399. X***************
  400. X*** 217,229 ****
  401. X  ###########################################################################
  402. X  # start of Imakefile
  403. X  
  404. X  #
  405. X! #Here is an Imakefile for twm.  It depends on having TWMDIR defined
  406. X  #in Imake.tmpl.  I like to use Imakefiles for everything, and I am sure
  407. X  #other people do also, so perhaps you could do us all a favor and
  408. X  #distribute this one.
  409. X  #
  410. X  
  411. X           YFLAGS = -d
  412. X          DEPLIBS = $(DEPXMULIB) $(DEPEXTENSIONLIB) $(DEPXLIB)
  413. X  LOCAL_LIBRARIES = $(XMULIB) $(EXTENSIONLIB) $(XLIB)
  414. X--- 217,234 ----
  415. X  ###########################################################################
  416. X  # start of Imakefile
  417. X  
  418. X+ # DWIM MODIFICATIONS David Rabson 1/90
  419. X+ 
  420. X  #
  421. X! #Here is an Imakefile for dwim.  It depends on having TWMDIR defined
  422. X  #in Imake.tmpl.  I like to use Imakefiles for everything, and I am sure
  423. X  #other people do also, so perhaps you could do us all a favor and
  424. X  #distribute this one.
  425. X  #
  426. X  
  427. X+     CC = gcc
  428. X+     CCOPTIONS = -O -finline-functions
  429. X+ 
  430. X           YFLAGS = -d
  431. X          DEPLIBS = $(DEPXMULIB) $(DEPEXTENSIONLIB) $(DEPXLIB)
  432. X  LOCAL_LIBRARIES = $(XMULIB) $(EXTENSIONLIB) $(XLIB)
  433. X***************
  434. X*** 232,268 ****
  435. X  
  436. X             SRCS = gram.c lex.c deftwmrc.c add_window.c gc.c list.c twm.c \
  437. X          parse.c menus.c events.c resize.c util.c version.c iconmgr.c \
  438. X!         cursor.c icons.c
  439. X  
  440. X             OBJS = gram.o lex.o deftwmrc.o add_window.o gc.o list.o twm.o \
  441. X          parse.o menus.o events.o resize.o util.o version.o iconmgr.o \
  442. X!         cursor.o icons.o
  443. X  
  444. X! all:: twm
  445. X  
  446. X  depend:: lex.c gram.c deftwmrc.c
  447. X  
  448. X!  PROGRAM = twm
  449. X  
  450. X! all:: twm
  451. X  
  452. X! twm: $(OBJS) $(DEPLIBS)
  453. X!      $(RM) $@
  454. X      $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
  455. X  
  456. X! install:: twm
  457. X!     $(INSTALL) -c $(INSTPGMFLAGS)   twm $(BINDIR)
  458. X  
  459. X! install.man:: twm.man
  460. X!     $(INSTALL) -c $(INSTMANFLAGS) twm.man $(MANDIR)/twm.n
  461. X  
  462. X- depend:: $(DEPEND)
  463. X- 
  464. X- $(DEPEND):
  465. X-     @echo "checking $@ over in $(DEPENDSRC) first..."; \
  466. X-     cd $(DEPENDSRC); $(MAKE); \
  467. X-     echo "okay, continuing in $(CURRENT_DIR)"
  468. X- 
  469. X  depend::
  470. X      $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  471. X  
  472. X--- 237,266 ----
  473. X  
  474. X             SRCS = gram.c lex.c deftwmrc.c add_window.c gc.c list.c twm.c \
  475. X          parse.c menus.c events.c resize.c util.c version.c iconmgr.c \
  476. X!         cursor.c icons.c dwim.c
  477. X  
  478. X             OBJS = gram.o lex.o deftwmrc.o add_window.o gc.o list.o twm.o \
  479. X          parse.o menus.o events.o resize.o util.o version.o iconmgr.o \
  480. X!         cursor.o icons.o dwim.o
  481. X  
  482. X! all:: dwim
  483. X  
  484. X  depend:: lex.c gram.c deftwmrc.c
  485. X  
  486. X!  PROGRAM = dwim
  487. X  
  488. X! all:: dwim
  489. X  
  490. X! dwim: $(OBJS) $(DEPLIBS)
  491. X!     $(RM) $@
  492. X      $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
  493. X  
  494. X! install:: dwim
  495. X!     $(INSTALL) -c $(INSTPGMFLAGS)   dwim $(BINDIR)
  496. X  
  497. X! install.man:: dwim.man
  498. X!     $(INSTALL) -c $(INSTMANFLAGS) dwim.man $(MANDIR)/dwim.n
  499. X  
  500. X  depend::
  501. X      $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  502. X  
  503. X***************
  504. X*** 282,299 ****
  505. X  clean::
  506. X      $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c
  507. X  
  508. X! deftwmrc.c:  system.twmrc
  509. X!     $(RM) $@
  510. X!     echo '/* ' >>$@
  511. X!     echo ' * This file is generated automatically from the default' >>$@
  512. X!     echo ' * twm bindings file system.twmrc by the twm Imakefile.' >>$@
  513. X!     echo ' */' >>$@
  514. X!     echo '' >>$@
  515. X!     echo 'char *defTwmrc[] = {' >>$@
  516. X!     sed -e '/^#/d' -e 's/"/\\"/g' -e 's/^/    "/' -e 's/$$/",/' \
  517. X!         system.twmrc >>$@
  518. X!     echo '    (char *) 0 };' >>$@
  519. X  
  520. X  ###########################################################################
  521. X  # common rules for all Makefiles - do not edit
  522. X  
  523. X--- 280,301 ----
  524. X  clean::
  525. X      $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c
  526. X  
  527. X! dwim.o: dwim.c
  528. X!     $(CC) $(CFLAGS) -traditional -c dwim.c
  529. X  
  530. X+ #deftwmrc.c:  system.twmrc
  531. X+ #    $(RM) $@
  532. X+ #    echo '/* ' >>$@
  533. X+ #    echo ' * This file is generated automatically from the default' >>$@
  534. X+ #    echo ' * twm bindings file system.twmrc by the twm Imakefile.' >>$@
  535. X+ #    echo ' */' >>$@
  536. X+ #    echo '' >>$@
  537. X+ #    echo 'char *defTwmrc[] = {' >>$@
  538. X+ #    sed -e '/^#/d' -e 's/"/\\"/g' -e 's/^/    "/' -e 's/$$/",/' \
  539. X+ #        system.twmrc >>$@
  540. X+ #    echo '    (char *) 0 };' >>$@
  541. X+ #
  542. X+ 
  543. X  ###########################################################################
  544. X  # common rules for all Makefiles - do not edit
  545. X  
  546. X***************
  547. X*** 301,315 ****
  548. X  
  549. X  clean::
  550. X      $(RM_CMD) \#*
  551. X- 
  552. X- Makefile:: $(IMAKE)
  553. X- 
  554. X- $(IMAKE):
  555. X-     @(cd $(IMAKESRC); if [ -f Makefile ]; then \
  556. X-     echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \
  557. X-     echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \
  558. X-     $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS); fi; \
  559. X-     echo "okay, continuing in $(CURRENT_DIR)")
  560. X  
  561. X  Makefile::
  562. X      -@if [ -f Makefile ]; then \
  563. X--- 303,308 ----
  564. XOnly in dwim: SUN3
  565. Xdiff -c twm/add_window.c dwim/add_window.c
  566. X*** twm/add_window.c    Thu Jan 18 12:51:06 1990
  567. X--- dwim/add_window.c    Sat Jan  6 01:33:06 1990
  568. X***************
  569. X*** 25,30 ****
  570. X--- 25,31 ----
  571. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  572. X  /*****************************************************************************/
  573. X  
  574. X+ /* DWIM modifications David Rabson 6/89, 1/90 */
  575. X  
  576. X  /**********************************************************************
  577. X   *
  578. X***************
  579. X*** 213,218 ****
  580. X--- 214,229 ----
  581. X        tmp_win->attr.x != 0 || tmp_win->attr.y != 0)))
  582. X        ask_user = FALSE;
  583. X  
  584. X+ /* BEGIN DWIM */
  585. X+     if(dwim_set)    {
  586. X+     /* titles become numbers in dwim */
  587. X+     dwim_setname(&tmp_win->name, tmp_win);
  588. X+     tmp_win->icon_name = tmp_win->name;
  589. X+     XStoreName(dpy, tmp_win->w, tmp_win->name);
  590. X+     XStoreName(dpy, tmp_win->icon_w, tmp_win->icon_name);
  591. X+     }
  592. X+ /* END DWIM */
  593. X+ 
  594. X      if (tmp_win->name == NULL)
  595. X      tmp_win->name = NoName;
  596. X      if (tmp_win->class.res_name == NULL)
  597. X***************
  598. X*** 560,565 ****
  599. X--- 571,580 ----
  600. X      if (XGetWindowProperty (dpy, tmp_win->w, XA_WM_ICON_NAME, 0L, 200L, False,
  601. X                  XA_STRING, &actual_type, &actual_format, &nitems,
  602. X                  &bytesafter,(unsigned char **)&tmp_win->icon_name))
  603. X+     tmp_win->icon_name = tmp_win->name;
  604. X+ 
  605. X+ /* DWIM: undo the resetting of the icon_name the above just did */
  606. X+     if(dwim_set)
  607. X      tmp_win->icon_name = tmp_win->name;
  608. X  
  609. X      if (tmp_win->icon_name == NULL)
  610. XOnly in dwim: dwim
  611. Xdiff -c twm/dwim.c dwim/dwim.c
  612. X*** twm/dwim.c    Thu Jan 18 12:54:09 1990
  613. X--- dwim/dwim.c    Sat Jan  6 00:01:49 1990
  614. X***************
  615. X*** 0 ****
  616. X--- 1,400 ----
  617. X+ /* dwim.c
  618. X+  *
  619. X+  * functions added to twm
  620. X+  *
  621. X+  * dwim_setname(sp, tw)
  622. X+  * char **sp;
  623. X+  * Window w, wf;
  624. X+  *
  625. X+  * Stuff sp with the name (number) of a new window and notes a new window's
  626. X+  * creation.  Wf is the window frame (which seems to be necessary to raise
  627. X+  * a window).
  628. X+  *
  629. X+  *
  630. X+  * dwim_demise(s)
  631. X+  * char *s;
  632. X+  *
  633. X+  * Note the demise of a window named s.  If !atoi(s), dwim ignores this.
  634. X+  *
  635. X+  *
  636. X+  * dwim_command()
  637. X+  *
  638. X+  * Grab the keyboard for a one-character command.  Execute it.
  639. X+  *
  640. X+  *
  641. X+  * dwim_press(pressq,action)
  642. X+  * char pressq;                1=press, 0=release
  643. X+  * char *action;
  644. X+  *
  645. X+  * do something according to "action" -- right now, the strings
  646. X+  * "left," "right," and "middle" are defined to generate left, right,
  647. X+  * and middle keypress events
  648. X+  *
  649. X+  *
  650. X+  * dwim_intercept(ev)
  651. X+  * XEvent ev;
  652. X+  *
  653. X+  * Intercept a grabbed key stroke and decide what we want to do with it.
  654. X+  * Return 1 if the usual twm keystroke event routine should get it or 0
  655. X+  * if it shouldn't.
  656. X+  *
  657. X+  * dwim_usleep(useconds)
  658. X+  * int useconds;
  659. X+  *
  660. X+  * sleep the given number of microseconds -- may be useful for mouse buttons
  661. X+  *
  662. X+  */
  663. X+ 
  664. X+ #include "twm.h"
  665. X+ #include "screen.h"
  666. X+ #include <stdio.h>
  667. X+ #include <ctype.h>
  668. X+ #define ALLOC(x) (x *)malloc(sizeof(x))
  669. X+ #define NUMMODS    8            /* # of mods in XModifierMap */
  670. X+ 
  671. X+ /* globals (also in twm.h) */
  672. X+ int dwim_set = 1;
  673. X+ 
  674. X+ /* statics */
  675. X+ 
  676. X+ static int grabit=0;    /* are we currently grabbing the keyboard? */
  677. X+ 
  678. X+ struct dwim_wits {        /* used to hold the two important windows */
  679. X+     Window w, wf;
  680. X+     TwmWindow *tw;
  681. X+ };
  682. X+ 
  683. X+ static int dwim_nextnum=1;
  684. X+ 
  685. X+ struct dwim_winlist {    /*list of windows*/
  686. X+     int num;
  687. X+     struct dwim_wits wins;
  688. X+     struct dwim_winlist *next;
  689. X+ } root={0};            /* root will be a fake to make things easier */
  690. X+ 
  691. X+ struct dwim_nlist {    /* list of free window numbers */
  692. X+     int n;
  693. X+     struct dwim_nlist *next;
  694. X+ } nroot={0,0};            /* again, a dummy root */
  695. X+ 
  696. X+ /* table of press/release requests */
  697. X+ void buttonfunc();
  698. X+ static struct prtable {
  699. X+     char *command;        /* when you get this command */
  700. X+     void (*func)();        /* do this */
  701. X+     int iparam;        /* with this parameter */
  702. X+ }prtable[]={
  703. X+     {"left",buttonfunc,1},
  704. X+     {"middle",buttonfunc,2},
  705. X+     {"right",buttonfunc,3},
  706. X+     {0,0,0}
  707. X+ };
  708. X+ 
  709. X+ char *malloc();
  710. X+ 
  711. X+ 
  712. X+ /* Stuff sp with the name of a new window and note the window struct */
  713. X+ dwim_setname(sp,tw)
  714. X+ char **sp;
  715. X+ TwmWindow *tw;
  716. X+ {
  717. X+     char *buffer=malloc(4);    /* 4 is magic */
  718. X+     int num = newnum();
  719. X+ 
  720. X+     if(num < 1 || num > 999)
  721. X+         dwim_err("inconsistency in dwim_setname");
  722. X+ 
  723. X+     sprintf(buffer,"%d",num);
  724. X+     *sp = buffer;                /* stuff it */
  725. X+ 
  726. X+     addwin(num,tw);                /* below */
  727. X+ }
  728. X+ 
  729. X+ /* Note the demise of a window (take it off the list if it's on it) */
  730. X+ dwim_demise(w)
  731. X+ Window w;
  732. X+ {
  733. X+     struct dwim_winlist *node = root.next;
  734. X+     struct dwim_winlist *prev = &root;
  735. X+ 
  736. X+     while(node)    {
  737. X+         if( w == node->wins.w )    {    /* match? */
  738. X+             prev->next = node->next;
  739. X+             addfree(node->num);    /*below--add num to freelist*/
  740. X+             free(node);
  741. X+             break;            /* no need to continue */
  742. X+         }
  743. X+         prev = node;
  744. X+         node = node->next;
  745. X+     }
  746. X+ }
  747. X+ 
  748. X+ /* Grab the keyboard for one keystroke and execute it (shift keys are tricky).
  749. X+  * Since events are asyncronous in X (and I don't know how to get around this),
  750. X+  * the ungrabbing will have to take place in dwim_intercept() below.
  751. X+  *
  752. X+  * I think this is essentially like shifting the focus to the root window.
  753. X+  */
  754. X+ dwim_command()
  755. X+ {
  756. X+     XGrabKeyboard(dpy,
  757. X+         Scr->Root, False, GrabModeAsync, GrabModeAsync, CurrentTime);
  758. X+ 
  759. X+     grabit=1;        /* let dwim_intercept, etc.,  know */
  760. X+ }
  761. X+ 
  762. X+ 
  763. X+ /* generate a keypress or keyrelease event (action to be interpreted) */
  764. X+ dwim_press(pressq, action)
  765. X+ char pressq;            /* 1=press, 0=release */
  766. X+ char *action;
  767. X+ {
  768. X+     struct prtable *t;
  769. X+ 
  770. X+     /* determine what kind of action this is (no abbreviation) */
  771. X+     for(t= prtable; t->command; t++)
  772. X+         if(!strcmp(t->command,action))    {
  773. X+             (*t->func)(pressq,t->iparam);    /* do it */
  774. X+             return;                /* leave */
  775. X+         }
  776. X+ 
  777. X+     /* reach here on unknown code */
  778. X+     fprintf(stderr,
  779. X+         "dwim: unknown dwim press/release command, <%s>\n",action);
  780. X+ }
  781. X+ 
  782. X+ /* do the press/release stuff -- called by dwim_press() above */
  783. X+ static void
  784. X+ buttonfunc(pressq, which)
  785. X+ char pressq;            /* 1=press, 0=release */
  786. X+ /* which tells which button to press or release */
  787. X+ {
  788. X+     XButtonEvent event;
  789. X+     static long buttonmasks[]=
  790. X+         {Button1Mask,Button2Mask,Button3Mask,Button4Mask,Button5Mask};
  791. X+     static long buttons[]=
  792. X+         {Button1,Button2,Button3,Button4,Button5};
  793. X+     Window focus;
  794. X+ 
  795. X+     /* get the focus window (into focus) */
  796. X+     {
  797. X+         int junk;
  798. X+         XGetInputFocus(dpy,&focus,&junk);
  799. X+     }
  800. X+ 
  801. X+     /* set up the event */
  802. X+     event.type  = pressq?ButtonPress:ButtonRelease;
  803. X+     event.state = buttonmasks[which-1];
  804. X+     event.button= buttons[which-1];
  805. X+     event.window = focus;            /* this IS necessary */
  806. X+ 
  807. X+     /* send the event */
  808. X+     if(!XSendEvent(dpy, focus, True, -1, &event))
  809. X+         fprintf(stderr,"dwim: XSendEvent returns error\n");
  810. X+     XFlush(dpy);                /* probably does nothing */
  811. X+ }
  812. X+ 
  813. X+ 
  814. X+ /* intercept an event; return 0 or 1 depending on whether twm should see it */
  815. X+ dwim_intercept(ev)
  816. X+ XEvent ev;
  817. X+ {
  818. X+     Window w = ev.xkey.window;
  819. X+     unsigned int keycode = ev.xkey.keycode;
  820. X+     unsigned int state = ev.xkey.state;        /* modifier mask */
  821. X+     char b, bu;        /* b is a char, bu is same char unshifted */
  822. X+     XEvent evc;        /* event copy used to get bu */
  823. X+ 
  824. X+ #ifdef NEVERDEF
  825. X+     fprintf(stderr,"TRACER [dwim_intercept]: keycode=0x%x, state=0x%x\n"
  826. X+         ,keycode,state);    /*TRACER*/
  827. X+ #endif NEVERDEF
  828. X+     /* ignore modifiers (shift keys) -- wait for the real thing */
  829. X+     if(ismodifier(keycode))
  830. X+         return(1);        /* twm probably ignores it, too */
  831. X+ 
  832. X+     /* ungrab a grabbed keyboard */
  833. X+     if(grabit)    {
  834. X+         XUngrabKeyboard(dpy, CurrentTime);
  835. X+         grabit=0;
  836. X+     }
  837. X+ 
  838. X+     /* get the key (truncate translation to one character) */
  839. X+     XLookupString(&ev, &b, 1, NULL, NULL);    /* b is a char */
  840. X+     evc = ev;            /* NOTE: an XEvent is not a pointer */
  841. X+     evc.xkey.state = 0;        /* unshift it */
  842. X+     XLookupString(&evc, &bu, 1, NULL, NULL);    /* bu is unshifted */
  843. X+ 
  844. X+     return(dokey(b,bu,state));
  845. X+ }
  846. X+ 
  847. X+ /* sleep some microseconds */
  848. X+ dwim_usleep(us)
  849. X+ char *us;
  850. X+ {
  851. X+     int u;
  852. X+     if((u=atoi(us))>1000)    {
  853. X+         fprintf(stderr,
  854. X+           "dwim: usleep > 1000 microseconds changed to 1000\n");
  855. X+         u = 1000;
  856. X+     }
  857. X+     usleep(u);
  858. X+ }
  859. X+ 
  860. X+ /* continue to process intercepted key -- return same as dwim_intercept() */
  861. X+ static
  862. X+ dokey(b,bu,state)
  863. X+ char b,bu;                /* bu is unshifted char */
  864. X+ {
  865. X+     struct dwim_wits numtowinframe();
  866. X+ 
  867. X+     if( (dwim_set && isdigit(bu)) )    {
  868. X+         warpto(numtowinframe(bu-'0'));    /* may fail with EBSDC */
  869. X+         return(0);
  870. X+     }
  871. X+     return(1);
  872. X+ }
  873. X+ 
  874. X+ /* convert a number to a window  --  return Scr->Root if no match */
  875. X+ static
  876. X+ struct dwim_wits
  877. X+ numtowinframe(n)
  878. X+ {
  879. X+     struct dwim_winlist *node = root.next;
  880. X+     static struct dwim_wits rvalue;
  881. X+ 
  882. X+     while(node)    {
  883. X+         if(node->num == n)
  884. X+             return(node->wins);
  885. X+         node = node->next;
  886. X+     }
  887. X+     rvalue.w = rvalue.wf = Scr->Root;
  888. X+     rvalue.tw = &Scr->TwmRoot;
  889. X+     return(rvalue);        /* no match */
  890. X+ }
  891. X+ 
  892. X+ /* is the keycode a modifier (e.g., just the shift key) ? */
  893. X+ static
  894. X+ ismodifier(key)
  895. X+ unsigned int key;
  896. X+ {
  897. X+     static XModifierKeymap *map = 0;
  898. X+     static int max_keypermod;
  899. X+     KeyCode *m;        /* a NUMMODS x max_keypermod array */
  900. X+     int i;
  901. X+ 
  902. X+     if(!map)    {
  903. X+         map = XGetModifierMapping(dpy);
  904. X+         max_keypermod = map->max_keypermod;
  905. X+         m = map->modifiermap;
  906. X+     }
  907. X+ 
  908. X+     /* just try them out serially (there can't be too many...) */
  909. X+     i = max_keypermod*NUMMODS;    /* number of possibilities */
  910. X+     m = map->modifiermap;
  911. X+     do {
  912. X+         if(*m++ == key)
  913. X+             return(1);
  914. X+     } while(--i);
  915. X+ 
  916. X+     return(0);            /* no, it's not a modifier */
  917. X+ }
  918. X+ 
  919. X+ 
  920. X+ /* add a number to the list of free numbers */
  921. X+ static
  922. X+ addfree(n)
  923. X+ {
  924. X+     struct dwim_nlist *old = nroot.next;
  925. X+     struct dwim_nlist *new = ALLOC(struct dwim_nlist);
  926. X+ 
  927. X+     new->n = n;
  928. X+     nroot.next = new;
  929. X+     new->next = old;
  930. X+ }
  931. X+ 
  932. X+ /* get a new number */
  933. X+ static
  934. X+ newnum()
  935. X+ {
  936. X+     int n;
  937. X+     struct dwim_nlist *node;
  938. X+     if(node = nroot.next)    {
  939. X+         /* first try the freelist */
  940. X+         n = node->n;
  941. X+         nroot.next = node->next;
  942. X+         free(node);
  943. X+     } else
  944. X+         /* otherwise ... */
  945. X+         n = dwim_nextnum++;
  946. X+ 
  947. X+     return(n);
  948. X+ }
  949. X+ 
  950. X+ /* add a new window and frame to our list */
  951. X+ static
  952. X+ addwin(num,tw)
  953. X+ TwmWindow *tw;
  954. X+ {
  955. X+     struct dwim_winlist *old = root.next;
  956. X+     struct dwim_winlist *new = ALLOC(struct dwim_winlist);
  957. X+ 
  958. X+     /* fill the new node */
  959. X+     new->num      = num;
  960. X+     new->wins.w   = tw->w;
  961. X+     new->wins.wf  = tw->frame;
  962. X+     new->wins.tw  = tw;
  963. X+ 
  964. X+     /* insert the new node */
  965. X+     root.next = new;
  966. X+     new->next = old;
  967. X+ }
  968. X+ 
  969. X+ 
  970. X+ static
  971. X+ dwim_err(s)
  972. X+ char *s;
  973. X+ {
  974. X+     fprintf(stderr,"dwim: %s\n",s);
  975. X+     Done();                /* in twm.c */
  976. X+ }
  977. X+ 
  978. X+ /* a debugging routine */
  979. X+ static
  980. X+ wintraverse()
  981. X+ {
  982. X+     struct dwim_winlist *node = root.next;
  983. X+     printf("------ wintraverse ------\n");
  984. X+     while(node)    {
  985. X+         printf("%d 0x%09x\n",node->num,(unsigned int)node->wins.w);
  986. X+         node=node->next;
  987. X+     }
  988. X+     printf("-------------------------\n");
  989. X+ }
  990. X+ 
  991. X+ 
  992. X+ /* warp pointer and focus to window w */
  993. X+ static
  994. X+ warpto(dw)
  995. X+ struct dwim_wits dw;
  996. X+ {
  997. X+     XRaiseWindow(dpy, dw.w);        /* seems to do nothing */
  998. X+     XRaiseWindow(dpy, dw.wf);
  999. X+     DeIconify(dw.tw);            /* this might work */
  1000. X+ 
  1001. X+     /* warp to upper left corner of window */
  1002. X+      XWarpPointer(dpy, None, dw.w, 0, 0, 0, 0, 0, 0);
  1003. X+ 
  1004. X+     XSetInputFocus(dpy, dw.w, RevertToNone, CurrentTime);
  1005. X+ }
  1006. X+ 
  1007. X+ /* get window width */
  1008. X+ static
  1009. X+ getwidth(w)
  1010. X+ Window w;
  1011. X+ {
  1012. X+     XWindowAttributes buf;
  1013. X+ 
  1014. X+     XGetWindowAttributes(dpy, w, &buf);
  1015. X+     return(buf.width);
  1016. X+ }
  1017. Xdiff -c twm/dwim.man dwim/dwim.man
  1018. X*** twm/dwim.man    Thu Jan 18 12:54:14 1990
  1019. X--- dwim/dwim.man    Sat Jan  6 01:43:12 1990
  1020. X***************
  1021. X*** 0 ****
  1022. X--- 1,61 ----
  1023. X+ .TH DWIM 1 "6 January 1990" "X Version 11R4"
  1024. X+ .SH NAME
  1025. X+ .PP
  1026. X+ dwim - a window manager hack for X11 (Do What I Mean)
  1027. X+ .PP
  1028. X+ .SH SYNTAX
  1029. X+ .PP
  1030. X+ \fBdwim \fP[-display \fIdisplay\fP]
  1031. X+ .PP
  1032. X+ .SH DESCRIPTION
  1033. X+ .PP
  1034. X+ \fIdwim\fR is a set of patches to \fItwm\fR (Tom's Window Manager, \fIcf.\fR)
  1035. X+ to do a small number of things with keystrokes that are more naturally done
  1036. X+ with keystrokes than with the mouse.
  1037. X+ .PP
  1038. X+ \fIdwim\fR reads a file called \fI.dwimrc\fR instead of \fI.twmrc\fR.
  1039. X+ (Just as twm release 4 reads .twmrc.0 [for screen 0], so dwim will
  1040. X+ read .dwimrc.0).
  1041. X+ .PP
  1042. X+ Xterm's are labeled with numbers instead of the name "xterm."
  1043. X+ Any digit typed in the root window will cause the focus to shift
  1044. X+ to the window numbered by the same digit.  In addition, if a digit key
  1045. X+ key is mapped in the \fI.dwimrc\fR (with or without shift modifiers),
  1046. X+ \fIdwim\fR will intercept that key before \fItwm\fR sees it and will
  1047. X+ cause the focus to be shifted.  When the focus is shifted, the appropriate
  1048. X+ window is also raised or deiconified.
  1049. X+ .PP
  1050. X+ The function \fIf.dwimcom\fR effectively shifts the focus to the root window
  1051. X+ for one keystroke only (shift-key, control-key, and meta-key all count as
  1052. X+ one keystroke).
  1053. X+ .PP
  1054. X+ The usual way to use \fIdwm\fR is to add the following lines to a \fI.twmrc\fR
  1055. X+ file:
  1056. X+ .IP
  1057. X+ .nf
  1058. X+ "w" = m : window : f.dwimcom
  1059. X+ "1" = c : window : f.nop
  1060. X+ "2" = c : window : f.nop
  1061. X+ "3" = c : window : f.nop
  1062. X+ "4" = c : window : f.nop
  1063. X+ "5" = c : window : f.nop
  1064. X+ "6" = c : window : f.nop
  1065. X+ "7" = c : window : f.nop
  1066. X+ "8" = c : window : f.nop
  1067. X+ "9" = c : window : f.nop
  1068. X+ .fi
  1069. X+ .PP
  1070. X+ With these lines, \fImeta-w digit\fR or \fIcontrol-digit\fR will cause the
  1071. X+ focus to be shifted to the given window.
  1072. X+ .SH "NOTES ON RELEASE 4"
  1073. X+ In X11R3, dwim (and twm) accepted "cm" in a binding to indicate that both
  1074. X+ control and meta should be pressed.  In X11R4, both dwim and twm require
  1075. X+ that modifier characters should be separated by vertical bars ("c|m").
  1076. X+ .PP
  1077. X+ Until I can figure out why most (but not all) applications ignore
  1078. X+ synthetic mouse button presses, users who wish to try the undocumented
  1079. X+ dwim artificial mouse commands will have to look in the sources.
  1080. X+ .SH AUTHOR
  1081. X+ David A. Rabson
  1082. X+ \".SH BUGS
  1083. X+ 
  1084. Xdiff -c twm/events.c dwim/events.c
  1085. X*** twm/events.c    Thu Jan 18 12:51:01 1990
  1086. X--- dwim/events.c    Fri Jan  5 20:59:08 1990
  1087. X***************
  1088. X*** 25,30 ****
  1089. X--- 25,31 ----
  1090. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1091. X  /*****************************************************************************/
  1092. X  
  1093. X+ /* DWIM modifications David Rabson 6/89, 1/90 */
  1094. X  
  1095. X  /***********************************************************************
  1096. X   *
  1097. X***************
  1098. X*** 479,487 ****
  1099. X--- 480,498 ----
  1100. X   ***********************************************************************
  1101. X   */
  1102. X  
  1103. X+ /* DWIM modifications: intercept the event first */
  1104. X  void
  1105. X  HandleKeyPress()
  1106. X  {
  1107. X+     static void TwmHandleKeyPress();
  1108. X+ 
  1109. X+     if(!dwim_set || dwim_intercept(Event))
  1110. X+         TwmHandleKeyPress();                    /* let twm see it, maybe */
  1111. X+ }
  1112. X+ 
  1113. X+ void static
  1114. X+ TwmHandleKeyPress()
  1115. X+ {
  1116. X      FuncKey *key;
  1117. X      int len;
  1118. X  
  1119. X***************
  1120. X*** 1086,1091 ****
  1121. X--- 1097,1105 ----
  1122. X      free_cwins (Tmp_win);                /* 9 */
  1123. X      if (Tmp_win->titlebuttons)                    /* 10 */
  1124. X        free ((char *) Tmp_win->titlebuttons);
  1125. X+ 
  1126. X+     dwim_demise(Tmp_win->w);    /*DWIM*/
  1127. X+ 
  1128. X      free((char *)Tmp_win);
  1129. X  }
  1130. X  
  1131. Xdiff -c twm/gram.y dwim/gram.y
  1132. X*** twm/gram.y    Thu Jan 18 12:50:56 1990
  1133. X--- dwim/gram.y    Fri Jan  5 20:43:07 1990
  1134. X***************
  1135. X*** 25,30 ****
  1136. X--- 25,31 ----
  1137. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1138. X  /*****************************************************************************/
  1139. X  
  1140. X+ /* DWIM modifications David Rabson 6/89, 1/90 */
  1141. X  
  1142. X  /***********************************************************************
  1143. X   *
  1144. X***************
  1145. X*** 88,93 ****
  1146. X--- 89,95 ----
  1147. X  %token <num> NUMBER KEYWORD NKEYWORD CKEYWORD CLKEYWORD FKEYWORD FSKEYWORD 
  1148. X  %token <num> SKEYWORD DKEYWORD JKEYWORD WINDOW_RING WARP_CURSOR ERRORTOKEN
  1149. X  %token <ptr> STRING 
  1150. X+ %token <num> DWIM_SET
  1151. X  
  1152. X  %type <ptr> string
  1153. X  %type <num> action button number signed_number full fullkey
  1154. X***************
  1155. X*** 103,108 ****
  1156. X--- 105,111 ----
  1157. X          ;
  1158. X  
  1159. X  stmt        : error
  1160. X+         | DWIM_SET              { dwim_set = 1; }
  1161. X          | noarg
  1162. X          | sarg
  1163. X          | narg
  1164. X***************
  1165. X*** 190,198 ****
  1166. X          | MENU string LP string COLON string RP    {
  1167. X                      root = GetRoot($2, $4, $6); }
  1168. X            menu            { root->real_menu = TRUE;}
  1169. X!         | MENU string         { root = GetRoot($2, NULLSTR, NULLSTR); }
  1170. X            menu            { root->real_menu = TRUE; }
  1171. X!         | FUNCTION string    { root = GetRoot($2, NULLSTR, NULLSTR); }
  1172. X            function
  1173. X          | ICONS         { list = &Scr->IconNames; }
  1174. X            icon_list
  1175. X--- 193,201 ----
  1176. X          | MENU string LP string COLON string RP    {
  1177. X                      root = GetRoot($2, $4, $6); }
  1178. X            menu            { root->real_menu = TRUE;}
  1179. X!         | MENU string         {root = GetRoot($2, NULLSTR, NULLSTR);}
  1180. X            menu            { root->real_menu = TRUE; }
  1181. X!         | FUNCTION string    {root = GetRoot($2, NULLSTR, NULLSTR);}
  1182. X            function
  1183. X          | ICONS         { list = &Scr->IconNames; }
  1184. X            icon_list
  1185. Xdiff -c twm/iconmgr.c dwim/iconmgr.c
  1186. X*** twm/iconmgr.c    Thu Jan 18 12:51:05 1990
  1187. X--- dwim/iconmgr.c    Sat Jan  6 01:27:27 1990
  1188. X***************
  1189. X*** 683,691 ****
  1190. X--- 683,694 ----
  1191. X      WList *tmp;
  1192. X  {
  1193. X      {
  1194. X+     extern int dwim_set;    /*DWIM*/
  1195. X      XSetForeground(dpy, Scr->NormalGC, tmp->fore);
  1196. X+     if(!dwim_set)    {    /*DWIM*//* I happen not to like this */
  1197. X          XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 2, 2,
  1198. X          tmp->width-5, tmp->height-5);
  1199. X+     }
  1200. X  
  1201. X      if (tmp->active && Scr->Highlight)
  1202. X          XSetForeground(dpy, Scr->NormalGC, tmp->highlight);
  1203. Xdiff -c twm/menus.c dwim/menus.c
  1204. X*** twm/menus.c    Thu Jan 18 12:50:57 1990
  1205. X--- dwim/menus.c    Fri Jan  5 22:30:28 1990
  1206. X***************
  1207. X*** 25,30 ****
  1208. X--- 25,31 ----
  1209. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1210. X  /*****************************************************************************/
  1211. X  
  1212. X+ /* DWIM modifications David Rabson 6/89, 1/90 */
  1213. X  
  1214. X  /***********************************************************************
  1215. X   *
  1216. X***************
  1217. X*** 1888,1893 ****
  1218. X--- 1889,1907 ----
  1219. X      XMapWindow(dpy, w);
  1220. X      XDestroyWindow(dpy, w);
  1221. X      XFlush(dpy);
  1222. X+     break;
  1223. X+ 
  1224. X+     case F_DWIMCOM:
  1225. X+     dwim_command();
  1226. X+     break;
  1227. X+     case F_DWIMPRESS:
  1228. X+         dwim_press((char)1,action);
  1229. X+         break;
  1230. X+     case F_DWIMRELEASE:
  1231. X+         dwim_press((char)0,action);
  1232. X+         break;
  1233. X+     case F_DWIMUSLEEP:
  1234. X+     dwim_usleep(action);
  1235. X      break;
  1236. X  
  1237. X      case F_QUIT:
  1238. Xdiff -c twm/parse.c dwim/parse.c
  1239. X*** twm/parse.c    Thu Jan 18 12:50:53 1990
  1240. X--- dwim/parse.c    Fri Jan  5 22:18:10 1990
  1241. X***************
  1242. X*** 25,36 ****
  1243. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1244. X  /*****************************************************************************/
  1245. X  
  1246. X  
  1247. X  /***********************************************************************
  1248. X   *
  1249. X   * $XConsortium: parse.c,v 1.39 89/12/14 14:51:30 jim Exp $
  1250. X   *
  1251. X!  * parse the .twmrc file
  1252. X   *
  1253. X   * 17-Nov-87 Thomas E. LaStrange        File created
  1254. X   *
  1255. X--- 25,37 ----
  1256. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1257. X  /*****************************************************************************/
  1258. X  
  1259. X+ /* DWIM modifications David Rabson, 1/90 */
  1260. X  
  1261. X  /***********************************************************************
  1262. X   *
  1263. X   * $XConsortium: parse.c,v 1.39 89/12/14 14:51:30 jim Exp $
  1264. X   *
  1265. X!  * parse the .dwimrc file
  1266. X   *
  1267. X   * 17-Nov-87 Thomas E. LaStrange        File created
  1268. X   *
  1269. X***************
  1270. X*** 78,87 ****
  1271. X  /***********************************************************************
  1272. X   *
  1273. X   *  Procedure:
  1274. X!  *    ParseTwmrc - parse the .twmrc file
  1275. X   *
  1276. X   *  Inputs:
  1277. X!  *    filename  - the filename to parse.  A NULL indicates $HOME/.twmrc
  1278. X   *
  1279. X   ***********************************************************************
  1280. X   */
  1281. X--- 79,88 ----
  1282. X  /***********************************************************************
  1283. X   *
  1284. X   *  Procedure:
  1285. X!  *    ParseTwmrc - parse the .dwimrc file
  1286. X   *
  1287. X   *  Inputs:
  1288. X!  *    filename  - the filename to parse.  A NULL indicates $HOME/.dwimrc
  1289. X   *
  1290. X   ***********************************************************************
  1291. X   */
  1292. X***************
  1293. X*** 121,128 ****
  1294. X      char tmpfilename[257];
  1295. X  
  1296. X      /*
  1297. X!      * If filename given, try it, else try ~/.twmrc.# then ~/.twmrc.  Then
  1298. X       * try system.twmrc; finally using built-in defaults.
  1299. X       */
  1300. X      for (twmrc = NULL, i = 0; !twmrc && i < 4; i++) {
  1301. X      switch (i) {
  1302. X--- 122,130 ----
  1303. X      char tmpfilename[257];
  1304. X  
  1305. X      /*
  1306. X!      * If filename given, try it, else try ~/.dwimrc.# then ~/.dwimrc.  Then
  1307. X       * try system.twmrc; finally using built-in defaults.
  1308. X+      * DWIM author note: the people at MIT write really AWFUL code.
  1309. X       */
  1310. X      for (twmrc = NULL, i = 0; !twmrc && i < 4; i++) {
  1311. X      switch (i) {
  1312. X***************
  1313. X*** 130,142 ****
  1314. X          cp = filename;
  1315. X          break;
  1316. X  
  1317. X!       case 1:            /* ~/.twmrc.screennum */
  1318. X          if (!filename) {
  1319. X          home = getenv ("HOME");
  1320. X          if (home) {
  1321. X              homelen = strlen (home);
  1322. X              cp = tmpfilename;
  1323. X!             (void) sprintf (tmpfilename, "%s/.twmrc.%d",
  1324. X                      home, Scr->screen);
  1325. X              break;
  1326. X          }
  1327. X--- 132,144 ----
  1328. X          cp = filename;
  1329. X          break;
  1330. X  
  1331. X!       case 1:            /* ~/.dwimrc.screennum */
  1332. X          if (!filename) {
  1333. X          home = getenv ("HOME");
  1334. X          if (home) {
  1335. X              homelen = strlen (home);
  1336. X              cp = tmpfilename;
  1337. X!             (void) sprintf (tmpfilename, "%s/.dwimrc.%d",
  1338. X                      home, Scr->screen);
  1339. X              break;
  1340. X          }
  1341. X***************
  1342. X*** 143,151 ****
  1343. X          }
  1344. X          continue;
  1345. X  
  1346. X!       case 2:            /* ~/.twmrc */
  1347. X          if (home) {
  1348. X!         tmpfilename[homelen + 7] = '\0';
  1349. X          }
  1350. X          break;
  1351. X  
  1352. X--- 145,153 ----
  1353. X          }
  1354. X          continue;
  1355. X  
  1356. X!       case 2:            /* ~/.dwimrc */
  1357. X          if (home) {
  1358. X!         tmpfilename[homelen + 8] = '\0'; /* DWIM: 8 was 7 (UGLY!) */
  1359. X          }
  1360. X          break;
  1361. X  
  1362. X***************
  1363. X*** 162,168 ****
  1364. X  
  1365. X      if (filename && cp != filename) {
  1366. X          fprintf (stderr,
  1367. X!              "%s:  unable to open twmrc file %s, using %s instead\n",
  1368. X               ProgramName, filename, cp);
  1369. X      }
  1370. X      status = doparse (twmFileInput, "file", cp);
  1371. X--- 164,170 ----
  1372. X  
  1373. X      if (filename && cp != filename) {
  1374. X          fprintf (stderr,
  1375. X!              "%s:  unable to open dwimrc file %s, using %s instead\n",
  1376. X               ProgramName, filename, cp);
  1377. X      }
  1378. X      status = doparse (twmFileInput, "file", cp);
  1379. X***************
  1380. X*** 171,177 ****
  1381. X      } else {
  1382. X      if (filename) {
  1383. X          fprintf (stderr,
  1384. X!     "%s:  unable to open twmrc file %s, using built-in defaults instead\n",
  1385. X               ProgramName, filename);
  1386. X      }
  1387. X      return ParseStringList (defTwmrc);
  1388. X--- 173,179 ----
  1389. X      } else {
  1390. X      if (filename) {
  1391. X          fprintf (stderr,
  1392. X!     "%s:  unable to open dwimrc file %s, using built-in defaults instead\n",
  1393. X               ProgramName, filename);
  1394. X      }
  1395. X      return ParseStringList (defTwmrc);
  1396. X***************
  1397. X*** 384,389 ****
  1398. X--- 386,392 ----
  1399. X      { "donticonifybyunmapping",    DONT_ICONIFY_BY_UNMAPPING, 0 },
  1400. X      { "dontmoveoff",        KEYWORD, kw0_DontMoveOff },
  1401. X      { "dontsqueezetitle",    DONT_SQUEEZE_TITLE, 0 },
  1402. X+     { "dwim_set",        KEYWORD, DWIM_SET },
  1403. X      { "east",            DKEYWORD, D_EAST },
  1404. X      { "f",            FRAME, 0 },
  1405. X      { "f.autoraise",        FKEYWORD, F_AUTORAISE },
  1406. X***************
  1407. X*** 400,405 ****
  1408. X--- 403,412 ----
  1409. X      { "f.deltastop",        FKEYWORD, F_DELTASTOP },
  1410. X      { "f.destroy",        FKEYWORD, F_DESTROY },
  1411. X      { "f.downiconmgr",        FKEYWORD, F_DOWNICONMGR },
  1412. X+     { "f.dwimcom",        FKEYWORD, F_DWIMCOM },
  1413. X+     { "f.dwimpress",        FSKEYWORD, F_DWIMPRESS },
  1414. X+     { "f.dwimrelease",        FSKEYWORD, F_DWIMRELEASE },
  1415. X+     { "f.dwimusleep",        FSKEYWORD, F_DWIMUSLEEP },
  1416. X      { "f.exec",            FSKEYWORD, F_EXEC },
  1417. X      { "f.file",            FSKEYWORD, F_FILE },
  1418. X      { "f.focus",        FKEYWORD, F_FOCUS },
  1419. Xdiff -c twm/parse.h dwim/parse.h
  1420. X*** twm/parse.h    Thu Jan 18 12:50:58 1990
  1421. X--- dwim/parse.h    Fri Jan  5 22:18:59 1990
  1422. X***************
  1423. X*** 25,30 ****
  1424. X--- 25,31 ----
  1425. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1426. X  /*****************************************************************************/
  1427. X  
  1428. X+ /* DWIM modifications: David Rabson, 6/89, 1/90 */
  1429. X  
  1430. X  /**********************************************************************
  1431. X   *
  1432. X***************
  1433. X*** 90,95 ****
  1434. X--- 91,102 ----
  1435. X  #define F_CUTFILE        43
  1436. X  #define F_SHOWLIST        44
  1437. X  #define F_HIDELIST        45
  1438. X+ 
  1439. X+ #define    F_DWIMCOM        8001
  1440. X+ #define    F_DWIMSET        8002
  1441. X+ #define    F_DWIMPRESS        8003
  1442. X+ #define    F_DWIMRELEASE        8004
  1443. X+ #define    F_DWIMUSLEEP        8005
  1444. X  
  1445. X  #define F_MENU            101    /* string */
  1446. X  #define F_WARPTO        102    /* string */
  1447. XCommon subdirectories: twm/sample-twmrc and dwim/sample-twmrc
  1448. Xdiff -c twm/twm.h dwim/twm.h
  1449. X*** twm/twm.h    Thu Jan 18 12:51:01 1990
  1450. X--- dwim/twm.h    Sat Jan  6 00:37:59 1990
  1451. X***************
  1452. X*** 25,30 ****
  1453. X--- 25,31 ----
  1454. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1455. X  /*****************************************************************************/
  1456. X  
  1457. X+ /* DWIM modifications David Rabson 6/89, 1/90 */
  1458. X  
  1459. X  /***********************************************************************
  1460. X   *
  1461. X***************
  1462. X*** 334,339 ****
  1463. X--- 335,342 ----
  1464. X  
  1465. X  extern Bool ErrorOccurred;
  1466. X  extern XErrorEvent LastErrorEvent;
  1467. X+ 
  1468. X+ extern int dwim_set;
  1469. X  
  1470. X  #define ResetError() (ErrorOccurred = False)
  1471. X  
  1472. Xdiff -c twm/version.c dwim/version.c
  1473. X*** twm/version.c    Thu Jan 18 12:50:58 1990
  1474. X--- dwim/version.c    Fri Jan  5 20:17:21 1990
  1475. X***************
  1476. X*** 25,29 ****
  1477. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1478. X  /*****************************************************************************/
  1479. X  
  1480. X! char *Version = "MIT X Consortium, R4";
  1481. X! 
  1482. X--- 25,29 ----
  1483. X  /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  1484. X  /*****************************************************************************/
  1485. X  
  1486. X! /*char *Version = "MIT X Consortium, R4";*/ /* modified David Rabson 1/90 */
  1487. X! char *Version = "dwim: from X11R4 release 1/90";
  1488. X
  1489. X
  1490. X
  1491. END_OF_FILE
  1492. if test 40231 -ne `wc -c <'dwim.patch'`; then
  1493.     echo shar: \"'dwim.patch'\" unpacked with wrong size!
  1494. fi
  1495. # end of 'dwim.patch'
  1496. fi
  1497. echo shar: End of shell archive.
  1498. exit 0
  1499.