home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume16 / nethck31 / patch1s < prev    next >
Encoding:
Text File  |  1993-03-04  |  58.9 KB  |  2,014 lines

  1. Subject:  v17i060:  nethack31 - display oriented dungeons & dragons (Ver. 3.1), Patch1s/31
  2. Newsgroups: comp.sources.games
  3. Approved: billr@saab.CNA.TEK.COM
  4.  
  5. Submitted-by: izchak@linc.cis.upenn.edu (Izchak Miller)
  6. Posting-number: Volume 17, Issue 60
  7. Archive-name: nethack31/Patch1s
  8. Patch-To: nethack31: Volume 16, Issue 1-116
  9. Environment: Amiga, Atari, Mac, MS-DOS, Windows-NT, OS2, Unix, VMS, X11
  10.  
  11.  
  12.  
  13. #! /bin/sh
  14. # This is a shell archive.  Remove anything before this line, then unpack
  15. # it by saving it into a file and typing "sh file".  To overwrite existing
  16. # files, type "sh file -c".  You can also feed this as standard input via
  17. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  18. # will see the following message at the end:
  19. #        "End of archive 19 (of 31)."
  20. # Contents:  patches01n sys/winnt/Makefile.dat
  21. # Wrapped by billr@saab on Fri Mar  5 10:50:46 1993
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'patches01n' -a "${1}" != "-c" ; then 
  24.   echo shar: Renaming existing file \"'patches01n'\" to \"'patches01n.orig'\"
  25.   mv -f 'patches01n' 'patches01n.orig'
  26. fi
  27. echo shar: Extracting \"'patches01n'\" \(51640 characters\)
  28. sed "s/^X//" >'patches01n' <<'END_OF_FILE'
  29. X*** /tmp/da10214    Thu Feb 25 10:32:43 1993
  30. X--- win/X11/Install.X11    Wed Feb 24 14:24:17 1993
  31. X***************
  32. X*** 8,13 ****
  33. X--- 8,19 ----
  34. X  may work as well, with some tweaking likely.  Follow WIN* in
  35. X  sys/unix/Makefile.src for compilation hints.
  36. X  
  37. X+ (If you try to compile it with X11R3 or earlier, you will get many errors,
  38. X+ starting with complaints about XtPointer not being declared.  If you get
  39. X+ around the compilation problems, you will still need a recent library of
  40. X+ Athena Widgets to link against.  Once compiled, you can probably run it
  41. X+ under an R3 X server, though.)
  42. X+ 
  43. X  The reason this uses the Athena widget set is that the Athena widgets come
  44. X  free from MIT (like X11).  Unfortunately, the companies that resell X11
  45. X  (value subtracted er, added software; yea, yea, that's the ticket) usually
  46. X***************
  47. X*** 15,25 ****
  48. X  "unsupported" portion of their tape.  If you do not have the Athena
  49. X  widgets, you may obtain them via anonymous ftp from export.lcs.mit.edu.
  50. X  
  51. X! To use this code, define X11_GRAPHICS in include/config.h.  Add $(WINX11SRC),
  52. X  $(WINX11OBJ), and $(WINX11LIB) to WINSRC, WINOBJ, and WINLIB respectively
  53. X  in src/Makefile.  This will give you an executable supporting both X11 and
  54. X  tty windowing.
  55. X  
  56. X  If you want special graphics symbols, you will also need to install one
  57. X  or both of the included X11 fonts and use the symbol mappings found in
  58. X  nethack.rc.  The fonts are found in nh10.bdf and ibm.bdf.  You first need
  59. X--- 21,42 ----
  60. X  "unsupported" portion of their tape.  If you do not have the Athena
  61. X  widgets, you may obtain them via anonymous ftp from export.lcs.mit.edu.
  62. X  
  63. X! To use this code, define X11_GRAPHICS in include/config.h.  (You can comment
  64. X! out TTY_GRAPHICS or change DEFAULT_WINDOW_SYS if you want to, but there's
  65. X! little reason to do so.  The X11 version almost requires a config file
  66. X! for full effect, so you can just as well set windowtype there; also, you
  67. X! or someone else might just possibly be stuck in a situation where you can't
  68. X! use the X version -- over a non-blindingly-fast modem, say.)  Add $(WINX11SRC),
  69. X  $(WINX11OBJ), and $(WINX11LIB) to WINSRC, WINOBJ, and WINLIB respectively
  70. X  in src/Makefile.  This will give you an executable supporting both X11 and
  71. X  tty windowing.
  72. X  
  73. X+ If you are using Xauthority security, installing NetHack setuid may cause
  74. X+ problems since the alternate id will probably not have permission to open
  75. X+ your display.  NetHack will be just as happy setgid, but you will have to
  76. X+ change the file permissions in the top Makefile before 'make install' to
  77. X+ do that.
  78. X+ 
  79. X  If you want special graphics symbols, you will also need to install one
  80. X  or both of the included X11 fonts and use the symbol mappings found in
  81. X  nethack.rc.  The fonts are found in nh10.bdf and ibm.bdf.  You first need
  82. X***************
  83. X*** 54,90 ****
  84. X  defaults directory:
  85. X      XAPPLRESDIR=$HACKDIR; export XAPPLRESDIR
  86. X  
  87. X! Two icon suggestions to the window manager are supported:  nh72 and nh56.
  88. X! Data for them comes from source files nh72icon and nh56icon and they are
  89. X! compiled into the program via #include in winX.c.  Selection between them
  90. X! is controlled by the "icon" resource in NetHack.ad; the default is nh72.
  91. X  
  92. X  Sorry, an Imakefile is not included.  Unlike many X11 programs, X11
  93. X  support is only a small, optional, part of nethack, and the Makefile is
  94. X  needed for systems that don't use X11.
  95. X  
  96. X! Notes for Sun's OpenWindows 3.x (2.x will not work):
  97. X!     1.    Define OPENWINBUG in include/unixconf.h.  Add -I/usr/openwin/include
  98. X!     to CFLAGS, -L/usr/openwin/lib to LFLAGS, and -lm to WINX11LIB in
  99. X!     src/Makefile.  (Naturally, if your OpenWindows is installed
  100. X!     elsewhere, adapt the two openwin paths.)  This will allow you
  101. X!     to create a game executable.
  102. X  
  103. X      2.    Run the fonts through convertfont and run bldfamily on the directory.
  104. X!     The environment variable FONTPATH must include the directory the fonts
  105. X!     are in when NetHack is run.  For a personal installation, setting the
  106. X!     variable in your .profile or .login is the simplest thing.  For a
  107. X!     multi-user installation, add the lines
  108. X!         FONTPATH=$FONTPATH:$HACKDIR/fonts
  109. X!         export FONTPATH
  110. X!     near the top of sys/unix/nethack.sh (before installation), and put
  111. X!     the fonts and associated files in the "fonts" subdirectory of your
  112. X!     GAMEDIR from the top Makefile (after installation via 'make install').
  113. X  
  114. X!     3.  Something must still be done with the NetHack.ad file.  All three
  115. X!     of the possibilities mentioned for standard X11 should work, but
  116. X!     it may be simplest to use the second or third, paralleling your
  117. X!     FONTPATH choice.
  118. X  
  119. X  
  120. X  File                Description
  121. X--- 71,106 ----
  122. X  defaults directory:
  123. X      XAPPLRESDIR=$HACKDIR; export XAPPLRESDIR
  124. X  
  125. X! Three icon suggestions to the window manager are supported:  nh72, nh56,
  126. X! and nh32.  Data for them comes from the source files nh72icon, nh56icon,
  127. X! and nh32icon; they are compiled into the program via #includes in winX.c.
  128. X! Selection between them is controlled by the "icon" resource in NetHack.ad;
  129. X! the default is nh72.
  130. X  
  131. X  Sorry, an Imakefile is not included.  Unlike many X11 programs, X11
  132. X  support is only a small, optional, part of nethack, and the Makefile is
  133. X  needed for systems that don't use X11.
  134. X  
  135. X! Notes for Sun's OpenWindows:
  136. X!     1.    For OpenWindows 3.x (NOT 2.x), define OPENWINBUG in include/unixconf.h.
  137. X!     The library bug from SunOS 4.1.x is apparently fixed in Solaris 2.x, 
  138. X!     so it is also unnecessary there.  (Defining it when unnecessary
  139. X!     causes the same problem being avoided when it is necessary. :-)
  140. X!     Add -I/usr/openwin/include to CFLAGS, -L/usr/openwin/lib to LFLAGS,
  141. X!     and -lm to WINX11LIB in src/Makefile.  (Naturally, if your OpenWindows
  142. X!     is installed elsewhere, adapt the two openwin paths.)  This will
  143. X!     allow you to create a game executable.
  144. X  
  145. X      2.    Run the fonts through convertfont and run bldfamily on the directory.
  146. X!     Now you must let your X server know where to find the fonts.  For a
  147. X!     personal installation, the simplest thing is to include the directory
  148. X!     of the fonts in the environment variable FONTPATH, as set in your
  149. X!     .profile or .login before starting the server.  For a multi-user
  150. X!     installation, you have the various "xset fp+" options outlined
  151. X!     above for standard X.
  152. X  
  153. X!     3.  Something must still be done with the NetHack.ad file -- all three
  154. X!     of the possibilities mentioned for standard X11 should work.
  155. X  
  156. X  
  157. X  File                Description
  158. X*** /tmp/da10222    Thu Feb 25 10:32:44 1993
  159. X--- win/X11/NetHack.ad    Tue Feb 23 09:38:32 1993
  160. X***************
  161. X*** 10,15 ****
  162. X--- 10,31 ----
  163. X  !NetHack*text*font:            fixed
  164. X  NetHack*map*font:            nh10
  165. X  
  166. X+ ! Translation tables.  There are currently several actions in nethack, but
  167. X+ ! the only one you should be using is "input()", which, with no parameters,
  168. X+ ! uses XLookupString to translate your keypress into a command.  You
  169. X+ ! can optionally give it parameters to change the behavior, see the example
  170. X+ ! below.  Note that you have to specify the translations in every appropriate
  171. X+ ! window.
  172. X+ NetHack*message*translations:    <KeyPress>: input()
  173. X+ !
  174. X+ ! Example extra translations for the map window.
  175. X+ !
  176. X+ !NetHack*map*translations:    #override \
  177. X+ !                !<Key>Left: input(h) \n\
  178. X+ !                !<Key>Right: input(l) \n\
  179. X+ !                !<Key>Up: input(k) \n\
  180. X+ !                !<Key>Down: input(j)
  181. X+ !
  182. X  ! The icon to use; supported values are nh72, nh56, and nh32; nh72 is the
  183. X  ! default.  Some window managers may not support the larger icon sizes.
  184. X  ! It is not guaranteed that the window manager will honor the icon selection.
  185. X***************
  186. X*** 42,48 ****
  187. X  NetHack*nethack.background:     wheat
  188. X  NetHack*map*yellow:        gold
  189. X  NetHack*map*brown:        tan
  190. X! NetHack*map*grey:        grey85
  191. X  NetHack*map*foreground:        wheat
  192. X  NetHack*map*background:        grey40
  193. X  
  194. X--- 58,64 ----
  195. X  NetHack*nethack.background:     wheat
  196. X  NetHack*map*yellow:        gold
  197. X  NetHack*map*brown:        tan
  198. X! NetHack*map*gray:        grey85
  199. X  NetHack*map*foreground:        wheat
  200. X  NetHack*map*background:        grey40
  201. X  
  202. X***************
  203. X*** 63,68 ****
  204. X--- 79,86 ----
  205. X  NetHack*player_selection*quit.foreground:    blue
  206. X  NetHack*player_selection*Command.borderColor:    red
  207. X  NetHack*player_selection*Command.foreground:    red
  208. X+ NetHack*player_selection*quit.accelerators: #override\n\
  209. X+                 <Key>Escape:    set() notify() unset()
  210. X  
  211. X  NetHack*extended_commands*dismiss.borderColor:    blue
  212. X  NetHack*extended_commands*dismiss.foreground:    blue
  213. X***************
  214. X*** 70,75 ****
  215. X--- 88,97 ----
  216. X  NetHack*extended_commands*help.foreground:    blue
  217. X  NetHack*extended_commands*Command.borderColor:    red
  218. X  NetHack*extended_commands*Command.foreground:    red
  219. X+ NetHack*extended_commands*help.accelerators: #override\n\
  220. X+                 :<Key>?:    set() notify() unset()
  221. X+ NetHack*extended_commands*dismiss.accelerators: #override\n\
  222. X+                 <Key>Escape:    set() notify() unset()
  223. X  !
  224. X  !
  225. X  ! The following are the default 15 colors that the nethack map uses.
  226. X***************
  227. X*** 77,94 ****
  228. X  !
  229. X  ! The foreground color is used as "no color".
  230. X  !
  231. X! !NetHack*map*black:        "black"
  232. X! !NetHack*map*red:        "red"
  233. X! !NetHack*map*green:        "pale green"
  234. X! !NetHack*map*brown:        "brown"
  235. X! !NetHack*map*blue:        "blue"
  236. X! !NetHack*map*magenta:        "magenta"
  237. X! !NetHack*map*cyan:        "light cyan"
  238. X! !NetHack*map*gray:        "gray"
  239. X! !NetHack*map*orange:        "orange"
  240. X! !NetHack*map*bright_green:    "green"
  241. X! !NetHack*map*yellow:        "yellow"
  242. X! !NetHack*map*bright_blue:    "royal blue"
  243. X! !NetHack*map*bright_magenta:    "violet"
  244. X! !NetHack*map*bright_cyan:    "cyan"
  245. X! !NetHack*map*white:        "white"
  246. X--- 99,116 ----
  247. X  !
  248. X  ! The foreground color is used as "no color".
  249. X  !
  250. X! !NetHack*map*black:        black
  251. X! !NetHack*map*red:        red
  252. X! !NetHack*map*green:        pale green
  253. X! !NetHack*map*brown:        brown
  254. X! !NetHack*map*blue:        blue
  255. X! !NetHack*map*magenta:        magenta
  256. X! !NetHack*map*cyan:        light cyan
  257. X! !NetHack*map*gray:        gray
  258. X! !NetHack*map*orange:        orange
  259. X! !NetHack*map*bright_green:    green
  260. X! !NetHack*map*yellow:        yellow
  261. X! !NetHack*map*bright_blue:    royal blue
  262. X! !NetHack*map*bright_magenta:    violet
  263. X! !NetHack*map*bright_cyan:    cyan
  264. X! !NetHack*map*white:        white
  265. X*** /tmp/da10230    Thu Feb 25 10:32:46 1993
  266. X--- win/X11/Window.c    Wed Feb 24 16:11:09 1993
  267. X***************
  268. X*** 1,4 ****
  269. X! /*    SCCS Id: @(#)Window.c    3.1    92/3/7
  270. X  /* Copyright (c) Dean Luick, 1992                  */
  271. X  /* NetHack may be freely redistributed.  See license for details. */
  272. X  
  273. X--- 1,4 ----
  274. X! /*    SCCS Id: @(#)Window.c    3.1    93/02/02          */
  275. X  /* Copyright (c) Dean Luick, 1992                  */
  276. X  /* NetHack may be freely redistributed.  See license for details. */
  277. X  
  278. X***************
  279. X*** 6,15 ****
  280. X--- 6,30 ----
  281. X   * Data structures and support routines for the Window widget.  This is a
  282. X   * drawing canvas with 16 colors and one font.
  283. X   */
  284. X+ 
  285. X+ #ifndef SYSV
  286. X+ #define PRESERVE_NO_SYSV    /* X11 include files may define SYSV */
  287. X+ #endif
  288. X+ 
  289. X  #include <X11/IntrinsicP.h>
  290. X  #include <X11/StringDefs.h>
  291. X+ 
  292. X+ #ifdef PRESERVE_NO_SYSV
  293. X+ # ifdef SYSV
  294. X+ #  undef SYSV
  295. X+ # endif
  296. X+ # undef PRESERVE_NO_SYSV
  297. X+ #endif
  298. X+ 
  299. X  #include "WindowP.h"
  300. X  
  301. X+ #include "config.h"
  302. X+ 
  303. X  static XtResource resources[] = {
  304. X  #define offset(field) XtOffset(WindowWidget, window.field)
  305. X      /* {name, class, type, size, offset, default_type, default_addr}, */
  306. X***************
  307. X*** 62,76 ****
  308. X  #undef offset
  309. X  };
  310. X  
  311. X! /* ARGSUSED */
  312. X! static void InputAction(w, event, params, num_params)
  313. X!     Widget   w;
  314. X!     XEvent   *event;
  315. X!     String   *params;        /* unused */
  316. X!     Cardinal *num_params;    /* unused */
  317. X! {
  318. X!     XtCallCallbacks(w, XtNcallback, (caddr_t) event);
  319. X! }
  320. X  
  321. X  /* ARGSUSED */
  322. X  static void no_op(w, event, params, num_params)
  323. X--- 77,84 ----
  324. X  #undef offset
  325. X  };
  326. X  
  327. X! extern void FDECL(map_input, (Widget, XEvent*, String*, Cardinal*));
  328. X!                             /* from winmap.c */
  329. X  
  330. X  /* ARGSUSED */
  331. X  static void no_op(w, event, params, num_params)
  332. X***************
  333. X*** 83,89 ****
  334. X  
  335. X  static XtActionsRec actions[] =
  336. X  {
  337. X!     {"input",    InputAction},
  338. X      {"no-op",    no_op},
  339. X  };
  340. X  
  341. X--- 91,97 ----
  342. X  
  343. X  static XtActionsRec actions[] =
  344. X  {
  345. X!     {"input",    map_input},
  346. X      {"no-op",    no_op},
  347. X  };
  348. X  
  349. X***************
  350. X*** 95,104 ****
  351. X  /* ARGSUSED */
  352. X  static void Redisplay(w, event, region)
  353. X      Widget w;
  354. X!     XEvent *event;    /* unused */
  355. X!     Region *region;
  356. X  {
  357. X!     XtCallCallbacks(w, XtNexposeCallback, (caddr_t) region);
  358. X  }
  359. X  
  360. X  /* ARGSUSED */
  361. X--- 103,113 ----
  362. X  /* ARGSUSED */
  363. X  static void Redisplay(w, event, region)
  364. X      Widget w;
  365. X!     XEvent *event;
  366. X!     Region region;    /* unused */
  367. X  {
  368. X!     /* This isn't correct - we need to call the callback with region. */
  369. X!     XtCallCallbacks(w, XtNexposeCallback, (caddr_t) event);
  370. X  }
  371. X  
  372. X  /* ARGSUSED */
  373. X*** /tmp/da10238    Thu Feb 25 10:32:48 1993
  374. X--- win/X11/dialogs.c    Wed Feb 24 16:11:18 1993
  375. X***************
  376. X*** 36,41 ****
  377. X--- 36,45 ----
  378. X   *    to this code.
  379. X   */
  380. X  
  381. X+ #ifndef SYSV
  382. X+ #define PRESERVE_NO_SYSV    /* X11 include files may define SYSV */
  383. X+ #endif
  384. X+ 
  385. X  #include <X11/Intrinsic.h>
  386. X  #include <X11/StringDefs.h>
  387. X  #include <X11/Xos.h>
  388. X***************
  389. X*** 45,50 ****
  390. X--- 49,61 ----
  391. X  #include <X11/Xaw/AsciiText.h>
  392. X  #include <X11/Xaw/Command.h>
  393. X  
  394. X+ #ifdef PRESERVE_NO_SYSV
  395. X+ # ifdef SYSV
  396. X+ #  undef SYSV
  397. X+ # endif
  398. X+ # undef PRESERVE_NO_SYSV
  399. X+ #endif
  400. X+ 
  401. X  #include "config.h"    /* #define for const for non __STDC__ compilers */
  402. X  
  403. X  /* ":" added to both translations below to allow limited redefining of
  404. X***************
  405. X*** 260,267 ****
  406. X  
  407. X  /* position popup window under the cursor */
  408. X  void
  409. X! positionpopup(w)
  410. X      Widget w;
  411. X  {
  412. X      Arg args[3];
  413. X      Cardinal num_args;
  414. X--- 271,279 ----
  415. X  
  416. X  /* position popup window under the cursor */
  417. X  void
  418. X! positionpopup(w, bottom)
  419. X      Widget w;
  420. X+     boolean bottom;    /* position y on bottom? */
  421. X  {
  422. X      Arg args[3];
  423. X      Cardinal num_args;
  424. X***************
  425. X*** 283,298 ****
  426. X      XtSetArg(args[num_args], XtNborderWidth, &b_width); num_args++;
  427. X      XtGetValues(w, args, num_args);
  428. X  
  429. X      width += 2 * b_width;
  430. X-     height += 2 * b_width;
  431. X- 
  432. X      x -= ( (Position) width/2 );
  433. X      if (x < 0) x = 0;
  434. X      if ( x > (max_x = (Position) (XtScreen(w)->width - width)) ) x = max_x;
  435. X  
  436. X!     y -= ( (Position) height/2 );
  437. X      if (y < 0) y = 0;
  438. X      if ( y > (max_y = (Position) (XtScreen(w)->height - height)) ) y = max_y;
  439. X  
  440. X      num_args = 0;
  441. X      XtSetArg(args[num_args], XtNx, x); num_args++;
  442. X--- 295,316 ----
  443. X      XtSetArg(args[num_args], XtNborderWidth, &b_width); num_args++;
  444. X      XtGetValues(w, args, num_args);
  445. X  
  446. X+     /* position so that the cursor is center,center or center,bottom */
  447. X      width += 2 * b_width;
  448. X      x -= ( (Position) width/2 );
  449. X      if (x < 0) x = 0;
  450. X      if ( x > (max_x = (Position) (XtScreen(w)->width - width)) ) x = max_x;
  451. X  
  452. X!     if (bottom) {
  453. X!     y -= (height+b_width-1);
  454. X!     height += 2 * b_width;
  455. X!     } else {
  456. X!     height += 2 * b_width;
  457. X!     y -= ( (Position) height/2 );
  458. X!     }
  459. X      if (y < 0) y = 0;
  460. X      if ( y > (max_y = (Position) (XtScreen(w)->height - height)) ) y = max_y;
  461. X+ 
  462. X  
  463. X      num_args = 0;
  464. X      XtSetArg(args[num_args], XtNx, x); num_args++;
  465. X*** /tmp/da10246    Thu Feb 25 10:32:50 1993
  466. X--- win/X11/ibm.bdf    Wed Feb 17 09:18:06 1993
  467. X***************
  468. X*** 3202,3220 ****
  469. X  DWIDTH 8 0
  470. X  BBX 8 14 0 -3
  471. X  BITMAP
  472. X  0000
  473. X  0000
  474. X  0000
  475. X  0000
  476. X! 0000
  477. X! 7600
  478. X! dc00
  479. X! 0000
  480. X! 7600
  481. X! dc00
  482. X! 0000
  483. X! 0000
  484. X! 0000
  485. X  0000
  486. X  ENDCHAR
  487. X  STARTCHAR fountain
  488. X--- 3202,3220 ----
  489. X  DWIDTH 8 0
  490. X  BBX 8 14 0 -3
  491. X  BITMAP
  492. X+ 7700
  493. X  0000
  494. X+ ee00
  495. X+ bb00
  496. X  0000
  497. X+ 7700
  498. X+ dd00
  499. X  0000
  500. X+ bb00
  501. X+ ee00
  502. X  0000
  503. X! dd00
  504. X! 7700
  505. X  0000
  506. X  ENDCHAR
  507. X  STARTCHAR fountain
  508. X*** /tmp/da10262    Thu Feb 25 10:32:55 1993
  509. X--- win/X11/nh10.bdf    Wed Feb 17 09:17:56 1993
  510. X***************
  511. X*** 3811,3826 ****
  512. X  DWIDTH 10 0
  513. X  BBX 10 20 0 -5
  514. X  BITMAP
  515. X  0000
  516. X  0000
  517. X  0000
  518. X! 0000
  519. X! 0000
  520. X! 0000
  521. X! 0000
  522. X! 0000
  523. X! 0000
  524. X! 0000
  525. X  0000
  526. X  2480
  527. X  db40
  528. X--- 3811,3826 ----
  529. X  DWIDTH 10 0
  530. X  BBX 10 20 0 -5
  531. X  BITMAP
  532. X+ b6c0
  533. X  0000
  534. X+ 2480
  535. X+ db40
  536. X  0000
  537. X+ 9240
  538. X+ 6d80
  539. X  0000
  540. X! 4900
  541. X! b6c0
  542. X  0000
  543. X  2480
  544. X  db40
  545. X*** /tmp/da10294    Thu Feb 25 10:33:05 1993
  546. X--- win/X11/winX.c    Wed Feb 24 16:11:24 1993
  547. X***************
  548. X*** 1,4 ****
  549. X! /*    SCCS Id: @(#)winX.c    3.1    93/01/22          */
  550. X  /* Copyright (c) Dean Luick, 1992                  */
  551. X  /* NetHack may be freely redistributed.  See license for details. */
  552. X  
  553. X--- 1,4 ----
  554. X! /*    SCCS Id: @(#)winX.c    3.1    93/02/17          */
  555. X  /* Copyright (c) Dean Luick, 1992                  */
  556. X  /* NetHack may be freely redistributed.  See license for details. */
  557. X  
  558. X***************
  559. X*** 7,12 ****
  560. X--- 7,17 ----
  561. X   * routines.  Please see doc/window.doc for an description of the window
  562. X   * interface.
  563. X   */
  564. X+ 
  565. X+ #ifndef SYSV
  566. X+ #define PRESERVE_NO_SYSV    /* X11 include files may define SYSV */
  567. X+ #endif
  568. X+ 
  569. X  #include <X11/Intrinsic.h>
  570. X  #include <X11/StringDefs.h>
  571. X  #include <X11/Shell.h>
  572. X***************
  573. X*** 16,24 ****
  574. X--- 21,37 ----
  575. X  #include <X11/Xaw/Cardinals.h>
  576. X  #include <X11/Xatom.h>
  577. X  #include <X11/Xos.h>
  578. X+ 
  579. X  /* for color support; should be ifdef TEXTCOLOR, but must come before hack.h */
  580. X  #include <X11/IntrinsicP.h>
  581. X  
  582. X+ #ifdef PRESERVE_NO_SYSV
  583. X+ # ifdef SYSV
  584. X+ #  undef SYSV
  585. X+ # endif
  586. X+ # undef PRESERVE_NO_SYSV
  587. X+ #endif
  588. X+ 
  589. X  #include "hack.h"
  590. X  #include "winX.h"
  591. X  
  592. X***************
  593. X*** 105,112 ****
  594. X--- 118,131 ----
  595. X   * Local functions.
  596. X   */
  597. X  static void FDECL(dismiss_file, (Widget, XEvent*, String*, Cardinal*));
  598. X+ static void FDECL(delete_file, (Widget, XEvent*, String*, Cardinal*));
  599. X  static void FDECL(yn_key, (Widget, XEvent*, String*, Cardinal*));
  600. X+ static void FDECL(yn_delete, (Widget, XEvent*, String*, Cardinal*));
  601. X+ static void FDECL(askname_delete, (Widget, XEvent*, String*, Cardinal*));
  602. X+ static void FDECL(getline_delete, (Widget, XEvent*, String*, Cardinal*));
  603. X+ static void FDECL(X11_hangup, (Widget, XEvent*, String*, Cardinal*));
  604. X  static int FDECL(input_event, (int));
  605. X+ static void FDECL(win_visible, (Widget,XtPointer,XEvent *,Boolean *));
  606. X  static void NDECL(init_standard_windows);
  607. X  
  608. X  
  609. X***************
  610. X*** 133,139 ****
  611. X  
  612. X      /* This is sad.  Search to find the corresponding window. */
  613. X      for (windex = 0, wp = window_list; windex < MAX_WINDOWS; windex++, wp++)
  614. X!     if (wp->type != NHW_NONE && wp->w == w) break;
  615. X      if (windex == MAX_WINDOWS) panic("find_widget:  can't match widget");
  616. X      return wp;
  617. X  }
  618. X--- 152,159 ----
  619. X  
  620. X      /* This is sad.  Search to find the corresponding window. */
  621. X      for (windex = 0, wp = window_list; windex < MAX_WINDOWS; windex++, wp++)
  622. X!     if (wp->type != NHW_NONE &&
  623. X!         (wp->w == w || (wp->w && XtParent(wp->w) == w))) break;
  624. X      if (windex == MAX_WINDOWS) panic("find_widget:  can't match widget");
  625. X      return wp;
  626. X  }
  627. X***************
  628. X*** 277,283 ****
  629. X       XtAppWarningMsg(app, "wrongParameters", "cvtStringToPixel",
  630. X      "XtToolkitError",
  631. X      "String to pixel conversion needs screen and colormap arguments",
  632. X!         (String *)NULL, (Cardinal *)NULL);
  633. X       return False;
  634. X      }
  635. X  
  636. X--- 297,303 ----
  637. X       XtAppWarningMsg(app, "wrongParameters", "cvtStringToPixel",
  638. X      "XtToolkitError",
  639. X      "String to pixel conversion needs screen and colormap arguments",
  640. X!     (String *)0, (Cardinal *)0);
  641. X       return False;
  642. X      }
  643. X  
  644. X***************
  645. X*** 329,335 ****
  646. X      return False;
  647. X      } else {
  648. X      *closure_ret = (char*)True;
  649. X!         done(Pixel, screenColor.pixel);
  650. X      }
  651. X  }
  652. X  
  653. X--- 349,355 ----
  654. X      return False;
  655. X      } else {
  656. X      *closure_ret = (char*)True;
  657. X!     done(Pixel, screenColor.pixel);
  658. X      }
  659. X  }
  660. X  
  661. X***************
  662. X*** 349,355 ****
  663. X       XtAppWarningMsg(app, "wrongParameters",
  664. X               "freePixel", "XtToolkitError",
  665. X               "Freeing a pixel requires screen and colormap arguments",
  666. X!              (String *)NULL, (Cardinal *)NULL);
  667. X       return;
  668. X      }
  669. X  
  670. X--- 369,375 ----
  671. X       XtAppWarningMsg(app, "wrongParameters",
  672. X               "freePixel", "XtToolkitError",
  673. X               "Freeing a pixel requires screen and colormap arguments",
  674. X!              (String *)0, (Cardinal *)0);
  675. X       return;
  676. X      }
  677. X  
  678. X***************
  679. X*** 574,580 ****
  680. X      switch (wp->type) {
  681. X      case NHW_MAP:
  682. X          if (wp->popup)
  683. X!         nh_XtPopup(wp->popup, XtGrabNone, wp->w);
  684. X          /*else
  685. X           *  XtMapWidget(toplevel);
  686. X           *
  687. X--- 594,600 ----
  688. X      switch (wp->type) {
  689. X      case NHW_MAP:
  690. X          if (wp->popup)
  691. X!         nh_XtPopup(wp->popup, (int)XtGrabNone, wp->w);
  692. X          /*else
  693. X           *  XtMapWidget(toplevel);
  694. X           *
  695. X***************
  696. X*** 605,611 ****
  697. X          break;
  698. X      case NHW_MESSAGE:
  699. X          if (wp->popup)
  700. X!          nh_XtPopup(wp->popup, XtGrabNone, wp->w);
  701. X          /*else
  702. X           *    XtMapWidget(toplevel);
  703. X           *
  704. X--- 625,631 ----
  705. X          break;
  706. X      case NHW_MESSAGE:
  707. X          if (wp->popup)
  708. X!          nh_XtPopup(wp->popup, (int)XtGrabNone, wp->w);
  709. X          /*else
  710. X           *    XtMapWidget(toplevel);
  711. X           *
  712. X***************
  713. X*** 616,622 ****
  714. X          break;
  715. X      case NHW_STATUS:
  716. X          if (wp->popup)
  717. X!         nh_XtPopup(wp->popup, XtGrabNone, wp->w);
  718. X          /*else
  719. X           *    XtMapWidget(toplevel);
  720. X           *
  721. X--- 636,642 ----
  722. X          break;
  723. X      case NHW_STATUS:
  724. X          if (wp->popup)
  725. X!         nh_XtPopup(wp->popup, (int)XtGrabNone, wp->w);
  726. X          /*else
  727. X           *    XtMapWidget(toplevel);
  728. X           *
  729. X***************
  730. X*** 741,755 ****
  731. X--- 761,784 ----
  732. X  
  733. X  XtAppContext app_context;        /* context of application */
  734. X  Widget         toplevel = (Widget) 0;    /* toplevel widget */
  735. X+ Atom         wm_delete_window;        /* To pop-down windows */
  736. X  
  737. X  static XtActionsRec actions[] = {
  738. X      {"dismiss_file",    dismiss_file},    /* action for file viewing widget */
  739. X+     {"delete_file",    delete_file},    /* action for file delete-window */
  740. X      {"dismiss_text",    dismiss_text},    /* button action for text widget */
  741. X+     {"delete_text",    delete_text},    /* delete action for text widget */
  742. X      {"key_dismiss_text",key_dismiss_text},/* key action for text widget */
  743. X      {"menu_key",    menu_key},    /* action for menu accelerators */
  744. X      {"yn_key",        yn_key},    /* action for yn accelerators */
  745. X+     {"yn_delete",    yn_delete},    /* action for yn delete-window */
  746. X+     {"askname_delete",    askname_delete},/* action for askname delete-window */
  747. X+     {"getline_delete",    getline_delete},/* action for getline delete-window */
  748. X+     {"menu_delete",    menu_delete},    /* action for menu delete-window */
  749. X      {"ec_key",        ec_key},    /* action for extended commands */
  750. X+     {"ec_delete",    ec_delete},    /* action for ext-com menu delete */
  751. X      {"ps_key",        ps_key},    /* action for player selection */
  752. X+     {"X11_hangup",    X11_hangup},    /* action for delete of top-level */
  753. X  };
  754. X  
  755. X  static XtResource resources[] = {
  756. X***************
  757. X*** 793,802 ****
  758. X      toplevel = XtAppInitialize(
  759. X              &app_context,
  760. X              "NetHack",        /* application class */
  761. X!             NULL, 0,        /* options list */
  762. X              &i, av,        /* command line args */
  763. X!             NULL,        /* fallback resources */
  764. X!             args, num_args);
  765. X  
  766. X      /* We don't need to realize the top level widget. */
  767. X  
  768. X--- 822,833 ----
  769. X      toplevel = XtAppInitialize(
  770. X              &app_context,
  771. X              "NetHack",        /* application class */
  772. X!             (XrmOptionDescList)0, 0,    /* options list */
  773. X              &i, av,        /* command line args */
  774. X!             (String *)0,    /* fallback resources */
  775. X!             (ArgList)args, num_args);
  776. X!     XtOverrideTranslations(toplevel,
  777. X!     XtParseTranslationTable("<Message>WM_PROTOCOLS: X11_hangup()"));
  778. X  
  779. X      /* We don't need to realize the top level widget. */
  780. X  
  781. X***************
  782. X*** 803,809 ****
  783. X  #ifdef TEXTCOLOR
  784. X      /* add new color converter to deal with overused colormaps */
  785. X      XtSetTypeConverter(XtRString, XtRPixel, nhCvtStringToPixel,
  786. X!                nhcolorConvertArgs, XtNumber(nhcolorConvertArgs),
  787. X                 XtCacheByDisplay, nhFreePixel);
  788. X  #endif /* TEXTCOLOR */
  789. X  
  790. X--- 834,841 ----
  791. X  #ifdef TEXTCOLOR
  792. X      /* add new color converter to deal with overused colormaps */
  793. X      XtSetTypeConverter(XtRString, XtRPixel, nhCvtStringToPixel,
  794. X!                (XtConvertArgList)nhcolorConvertArgs, 
  795. X!                XtNumber(nhcolorConvertArgs),
  796. X                 XtCacheByDisplay, nhFreePixel);
  797. X  #endif /* TEXTCOLOR */
  798. X  
  799. X***************
  800. X*** 811,818 ****
  801. X      XtAppAddActions(app_context, actions, XtNumber(actions));
  802. X  
  803. X      /* Get application-wide resources */
  804. X!     XtGetApplicationResources(toplevel,(XtPointer)&appResources,
  805. X!                   resources,XtNumber(resources),NULL,ZERO);
  806. X  
  807. X      /* Initialize other things. */
  808. X      init_standard_windows();
  809. X--- 843,851 ----
  810. X      XtAppAddActions(app_context, actions, XtNumber(actions));
  811. X  
  812. X      /* Get application-wide resources */
  813. X!     XtGetApplicationResources(toplevel, (XtPointer)&appResources,
  814. X!                   resources, XtNumber(resources),
  815. X!                   (ArgList)0, ZERO);
  816. X  
  817. X      /* Initialize other things. */
  818. X      init_standard_windows();
  819. X***************
  820. X*** 909,916 ****
  821. X--- 942,973 ----
  822. X      (void) x_event(EXIT_ON_SENT_EVENT);
  823. X  }
  824. X  
  825. X+ /* X11_hangup -------------------------------------------------------------- */
  826. X+ /* ARGSUSED */
  827. X+ static void
  828. X+ X11_hangup(w, event, params, num_params)
  829. X+     Widget w;
  830. X+     XEvent *event;
  831. X+     String *params;
  832. X+     Cardinal *num_params;
  833. X+ {
  834. X+     (void) hangup();
  835. X+ }
  836. X  
  837. X  /* askname ----------------------------------------------------------------- */
  838. X+ /* ARGSUSED */
  839. X+ static void
  840. X+ askname_delete(w, event, params, num_params)
  841. X+     Widget w;
  842. X+     XEvent *event;
  843. X+     String *params;
  844. X+     Cardinal *num_params;
  845. X+ {
  846. X+     nh_XtPopdown(w);
  847. X+     (void) strcpy(plname, "Mumbles");    /* give them a name... ;-) */
  848. X+     exit_x_event = TRUE;
  849. X+ }
  850. X+ 
  851. X  /* Callback for askname dialog widget. */
  852. X  /* ARGSUSED */
  853. X  static void
  854. X***************
  855. X*** 952,957 ****
  856. X--- 1009,1016 ----
  857. X  
  858. X      popup = XtCreatePopupShell("askname", transientShellWidgetClass,
  859. X                     toplevel, args, ONE);
  860. X+     XtOverrideTranslations(popup,
  861. X+     XtParseTranslationTable("<Message>WM_PROTOCOLS: askname_delete()"));
  862. X  
  863. X      dialog = CreateDialog(popup, "dialog",
  864. X                      askname_done, (XtCallbackProc) 0);
  865. X***************
  866. X*** 960,968 ****
  867. X      SetDialogResponse(dialog, "");        /* set default answer */
  868. X  
  869. X      XtRealizeWidget(popup);
  870. X!     positionpopup(popup);        /* center on cursor */
  871. X  
  872. X!     nh_XtPopup(popup, XtGrabExclusive, dialog);
  873. X  
  874. X      /* The callback will enable the event loop exit. */
  875. X      (void) x_event(EXIT_ON_EXIT);
  876. X--- 1019,1027 ----
  877. X      SetDialogResponse(dialog, "");        /* set default answer */
  878. X  
  879. X      XtRealizeWidget(popup);
  880. X!     positionpopup(popup, TRUE);        /* center,bottom */
  881. X  
  882. X!     nh_XtPopup(popup, (int)XtGrabExclusive, dialog);
  883. X  
  884. X      /* The callback will enable the event loop exit. */
  885. X      (void) x_event(EXIT_ON_EXIT);
  886. X***************
  887. X*** 990,1005 ****
  888. X      Widget dialog = (Widget) client_data;
  889. X  
  890. X      s = (char *) GetDialogResponse(dialog);
  891. X! 
  892. X!     if (strlen(s) == 0)
  893. X!     Strcpy(getline_input, CANCEL_STR);
  894. X!     else
  895. X!     Strcpy(getline_input, s);
  896. X! 
  897. X      nh_XtPopdown(XtParent(dialog));
  898. X      exit_x_event = TRUE;
  899. X  }
  900. X  
  901. X  /* Callback for getline dialog widget. */
  902. X  /* ARGSUSED */
  903. X  static void
  904. X--- 1049,1072 ----
  905. X      Widget dialog = (Widget) client_data;
  906. X  
  907. X      s = (char *) GetDialogResponse(dialog);
  908. X!     Strcpy(getline_input, s);
  909. X      nh_XtPopdown(XtParent(dialog));
  910. X      exit_x_event = TRUE;
  911. X  }
  912. X  
  913. X+ /* ARGSUSED */
  914. X+ static void
  915. X+ getline_delete(w, event, params, num_params)
  916. X+     Widget w;
  917. X+     XEvent *event;
  918. X+     String *params;
  919. X+     Cardinal *num_params;
  920. X+ {
  921. X+     Strcpy(getline_input, CANCEL_STR);
  922. X+     nh_XtPopdown(w);
  923. X+     exit_x_event = TRUE;
  924. X+ }
  925. X+ 
  926. X  /* Callback for getline dialog widget. */
  927. X  /* ARGSUSED */
  928. X  static void
  929. X***************
  930. X*** 1035,1051 ****
  931. X  
  932. X      getline_popup = XtCreatePopupShell("getline",transientShellWidgetClass,
  933. X                     toplevel, args, ONE);
  934. X  
  935. X      getline_dialog = CreateDialog(getline_popup, "dialog",
  936. X                      done_button, abort_button);
  937. X  
  938. X      XtRealizeWidget(getline_popup);
  939. X      }
  940. X!     SetDialogPrompt(getline_dialog, question);    /* set prompt */
  941. X      SetDialogResponse(getline_dialog, "");    /* set default answer */
  942. X!     positionpopup(getline_popup);        /* center on cursor */
  943. X  
  944. X!     nh_XtPopup(getline_popup, XtGrabNone, getline_dialog);
  945. X  
  946. X      /* The callback will enable the event loop exit. */
  947. X      (void) x_event(EXIT_ON_EXIT);
  948. X--- 1102,1122 ----
  949. X  
  950. X      getline_popup = XtCreatePopupShell("getline",transientShellWidgetClass,
  951. X                     toplevel, args, ONE);
  952. X+     XtOverrideTranslations(getline_popup,
  953. X+         XtParseTranslationTable("<Message>WM_PROTOCOLS: getline_delete()"));
  954. X  
  955. X      getline_dialog = CreateDialog(getline_popup, "dialog",
  956. X                      done_button, abort_button);
  957. X  
  958. X      XtRealizeWidget(getline_popup);
  959. X+     XSetWMProtocols(XtDisplay(getline_popup), XtWindow(getline_popup),
  960. X+             &wm_delete_window, 1);
  961. X      }
  962. X!     SetDialogPrompt(getline_dialog, (String)question);    /* set prompt */
  963. X      SetDialogResponse(getline_dialog, "");    /* set default answer */
  964. X!     positionpopup(getline_popup, TRUE);        /* center,bottom */
  965. X  
  966. X!     nh_XtPopup(getline_popup, (int)XtGrabNone, getline_dialog);
  967. X  
  968. X      /* The callback will enable the event loop exit. */
  969. X      (void) x_event(EXIT_ON_EXIT);
  970. X***************
  971. X*** 1055,1063 ****
  972. X--- 1126,1149 ----
  973. X  /* Display file ------------------------------------------------------------ */
  974. X  static const char display_translations[] =
  975. X      "#override\n\
  976. X+      <Key>q: dismiss_file()\n\
  977. X+      <Key>Escape: dismiss_file()\n\
  978. X       <BtnDown>: dismiss_file()";
  979. X  
  980. X  
  981. X+ /* WM_DELETE_WINDOW callback for file dismissal. */
  982. X+ /*ARGSUSED*/
  983. X+ static void
  984. X+ delete_file(w, event, params, num_params)
  985. X+     Widget w;
  986. X+     XEvent *event;
  987. X+     String *params;
  988. X+     Cardinal *num_params;
  989. X+ {
  990. X+     nh_XtPopdown(w);
  991. X+     XtDestroyWidget(w);
  992. X+ }
  993. X+ 
  994. X  /* Callback for file dismissal. */
  995. X  /*ARGSUSED*/
  996. X  static void
  997. X***************
  998. X*** 1117,1122 ****
  999. X--- 1203,1210 ----
  1000. X  
  1001. X      popup = XtCreatePopupShell("display_file", topLevelShellWidgetClass,
  1002. X                             toplevel, args, num_args);
  1003. X+     XtOverrideTranslations(popup,
  1004. X+     XtParseTranslationTable("<Message>WM_PROTOCOLS: delete_file()"));
  1005. X  
  1006. X      num_args = 0;
  1007. X      XtSetArg(args[num_args], XtNscrollHorizontal,
  1008. X***************
  1009. X*** 1161,1167 ****
  1010. X      XtSetArg(args[num_args], XtNheight, new_height); num_args++;
  1011. X      XtSetValues(dispfile, args, num_args);
  1012. X  
  1013. X!     nh_XtPopup(popup, XtGrabNone, None);
  1014. X  }
  1015. X  
  1016. X  
  1017. X--- 1249,1255 ----
  1018. X      XtSetArg(args[num_args], XtNheight, new_height); num_args++;
  1019. X      XtSetValues(dispfile, args, num_args);
  1020. X  
  1021. X!     nh_XtPopup(popup, (int)XtGrabNone, None);
  1022. X  }
  1023. X  
  1024. X  
  1025. X***************
  1026. X*** 1194,1209 ****
  1027. X  {
  1028. X      char keystring[MAX_KEY_STRING];
  1029. X      int nbytes;
  1030. X  
  1031. X!     nbytes = XLookupString(key, keystring, MAX_KEY_STRING, NULL, NULL);
  1032. X  
  1033. X      /* Modifier keys return a zero lengh string when pressed. */
  1034. X      if (nbytes == 0) return '\0';
  1035. X  
  1036. X!     return keystring[0];
  1037. X  }
  1038. X  
  1039. X  /*
  1040. X   * Called when we get a key press event on a yn window.
  1041. X   */
  1042. X  /* ARGSUSED */
  1043. X--- 1282,1316 ----
  1044. X  {
  1045. X      char keystring[MAX_KEY_STRING];
  1046. X      int nbytes;
  1047. X+     boolean meta = !!(key->state & Mod1Mask);
  1048. X  
  1049. X!     nbytes = XLookupString(key, keystring, MAX_KEY_STRING,
  1050. X!                (KeySym *)0, (XComposeStatus *)0);
  1051. X  
  1052. X      /* Modifier keys return a zero lengh string when pressed. */
  1053. X      if (nbytes == 0) return '\0';
  1054. X  
  1055. X!     return (char) (((int) keystring[0]) + (meta ? 0x80 : 0));
  1056. X  }
  1057. X  
  1058. X  /*
  1059. X+  * Called when we get a WM_DELETE_WINDOW event on a yn window.
  1060. X+  */
  1061. X+ /* ARGSUSED */
  1062. X+ static void
  1063. X+ yn_delete(w, event, params, num_params)
  1064. X+     Widget w;
  1065. X+     XEvent *event;
  1066. X+     String *params;
  1067. X+     Cardinal *num_params;
  1068. X+ {
  1069. X+     yn_getting_num = FALSE;
  1070. X+     /* Only use yn_esc_map if we have choices.  Otherwise, return ESC. */
  1071. X+     yn_return = yn_choices ? yn_esc_map : '\033';
  1072. X+     exit_x_event = TRUE;    /* exit our event handler */
  1073. X+ }
  1074. X+ 
  1075. X+ /*
  1076. X   * Called when we get a key press event on a yn window.
  1077. X   */
  1078. X  /* ARGSUSED */
  1079. X***************
  1080. X*** 1217,1223 ****
  1081. X      char ch;
  1082. X  
  1083. X      if(appResources.slow && !input_func)
  1084. X!     extern_map_input(event);
  1085. X  
  1086. X      ch = key_event_to_char((XKeyEvent *) event);
  1087. X  
  1088. X--- 1324,1330 ----
  1089. X      char ch;
  1090. X  
  1091. X      if(appResources.slow && !input_func)
  1092. X!     map_input(w, event, params, num_params);
  1093. X  
  1094. X      ch = key_event_to_char((XKeyEvent *) event);
  1095. X  
  1096. X***************
  1097. X*** 1268,1273 ****
  1098. X--- 1375,1381 ----
  1099. X  
  1100. X      if (yn_getting_num) {
  1101. X          yn_return = '#';
  1102. X+         if (yn_val < 0) yn_val = 0;
  1103. X          yn_number = yn_val;    /* assign global */
  1104. X      }
  1105. X      }
  1106. X***************
  1107. X*** 1324,1329 ****
  1108. X--- 1432,1439 ----
  1109. X      XtSetArg(args[0], XtNallowShellResize, True);
  1110. X      yn_popup = XtCreatePopupShell("query", transientShellWidgetClass,
  1111. X                      toplevel, args, ONE);
  1112. X+     XtOverrideTranslations(yn_popup,
  1113. X+         XtParseTranslationTable("<Message>WM_PROTOCOLS: yn_delete()"));
  1114. X  
  1115. X      num_args = 0;
  1116. X      XtSetArg(args[num_args], XtNtranslations,
  1117. X***************
  1118. X*** 1334,1339 ****
  1119. X--- 1444,1451 ----
  1120. X                  args, num_args);
  1121. X  
  1122. X      XtRealizeWidget(yn_popup);
  1123. X+     XSetWMProtocols(XtDisplay(yn_popup), XtWindow(yn_popup),
  1124. X+             &wm_delete_window, 1);
  1125. X      }
  1126. X  
  1127. X      if(appResources.slow)
  1128. X***************
  1129. X*** 1352,1359 ****
  1130. X      XtSetArg(args[num_args], XtNlabel, buf); num_args++;
  1131. X      XtSetValues(yn_label, args, num_args);
  1132. X  
  1133. X!     positionpopup(yn_popup);
  1134. X!     nh_XtPopup(yn_popup, XtGrabExclusive, yn_label);
  1135. X      }
  1136. X  
  1137. X      yn_getting_num = FALSE;
  1138. X--- 1464,1471 ----
  1139. X      XtSetArg(args[num_args], XtNlabel, buf); num_args++;
  1140. X      XtSetValues(yn_label, args, num_args);
  1141. X  
  1142. X!     positionpopup(yn_popup, TRUE);
  1143. X!     nh_XtPopup(yn_popup, (int)XtGrabExclusive, yn_label);
  1144. X      }
  1145. X  
  1146. X      yn_getting_num = FALSE;
  1147. X***************
  1148. X*** 1399,1407 ****
  1149. X      XtPointer data;
  1150. X      XEvent *event;
  1151. X  {
  1152. X!     extern_map_input(event);
  1153. X  }
  1154. X  
  1155. X  /*
  1156. X   * Set up the playing console.  This has three major parts:  the
  1157. X   * message window, the map, and the status window.
  1158. X--- 1511,1539 ----
  1159. X      XtPointer data;
  1160. X      XEvent *event;
  1161. X  {
  1162. X!     Cardinal num = 0;
  1163. X!     map_input(window_list[WIN_MAP].w, event, (String*) 0, &num);
  1164. X  }
  1165. X  
  1166. X+ /*ARGSUSED*/
  1167. X+ static void
  1168. X+ win_visible(w, data, event, flag)    /* only called for autofocus */
  1169. X+     Widget w;
  1170. X+     XtPointer data;    /* client_data not used */
  1171. X+     XEvent *event;
  1172. X+     Boolean *flag;    /* continue_to_dispatch flag not used */
  1173. X+ {
  1174. X+     XVisibilityEvent *vis_event = (XVisibilityEvent *)event;
  1175. X+ 
  1176. X+     if (vis_event->state != VisibilityFullyObscured) {
  1177. X+     /* one-time operation; cancel ourself */
  1178. X+     XtRemoveEventHandler(toplevel, VisibilityChangeMask, False,
  1179. X+                  win_visible, (XtPointer) 0);
  1180. X+     /* grab initial input focus */
  1181. X+     XSetInputFocus(XtDisplay(w), XtWindow(w), RevertToNone, CurrentTime);
  1182. X+     }
  1183. X+ }
  1184. X+ 
  1185. X  /*
  1186. X   * Set up the playing console.  This has three major parts:  the
  1187. X   * message window, the map, and the status window.
  1188. X***************
  1189. X*** 1426,1431 ****
  1190. X--- 1558,1567 ----
  1191. X      XtAddEventHandler(form, KeyPressMask, False,
  1192. X                (XtEventHandler) msgkey, (XtPointer) 0);
  1193. X  
  1194. X+     if (appResources.autofocus)
  1195. X+     XtAddEventHandler(toplevel, VisibilityChangeMask, False,
  1196. X+               win_visible, (XtPointer) 0);
  1197. X+ 
  1198. X      /*
  1199. X       * Create message window.
  1200. X       */
  1201. X***************
  1202. X*** 1513,1527 ****
  1203. X       */
  1204. X      /* XtSetMappedWhenManaged(toplevel, False); */
  1205. X      XtRealizeWidget(toplevel);
  1206. X!     /*
  1207. X!      * The message window was the size we want the viewport to take (when
  1208. X!      * realized).  Now change to our real height.  Do this before we resize
  1209. X!      * so that the vertical scrollbar is activated and is taken into account
  1210. X!      * when calculating the widget size.  If we do this last, then the
  1211. X!      * message window ends up being short by one scrollbar width.  [Brain-dead
  1212. X!      * viewport widget.]
  1213. X!      */
  1214. X!     set_message_height(&window_list[message_win], (int) flags.msg_history);
  1215. X  
  1216. X      /*
  1217. X       * Now get the default widths of the windows.
  1218. X--- 1649,1658 ----
  1219. X       */
  1220. X      /* XtSetMappedWhenManaged(toplevel, False); */
  1221. X      XtRealizeWidget(toplevel);
  1222. X!     wm_delete_window = XInternAtom(XtDisplay(toplevel),
  1223. X!                    "WM_DELETE_WINDOW", False);
  1224. X!     XSetWMProtocols(XtDisplay(toplevel), XtWindow(toplevel),
  1225. X!             &wm_delete_window, 1);
  1226. X  
  1227. X      /*
  1228. X       * Now get the default widths of the windows.
  1229. X***************
  1230. X*** 1584,1608 ****
  1231. X      set_map_size(&window_list[map_win], COLNO, ROWNO);
  1232. X      set_message_slider(&window_list[message_win]);
  1233. X  
  1234. X-     /* grab initial input focus */
  1235. X-     if (appResources.autofocus) {
  1236. X-     Display *dpy = XtDisplay(toplevel);
  1237. X-     Window   win = XtWindow(toplevel), current;
  1238. X-     int      revert;
  1239. X- 
  1240. X-     /*
  1241. X-      * We don't actually care about the `revert' value; this mainly serves
  1242. X-      * the purpose of synchronizing with the popup.
  1243. X-      */
  1244. X-     XGetInputFocus(dpy, ¤t, &revert);
  1245. X- 
  1246. X-     /* attach the keyboard to the main window */
  1247. X-     if (win != current) {
  1248. X-         sleep(1);    /* ugh, delay so window is showing.. */
  1249. X-         XSetInputFocus(dpy, win, revert, CurrentTime);
  1250. X-     }
  1251. X-     }
  1252. X- 
  1253. X      /* attempt to catch fatal X11 errors before the program quits */
  1254. X      (void) XtAppSetErrorHandler(app_context, (XtErrorHandler) hangup);
  1255. X  
  1256. X--- 1715,1720 ----
  1257. X***************
  1258. X*** 1618,1623 ****
  1259. X--- 1730,1736 ----
  1260. X      Widget childwid;    /* child to recieve focus (can be None) */
  1261. X  {
  1262. X      XtPopup(w, (XtGrabKind)g);
  1263. X+     XSetWMProtocols(XtDisplay(w), XtWindow(w), &wm_delete_window, 1);
  1264. X      if (appResources.autofocus) XtSetKeyboardFocus(toplevel, childwid);
  1265. X  }
  1266. X  
  1267. X*** /tmp/da10302    Thu Feb 25 10:33:09 1993
  1268. X--- win/X11/winmap.c    Wed Feb 24 16:11:30 1993
  1269. X***************
  1270. X*** 1,4 ****
  1271. X! /*    SCCS Id: @(#)winmap.c    3.1    92/04/30          */
  1272. X  /* Copyright (c) Dean Luick, 1992                  */
  1273. X  /* NetHack may be freely redistributed.  See license for details. */
  1274. X  
  1275. X--- 1,4 ----
  1276. X! /*    SCCS Id: @(#)winmap.c    3.1    93/02/02          */
  1277. X  /* Copyright (c) Dean Luick, 1992                  */
  1278. X  /* NetHack may be freely redistributed.  See license for details. */
  1279. X  
  1280. X***************
  1281. X*** 14,19 ****
  1282. X--- 14,24 ----
  1283. X   *      values in the Window widget.  I am _not_ in favor of including
  1284. X   *      some nethack include file for Window.c.
  1285. X   */
  1286. X+ 
  1287. X+ #ifndef SYSV
  1288. X+ #define PRESERVE_NO_SYSV    /* X11 include files may define SYSV */
  1289. X+ #endif
  1290. X+ 
  1291. X  #include <X11/Intrinsic.h>
  1292. X  #include <X11/StringDefs.h>
  1293. X  #include <X11/Shell.h>
  1294. X***************
  1295. X*** 20,25 ****
  1296. X--- 25,39 ----
  1297. X  #include <X11/Xaw/Cardinals.h>
  1298. X  #include <X11/Xaw/Scrollbar.h>
  1299. X  #include <X11/Xaw/Viewport.h>
  1300. X+ #include <X11/Xatom.h>
  1301. X+ 
  1302. X+ #ifdef PRESERVE_NO_SYSV
  1303. X+ # ifdef SYSV
  1304. X+ #  undef SYSV
  1305. X+ # endif
  1306. X+ # undef PRESERVE_NO_SYSV
  1307. X+ #endif
  1308. X+ 
  1309. X  #include "Window.h"    /* map widget declarations */
  1310. X  
  1311. X  #include "hack.h"
  1312. X***************
  1313. X*** 30,44 ****
  1314. X  /* #define VERBOSE_UPDATE    /* print screen update bounds */
  1315. X  /* #define VERBOSE_INPUT    /* print input events */
  1316. X  
  1317. X! static void set_button_values();
  1318. X! static void map_check_size_change();
  1319. X! static void map_update();
  1320. X! static void map_exposed();
  1321. X! static void map_input();
  1322. X! static void set_gc();
  1323. X! static void get_gc();
  1324. X! static void get_char_info();
  1325. X! static void display_cursor();
  1326. X  
  1327. X  /* Global functions ======================================================== */
  1328. X  
  1329. X--- 44,57 ----
  1330. X  /* #define VERBOSE_UPDATE    /* print screen update bounds */
  1331. X  /* #define VERBOSE_INPUT    /* print input events */
  1332. X  
  1333. X! static void FDECL(set_button_values, (Widget,int,int,unsigned));
  1334. X! static void FDECL(map_check_size_change, (struct xwindow *));
  1335. X! static void FDECL(map_update, (struct xwindow *,int,int,int,int,BOOLEAN_P));
  1336. X! static void FDECL(map_exposed, (Widget,XtPointer,XtPointer));
  1337. X! static void FDECL(set_gc, (Widget,Font,char *,Pixel,GC *,GC *));
  1338. X! static void FDECL(get_gc, (struct xwindow *,Font));
  1339. X! static void FDECL(get_char_info, (struct xwindow *));
  1340. X! static void FDECL(display_cursor, (struct xwindow *));
  1341. X  
  1342. X  /* Global functions ======================================================== */
  1343. X  
  1344. X***************
  1345. X*** 514,540 ****
  1346. X  int inptr = 0;    /* points to valid data */
  1347. X  
  1348. X  
  1349. X- void
  1350. X- extern_map_input(event)
  1351. X-     XEvent *event;
  1352. X- {
  1353. X-     if(event->type == KeyPress)
  1354. X-     map_input(window_list[WIN_MAP].w, (XtPointer) 0, (XtPointer) event);
  1355. X- }
  1356. X- 
  1357. X  /*
  1358. X   * Keyboard and button event handler for map window.
  1359. X   */
  1360. X! /* ARGSUSED */
  1361. X! static void
  1362. X! map_input(w, client_data, call_data)
  1363. X!     Widget w;
  1364. X!     XtPointer client_data, call_data;
  1365. X  {
  1366. X-     XEvent *event = (XEvent *) call_data;
  1367. X      XKeyEvent *key;
  1368. X      XButtonEvent *button;
  1369. X      int i, nbytes;
  1370. X      char c;
  1371. X      char keystring[MAX_KEY_STRING];
  1372. X  
  1373. X--- 527,547 ----
  1374. X  int inptr = 0;    /* points to valid data */
  1375. X  
  1376. X  
  1377. X  /*
  1378. X   * Keyboard and button event handler for map window.
  1379. X   */
  1380. X! void
  1381. X! map_input(w, event, params, num_params)
  1382. X!     Widget   w;
  1383. X!     XEvent   *event;
  1384. X!     String   *params;
  1385. X!     Cardinal *num_params;
  1386. X  {
  1387. X      XKeyEvent *key;
  1388. X      XButtonEvent *button;
  1389. X+     boolean meta = FALSE;
  1390. X      int i, nbytes;
  1391. X+     Cardinal in_nparams = (num_params ? *num_params : 0);
  1392. X      char c;
  1393. X      char keystring[MAX_KEY_STRING];
  1394. X  
  1395. X***************
  1396. X*** 544,549 ****
  1397. X--- 551,562 ----
  1398. X  #ifdef VERBOSE_INPUT
  1399. X          printf("button press\n");
  1400. X  #endif
  1401. X+         if (in_nparams > 0 &&
  1402. X+         (nbytes = strlen(params[0])) < MAX_KEY_STRING) {
  1403. X+         Strcpy(keystring, params[0]);
  1404. X+         key = (XKeyEvent *) event; /* just in case */
  1405. X+         goto key_events;
  1406. X+         }
  1407. X          set_button_values(w, button->x, button->y, button->button);
  1408. X          break;
  1409. X      case KeyPress:
  1410. X***************
  1411. X*** 551,557 ****
  1412. X          printf("key: ");
  1413. X  #endif
  1414. X          if(appResources.slow && input_func) {
  1415. X!         (*input_func)(w, event, NULL, NULL);
  1416. X          break;
  1417. X          }
  1418. X  
  1419. X--- 564,570 ----
  1420. X          printf("key: ");
  1421. X  #endif
  1422. X          if(appResources.slow && input_func) {
  1423. X!         (*input_func)(w, event, params, num_params);
  1424. X          break;
  1425. X          }
  1426. X  
  1427. X***************
  1428. X*** 560,566 ****
  1429. X           * to allow keys mapped to multiple characters.
  1430. X           */
  1431. X          key = (XKeyEvent *) event;
  1432. X!         nbytes = XLookupString(key, keystring, MAX_KEY_STRING, NULL, NULL);
  1433. X          /* Modifier keys return a zero length string when pressed. */
  1434. X          if (nbytes) {
  1435. X  #ifdef VERBOSE_INPUT
  1436. X--- 573,591 ----
  1437. X           * to allow keys mapped to multiple characters.
  1438. X           */
  1439. X          key = (XKeyEvent *) event;
  1440. X!         if (in_nparams > 0 &&
  1441. X!         (nbytes = strlen(params[0])) < MAX_KEY_STRING) {
  1442. X!         Strcpy(keystring, params[0]);
  1443. X!         } else {
  1444. X!         /*
  1445. X!          * Assume that mod1 is really the meta key.
  1446. X!          */
  1447. X!         meta = !!(key->state & Mod1Mask);
  1448. X!         nbytes =
  1449. X!             XLookupString(key, keystring, MAX_KEY_STRING,
  1450. X!                   (KeySym *)0, (XComposeStatus *)0);
  1451. X!         }
  1452. X!     key_events:
  1453. X          /* Modifier keys return a zero length string when pressed. */
  1454. X          if (nbytes) {
  1455. X  #ifdef VERBOSE_INPUT
  1456. X***************
  1457. X*** 571,586 ****
  1458. X  
  1459. X              if (incount < INBUF_SIZE) {
  1460. X              inbuf[(inptr+incount)%INBUF_SIZE] =
  1461. X!                 ((int) c) + ((key->state & Mod1Mask) ? 0x80 : 0);
  1462. X              incount++;
  1463. X              } else {
  1464. X              X11_nhbell();
  1465. X              }
  1466. X  #ifdef VERBOSE_INPUT
  1467. X!             /*
  1468. X!              * Assume that mod1 is really the meta key.
  1469. X!              */
  1470. X!             if (key->state & Mod1Mask)    /* meta will print as M<c> */
  1471. X              (void) putchar('M');
  1472. X              if (c < ' ') {        /* ctrl will print as ^<c> */
  1473. X              (void) putchar('^');
  1474. X--- 596,608 ----
  1475. X  
  1476. X              if (incount < INBUF_SIZE) {
  1477. X              inbuf[(inptr+incount)%INBUF_SIZE] =
  1478. X!                 ((int) c) + (meta ? 0x80 : 0);
  1479. X              incount++;
  1480. X              } else {
  1481. X              X11_nhbell();
  1482. X              }
  1483. X  #ifdef VERBOSE_INPUT
  1484. X!             if (meta)            /* meta will print as M<c> */
  1485. X              (void) putchar('M');
  1486. X              if (c < ' ') {        /* ctrl will print as ^<c> */
  1487. X              (void) putchar('^');
  1488. X***************
  1489. X*** 629,638 ****
  1490. X  /*
  1491. X   * Map window expose callback.
  1492. X   */
  1493. X  static void
  1494. X! map_exposed(w, event)
  1495. X      Widget w;
  1496. X!     XExposeEvent *event;
  1497. X  {
  1498. X      int x, y;
  1499. X      struct xwindow *wp;
  1500. X--- 651,662 ----
  1501. X  /*
  1502. X   * Map window expose callback.
  1503. X   */
  1504. X+ /*ARGSUSED*/
  1505. X  static void
  1506. X! map_exposed(w, client_data, widget_data)
  1507. X      Widget w;
  1508. X!     XtPointer client_data;    /* unused */
  1509. X!     XtPointer widget_data;    /* expose event from Window widget */
  1510. X  {
  1511. X      int x, y;
  1512. X      struct xwindow *wp;
  1513. X***************
  1514. X*** 639,646 ****
  1515. X      struct map_info_t *map_info;
  1516. X      unsigned width, height;
  1517. X      int start_row, stop_row, start_col, stop_col;
  1518. X  
  1519. X!     if (!XtIsRealized(w)) return;
  1520. X  
  1521. X      wp = find_widget(w);
  1522. X      map_info = wp->map_information;
  1523. X--- 663,671 ----
  1524. X      struct map_info_t *map_info;
  1525. X      unsigned width, height;
  1526. X      int start_row, stop_row, start_col, stop_col;
  1527. X+     XExposeEvent *event = (XExposeEvent *) widget_data;
  1528. X  
  1529. X!     if (!XtIsRealized(w) || event->count > 0) return;
  1530. X  
  1531. X      wp = find_widget(w);
  1532. X      map_info = wp->map_information;
  1533. X***************
  1534. X*** 839,844 ****
  1535. X--- 864,873 ----
  1536. X      wp->popup = parent = XtCreatePopupShell("nethack",
  1537. X                      topLevelShellWidgetClass,
  1538. X                         toplevel, args, num_args);
  1539. X+     /*
  1540. X+      * If we're here, then this is an auxiliary map window.  If we're
  1541. X+      * cancelled via a delete window message, we should just pop down.
  1542. X+      */
  1543. X      }
  1544. X  
  1545. X      num_args = 0;
  1546. X***************
  1547. X*** 869,875 ****
  1548. X          args,            /* set some values */
  1549. X          num_args);        /* number of values to set */
  1550. X  
  1551. X-     XtAddCallback(map, XtNcallback,      map_input,      (XtPointer) 0);
  1552. X      XtAddCallback(map, XtNexposeCallback, map_exposed, (XtPointer) 0);
  1553. X  
  1554. X      get_char_info(wp);
  1555. X--- 898,903 ----
  1556. X***************
  1557. X*** 898,903 ****
  1558. X--- 926,933 ----
  1559. X       */
  1560. X      if (create_popup) {
  1561. X      XtRealizeWidget(wp->popup);
  1562. X+     XSetWMProtocols(XtDisplay(wp->popup), XtWindow(wp->popup),
  1563. X+             &wm_delete_window, 1);
  1564. X      set_map_size(wp, COLNO, ROWNO);
  1565. X      }
  1566. X  }
  1567. X*** /tmp/da10310    Thu Feb 25 10:33:11 1993
  1568. X--- win/X11/winmenu.c    Wed Feb 24 16:11:37 1993
  1569. X***************
  1570. X*** 1,4 ****
  1571. X! /*    SCCS Id: @(#)winmenu.c    3.1    92/3/7
  1572. X  /* Copyright (c) Dean Luick, 1992                  */
  1573. X  /* NetHack may be freely redistributed.  See license for details. */
  1574. X  
  1575. X--- 1,4 ----
  1576. X! /*    SCCS Id: @(#)winmenu.c    3.1    93/02/04    */
  1577. X  /* Copyright (c) Dean Luick, 1992                  */
  1578. X  /* NetHack may be freely redistributed.  See license for details. */
  1579. X  
  1580. X***************
  1581. X*** 7,12 ****
  1582. X--- 7,17 ----
  1583. X   * 
  1584. X   *     + Global functions: start_menu, add_menu, end_menu, select_menu
  1585. X   */
  1586. X+ 
  1587. X+ #ifndef SYSV
  1588. X+ #define PRESERVE_NO_SYSV    /* X11 include files may define SYSV */
  1589. X+ #endif
  1590. X+ 
  1591. X  #include <X11/Intrinsic.h>
  1592. X  #include <X11/StringDefs.h>
  1593. X  #include <X11/Shell.h>
  1594. X***************
  1595. X*** 13,25 ****
  1596. X  #include <X11/Xaw/List.h>
  1597. X  #include <X11/Xaw/Viewport.h>
  1598. X  #include <X11/Xaw/Cardinals.h>
  1599. X  
  1600. X  #include "hack.h"
  1601. X  #include "winX.h"
  1602. X  
  1603. X  
  1604. X! static void clear_old_menu();
  1605. X! static char *copy_of();
  1606. X  
  1607. X  #define check_menu(func_name)                    \
  1608. X  {                                \
  1609. X--- 18,39 ----
  1610. X  #include <X11/Xaw/List.h>
  1611. X  #include <X11/Xaw/Viewport.h>
  1612. X  #include <X11/Xaw/Cardinals.h>
  1613. X+ #include <X11/Xatom.h>
  1614. X  
  1615. X+ #ifdef PRESERVE_NO_SYSV
  1616. X+ # ifdef SYSV
  1617. X+ #  undef SYSV
  1618. X+ # endif
  1619. X+ # undef PRESERVE_NO_SYSV
  1620. X+ #endif
  1621. X+ 
  1622. X  #include "hack.h"
  1623. X  #include "winX.h"
  1624. X  
  1625. X  
  1626. X! static void FDECL(menu_select, (Widget,XtPointer,XtPointer));
  1627. X! static void FDECL(clear_old_menu, (struct xwindow *));
  1628. X! static char *FDECL(copy_of, (const char *));
  1629. X  
  1630. X  #define check_menu(func_name)                    \
  1631. X  {                                \
  1632. X***************
  1633. X*** 70,75 ****
  1634. X--- 84,105 ----
  1635. X  }
  1636. X  
  1637. X  /*
  1638. X+  * Called when menu window is deleted.
  1639. X+  */
  1640. X+ /* ARGSUSED */
  1641. X+ void
  1642. X+ menu_delete(w, event, params, num_params)
  1643. X+     Widget w;
  1644. X+     XEvent *event;
  1645. X+     String *params;
  1646. X+     Cardinal *num_params;
  1647. X+ {
  1648. X+     menu_selected = '\033';
  1649. X+     nh_XtPopdown(w);        /* this removes the event grab */
  1650. X+     exit_x_event = TRUE;    /* exit our event handler */
  1651. X+ }
  1652. X+ 
  1653. X+ /*
  1654. X   * Called when we get a key press event on a menu window.
  1655. X   */
  1656. X  /* ARGSUSED */
  1657. X***************
  1658. X*** 247,252 ****
  1659. X--- 277,284 ----
  1660. X  
  1661. X      wp->popup = XtCreatePopupShell("menu", transientShellWidgetClass,
  1662. X                     toplevel, args, num_args);
  1663. X+     XtOverrideTranslations(wp->popup,
  1664. X+     XtParseTranslationTable("<Message>WM_PROTOCOLS: menu_delete()"));
  1665. X  
  1666. X      menu_info->list_pointer =
  1667. X      (String *) alloc((unsigned) (sizeof(String) * (menu_info->count+1)));
  1668. X***************
  1669. X*** 305,315 ****
  1670. X      }
  1671. X  
  1672. X      XtRealizeWidget(wp->popup);    /* need to realize before we position */
  1673. X!     positionpopup(wp->popup);
  1674. X  
  1675. X      menu_selected = '\0';
  1676. X  
  1677. X!     nh_XtPopup(wp->popup, XtGrabExclusive, wp->w);
  1678. X      (void) x_event(EXIT_ON_EXIT);
  1679. X  
  1680. X      return menu_selected;
  1681. X--- 337,347 ----
  1682. X      }
  1683. X  
  1684. X      XtRealizeWidget(wp->popup);    /* need to realize before we position */
  1685. X!     positionpopup(wp->popup, FALSE);
  1686. X  
  1687. X      menu_selected = '\0';
  1688. X  
  1689. X!     nh_XtPopup(wp->popup, (int)XtGrabExclusive, wp->w);
  1690. X      (void) x_event(EXIT_ON_EXIT);
  1691. X  
  1692. X      return menu_selected;
  1693. X***************
  1694. X*** 319,325 ****
  1695. X  
  1696. X  static char *
  1697. X  copy_of(s)
  1698. X!     char *s;
  1699. X  {
  1700. X      char *copy;
  1701. X      if (s) {
  1702. X--- 351,357 ----
  1703. X  
  1704. X  static char *
  1705. X  copy_of(s)
  1706. X!     const char *s;
  1707. X  {
  1708. X      char *copy;
  1709. X      if (s) {
  1710. X*** /tmp/da10342    Thu Feb 25 10:33:20 1993
  1711. X--- win/X11/wintext.c    Wed Feb 24 16:12:05 1993
  1712. X***************
  1713. X*** 7,12 ****
  1714. X--- 7,17 ----
  1715. X   * 
  1716. X   *     + No global functions.
  1717. X   */
  1718. X+ 
  1719. X+ #ifndef SYSV
  1720. X+ #define PRESERVE_NO_SYSV    /* X11 include files may define SYSV */
  1721. X+ #endif
  1722. X+ 
  1723. X  #include <X11/Intrinsic.h>
  1724. X  #include <X11/StringDefs.h>
  1725. X  #include <X11/Shell.h>
  1726. X***************
  1727. X*** 13,19 ****
  1728. X--- 18,32 ----
  1729. X  #include <X11/Xos.h>
  1730. X  #include <X11/Xaw/AsciiText.h>
  1731. X  #include <X11/Xaw/Cardinals.h>
  1732. X+ #include <X11/Xatom.h>
  1733. X  
  1734. X+ #ifdef PRESERVE_NO_SYSV
  1735. X+ # ifdef SYSV
  1736. X+ #  undef SYSV
  1737. X+ # endif
  1738. X+ # undef PRESERVE_NO_SYSV
  1739. X+ #endif
  1740. X+ 
  1741. X  #include "hack.h"
  1742. X  #include "winX.h"
  1743. X  
  1744. X***************
  1745. X*** 25,30 ****
  1746. X--- 38,67 ----
  1747. X       <BtnDown>: dismiss_text()\n\
  1748. X       <Key>: key_dismiss_text()";
  1749. X  
  1750. X+ 
  1751. X+ /*ARGSUSED*/
  1752. X+ void
  1753. X+ delete_text(w, event, params, num_params)
  1754. X+     Widget w;
  1755. X+     XEvent *event;
  1756. X+     String *params;
  1757. X+     Cardinal *num_params;
  1758. X+ {
  1759. X+     struct xwindow *wp;
  1760. X+     struct text_info_t *text_info;
  1761. X+ 
  1762. X+     wp = find_widget(w);
  1763. X+     text_info = wp->text_information;
  1764. X+ 
  1765. X+     nh_XtPopdown(w);
  1766. X+ 
  1767. X+     if (text_info->blocked) {
  1768. X+     exit_x_event = TRUE;
  1769. X+     } else if (text_info->destroy_on_ack) {
  1770. X+     destroy_text_window(wp);
  1771. X+     }
  1772. X+ }
  1773. X+ 
  1774. X  /*
  1775. X   * Callback used for all text windows.  The window is poped down on any key
  1776. X   * or button down event.  It is destroyed if the main nethack code is done
  1777. X***************
  1778. X*** 141,150 ****
  1779. X  
  1780. X  #ifdef TRANSIENT_TEXT
  1781. X      XtRealizeWidget(wp->popup);
  1782. X!     positionpopup(wp->popup);
  1783. X  #endif
  1784. X  
  1785. X!     nh_XtPopup(wp->popup, XtGrabNone, wp->w);
  1786. X  
  1787. X      /* Kludge alert.  Scrollbars are not sized correctly by the Text widget */
  1788. X      /* if added before the window is displayed, so do it afterward. */
  1789. X--- 178,189 ----
  1790. X  
  1791. X  #ifdef TRANSIENT_TEXT
  1792. X      XtRealizeWidget(wp->popup);
  1793. X!     XSetWMProtocols(XtDisplay(wp->popup), XtWindow(wp->popup), 
  1794. X!             &wm_delete_window, 1);
  1795. X!     positionpopup(wp->popup, FALSE);
  1796. X  #endif
  1797. X  
  1798. X!     nh_XtPopup(wp->popup, (int)XtGrabNone, wp->w);
  1799. X  
  1800. X      /* Kludge alert.  Scrollbars are not sized correctly by the Text widget */
  1801. X      /* if added before the window is displayed, so do it afterward. */
  1802. X***************
  1803. X*** 198,203 ****
  1804. X--- 237,244 ----
  1805. X      wp->popup = XtCreatePopupShell("text", topLevelShellWidgetClass,
  1806. X                     toplevel, args, num_args);
  1807. X  #endif
  1808. X+     XtOverrideTranslations(wp->popup,
  1809. X+     XtParseTranslationTable("<Message>WM_PROTOCOLS: delete_text()"));
  1810. X  
  1811. X      num_args = 0;
  1812. X      XtSetArg(args[num_args], XtNdisplayCaret, False);        num_args++;
  1813. X***************
  1814. X*** 266,272 ****
  1815. X      if (!tb->text) panic("append_text_buffer:  null text buffer");
  1816. X  
  1817. X      if (str) {
  1818. X!         length = strlen(str);
  1819. X      } else {
  1820. X      length = 0;
  1821. X      }
  1822. X--- 307,313 ----
  1823. X      if (!tb->text) panic("append_text_buffer:  null text buffer");
  1824. X  
  1825. X      if (str) {
  1826. X!     length = strlen(str);
  1827. X      } else {
  1828. X      length = 0;
  1829. X      }
  1830. X*** /tmp/da10350    Thu Feb 25 10:33:22 1993
  1831. X--- win/X11/winval.c    Wed Feb 24 16:12:11 1993
  1832. X***************
  1833. X*** 7,17 ****
  1834. X--- 7,29 ----
  1835. X   * form widget.
  1836. X   */
  1837. X  #include <stdio.h>
  1838. X+ 
  1839. X+ #ifndef SYSV
  1840. X+ #define PRESERVE_NO_SYSV    /* X11 include files may define SYSV */
  1841. X+ #endif
  1842. X+ 
  1843. X  #include <X11/Intrinsic.h>
  1844. X  #include <X11/StringDefs.h>
  1845. X  #include <X11/Xaw/Label.h>
  1846. X  #include <X11/Xaw/Form.h>
  1847. X  #include <X11/Xaw/Cardinals.h>
  1848. X+ 
  1849. X+ #ifdef PRESERVE_NO_SYSV
  1850. X+ # ifdef SYSV
  1851. X+ #  undef SYSV
  1852. X+ # endif
  1853. X+ # undef PRESERVE_NO_SYSV
  1854. X+ #endif
  1855. X  
  1856. X  #include "config.h"    /* #define for const for non __STDC__ compilers */
  1857. X  
  1858. X
  1859. END_OF_FILE
  1860. if test 51640 -ne `wc -c <'patches01n'`; then
  1861.     echo shar: \"'patches01n'\" unpacked with wrong size!
  1862. fi
  1863. # end of 'patches01n'
  1864. if test -f 'sys/winnt/Makefile.dat' -a "${1}" != "-c" ; then 
  1865.   echo shar: Renaming existing file \"'sys/winnt/Makefile.dat'\" to \"'sys/winnt/Makefile.dat.orig'\"
  1866.   mv -f 'sys/winnt/Makefile.dat' 'sys/winnt/Makefile.dat.orig'
  1867. fi
  1868. echo shar: Extracting \"'sys/winnt/Makefile.dat'\" \(4339 characters\)
  1869. sed "s/^X//" >'sys/winnt/Makefile.dat' <<'END_OF_FILE'
  1870. X# SCCS Id: @(#)Makefile.dat  3.1   93/02/21
  1871. X# Copyright (c) NetHack PC Development Team 1992,1993
  1872. X# NetHack may be freely redistributed.  See license for details.
  1873. X#
  1874. X#       NT NetHack 3.1 DAT Makefile 
  1875. X#    for MS NMAKE for Windows NT
  1876. X#  
  1877. X#    NT Version Tested:  October 1992 SDK pre-release
  1878. X#                + December '92 compiler fix
  1879. X#
  1880. X#       For questions read the Install.nt file included with
  1881. X#       the distribution.
  1882. X#
  1883. X#    Michael Allison
  1884. X#
  1885. X#----------------------------------------------------------------------
  1886. X#
  1887. X
  1888. XDAT    = ..\dat
  1889. XINCL    = ..\include
  1890. XUTL    = ..\util
  1891. X
  1892. Xdefault: all
  1893. X
  1894. Xall:    $(DAT)\data        $(DAT)\rumors    $(DAT)\dungeon \
  1895. X    $(DAT)\oracles        $(DAT)\quest.dat    $(DAT)\sp_lev.tag
  1896. X
  1897. X$(UTL)\utility.tag: $(UTL)\*.c $(UTL)\*.l $(UTL)\*.y $(INCL)\*.h
  1898. X    @echo You must "make all" in $(UTL) first.
  1899. X    @attrib .foo
  1900. X
  1901. X$(DAT)\data:     $(UTL)\utility.tag    $(DAT)\data.bas
  1902. X    $(UTL)\makedefs -d
  1903. X
  1904. X$(DAT)\rumors:    $(UTL)\utility.tag    $(DAT)\rumors.tru   $(DAT)\rumors.fal
  1905. X    $(UTL)\makedefs -r
  1906. X
  1907. X$(DAT)\quest.dat: $(UTL)\utility.tag  $(DAT)\quest.txt
  1908. X    $(UTL)\makedefs -q
  1909. X
  1910. X$(DAT)\oracles:    $(UTL)\utility.tag    $(DAT)\oracles.txt
  1911. X    $(UTL)\makedefs -h
  1912. X
  1913. X#
  1914. X# Note: `options` should be created via date.h target in ..\src\makefile
  1915. X#
  1916. X$(DAT)\options: $(UTL)\utility.tag    $(INCL)\config.h    $(INCL)\ntconf.h
  1917. X    $(UTL)\makedefs -v
  1918. X
  1919. X$(DAT)\sp_lev.tag: $(UTL)\utility.tag $(DAT)\bigroom.des  $(DAT)\castle.des \
  1920. X    $(DAT)\endgame.des $(DAT)\gehennom.des $(DAT)\knox.des   \
  1921. X    $(DAT)\medusa.des  $(DAT)\oracle.des   $(DAT)\tower.des  \
  1922. X    $(DAT)\yendor.des  $(DAT)\arch.des     $(DAT)\barb.des   \
  1923. X    $(DAT)\caveman.des $(DAT)\elf.des      $(DAT)\healer.des \
  1924. X    $(DAT)\knight.des  $(DAT)\priest.des   $(DAT)\rogue.des  \
  1925. X    $(DAT)\samurai.des $(DAT)\tourist.des  $(DAT)\valkyrie.des \
  1926. X    $(DAT)\wizard.des
  1927. X    $(UTL)\lev_comp $(DAT)\bigroom.des
  1928. X    $(UTL)\lev_comp $(DAT)\castle.des
  1929. X    $(UTL)\lev_comp $(DAT)\endgame.des
  1930. X    $(UTL)\lev_comp $(DAT)\gehennom.des
  1931. X    $(UTL)\lev_comp $(DAT)\knox.des
  1932. X    $(UTL)\lev_comp $(DAT)\mines.des
  1933. X    $(UTL)\lev_comp $(DAT)\medusa.des
  1934. X    $(UTL)\lev_comp $(DAT)\oracle.des
  1935. X    $(UTL)\lev_comp $(DAT)\tower.des
  1936. X    $(UTL)\lev_comp $(DAT)\yendor.des
  1937. X    $(UTL)\lev_comp $(DAT)\arch.des
  1938. X    $(UTL)\lev_comp $(DAT)\barb.des
  1939. X    $(UTL)\lev_comp $(DAT)\caveman.des
  1940. X    $(UTL)\lev_comp $(DAT)\elf.des
  1941. X    $(UTL)\lev_comp $(DAT)\healer.des
  1942. X    $(UTL)\lev_comp $(DAT)\knight.des
  1943. X    $(UTL)\lev_comp $(DAT)\priest.des
  1944. X    $(UTL)\lev_comp $(DAT)\rogue.des
  1945. X    $(UTL)\lev_comp $(DAT)\samurai.des
  1946. X    $(UTL)\lev_comp $(DAT)\tourist.des
  1947. X    $(UTL)\lev_comp $(DAT)\valkyrie.des
  1948. X    $(UTL)\lev_comp $(DAT)\wizard.des
  1949. X    echo sp_levs done > $(DAT)\sp_lev.tag
  1950. X
  1951. X$(DAT)\dungeon:    $(UTL)\utility.tag  $(DAT)\dungeon.def
  1952. X    $(UTL)\makedefs -e
  1953. X    $(UTL)\dgn_comp $(DAT)\dungeon.pdf
  1954. X
  1955. Xclean: spotless
  1956. X
  1957. Xspotless:
  1958. X    if exist $(DAT)\?-fill?.lev    del $(DAT)\?-fill?.lev
  1959. X    if exist $(DAT)\?-goal.lev    del $(DAT)\?-goal.lev
  1960. X    if exist $(DAT)\?-start.lev    del $(DAT)\?-start.lev
  1961. X    if exist $(DAT)\air.lev        del $(DAT)\air.lev
  1962. X    if exist $(DAT)\asmodeus.lev    del $(DAT)\asmodeus.lev
  1963. X    if exist $(DAT)\astral.lev    del $(DAT)\astral.lev
  1964. X    if exist $(DAT)\baalz.lev    del $(DAT)\baalz.lev
  1965. X    if exist $(DAT)\bigroom.lev    del $(DAT)\bigroom.lev
  1966. X    if exist $(DAT)\castle.lev    del $(DAT)\castle.lev
  1967. X    if exist $(DAT)\data        del $(DAT)\data
  1968. X    if exist $(DAT)\dungeon        del $(DAT)\dungeon
  1969. X    if exist $(DAT)\dungeon.pdf    del $(DAT)\dungeon.pdf
  1970. X    if exist $(DAT)\earth.lev    del $(DAT)\earth.lev
  1971. X    if exist $(DAT)\fakewiz?.lev    del $(DAT)\fakewiz?.lev
  1972. X    if exist $(DAT)\fire.lev    del $(DAT)\fire.lev
  1973. X    if exist $(DAT)\juiblex.lev    del $(DAT)\juiblex.lev
  1974. X    if exist $(DAT)\medusa-?.lev    del $(DAT)\medusa-?.lev
  1975. X    if exist $(DAT)\mine_end.lev    del $(DAT)\mine_end.lev
  1976. X    if exist $(DAT)\minefill.lev    del $(DAT)\minefill.lev
  1977. X    if exist $(DAT)\minetown.lev    del $(DAT)\minetown.lev
  1978. X    if exist $(DAT)\options        del $(DAT)\options
  1979. X    if exist $(DAT)\oracle.lev    del $(DAT)\oracle.lev
  1980. X    if exist $(DAT)\oracles        del $(DAT)\oracles
  1981. X    if exist $(DAT)\orcus.lev    del $(DAT)\orcus.lev
  1982. X    if exist $(DAT)\rumors        del $(DAT)\rumors
  1983. X    if exist $(DAT)\quest.dat    del $(DAT)\quest.dat
  1984. X    if exist $(DAT)\sanctum.lev    del $(DAT)\sanctum.lev
  1985. X    if exist $(DAT)\tower?.lev    del $(DAT)\tower?.lev
  1986. X    if exist $(DAT)\valley.lev    del $(DAT)\valley.lev
  1987. X    if exist $(DAT)\water.lev    del $(DAT)\water.lev
  1988. X    if exist $(DAT)\wizard?.lev    del $(DAT)\wizard?.lev
  1989. X    if exist $(DAT)\sp_lev.tag    del $(DAT)\sp_lev.tag
  1990. X#    if exist $(DAT)\?-locate.lev    del $(DAT)\?-locate
  1991. END_OF_FILE
  1992. if test 4339 -ne `wc -c <'sys/winnt/Makefile.dat'`; then
  1993.     echo shar: \"'sys/winnt/Makefile.dat'\" unpacked with wrong size!
  1994. fi
  1995. # end of 'sys/winnt/Makefile.dat'
  1996. echo shar: End of archive 19 \(of 31\).
  1997. cp /dev/null ark19isdone
  1998. MISSING=""
  1999. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ; do
  2000.     if test ! -f ark${I}isdone ; then
  2001.     MISSING="${MISSING} ${I}"
  2002.     fi
  2003. done
  2004. if test "${MISSING}" = "" ; then
  2005.     echo You have unpacked all 31 archives.
  2006.     echo "Now execute 'patchit.sh'"
  2007.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2008. else
  2009.     echo You still need to unpack the following archives:
  2010.     echo "        " ${MISSING}
  2011. fi
  2012. ##  End of shell archive.
  2013. exit 0
  2014.