Merge branch 'master' into win32-x64-working

Conflicts:
	include/hack.h
	win/X11/winmenu.c
	win/X11/winstat.c
This commit is contained in:
nhmall
2015-05-06 19:53:26 -04:00
22 changed files with 659 additions and 402 deletions
+2 -32
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 hack.h $NHDT-Date: 1429136301 2015/04/15 22:18:21 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.59 $ */ /* NetHack 3.5 hack.h $NHDT-Date: 1430897858 2015/05/06 07:37:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */
/* SCCS Id: @(#)hack.h 3.5 2008/03/19 */ /* SCCS Id: @(#)hack.h 3.5 2008/03/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -9,37 +9,7 @@
#ifndef CONFIG_H #ifndef CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#include "lint.h"
/* [DEBUG shouldn't be defined unless you know what you're doing...] */
#ifdef DEBUG
# define showdebug(file) debugcore(file, TRUE)
# define explicitdebug(file) debugcore(file, FALSE)
# define ifdebug(stmt) do { if (showdebug(__FILE__)) stmt; } while (0)
# ifdef _MSC_VER
/* if we have microsoft's C runtime we can use these instead */
# include <crtdbg.h>
# define crtdebug(stmt) do { if (showdebug(__FILE__)) stmt; \
_RPT0(_CRT_WARN,"\n"); } while (0)
# define debugpline0(str) crtdebug(_RPT0(_CRT_WARN,str))
# define debugpline1(fmt,arg) crtdebug(_RPT1(_CRT_WARN,fmt,arg))
# define debugpline2(fmt,a1,a2) crtdebug(_RPT2(_CRT_WARN,fmt,a1,a2))
# define debugpline3(fmt,a1,a2,a3) crtdebug(_RPT3(_CRT_WARN,fmt,a1,a2,a3))
# define debugpline4(fmt,a1,a2,a3,a4) crtdebug(_RPT4(_CRT_WARN,fmt,a1,a2,a3,a4))
# else
/* these don't require compiler support for C99 variadic macros */
# define debugpline0(str) ifdebug(pline(str))
# define debugpline1(fmt,arg) ifdebug(pline(fmt,arg))
# define debugpline2(fmt,a1,a2) ifdebug(pline(fmt,a1,a2))
# define debugpline3(fmt,a1,a2,a3) ifdebug(pline(fmt,a1,a2,a3))
# define debugpline4(fmt,a1,a2,a3,a4) ifdebug(pline(fmt,a1,a2,a3,a4))
# endif
#else
# define debugpline0(str) /*empty*/
# define debugpline1(fmt,arg) /*empty*/
# define debugpline2(fmt,a1,a2) /*empty*/
# define debugpline3(fmt,a1,a2,a3) /*empty*/
# define debugpline4(fmt,a1,a2,a3,a4) /*empty*/
#endif /*DEBUG*/
#define TELL 1 #define TELL 1
#define NOTELL 0 #define NOTELL 0
+52
View File
@@ -0,0 +1,52 @@
/* NetHack 3.5 lint.h $NHDT-Date: 1430897871 2015/05/06 07:37:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */
/* NetHack may be freely redistributed. See license for details. */
/*
* Hacks to suppress compiler warnings. Use with caution.
* Assumes it has been preceded by '#include "config.h"' but
* not necessarily by '#include "hack.h"'.
*/
#ifndef LINT_H
#define LINT_H
/* cast away implicit const from a string literal (caller's responsibility
to ensure that) in order to avoid a warning from 'gcc -Wwrite-strings'
(also caller's responsibility to ensure it isn't actually modified!) */
#define nhStr(str) ((char *)str)
#if defined(GCC_WARN) && !defined(FORCE_ARG_USAGE)
# define FORCE_ARG_USAGE
#endif
#ifdef FORCE_ARG_USAGE
/* force an unused function argument to become used in an arbitrary
manner in order to suppress warning about unused function arguments;
viable for scalar and pointer arguments */
# define nhUse(arg) nhUse_dummy += (unsigned)arg;
extern unsigned nhUse_dummy;
#else
# define nhUse(arg) /*empty*/
#endif
/*
* This stuff isn't related to lint suppression but lives here to
* avoid cluttering up hack.h.
*/
/* [DEBUG shouldn't be defined unless you know what you're doing...] */
#ifdef DEBUG
# define ifdebug(stmt) do { if (showdebug(__FILE__)) stmt; } while (0)
/* these don't require compiler support for C99 variadic macros */
# define debugpline0(str) ifdebug(pline(str))
# define debugpline1(fmt,arg) ifdebug(pline(fmt,arg))
# define debugpline2(fmt,a1,a2) ifdebug(pline(fmt,a1,a2))
# define debugpline3(fmt,a1,a2,a3) ifdebug(pline(fmt,a1,a2,a3))
# define debugpline4(fmt,a1,a2,a3,a4) ifdebug(pline(fmt,a1,a2,a3,a4))
#else
# define debugpline0(str) /*empty*/
# define debugpline1(fmt,arg) /*empty*/
# define debugpline2(fmt,a1,a2) /*empty*/
# define debugpline3(fmt,a1,a2,a3) /*empty*/
# define debugpline4(fmt,a1,a2,a3,a4) /*empty*/
#endif /*DEBUG*/
#endif /* LINT_H */
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 winX.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 winX.h $NHDT-Date: 1430899132 2015/05/06 07:58:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* NetHack 3.5 winX.h $Date: 2012/01/24 04:26:18 $ $Revision: 1.9 $ */ /* NetHack 3.5 winX.h $Date: 2012/01/24 04:26:18 $ $Revision: 1.9 $ */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -356,7 +356,7 @@ E void FDECL(calculate_rip_text, (int,time_t));
/* ### winval.c ### */ /* ### winval.c ### */
E Widget FDECL(create_value,(Widget, const char*)); E Widget FDECL(create_value,(Widget, const char*));
E void FDECL(set_name,(Widget, char*)); E void FDECL(set_name,(Widget, const char*));
E void FDECL(set_name_width,(Widget, int)); E void FDECL(set_name_width,(Widget, int));
E int FDECL(get_name_width,(Widget)); E int FDECL(get_name_width,(Widget));
E void FDECL(set_value,(Widget, const char*)); E void FDECL(set_value,(Widget, const char*));
+4 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 decl.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 decl.c $NHDT-Date: 1430897862 2015/05/06 07:37:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.56 $ */
/* NetHack 3.5 decl.c $Date: 2012/04/09 02:56:30 $ $Revision: 1.37 $ */ /* NetHack 3.5 decl.c $Date: 2012/04/09 02:56:30 $ $Revision: 1.37 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -331,6 +331,9 @@ NEARDATA struct savefile_info sfrestinfo, sfsaveinfo = {
char *ARGV0; char *ARGV0;
#endif #endif
/* support for lint.h */
unsigned nhUse_dummy = 0;
/* dummy routine used to force linkage */ /* dummy routine used to force linkage */
void void
decl_init() decl_init()
+1
View File
@@ -568,6 +568,7 @@ int ttyp;
if (!ttmp) return; if (!ttmp) return;
newobjs = level.objects[x][y]; newobjs = level.objects[x][y];
ttmp->madeby_u = madeby_u; ttmp->madeby_u = madeby_u;
ttmp->tseen = 0;
if (cansee(x,y)) seetrap(ttmp); if (cansee(x,y)) seetrap(ttmp);
else if (madeby_u) feeltrap(ttmp); else if (madeby_u) feeltrap(ttmp);
+2 -1
View File
@@ -217,7 +217,8 @@ const char *verb;
/* Globby things like puddings might stick together */ /* Globby things like puddings might stick together */
while (obj && (otmp = obj_nexto_xy(obj->otyp, x, y, obj->o_id)) != (struct obj*)0) { while (obj && (otmp = obj_nexto_xy(obj->otyp, x, y, obj->o_id)) != (struct obj*)0) {
pudding_merge_message(obj, otmp); pudding_merge_message(obj, otmp);
obj = obj_meld(&obj, &otmp); /* intentionally not getting the melded object; obj_meld may set obj to null. */
(void) obj_meld(&obj, &otmp);
} }
return (obj == NULL); return (obj == NULL);
} }
+9 -4
View File
@@ -239,10 +239,15 @@ boolean devour;
unseen spot to eat the food there, avoid referring to that unseen spot to eat the food there, avoid referring to that
pet as "it". However, we want "it" if invisible/unsensed pet as "it". However, we want "it" if invisible/unsensed
pet eats visible food. */ pet eats visible food. */
if (seeobj || sawpet) if (sawpet || (seeobj && canspotmon(mtmp))) {
pline("%s %s %s.", if (tunnels(mtmp->data))
(sawpet || canspotmon(mtmp)) ? noit_Monnam(mtmp) : "It", pline("%s digs in.", noit_Monnam(mtmp));
devour ? "devours" : "eats", distant_name(obj, doname)); else
pline("%s %s %s.", noit_Monnam(mtmp),
devour ? "devours" : "eats", distant_name(obj, doname));
} else if (seeobj)
pline("It %s %s.", devour ? "devours" : "eats",
distant_name(obj, doname));
} }
if (obj->unpaid) { if (obj->unpaid) {
Strcpy(objnambuf, xname(obj)); Strcpy(objnambuf, xname(obj));
+37 -18
View File
@@ -425,8 +425,8 @@ struct obj *obj;
goto added; goto added;
} }
/* didn't merge, so insert into chain */ /* didn't merge, so insert into chain */
assigninvlet(obj);
if (flags.invlet_constant || !prev) { if (flags.invlet_constant || !prev) {
if (flags.invlet_constant) assigninvlet(obj);
obj->nobj = invent; /* insert at beginning */ obj->nobj = invent; /* insert at beginning */
invent = obj; invent = obj;
if (flags.invlet_constant) reorder_invent(); if (flags.invlet_constant) reorder_invent();
@@ -1134,7 +1134,14 @@ register const char *let,*word;
} }
/* they typed a letter (not a space) at the prompt */ /* they typed a letter (not a space) at the prompt */
} }
if (ilet == def_oc_syms[COIN_CLASS].sym) { /* find the item which was picked */
for (otmp = invent; otmp; otmp = otmp->nobj)
if (otmp->invlet == ilet) break;
/* some items have restrictions */
if (ilet == def_oc_syms[COIN_CLASS].sym
/* guard against the [hypothetical] chace of having more
than one invent slot of gold and picking the non-'$' one */
|| (otmp && otmp->oclass == COIN_CLASS)) {
if (!usegold) { if (!usegold) {
You("cannot %s gold.", word); You("cannot %s gold.", word);
return(struct obj *)0; return(struct obj *)0;
@@ -1156,7 +1163,8 @@ register const char *let,*word;
/* permit counts for throwing gold, but don't accept /* permit counts for throwing gold, but don't accept
* counts for other things since the throw code will * counts for other things since the throw code will
* split off a single item anyway */ * split off a single item anyway */
if (ilet != def_oc_syms[COIN_CLASS].sym) if (ilet != def_oc_syms[COIN_CLASS].sym
&& !(otmp && otmp->oclass == COIN_CLASS))
allowcnt = 1; allowcnt = 1;
if (cnt == 0 && prezero) return (struct obj *)0; if (cnt == 0 && prezero) return (struct obj *)0;
if (cnt > 1) { if (cnt > 1) {
@@ -1166,8 +1174,9 @@ register const char *let,*word;
} }
context.botl = 1; /* May have changed the amount of money */ context.botl = 1; /* May have changed the amount of money */
savech(ilet); savech(ilet);
for (otmp = invent; otmp; otmp = otmp->nobj) /* [we used to set otmp (by finding ilet in invent) here, but
if (otmp->invlet == ilet) break; that's been moved above so that otmp can be checked earlier] */
/* verify the chosen object */
if(!otmp) { if(!otmp) {
You("don't have that object."); You("don't have that object.");
if (in_doagain) return((struct obj *) 0); if (in_doagain) return((struct obj *) 0);
@@ -2958,23 +2967,33 @@ free_invbuf()
invbufsiz = 0; invbufsiz = 0;
} }
/* give consecutive letters to every item in inventory (for !fixinv mode) */ /* give consecutive letters to every item in inventory (for !fixinv mode);
gold is always forced to '$' slot at head of list */
void void
reassign() reassign()
{ {
register int i; int i;
register struct obj *obj; struct obj *obj, *prevobj, *goldobj;
for(obj = invent, i = 0; obj; obj = obj->nobj, i++) { /* first, remove [first instance of] gold from invent, if present */
if (obj->oclass == COIN_CLASS && obj->invlet == GOLD_SYM) prevobj = goldobj = 0;
--i; /* keep $ instead of using up i'th letter */ for (obj = invent; obj; prevobj = obj, obj = obj->nobj)
else if (obj->oclass == COIN_CLASS) {
if (i < 52) goldobj = obj;
obj->invlet = (i < 26) ? ('a'+i) : ('A'+i-26); if (prevobj)
else if (obj->oclass == COIN_CLASS) prevobj->nobj = goldobj->nobj;
obj->invlet = GOLD_SYM; else
else invent = goldobj->nobj;
obj->invlet = NOINVSYM; break;
}
/* second, re-letter the rest of the list */
for (obj = invent, i = 0; obj; obj = obj->nobj, i++)
obj->invlet = (i < 26) ? ('a'+i) : (i < 52) ? ('A'+i-26) : NOINVSYM;
/* third, assign gold the "letter" '$' and re-insert it at head */
if (goldobj) {
goldobj->invlet = GOLD_SYM;
goldobj->nobj = invent;
invent = goldobj;
} }
if (i >= 52) i = 52 - 1; if (i >= 52) i = 52 - 1;
lastinvnr = i; lastinvnr = i;
+2
View File
@@ -1818,6 +1818,8 @@ struct permonst _mons2[] = {
M3_INFRAVISIBLE|M3_INFRAVISION, HI_LORD), M3_INFRAVISIBLE|M3_INFRAVISION, HI_LORD),
/* /*
* Puddings * Puddings
*
* must be in the same order as the pudding globs in objects.c
*/ */
MON("gray ooze", S_PUDDING, MON("gray ooze", S_PUDDING,
LVL(3, 1, 8, 0, 0), (G_GENO|G_NOCORPSE|2), LVL(3, 1, 8, 0, 0), (G_GENO|G_NOCORPSE|2),
+2 -1
View File
@@ -675,7 +675,8 @@ OBJECT(OBJ("meat ring", (char *)0),
BITS(1,0,0,0,0,0,0,0,0,0,0,0,FLESH), BITS(1,0,0,0,0,0,0,0,0,0,0,0,FLESH),
0, FOOD_CLASS, 0, 1, 5, 1, 0, 0, 0, 0, 5, CLR_BROWN), 0, FOOD_CLASS, 0, 1, 5, 1, 0, 0, 0, 0, 5, CLR_BROWN),
/* pudding 'corpses' will turn into these and combine */ /* pudding 'corpses' will turn into these and combine.
must be in same order as the pudding monsters */
FOOD("glob of gray ooze", 0, 2, 20, 0, FLESH, 20, CLR_GRAY), FOOD("glob of gray ooze", 0, 2, 20, 0, FLESH, 20, CLR_GRAY),
FOOD("glob of brown pudding", 0, 2, 20, 0, FLESH, 20, CLR_BROWN), FOOD("glob of brown pudding", 0, 2, 20, 0, FLESH, 20, CLR_BROWN),
FOOD("glob of green slime", 0, 2, 20, 0, FLESH, 20, CLR_GREEN), FOOD("glob of green slime", 0, 2, 20, 0, FLESH, 20, CLR_GREEN),
+1
View File
@@ -115,6 +115,7 @@ register struct monst *mtmp;
tmp = (somegold(money_cnt(invent)) + gold_price - 1) / gold_price; tmp = (somegold(money_cnt(invent)) + gold_price - 1) / gold_price;
tmp = min(tmp, ygold->quan); tmp = min(tmp, ygold->quan);
if (tmp < ygold->quan) ygold = splitobj(ygold, tmp); if (tmp < ygold->quan) ygold = splitobj(ygold, tmp);
else setnotworn(ygold);
freeinv(ygold); freeinv(ygold);
add_to_minv(mtmp, ygold); add_to_minv(mtmp, ygold);
Your("purse feels lighter."); Your("purse feels lighter.");
+5 -4
View File
@@ -1,5 +1,5 @@
# NetHack Makefile. # NetHack Makefile.
# NetHack 3.5 Makefile.src $NHDT-Date: 1428590253 2015/04/09 14:37:33 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.38 $ # NetHack 3.5 Makefile.src $NHDT-Date: 1430897864 2015/05/06 07:37:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $
# NetHack 3.5 Makefile.src $Date: 2012/01/20 03:41:33 $ $Revision: 1.37 $ # NetHack 3.5 Makefile.src $Date: 2012/01/20 03:41:33 $ $Revision: 1.37 $
# Root of source tree: # Root of source tree:
@@ -369,7 +369,8 @@ CSOURCES = $(HACKCSRC) $(SYSCSRC) $(WINCSRC) $(CHAINSRC) $(GENCSRC)
HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \ HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \
color.h config.h config1.h context.h coord.h decl.h def_os2.h \ color.h config.h config1.h context.h coord.h decl.h def_os2.h \
display.h dlb.h dungeon.h engrave.h extern.h flag.h func_tab.h \ display.h dlb.h dungeon.h engrave.h extern.h flag.h func_tab.h \
global.h hack.h lev.h macconf.h mextra.h mfndpos.h micro.h mkroom.h \ global.h hack.h lev.h lint.h macconf.h mextra.h mfndpos.h micro.h \
mkroom.h \
monattk.h mondata.h monflag.h monst.h monsym.h obj.h objclass.h \ monattk.h mondata.h monflag.h monst.h monsym.h obj.h objclass.h \
os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h region.h rm.h \ os2conf.h patchlevel.h pcconf.h permonst.h prop.h rect.h region.h rm.h \
sp_lev.h spell.h sys.h system.h tcap.h timeout.h tosconf.h tradstdc.h \ sp_lev.h spell.h sys.h system.h tcap.h timeout.h tosconf.h tradstdc.h \
@@ -572,7 +573,7 @@ $(CONFIG_H): ../include/config.h ../include/config1.h ../include/tradstdc.h \
../include/wceconf.h ../include/ntconf.h ../include/wceconf.h ../include/ntconf.h
touch $(CONFIG_H) touch $(CONFIG_H)
# hack.h timestamp # hack.h timestamp
$(HACK_H): ../include/hack.h $(CONFIG_H) ../include/align.h \ $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \
../include/dungeon.h ../include/monsym.h ../include/mkroom.h \ ../include/dungeon.h ../include/monsym.h ../include/mkroom.h \
../include/objclass.h ../include/youprop.h ../include/prop.h \ ../include/objclass.h ../include/youprop.h ../include/prop.h \
../include/permonst.h ../include/monattk.h \ ../include/permonst.h ../include/monattk.h \
@@ -624,7 +625,7 @@ topl.o: ../win/tty/topl.c $(HACK_H) ../include/tcap.h
wintty.o: ../win/tty/wintty.c $(HACK_H) ../include/dlb.h ../include/tcap.h wintty.o: ../win/tty/wintty.c $(HACK_H) ../include/dlb.h ../include/tcap.h
$(CC) $(CFLAGS) -c ../win/tty/wintty.c $(CC) $(CFLAGS) -c ../win/tty/wintty.c
Window.o: ../win/X11/Window.c ../include/xwindowp.h ../include/xwindow.h \ Window.o: ../win/X11/Window.c ../include/xwindowp.h ../include/xwindow.h \
$(CONFIG_H) $(CONFIG_H) ../include/lint.h
$(CC) $(CFLAGS) -c ../win/X11/Window.c $(CC) $(CFLAGS) -c ../win/X11/Window.c
dialogs.o: ../win/X11/dialogs.c $(CONFIG_H) dialogs.o: ../win/X11/dialogs.c $(CONFIG_H)
$(CC) $(CFLAGS) -c ../win/X11/dialogs.c $(CC) $(CFLAGS) -c ../win/X11/dialogs.c
+51 -42
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 Window.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 Window.c $NHDT-Date: 1430899134 2015/05/06 07:58:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $ */
/* NetHack 3.5 Window.c $Date: 2009/05/06 10:55:43 $ $Revision: 1.4 $ */ /* NetHack 3.5 Window.c $Date: 2009/05/06 10:55:43 $ $Revision: 1.4 $ */
/* SCCS Id: @(#)Window.c 3.5 1993/02/02 */ /* SCCS Id: @(#)Window.c 3.5 1993/02/02 */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
@@ -34,55 +34,56 @@
#include "xwindowp.h" #include "xwindowp.h"
#include "config.h" #include "config.h"
#include "lint.h"
static XtResource resources[] = { static XtResource resources[] = {
#define offset(field) XtOffset(WindowWidget, window.field) #define offset(field) XtOffset(WindowWidget, window.field)
/* {name, class, type, size, offset, default_type, default_addr}, */ /* {name, class, type, size, offset, default_type, default_addr}, */
{ XtNrows, XtCRows, XtRDimension, sizeof(Dimension), { nhStr(XtNrows), nhStr(XtCRows), XtRDimension, sizeof(Dimension),
offset(rows), XtRImmediate, (XtPointer) 21}, offset(rows), XtRImmediate, (XtPointer) 21},
{ XtNcolumns, XtCColumns, XtRDimension, sizeof(Dimension), { nhStr(XtNcolumns), nhStr(XtCColumns), XtRDimension, sizeof(Dimension),
offset(columns), XtRImmediate, (XtPointer) 80}, offset(columns), XtRImmediate, (XtPointer) 80},
{ XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), { nhStr(XtNforeground), XtCForeground, XtRPixel, sizeof(Pixel),
offset(foreground), XtRString, XtDefaultForeground }, offset(foreground), XtRString, (XtPointer) XtDefaultForeground },
{ XtNblack, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNblack), XtCColor, XtRPixel, sizeof(Pixel),
offset(black), XtRString, "black"}, offset(black), XtRString, (XtPointer) "black"},
{ XtNred, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNred), XtCColor, XtRPixel, sizeof(Pixel),
offset(red), XtRString, "red" }, offset(red), XtRString, (XtPointer) "red" },
{ XtNgreen, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNgreen), XtCColor, XtRPixel, sizeof(Pixel),
offset(green), XtRString, "pale green" }, offset(green), XtRString, (XtPointer) "pale green" },
{ XtNbrown, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNbrown), XtCColor, XtRPixel, sizeof(Pixel),
offset(brown), XtRString, "brown" }, offset(brown), XtRString, (XtPointer) "brown" },
{ XtNblue, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNblue), XtCColor, XtRPixel, sizeof(Pixel),
offset(blue), XtRString, "blue" }, offset(blue), XtRString, (XtPointer) "blue" },
{ XtNmagenta, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNmagenta), XtCColor, XtRPixel, sizeof(Pixel),
offset(magenta), XtRString, "magenta" }, offset(magenta), XtRString, (XtPointer) "magenta" },
{ XtNcyan, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNcyan), XtCColor, XtRPixel, sizeof(Pixel),
offset(cyan), XtRString, "light cyan" }, offset(cyan), XtRString, (XtPointer) "light cyan" },
{ XtNgray, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNgray), XtCColor, XtRPixel, sizeof(Pixel),
offset(gray), XtRString, "gray" }, offset(gray), XtRString, (XtPointer) "gray" },
{ XtNorange, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNorange), XtCColor, XtRPixel, sizeof(Pixel),
offset(orange), XtRString, "orange" }, offset(orange), XtRString, (XtPointer) "orange" },
{ XtNbright_green, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNbright_green), XtCColor, XtRPixel, sizeof(Pixel),
offset(bright_green), XtRString, "green" }, offset(bright_green), XtRString, (XtPointer) "green" },
{ XtNyellow, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNyellow), XtCColor, XtRPixel, sizeof(Pixel),
offset(yellow), XtRString, "yellow" }, offset(yellow), XtRString, (XtPointer) "yellow" },
{ XtNbright_blue, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNbright_blue), XtCColor, XtRPixel, sizeof(Pixel),
offset(bright_blue), XtRString, "royal blue" }, offset(bright_blue), XtRString, (XtPointer) "royal blue" },
{ XtNbright_magenta, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNbright_magenta), XtCColor, XtRPixel, sizeof(Pixel),
offset(bright_magenta), XtRString, "violet" }, offset(bright_magenta), XtRString, (XtPointer) "violet" },
{ XtNbright_cyan, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNbright_cyan), XtCColor, XtRPixel, sizeof(Pixel),
offset(bright_cyan), XtRString, "cyan" }, offset(bright_cyan), XtRString, (XtPointer) "cyan" },
{ XtNwhite, XtCColor, XtRPixel, sizeof(Pixel), { nhStr(XtNwhite), XtCColor, XtRPixel, sizeof(Pixel),
offset(white), XtRString, "white" }, offset(white), XtRString, (XtPointer) "white" },
{ XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), { nhStr(XtNfont), XtCFont, XtRFontStruct, sizeof(XFontStruct *),
offset(font), XtRString, XtDefaultFont }, offset(font), XtRString, (XtPointer) XtDefaultFont },
{ XtNexposeCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), { nhStr(XtNexposeCallback), XtCCallback, XtRCallback, sizeof(XtCallbackList),
offset(expose_callback), XtRCallback, (char *)0 }, offset(expose_callback), XtRCallback, (char *)0 },
{ XtNcallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), { nhStr(XtNcallback), XtCCallback, XtRCallback, sizeof(XtCallbackList),
offset(input_callback), XtRCallback, (char *)0 }, offset(input_callback), XtRCallback, (char *)0 },
{ XtNresizeCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), { nhStr(XtNresizeCallback), XtCCallback, XtRCallback, sizeof(XtCallbackList),
offset(resize_callback), XtRCallback, (char *)0 }, offset(resize_callback), XtRCallback, (char *)0 },
#undef offset #undef offset
}; };
@@ -94,11 +95,17 @@ static void no_op(w, event, params, num_params)
String *params; /* unused */ String *params; /* unused */
Cardinal *num_params; /* unused */ Cardinal *num_params; /* unused */
{ {
nhUse(w);
nhUse(event);
nhUse(params);
nhUse(num_params);
return;
} }
static XtActionsRec actions[] = static XtActionsRec actions[] =
{ {
{"no-op", no_op}, { nhStr("no-op"), no_op },
}; };
static char translations[] = static char translations[] =
@@ -111,6 +118,8 @@ static void Redisplay(w, event, region)
XEvent *event; XEvent *event;
Region region; /* unused */ Region region; /* unused */
{ {
nhUse(region);
/* This isn't correct - we need to call the callback with region. */ /* This isn't correct - we need to call the callback with region. */
XtCallCallbacks(w, XtNexposeCallback, (caddr_t) event); XtCallCallbacks(w, XtNexposeCallback, (caddr_t) event);
} }
@@ -126,7 +135,7 @@ static void Resize(w)
WindowClassRec windowClassRec = { WindowClassRec windowClassRec = {
{ /* core fields */ { /* core fields */
/* superclass */ (WidgetClass) &widgetClassRec, /* superclass */ (WidgetClass) &widgetClassRec,
/* class_name */ "Window", /* class_name */ nhStr("Window"),
/* widget_size */ sizeof(WindowRec), /* widget_size */ sizeof(WindowRec),
/* class_initialize */ 0, /* class_initialize */ 0,
/* class_part_initialize */ 0, /* class_part_initialize */ 0,
+60 -51
View File
@@ -40,7 +40,15 @@
* + Changed the default width response text widget to be as wide as the * + Changed the default width response text widget to be as wide as the
* window itself. Suggestion from David E. Wexelblat, dwex@goblin.org. * window itself. Suggestion from David E. Wexelblat, dwex@goblin.org.
* *
* $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ * Modified 5/2015, anonymous.
* + Include nethack's lint.h to get nhStr() macro.
* + Use nhStr() on string literals (or macros from <X11/StringDefs.h>
* that hide string literals) to cast away implicit 'const' in order
* to suppress "warning: assignment discards qualifers from pointer
* target type" issued by 'gcc -Wwrite-strings' as used by nethack.
* (For this file, always the second parameter to XtSetArg().)
*
* $NHDT-Date: 1430899133 2015/05/06 07:58:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.3 $
* $Date: 2002/03/31 17:11:23 $ $Revision: 1.2 $ * $Date: 2002/03/31 17:11:23 $ $Revision: 1.2 $
*/ */
@@ -65,6 +73,7 @@
#endif #endif
#include "config.h" /* #define for const for non __STDC__ compilers */ #include "config.h" /* #define for const for non __STDC__ compilers */
#include "lint.h" /* for nethack's nhStr() macro */
/* ":" added to both translations below to allow limited redefining of /* ":" added to both translations below to allow limited redefining of
* keysyms before testing for keysym values -- dlc */ * keysyms before testing for keysym values -- dlc */
@@ -98,7 +107,7 @@ CreateDialog(parent, name, okay_callback, cancel_callback)
num_args = 0; num_args = 0;
#ifdef SPECIAL_CMAP #ifdef SPECIAL_CMAP
if (special_cmap) { if (special_cmap) {
XtSetArg(args[num_args], XtNbackground, white); num_args++; XtSetArg(args[num_args], nhStr(XtNbackground), white); num_args++;
} }
#endif #endif
form = XtCreateManagedWidget(name, formWidgetClass, parent, args, num_args); form = XtCreateManagedWidget(name, formWidgetClass, parent, args, num_args);
@@ -106,52 +115,52 @@ CreateDialog(parent, name, okay_callback, cancel_callback)
num_args = 0; num_args = 0;
#ifdef SPECIAL_CMAP #ifdef SPECIAL_CMAP
if (special_cmap) { if (special_cmap) {
XtSetArg(args[num_args], XtNforeground, black); num_args++; XtSetArg(args[num_args], nhStr(XtNforeground), black); num_args++;
XtSetArg(args[num_args], XtNbackground, white); num_args++; XtSetArg(args[num_args], nhStr(XtNbackground), white); num_args++;
} }
#endif #endif
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNresizable, True); num_args++; XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
XtSetArg(args[num_args], XtNborderWidth, 0); num_args++; XtSetArg(args[num_args], nhStr(XtNborderWidth), 0); num_args++;
prompt = XtCreateManagedWidget("prompt", labelWidgetClass, prompt = XtCreateManagedWidget("prompt", labelWidgetClass,
form, args, num_args); form, args, num_args);
num_args = 0; num_args = 0;
#ifdef SPECIAL_CMAP #ifdef SPECIAL_CMAP
if (special_cmap) { if (special_cmap) {
XtSetArg(args[num_args], XtNforeground, black); num_args++; XtSetArg(args[num_args], nhStr(XtNforeground), black); num_args++;
XtSetArg(args[num_args], XtNbackground, white); num_args++; XtSetArg(args[num_args], nhStr(XtNbackground), white); num_args++;
} }
#endif #endif
XtSetArg(args[num_args], XtNfromVert, prompt); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), prompt); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNresizable, True); num_args++; XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++; XtSetArg(args[num_args], nhStr(XtNeditType), XawtextEdit); num_args++;
XtSetArg(args[num_args], XtNresize, XawtextResizeWidth); num_args++; XtSetArg(args[num_args], nhStr(XtNresize), XawtextResizeWidth); num_args++;
XtSetArg(args[num_args], XtNstring, ""); num_args++; XtSetArg(args[num_args], nhStr(XtNstring), ""); num_args++;
response = XtCreateManagedWidget("response", asciiTextWidgetClass, response = XtCreateManagedWidget("response", asciiTextWidgetClass,
form, args, num_args); form, args, num_args);
num_args = 0; num_args = 0;
#ifdef SPECIAL_CMAP #ifdef SPECIAL_CMAP
if (special_cmap) { if (special_cmap) {
XtSetArg(args[num_args], XtNforeground, black); num_args++; XtSetArg(args[num_args], nhStr(XtNforeground), black); num_args++;
XtSetArg(args[num_args], XtNbackground, white); num_args++; XtSetArg(args[num_args], nhStr(XtNbackground), white); num_args++;
} }
#endif #endif
XtSetArg(args[num_args], XtNfromVert, response); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), response); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNresizable, True); num_args++; XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
XtSetArg(args[num_args], XtNaccelerators, XtSetArg(args[num_args], nhStr(XtNaccelerators),
XtParseAcceleratorTable(okay_accelerators)); num_args++; XtParseAcceleratorTable(okay_accelerators)); num_args++;
okay = XtCreateManagedWidget("okay", commandWidgetClass, okay = XtCreateManagedWidget("okay", commandWidgetClass,
form, args, num_args); form, args, num_args);
@@ -162,18 +171,18 @@ CreateDialog(parent, name, okay_callback, cancel_callback)
num_args = 0; num_args = 0;
#ifdef SPECIAL_CMAP #ifdef SPECIAL_CMAP
if (special_cmap) { if (special_cmap) {
XtSetArg(args[num_args], XtNforeground, black); num_args++; XtSetArg(args[num_args], nhStr(XtNforeground), black); num_args++;
XtSetArg(args[num_args], XtNbackground, white); num_args++; XtSetArg(args[num_args], nhStr(XtNbackground), white); num_args++;
} }
#endif #endif
XtSetArg(args[num_args], XtNfromVert, response); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), response); num_args++;
XtSetArg(args[num_args], XtNfromHoriz, okay); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), okay); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNresizable, True); num_args++; XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
XtSetArg(args[num_args], XtNaccelerators, XtSetArg(args[num_args], nhStr(XtNaccelerators),
XtParseAcceleratorTable(cancel_accelerators)); num_args++; XtParseAcceleratorTable(cancel_accelerators)); num_args++;
cancel = XtCreateManagedWidget("cancel", commandWidgetClass, cancel = XtCreateManagedWidget("cancel", commandWidgetClass,
form, args, num_args); form, args, num_args);
@@ -199,7 +208,7 @@ GetDialogPrompt(w)
String s; String s;
label = XtNameToWidget(w, "prompt"); label = XtNameToWidget(w, "prompt");
XtSetArg(args[0], XtNlabel, &s); XtSetArg(args[0], nhStr(XtNlabel), &s);
XtGetValues(label, args, ONE); XtGetValues(label, args, ONE);
return XtNewString(s); return XtNewString(s);
} }
@@ -215,7 +224,7 @@ SetDialogPrompt(w, newprompt)
Widget label; Widget label;
label = XtNameToWidget(w, "prompt"); label = XtNameToWidget(w, "prompt");
XtSetArg(args[0], XtNlabel, newprompt); XtSetArg(args[0], nhStr(XtNlabel), newprompt);
XtSetValues(label, args, ONE); XtSetValues(label, args, ONE);
} }
@@ -229,7 +238,7 @@ GetDialogResponse(w)
String s; String s;
response = XtNameToWidget(w, "response"); response = XtNameToWidget(w, "response");
XtSetArg(args[0], XtNstring, &s); XtSetArg(args[0], nhStr(XtNstring), &s);
XtGetValues(response, args, ONE); XtGetValues(response, args, ONE);
return XtNewString(s); return XtNewString(s);
} }
@@ -247,18 +256,18 @@ SetDialogResponse(w, s)
Dimension width, nwidth, leftMargin, rightMargin; Dimension width, nwidth, leftMargin, rightMargin;
response = XtNameToWidget(w, "response"); response = XtNameToWidget(w, "response");
XtSetArg(args[0], XtNfont, &font); XtSetArg(args[0], nhStr(XtNfont), &font);
XtSetArg(args[1], XtNleftMargin, &leftMargin); XtSetArg(args[1], nhStr(XtNleftMargin), &leftMargin);
XtSetArg(args[2], XtNrightMargin, &rightMargin); XtSetArg(args[2], nhStr(XtNrightMargin), &rightMargin);
XtSetArg(args[3], XtNwidth, &width); XtSetArg(args[3], nhStr(XtNwidth), &width);
XtGetValues(response, args, FOUR); XtGetValues(response, args, FOUR);
/* width includes margins as per Xaw documentation */ /* width includes margins as per Xaw documentation */
nwidth = (font->max_bounds.width * strlen(s))+leftMargin+rightMargin; nwidth = (font->max_bounds.width * strlen(s))+leftMargin+rightMargin;
if (nwidth < width) if (nwidth < width)
nwidth = width; nwidth = width;
XtSetArg(args[0], XtNstring, s); XtSetArg(args[0], nhStr(XtNstring), s);
XtSetArg(args[1], XtNwidth, nwidth); XtSetArg(args[1], nhStr(XtNwidth), nwidth);
XtSetValues(response, args, TWO); XtSetValues(response, args, TWO);
XawTextSetInsertionPoint(response, strlen(s)); XawTextSetInsertionPoint(response, strlen(s));
} }
@@ -273,8 +282,8 @@ ClearDialogResponse(w)
Widget response; Widget response;
response = XtNameToWidget(w, "response"); response = XtNameToWidget(w, "response");
XtSetArg(args[0], XtNstring, ""); XtSetArg(args[0], nhStr(XtNstring), "");
XtSetArg(args[1], XtNwidth, 100); XtSetArg(args[1], nhStr(XtNwidth), 100);
XtSetValues(response, args, TWO); XtSetValues(response, args, TWO);
} }
#endif #endif
+176 -104
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 winX.c $NHDT-Date: 1430040327 2015/04/26 09:25:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.28 $ */ /* NetHack 3.5 winX.c $NHDT-Date: 1430899139 2015/05/06 07:58:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.29 $ */
/* NetHack 3.5 winX.c $Date: 2012/01/24 04:26:26 $ $Revision: 1.27 $ */ /* NetHack 3.5 winX.c $Date: 2012/01/24 04:26:26 $ $Revision: 1.27 $ */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -418,18 +418,17 @@ XtPointer *closure_ret;
*closure_ret = (char*)True; *closure_ret = (char*)True;
done(Pixel, screenColor.pixel); done(Pixel, screenColor.pixel);
} }
type = "noColormap"; type = nhStr("noColormap");
msg = "Cannot allocate colormap entry for \"%s\""; msg = nhStr("Cannot allocate colormap entry for \"%s\"");
} } else {
else {
/* some versions of XLookupColor also don't allow #xxyyzz names */ /* some versions of XLookupColor also don't allow #xxyyzz names */
if(str[0] == '#' && if(str[0] == '#' &&
(nhApproxColor(screen, colormap, (char*) str, &screenColor))) { (nhApproxColor(screen, colormap, (char*) str, &screenColor))) {
*closure_ret = (char*)True; *closure_ret = (char*)True;
done(Pixel, screenColor.pixel); done(Pixel, screenColor.pixel);
} }
type = "badValue"; type = nhStr("badValue");
msg = "Color name \"%s\" is not defined"; msg = nhStr("Color name \"%s\" is not defined");
} }
XtAppWarningMsg(app, type, "cvtStringToPixel", XtAppWarningMsg(app, type, "cvtStringToPixel",
@@ -884,14 +883,24 @@ void X11_wait_synch() { if (x_inited) XFlush(XtDisplay(toplevel)); }
/* Both resume_ and suspend_ are called from ioctl.c and unixunix.c. */ /* Both resume_ and suspend_ are called from ioctl.c and unixunix.c. */
void X11_resume_nhwindows() { return; } void X11_resume_nhwindows() { return; }
/* ARGSUSED */ /* ARGSUSED */
void X11_suspend_nhwindows(str) const char *str; { return; } void X11_suspend_nhwindows(str)
const char *str;
{
nhUse(str);
return;
}
/* Under X, we don't need to initialize the number pad. */ /* Under X, we don't need to initialize the number pad. */
/* ARGSUSED */ /* ARGSUSED */
void X11_number_pad(state) int state; { return; } /* called from options.c */ void X11_number_pad(state) /* called from options.c */
int state;
{
nhUse(state);
return;
}
void X11_start_screen() { return; } /* called from setftty() in unixtty.c */ void X11_start_screen() { return; } /* called from setftty() in unixtty.c */
void X11_end_screen() { return; } /* called from settty() in unixtty.c */ void X11_end_screen() { return; } /* called from settty() in unixtty.c */
@@ -924,60 +933,65 @@ Widget toplevel = (Widget) 0; /* toplevel widget */
Atom wm_delete_window; /* pop down windows */ Atom wm_delete_window; /* pop down windows */
static XtActionsRec actions[] = { static XtActionsRec actions[] = {
{"dismiss_file", dismiss_file}, /* action for file viewing widget */ {nhStr("dismiss_file"), dismiss_file}, /* file viewing widget */
{"delete_file", delete_file}, /* action for file delete-window */ {nhStr("delete_file"), delete_file}, /* file delete-window */
{"dismiss_text", dismiss_text}, /* button action for text widget */ {nhStr("dismiss_text"), dismiss_text}, /* text widget button action */
{"delete_text", delete_text}, /* delete action for text widget */ {nhStr("delete_text"), delete_text}, /* text widget delete action */
{"key_dismiss_text",key_dismiss_text},/* key action for text widget */ {nhStr("key_dismiss_text"), key_dismiss_text}, /* text widget key action */
#ifdef GRAPHIC_TOMBSTONE #ifdef GRAPHIC_TOMBSTONE
{"rip_dismiss_text",rip_dismiss_text},/* action for rip in text widget */ {nhStr("rip_dismiss_text"), rip_dismiss_text}, /* rip in text widget */
#endif #endif
{"menu_key", menu_key}, /* action for menu accelerators */ {nhStr("menu_key"), menu_key}, /* menu accelerators */
{"yn_key", yn_key}, /* action for yn accelerators */ {nhStr("yn_key"), yn_key}, /* yn accelerators */
{"yn_delete", yn_delete}, /* action for yn delete-window */ {nhStr("yn_delete"), yn_delete}, /* yn delete-window */
{"askname_delete", askname_delete},/* action for askname delete-window */ {nhStr("askname_delete"), askname_delete}, /* askname delete-window */
{"getline_delete", getline_delete},/* action for getline delete-window */ {nhStr("getline_delete"), getline_delete}, /* getline delete-window */
{"menu_delete", menu_delete}, /* action for menu delete-window */ {nhStr("menu_delete"), menu_delete}, /* menu delete-window */
{"ec_key", ec_key}, /* action for extended commands */ {nhStr("ec_key"), ec_key}, /* extended commands */
{"ec_delete", ec_delete}, /* action for ext-com menu delete */ {nhStr("ec_delete"), ec_delete}, /* ext-com menu delete */
{"ps_key", ps_key}, /* action for player selection */ {nhStr("ps_key"), ps_key}, /* player selection */
{"race_key", race_key}, /* action for race selection */ {nhStr("race_key"), race_key}, /* race selection */
{"gend_key", gend_key}, /* action for gender selection */ {nhStr("gend_key"), gend_key}, /* gender selection */
{"algn_key", algn_key}, /* action for alignment selection */ {nhStr("algn_key"), algn_key}, /* alignment selection */
{"X11_hangup", X11_hangup}, /* action for delete of top-level */ {nhStr("X11_hangup"), X11_hangup}, /* delete of top-level */
{"input", map_input}, /* action for key input */ {nhStr("input"), map_input}, /* key input */
{"scroll", nh_keyscroll}, /* action for scrolling by keys */ {nhStr("scroll"), nh_keyscroll}, /* scrolling by keys */
}; };
static XtResource resources[] = { static XtResource resources[] = {
{ "slow", "Slow", XtRBoolean, sizeof(Boolean), { nhStr("slow"), nhStr("Slow"), XtRBoolean, sizeof(Boolean),
XtOffset(AppResources *,slow), XtRString, "True" }, XtOffset(AppResources *,slow), XtRString, nhStr("True") },
{ "autofocus", "AutoFocus", XtRBoolean, sizeof(Boolean), { nhStr("autofocus"), nhStr("AutoFocus"), XtRBoolean, sizeof(Boolean),
XtOffset(AppResources *,autofocus), XtRString, "False" }, XtOffset(AppResources *,autofocus), XtRString, nhStr("False") },
{ "message_line", "Message_line", XtRBoolean, sizeof(Boolean), { nhStr("message_line"), nhStr("Message_line"), XtRBoolean,
XtOffset(AppResources *,message_line), XtRString, "False" }, sizeof(Boolean),
{ "double_tile_size", "Double_tile_size", XtRBoolean, sizeof(Boolean), XtOffset(AppResources *,message_line), XtRString, nhStr("False") },
XtOffset(AppResources *,double_tile_size), XtRString, "False" }, { nhStr("double_tile_size"), nhStr("Double_tile_size"), XtRBoolean,
{ "tile_file", "Tile_file", XtRString, sizeof(String), sizeof(Boolean),
XtOffset(AppResources *,tile_file), XtRString, "x11tiles" }, XtOffset(AppResources *,double_tile_size), XtRString, nhStr("False") },
{ "icon", "Icon", XtRString, sizeof(String), { nhStr("tile_file"), nhStr("Tile_file"), XtRString, sizeof(String),
XtOffset(AppResources *,icon), XtRString, "nh72" }, XtOffset(AppResources *,tile_file), XtRString, nhStr("x11tiles") },
{ "message_lines", "Message_lines", XtRInt, sizeof(int), { nhStr("icon"), nhStr("Icon"), XtRString, sizeof(String),
XtOffset(AppResources *,message_lines), XtRString, "12" }, XtOffset(AppResources *,icon), XtRString, nhStr("nh72") },
{ "pet_mark_bitmap", "Pet_mark_bitmap", XtRString, sizeof(String), { nhStr("message_lines"), nhStr("Message_lines"), XtRInt, sizeof(int),
XtOffset(AppResources *,pet_mark_bitmap), XtRString, "pet_mark.xbm" }, XtOffset(AppResources *,message_lines), XtRString, nhStr("12") },
{ "pet_mark_color", "Pet_mark_color", XtRPixel, sizeof(XtRPixel), { nhStr("pet_mark_bitmap"), nhStr("Pet_mark_bitmap"), XtRString,
XtOffset(AppResources *,pet_mark_color), XtRString, "Red" }, sizeof(String),
XtOffset(AppResources *,pet_mark_bitmap), XtRString,
nhStr("pet_mark.xbm") },
{ nhStr("pet_mark_color"), nhStr("Pet_mark_color"), XtRPixel,
sizeof(XtRPixel),
XtOffset(AppResources *,pet_mark_color), XtRString, nhStr("Red") },
#ifdef GRAPHIC_TOMBSTONE #ifdef GRAPHIC_TOMBSTONE
{ "tombstone", "Tombstone", XtRString, sizeof(String), { nhStr("tombstone"), "Tombstone", XtRString, sizeof(String),
XtOffset(AppResources *,tombstone), XtRString, "rip.xpm" }, XtOffset(AppResources *,tombstone), XtRString, "rip.xpm" },
{ "tombtext_x", "Tombtext_x", XtRInt, sizeof(int), { nhStr("tombtext_x"), "Tombtext_x", XtRInt, sizeof(int),
XtOffset(AppResources *,tombtext_x), XtRString, "155" }, XtOffset(AppResources *,tombtext_x), XtRString, "155" },
{ "tombtext_y", "Tombtext_y", XtRInt, sizeof(int), { nhStr("tombtext_y"), "Tombtext_y", XtRInt, sizeof(int),
XtOffset(AppResources *,tombtext_y), XtRString, "78" }, XtOffset(AppResources *,tombtext_y), XtRString, "78" },
{ "tombtext_dx", "Tombtext_dx", XtRInt, sizeof(int), { nhStr("tombtext_dx"), "Tombtext_dx", XtRInt, sizeof(int),
XtOffset(AppResources *,tombtext_dx), XtRString, "0" }, XtOffset(AppResources *,tombtext_dx), XtRString, "0" },
{ "tombtext_dy", "Tombtext_dy", XtRInt, sizeof(int), { nhStr("tombtext_dy"), "Tombtext_dy", XtRInt, sizeof(int),
XtOffset(AppResources *,tombtext_dy), XtRString, "13" }, XtOffset(AppResources *,tombtext_dy), XtRString, "13" },
#endif #endif
}; };
@@ -1085,6 +1099,8 @@ void X11_exit_nhwindows(dummy)
{ {
extern Pixmap tile_pixmap; /* from winmap.c */ extern Pixmap tile_pixmap; /* from winmap.c */
nhUse(dummy);
/* explicitly free the icon and tile pixmaps */ /* explicitly free the icon and tile pixmaps */
if (icon_pixmap != None) { if (icon_pixmap != None) {
XFreePixmap(XtDisplay(toplevel), icon_pixmap); XFreePixmap(XtDisplay(toplevel), icon_pixmap);
@@ -1121,6 +1137,9 @@ X11_sig_cb(not_used, id)
XEvent event; XEvent event;
XClientMessageEvent *mesg; XClientMessageEvent *mesg;
nhUse(not_used);
nhUse(id);
/* Set up a fake message to the event handler. */ /* Set up a fake message to the event handler. */
mesg = (XClientMessageEvent *) &event; mesg = (XClientMessageEvent *) &event;
mesg->type = ClientMessage; mesg->type = ClientMessage;
@@ -1150,6 +1169,9 @@ d_timeout(client_data, id)
XEvent event; XEvent event;
XClientMessageEvent *mesg; XClientMessageEvent *mesg;
nhUse(client_data);
nhUse(id);
/* Set up a fake message to the event handler. */ /* Set up a fake message to the event handler. */
mesg = (XClientMessageEvent *) &event; mesg = (XClientMessageEvent *) &event;
mesg->type = ClientMessage; mesg->type = ClientMessage;
@@ -1188,6 +1210,11 @@ X11_hangup(w, event, params, num_params)
String *params; String *params;
Cardinal *num_params; Cardinal *num_params;
{ {
nhUse(w);
nhUse(event);
nhUse(params);
nhUse(num_params);
hangup(1); /* 1 is commonly SIGHUP, but ignored anyway */ hangup(1); /* 1 is commonly SIGHUP, but ignored anyway */
exit_x_event = TRUE; exit_x_event = TRUE;
} }
@@ -1201,6 +1228,10 @@ askname_delete(w, event, params, num_params)
String *params; String *params;
Cardinal *num_params; Cardinal *num_params;
{ {
nhUse(event);
nhUse(params);
nhUse(num_params);
nh_XtPopdown(w); nh_XtPopdown(w);
(void) strcpy(plname, "Mumbles"); /* give them a name... ;-) */ (void) strcpy(plname, "Mumbles"); /* give them a name... ;-) */
exit_x_event = TRUE; exit_x_event = TRUE;
@@ -1218,17 +1249,20 @@ askname_done(w, client_data, call_data)
char *s; char *s;
Widget dialog = (Widget) client_data; Widget dialog = (Widget) client_data;
nhUse(w);
nhUse(call_data);
s = (char *) GetDialogResponse(dialog); s = (char *) GetDialogResponse(dialog);
len = strlen(s); len = (int) strlen(s);
if (len == 0) { if (len == 0) {
X11_nhbell(); X11_nhbell();
return; return;
} }
/* Truncate name if necessary */ /* Truncate name if necessary */
if (len >= sizeof(plname)-1) if (len >= (int) sizeof(plname)-1)
len = sizeof(plname)-1; len = (int) sizeof(plname)-1;
(void) strncpy(plname, s, len); (void) strncpy(plname, s, len);
plname[len] = '\0'; plname[len] = '\0';
@@ -1251,11 +1285,11 @@ X11_askname()
XtOverrideTranslations(popup, XtOverrideTranslations(popup,
XtParseTranslationTable("<Message>WM_PROTOCOLS: askname_delete()")); XtParseTranslationTable("<Message>WM_PROTOCOLS: askname_delete()"));
dialog = CreateDialog(popup, "dialog", dialog = CreateDialog(popup, nhStr("dialog"),
askname_done, (XtCallbackProc) 0); askname_done, (XtCallbackProc) 0);
SetDialogPrompt(dialog, "What is your name?"); /* set prompt */ SetDialogPrompt(dialog, nhStr("What is your name?")); /* set prompt */
SetDialogResponse(dialog, ""); /* set default answer */ SetDialogResponse(dialog, nhStr("")); /* set default answer */
XtRealizeWidget(popup); XtRealizeWidget(popup);
positionpopup(popup, TRUE); /* center,bottom */ positionpopup(popup, TRUE); /* center,bottom */
@@ -1288,6 +1322,9 @@ done_button(w, client_data, call_data)
char *s; char *s;
Widget dialog = (Widget) client_data; Widget dialog = (Widget) client_data;
nhUse(w);
nhUse(call_data);
s = (char *) GetDialogResponse(dialog); s = (char *) GetDialogResponse(dialog);
len = strlen(s); len = strlen(s);
@@ -1310,6 +1347,10 @@ getline_delete(w, event, params, num_params)
String *params; String *params;
Cardinal *num_params; Cardinal *num_params;
{ {
nhUse(event);
nhUse(params);
nhUse(num_params);
Strcpy(getline_input, CANCEL_STR); Strcpy(getline_input, CANCEL_STR);
nh_XtPopdown(w); nh_XtPopdown(w);
exit_x_event = TRUE; exit_x_event = TRUE;
@@ -1325,6 +1366,9 @@ abort_button(w, client_data, call_data)
{ {
Widget dialog = (Widget) client_data; Widget dialog = (Widget) client_data;
nhUse(w);
nhUse(call_data);
Strcpy(getline_input, CANCEL_STR); Strcpy(getline_input, CANCEL_STR);
nh_XtPopdown(XtParent(dialog)); nh_XtPopdown(XtParent(dialog));
exit_x_event = TRUE; exit_x_event = TRUE;
@@ -1353,7 +1397,7 @@ X11_getlin(question, input)
XtOverrideTranslations(getline_popup, XtOverrideTranslations(getline_popup,
XtParseTranslationTable("<Message>WM_PROTOCOLS: getline_delete()")); XtParseTranslationTable("<Message>WM_PROTOCOLS: getline_delete()"));
getline_dialog = CreateDialog(getline_popup, "dialog", getline_dialog = CreateDialog(getline_popup, nhStr("dialog"),
done_button, abort_button); done_button, abort_button);
XtRealizeWidget(getline_popup); XtRealizeWidget(getline_popup);
@@ -1361,7 +1405,7 @@ X11_getlin(question, input)
&wm_delete_window, 1); &wm_delete_window, 1);
} }
SetDialogPrompt(getline_dialog, (String)question); /* set prompt */ SetDialogPrompt(getline_dialog, (String)question); /* set prompt */
SetDialogResponse(getline_dialog, ""); /* set default answer */ SetDialogResponse(getline_dialog, nhStr("")); /* set default answer */
positionpopup(getline_popup, TRUE); /* center,bottom */ positionpopup(getline_popup, TRUE); /* center,bottom */
nh_XtPopup(getline_popup, (int)XtGrabExclusive, getline_dialog); nh_XtPopup(getline_popup, (int)XtGrabExclusive, getline_dialog);
@@ -1388,6 +1432,10 @@ delete_file(w, event, params, num_params)
String *params; String *params;
Cardinal *num_params; Cardinal *num_params;
{ {
nhUse(event);
nhUse(params);
nhUse(num_params);
nh_XtPopdown(w); nh_XtPopdown(w);
XtDestroyWidget(w); XtDestroyWidget(w);
} }
@@ -1402,6 +1450,11 @@ dismiss_file(w, event, params, num_params)
Cardinal *num_params; Cardinal *num_params;
{ {
Widget popup = XtParent(w); Widget popup = XtParent(w);
nhUse(event);
nhUse(params);
nhUse(num_params);
nh_XtPopdown(popup); nh_XtPopdown(popup);
XtDestroyWidget(popup); XtDestroyWidget(popup);
} }
@@ -1468,7 +1521,7 @@ X11_display_file(str, complain)
(void) dlb_fclose(fp); (void) dlb_fclose(fp);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNtitle, str); num_args++; XtSetArg(args[num_args], nhStr(XtNtitle), str); num_args++;
popup = XtCreatePopupShell("display_file", topLevelShellWidgetClass, popup = XtCreatePopupShell("display_file", topLevelShellWidgetClass,
toplevel, args, num_args); toplevel, args, num_args);
@@ -1476,15 +1529,15 @@ X11_display_file(str, complain)
XtParseTranslationTable("<Message>WM_PROTOCOLS: delete_file()")); XtParseTranslationTable("<Message>WM_PROTOCOLS: delete_file()"));
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNscrollHorizontal, XtSetArg(args[num_args], nhStr(XtNscrollHorizontal),
XawtextScrollWhenNeeded); num_args++; XawtextScrollWhenNeeded); num_args++;
XtSetArg(args[num_args], XtNscrollVertical, XtSetArg(args[num_args], nhStr(XtNscrollVertical),
XawtextScrollAlways); num_args++; XawtextScrollAlways); num_args++;
XtSetArg(args[num_args], XtNtype, XawAsciiString); num_args++; XtSetArg(args[num_args], nhStr(XtNtype), XawAsciiString); num_args++;
XtSetArg(args[num_args], XtNstring, textlines); num_args++; XtSetArg(args[num_args], nhStr(XtNstring), textlines); num_args++;
XtSetArg(args[num_args], XtNdisplayCaret, False); num_args++; XtSetArg(args[num_args], nhStr(XtNdisplayCaret), False); num_args++;
XtSetArg(args[num_args], XtNtranslations, XtSetArg(args[num_args], nhStr(XtNtranslations),
XtParseTranslationTable(display_translations)); num_args++; XtParseTranslationTable(display_translations)); num_args++;
dispfile = XtCreateManagedWidget( dispfile = XtCreateManagedWidget(
"text", /* name */ "text", /* name */
@@ -1495,11 +1548,12 @@ X11_display_file(str, complain)
/* Get font and border information. */ /* Get font and border information. */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfont, &fs); num_args++; XtSetArg(args[num_args], nhStr(XtNfont), &fs); num_args++;
XtSetArg(args[num_args], XtNtopMargin, &top_margin); num_args++; XtSetArg(args[num_args], nhStr(XtNtopMargin), &top_margin); num_args++;
XtSetArg(args[num_args], XtNbottomMargin, &bottom_margin); num_args++; XtSetArg(args[num_args], nhStr(XtNbottomMargin),
XtSetArg(args[num_args], XtNleftMargin, &left_margin); num_args++; &bottom_margin); num_args++;
XtSetArg(args[num_args], XtNrightMargin, &right_margin); num_args++; XtSetArg(args[num_args], nhStr(XtNleftMargin), &left_margin); num_args++;
XtSetArg(args[num_args], nhStr(XtNrightMargin), &right_margin); num_args++;
XtGetValues(dispfile, args, num_args); XtGetValues(dispfile, args, num_args);
/* /*
@@ -1573,6 +1627,11 @@ yn_delete(w, event, params, num_params)
String *params; String *params;
Cardinal *num_params; Cardinal *num_params;
{ {
nhUse(w);
nhUse(event);
nhUse(params);
nhUse(num_params);
yn_getting_num = FALSE; yn_getting_num = FALSE;
/* Only use yn_esc_map if we have choices. Otherwise, return ESC. */ /* Only use yn_esc_map if we have choices. Otherwise, return ESC. */
yn_return = yn_choices ? yn_esc_map : '\033'; yn_return = yn_choices ? yn_esc_map : '\033';
@@ -1808,6 +1867,10 @@ msgkey(w, data, event)
XEvent *event; XEvent *event;
{ {
Cardinal num = 0; Cardinal num = 0;
nhUse(w);
nhUse(data);
map_input(window_list[WIN_MAP].w, event, (String*) 0, &num); map_input(window_list[WIN_MAP].w, event, (String*) 0, &num);
} }
@@ -1821,6 +1884,9 @@ win_visible(w, data, event, flag) /* only called for autofocus */
{ {
XVisibilityEvent *vis_event = (XVisibilityEvent *)event; XVisibilityEvent *vis_event = (XVisibilityEvent *)event;
nhUse(data);
nhUse(flag);
if (vis_event->state != VisibilityFullyObscured) { if (vis_event->state != VisibilityFullyObscured) {
/* one-time operation; cancel ourself */ /* one-time operation; cancel ourself */
XtRemoveEventHandler(toplevel, VisibilityChangeMask, False, XtRemoveEventHandler(toplevel, VisibilityChangeMask, False,
@@ -1871,9 +1937,9 @@ init_standard_windows()
/* Tell the form that contains it that resizes are OK. */ /* Tell the form that contains it that resizes are OK. */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNresizable, True); num_args++; XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetValues(message_viewport, args, num_args); XtSetValues(message_viewport, args, num_args);
if(appResources.slow) { if(appResources.slow) {
@@ -1885,10 +1951,12 @@ init_standard_windows()
form, form,
args, num_args); args, num_args);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, message_viewport); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert),
XtSetArg(args[num_args], XtNjustify, XtJustifyLeft); num_args++; message_viewport); num_args++;
XtSetArg(args[num_args], XtNresizable, True); num_args++; XtSetArg(args[num_args], nhStr(XtNjustify),
XtSetArg(args[num_args], XtNlabel, " "); num_args++; XtJustifyLeft); num_args++;
XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
XtSetArg(args[num_args], nhStr(XtNlabel), " "); num_args++;
XtSetValues(yn_label, args, num_args); XtSetValues(yn_label, args, num_args);
} }
@@ -1906,11 +1974,12 @@ init_standard_windows()
/* Chain beneath message_viewport or yn window. */ /* Chain beneath message_viewport or yn window. */
num_args = 0; num_args = 0;
if(appResources.slow) { if(appResources.slow) {
XtSetArg(args[num_args], XtNfromVert, yn_label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), yn_label); num_args++;
} else { } else {
XtSetArg(args[num_args], XtNfromVert, message_viewport);num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert),
message_viewport); num_args++;
} }
XtSetArg(args[num_args], XtNbottom, XtChainBottom); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainBottom); num_args++;
XtSetValues(map_viewport, args, num_args); XtSetValues(map_viewport, args, num_args);
/* Create the status window, with the form as it's parent. */ /* Create the status window, with the form as it's parent. */
@@ -1929,11 +1998,11 @@ init_standard_windows()
* will never expand or contract. * will never expand or contract.
*/ */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, map_viewport); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), map_viewport); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainBottom); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainBottom); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainBottom); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainBottom); num_args++;
XtSetValues(status, args, num_args); XtSetValues(status, args, num_args);
@@ -1980,13 +2049,13 @@ init_standard_windows()
/* /*
* Now get the default widths of the windows. * Now get the default widths of the windows.
*/ */
XtSetArg(args[0], XtNwidth, &message_vp_width); XtSetArg(args[0], nhStr(XtNwidth), &message_vp_width);
XtGetValues(message_viewport, args, ONE); XtGetValues(message_viewport, args, ONE);
XtSetArg(args[0], XtNwidth, &map_vp_width); XtSetArg(args[0], nhStr(XtNwidth), &map_vp_width);
XtSetArg(args[1], XtNhorizDistance, &map_vp_hd); XtSetArg(args[1], nhStr(XtNhorizDistance), &map_vp_hd);
XtGetValues(map_viewport, args, TWO); XtGetValues(map_viewport, args, TWO);
XtSetArg(args[0], XtNwidth, &status_width); XtSetArg(args[0], nhStr(XtNwidth), &status_width);
XtSetArg(args[1], XtNhorizDistance, &status_hd); XtSetArg(args[1], nhStr(XtNhorizDistance), &status_hd);
XtGetValues(status, args, TWO); XtGetValues(status, args, TWO);
/* /*
@@ -1996,17 +2065,18 @@ init_standard_windows()
*/ */
if (map_vp_width < status_width || map_vp_width < message_vp_width) { if (map_vp_width < status_width || map_vp_width < message_vp_width) {
if (status_width > message_vp_width) { if (status_width > message_vp_width) {
XtSetArg(args[0], XtNwidth, status_width); XtSetArg(args[0], nhStr(XtNwidth), status_width);
XtSetValues(message_viewport, args, ONE); XtSetValues(message_viewport, args, ONE);
max_width = status_width; max_width = status_width;
} else { } else {
max_width = message_vp_width; max_width = message_vp_width;
} }
XtSetArg(args[0], XtNhorizDistance, map_vp_hd+((int)(max_width-map_vp_width)/2)); XtSetArg(args[0], nhStr(XtNhorizDistance),
map_vp_hd + ((int)(max_width - map_vp_width) / 2));
XtSetValues(map_viewport, args, ONE); XtSetValues(map_viewport, args, ONE);
} else { /* map is widest */ } else { /* map is widest */
XtSetArg(args[0], XtNwidth, map_vp_width); XtSetArg(args[0], nhStr(XtNwidth), map_vp_width);
XtSetValues(message_viewport, args, ONE); XtSetValues(message_viewport, args, ONE);
} }
/* /*
@@ -2094,6 +2164,8 @@ nh_keyscroll(viewport, event, params, num_params)
int direction; int direction;
Cardinal in_nparams = (num_params ? *num_params : 0); Cardinal in_nparams = (num_params ? *num_params : 0);
nhUse(event);
if (in_nparams != 1) return; /* bad translation */ if (in_nparams != 1) return; /* bad translation */
direction=atoi(params[0]); direction=atoi(params[0]);
@@ -2115,8 +2187,8 @@ nh_keyscroll(viewport, event, params, num_params)
/* The V_DELTA is 1/2 the value of shown. */ /* The V_DELTA is 1/2 the value of shown. */
if (horiz_sb) { if (horiz_sb) {
XtSetArg(arg[0], XtNshown, &shown); XtSetArg(arg[0], nhStr(XtNshown), &shown);
XtSetArg(arg[1], XtNtopOfThumb, &top); XtSetArg(arg[1], nhStr(XtNtopOfThumb), &top);
XtGetValues(horiz_sb, arg, TWO); XtGetValues(horiz_sb, arg, TWO);
do_call = True; do_call = True;
@@ -2138,8 +2210,8 @@ nh_keyscroll(viewport, event, params, num_params)
} }
if (vert_sb) { if (vert_sb) {
XtSetArg(arg[0], XtNshown, &shown); XtSetArg(arg[0], nhStr(XtNshown), &shown);
XtSetArg(arg[1], XtNtopOfThumb, &top); XtSetArg(arg[1], nhStr(XtNtopOfThumb), &top);
XtGetValues(vert_sb, arg, TWO); XtGetValues(vert_sb, arg, TWO);
do_call = True; do_call = True;
+23 -20
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 winmap.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 winmap.c $NHDT-Date: 1430899135 2015/05/06 07:58:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ */
/* NetHack 3.5 winmap.c $Date: 2009/05/06 10:55:49 $ $Revision: 1.14 $ */ /* NetHack 3.5 winmap.c $Date: 2009/05/06 10:55:49 $ $Revision: 1.14 $ */
/* SCCS Id: @(#)winmap.c 3.5 2005/11/12 */ /* SCCS Id: @(#)winmap.c 3.5 2005/11/12 */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
@@ -66,7 +66,7 @@ static void FDECL(map_check_size_change, (struct xwindow *));
static void FDECL(map_update, (struct xwindow *,int,int,int,int,BOOLEAN_P)); static void FDECL(map_update, (struct xwindow *,int,int,int,int,BOOLEAN_P));
static void FDECL(init_text, (struct xwindow *)); static void FDECL(init_text, (struct xwindow *));
static void FDECL(map_exposed, (Widget,XtPointer,XtPointer)); static void FDECL(map_exposed, (Widget,XtPointer,XtPointer));
static void FDECL(set_gc, (Widget,Font,char *,Pixel,GC *,GC *)); static void FDECL(set_gc, (Widget,Font,const char *,Pixel,GC *,GC *));
static void FDECL(get_text_gc, (struct xwindow *,Font)); static void FDECL(get_text_gc, (struct xwindow *,Font));
static void FDECL(get_char_info, (struct xwindow *)); static void FDECL(get_char_info, (struct xwindow *));
static void FDECL(display_cursor, (struct xwindow *)); static void FDECL(display_cursor, (struct xwindow *));
@@ -249,7 +249,8 @@ init_tiles(wp)
unsigned char *tb, *tile_bytes = (unsigned char *)0; unsigned char *tb, *tile_bytes = (unsigned char *)0;
int size; int size;
XColor *colors = (XColor *)0; XColor *colors = (XColor *)0;
int i, x, y; unsigned i;
int x, y;
int bitmap_pad; int bitmap_pad;
int ddepth; int ddepth;
#endif #endif
@@ -348,7 +349,7 @@ init_tiles(wp)
goto tiledone; goto tiledone;
} }
if (fread((char *) &header, sizeof(header), 1, fp) != 1) { if ((int) fread((char *) &header, sizeof(header), 1, fp) != 1) {
X11_raw_print("read of header failed"); X11_raw_print("read of header failed");
result = FALSE; result = FALSE;
goto tiledone; goto tiledone;
@@ -374,7 +375,7 @@ init_tiles(wp)
size = 3*header.ncolors; size = 3*header.ncolors;
colormap = (unsigned char *) alloc((unsigned)size); colormap = (unsigned char *) alloc((unsigned)size);
if (fread((char *) colormap, 1, size, fp) != size) { if ((int) fread((char *) colormap, 1, size, fp) != size) {
X11_raw_print("read of colormap failed"); X11_raw_print("read of colormap failed");
result = FALSE; result = FALSE;
goto tiledone; goto tiledone;
@@ -410,13 +411,13 @@ init_tiles(wp)
tile_count += header.per_row - (tile_count % header.per_row); tile_count += header.per_row - (tile_count % header.per_row);
} }
tile_bytes = (unsigned char *) alloc((unsigned)tile_count*size); tile_bytes = (unsigned char *) alloc((unsigned)tile_count*size);
if (fread((char *) tile_bytes, size, tile_count, fp) != tile_count) { if ((int) fread((char *) tile_bytes, size, tile_count, fp) != tile_count) {
X11_raw_print("read of tile bytes failed"); X11_raw_print("read of tile bytes failed");
result = FALSE; result = FALSE;
goto tiledone; goto tiledone;
} }
if (header.ntiles < total_tiles_used) { if (header.ntiles < (unsigned) total_tiles_used) {
Sprintf(buf, "tile file incomplete, expecting %d tiles, found %lu", Sprintf(buf, "tile file incomplete, expecting %d tiles, found %lu",
total_tiles_used, header.ntiles); total_tiles_used, header.ntiles);
X11_raw_print(buf); X11_raw_print(buf);
@@ -463,27 +464,27 @@ init_tiles(wp)
if (appResources.double_tile_size) { if (appResources.double_tile_size) {
unsigned long *expanded_row = unsigned long *expanded_row =
(unsigned long *)alloc(sizeof(unsigned long)*(unsigned)image_width); (unsigned long *)alloc(sizeof (unsigned long) * image_width);
tb = tile_bytes; tb = tile_bytes;
for (y = 0; y < image_height; y++) { for (y = 0; y < (int) image_height; y++) {
for (x = 0; x < image_width/2; x++) for (x = 0; x < (int) image_width / 2; x++)
expanded_row[2*x] = expanded_row[2*x] =
expanded_row[(2*x)+1] = colors[*tb++].pixel; expanded_row[(2*x)+1] = colors[*tb++].pixel;
for (x = 0; x < image_width; x++) for (x = 0; x < (int) image_width; x++)
XPutPixel(tile_image, x, y, expanded_row[x]); XPutPixel(tile_image, x, y, expanded_row[x]);
y++; /* duplicate row */ y++; /* duplicate row */
for (x = 0; x < image_width; x++) for (x = 0; x < (int) image_width; x++)
XPutPixel(tile_image, x, y, expanded_row[x]); XPutPixel(tile_image, x, y, expanded_row[x]);
} }
free((genericptr_t)expanded_row); free((genericptr_t)expanded_row);
} else { } else {
for (tb = tile_bytes, y = 0; y < image_height; y++) for (tb = tile_bytes, y = 0; y < (int) image_height; y++)
for (x = 0; x < image_width; x++, tb++) for (x = 0; x < (int) image_width; x++, tb++)
XPutPixel(tile_image, x, y, colors[*tb].pixel); XPutPixel(tile_image, x, y, colors[*tb].pixel);
} }
#endif /* USE_XPM */ #endif /* USE_XPM */
@@ -569,7 +570,7 @@ check_cursor_visibility(wp)
if (horiz_sb) { if (horiz_sb) {
XtSetArg(arg[0], XtNshown, &shown); XtSetArg(arg[0], XtNshown, &shown);
XtSetArg(arg[1], XtNtopOfThumb, &top); XtSetArg(arg[1], nhStr(XtNtopOfThumb), &top);
XtGetValues(horiz_sb, arg, TWO); XtGetValues(horiz_sb, arg, TWO);
/* [ALI] Don't assume map widget is the same size as actual map */ /* [ALI] Don't assume map widget is the same size as actual map */
@@ -620,7 +621,7 @@ check_cursor_visibility(wp)
if (vert_sb) { if (vert_sb) {
XtSetArg(arg[0], XtNshown, &shown); XtSetArg(arg[0], XtNshown, &shown);
XtSetArg(arg[1], XtNtopOfThumb, &top); XtSetArg(arg[1], nhStr(XtNtopOfThumb), &top);
XtGetValues(vert_sb, arg, TWO); XtGetValues(vert_sb, arg, TWO);
if (wp->map_information->is_tile) if (wp->map_information->is_tile)
@@ -742,7 +743,7 @@ static void
set_gc(w, font, resource_name, bgpixel, regular, inverse) set_gc(w, font, resource_name, bgpixel, regular, inverse)
Widget w; Widget w;
Font font; Font font;
char *resource_name; const char *resource_name;
Pixel bgpixel; Pixel bgpixel;
GC *regular, *inverse; GC *regular, *inverse;
{ {
@@ -751,7 +752,7 @@ set_gc(w, font, resource_name, bgpixel, regular, inverse)
Pixel curpixel; Pixel curpixel;
Arg arg[1]; Arg arg[1];
XtSetArg(arg[0], resource_name, &curpixel); XtSetArg(arg[0], (char *) resource_name, &curpixel);
XtGetValues(w, arg, ONE); XtGetValues(w, arg, ONE);
values.foreground = curpixel; values.foreground = curpixel;
@@ -1124,6 +1125,8 @@ map_exposed(w, client_data, widget_data)
XExposeEvent *event = (XExposeEvent *) widget_data; XExposeEvent *event = (XExposeEvent *) widget_data;
int t_height, t_width; /* tile/text height & width */ int t_height, t_width; /* tile/text height & width */
nhUse(client_data);
if (!XtIsRealized(w) || event->count > 0) return; if (!XtIsRealized(w) || event->count > 0) return;
wp = find_widget(w); wp = find_widget(w);
@@ -1489,8 +1492,8 @@ create_map_window(wp, create_popup, parent)
* realized, then the map can resize to its normal size. * realized, then the map can resize to its normal size.
*/ */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNrows, &rows); num_args++; XtSetArg(args[num_args], nhStr(XtNrows), &rows); num_args++;
XtSetArg(args[num_args], XtNcolumns, &columns); num_args++; XtSetArg(args[num_args], nhStr(XtNcolumns), &columns); num_args++;
XtGetValues(wp->w, args, num_args); XtGetValues(wp->w, args, num_args);
/* Don't bother with windows larger than ROWNOxCOLNO. */ /* Don't bother with windows larger than ROWNOxCOLNO. */
+98 -62
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 winmenu.c $NHDT-Date: 1428828477 2015/04/12 08:47:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */ /* NetHack 3.5 winmenu.c $NHDT-Date: 1430899135 2015/05/06 07:58:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* SCCS Id: @(#)winmenu.c 3.5 1996/08/15 */ /* SCCS Id: @(#)winmenu.c 3.5 1996/08/15 */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -97,6 +97,8 @@ menu_select(w, client_data, call_data)
#endif #endif
long how_many; long how_many;
nhUse(client_data);
wp = find_widget(w); wp = find_widget(w);
menu_info = wp->menu_information; menu_info = wp->menu_information;
how_many = menu_info->counting ? menu_info->menu_count : -1L; how_many = menu_info->counting ? menu_info->menu_count : -1L;
@@ -156,6 +158,10 @@ menu_delete(w, event, params, num_params)
String *params; String *params;
Cardinal *num_params; Cardinal *num_params;
{ {
nhUse(event);
nhUse(params);
nhUse(num_params);
menu_cancel((Widget)None, (XtPointer) find_widget(w), (XtPointer) 0); menu_cancel((Widget)None, (XtPointer) find_widget(w), (XtPointer) 0);
} }
@@ -170,6 +176,9 @@ invert_line(wp, curr, which, how_many)
int which; int which;
long how_many; long how_many;
{ {
#ifndef USE_FWF
nhUse(which);
#endif
reset_menu_count(wp->menu_information); reset_menu_count(wp->menu_information);
curr->selected = !curr->selected; curr->selected = !curr->selected;
if (curr->selected) { if (curr->selected) {
@@ -207,6 +216,9 @@ menu_key(w, event, params, num_params)
int count; int count;
boolean selected_something; boolean selected_something;
nhUse(params);
nhUse(num_params);
wp = find_widget(w); wp = find_widget(w);
menu_info = wp->menu_information; menu_info = wp->menu_information;
@@ -345,6 +357,9 @@ menu_ok(w, client_data, call_data)
{ {
struct xwindow *wp = (struct xwindow *) client_data; struct xwindow *wp = (struct xwindow *) client_data;
nhUse(w);
nhUse(call_data);
menu_popdown(wp); menu_popdown(wp);
} }
@@ -356,6 +371,9 @@ menu_cancel(w, client_data, call_data)
{ {
struct xwindow *wp = (struct xwindow *) client_data; struct xwindow *wp = (struct xwindow *) client_data;
nhUse(w);
nhUse(call_data);
if (wp->menu_information->is_active) { if (wp->menu_information->is_active) {
select_none(wp); select_none(wp);
wp->menu_information->cancelled = TRUE; wp->menu_information->cancelled = TRUE;
@@ -369,6 +387,9 @@ menu_all(w, client_data, call_data)
Widget w; Widget w;
XtPointer client_data, call_data; XtPointer client_data, call_data;
{ {
nhUse(w);
nhUse(call_data);
select_all((struct xwindow *) client_data); select_all((struct xwindow *) client_data);
} }
@@ -378,6 +399,9 @@ menu_none(w, client_data, call_data)
Widget w; Widget w;
XtPointer client_data, call_data; XtPointer client_data, call_data;
{ {
nhUse(w);
nhUse(call_data);
select_none((struct xwindow *) client_data); select_none((struct xwindow *) client_data);
} }
@@ -387,6 +411,9 @@ menu_invert(w, client_data, call_data)
Widget w; Widget w;
XtPointer client_data, call_data; XtPointer client_data, call_data;
{ {
nhUse(w);
nhUse(call_data);
invert_all((struct xwindow *) client_data); invert_all((struct xwindow *) client_data);
} }
@@ -400,6 +427,9 @@ menu_search(w, client_data, call_data)
struct menu_info_t *menu_info = wp->menu_information; struct menu_info_t *menu_info = wp->menu_information;
char buf[BUFSZ+2], tmpbuf[BUFSZ]; char buf[BUFSZ+2], tmpbuf[BUFSZ];
nhUse(w);
nhUse(call_data);
X11_getlin("Search for:", tmpbuf); X11_getlin("Search for:", tmpbuf);
if (!*tmpbuf || *tmpbuf == '\033') return; if (!*tmpbuf || *tmpbuf == '\033') return;
/* convert "string" into "*string*" for use with pmatch() */ /* convert "string" into "*string*" for use with pmatch() */
@@ -613,6 +643,9 @@ X11_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected)
x11_menu_item *item; x11_menu_item *item;
struct menu_info_t *menu_info; struct menu_info_t *menu_info;
nhUse(glyph);
nhUse(preselected); /*FIXME*/
check_winid(window); check_winid(window);
menu_info = window_list[window].menu_information; menu_info = window_list[window].menu_information;
if (!menu_info->is_menu) { if (!menu_info->is_menu) {
@@ -804,10 +837,10 @@ X11_select_menu(window, how, menu_list)
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNborderWidth, 0); num_args++; XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
if (labeled) if (labeled)
label = XtCreateManagedWidget(menu_info->new_menu.query, label = XtCreateManagedWidget(menu_info->new_menu.query,
@@ -820,11 +853,11 @@ X11_select_menu(window, how, menu_list)
* Create ok, cancel, all, none, invert, and search buttons.. * Create ok, cancel, all, none, invert, and search buttons..
*/ */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
ok = XtCreateManagedWidget("OK", ok = XtCreateManagedWidget("OK",
commandWidgetClass, commandWidgetClass,
form, form,
@@ -832,13 +865,14 @@ X11_select_menu(window, how, menu_list)
XtAddCallback(ok, XtNcallback, menu_ok, (XtPointer) wp); XtAddCallback(ok, XtNcallback, menu_ok, (XtPointer) wp);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], XtNfromHoriz, ok); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), ok); num_args++;
XtSetArg(args[num_args], XtNsensitive, how!=PICK_NONE); num_args++; XtSetArg(args[num_args], nhStr(XtNsensitive),
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; how != PICK_NONE); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
cancel = XtCreateManagedWidget("cancel", cancel = XtCreateManagedWidget("cancel",
commandWidgetClass, commandWidgetClass,
form, form,
@@ -847,13 +881,13 @@ X11_select_menu(window, how, menu_list)
sens = (how == PICK_ANY); sens = (how == PICK_ANY);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], XtNfromHoriz, cancel); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), cancel); num_args++;
XtSetArg(args[num_args], XtNsensitive, sens); num_args++; XtSetArg(args[num_args], nhStr(XtNsensitive), sens); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
all = XtCreateManagedWidget("all", all = XtCreateManagedWidget("all",
commandWidgetClass, commandWidgetClass,
form, form,
@@ -861,13 +895,13 @@ X11_select_menu(window, how, menu_list)
XtAddCallback(all, XtNcallback, menu_all, (XtPointer) wp); XtAddCallback(all, XtNcallback, menu_all, (XtPointer) wp);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], XtNfromHoriz, all); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), all); num_args++;
XtSetArg(args[num_args], XtNsensitive, sens); num_args++; XtSetArg(args[num_args], nhStr(XtNsensitive), sens); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
none = XtCreateManagedWidget("none", none = XtCreateManagedWidget("none",
commandWidgetClass, commandWidgetClass,
form, form,
@@ -875,13 +909,13 @@ X11_select_menu(window, how, menu_list)
XtAddCallback(none, XtNcallback, menu_none, (XtPointer) wp); XtAddCallback(none, XtNcallback, menu_none, (XtPointer) wp);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], XtNfromHoriz, none); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), none); num_args++;
XtSetArg(args[num_args], XtNsensitive, sens); num_args++; XtSetArg(args[num_args], nhStr(XtNsensitive), sens); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
invert = XtCreateManagedWidget("invert", invert = XtCreateManagedWidget("invert",
commandWidgetClass, commandWidgetClass,
form, form,
@@ -889,13 +923,14 @@ X11_select_menu(window, how, menu_list)
XtAddCallback(invert, XtNcallback, menu_invert, (XtPointer) wp); XtAddCallback(invert, XtNcallback, menu_invert, (XtPointer) wp);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], XtNfromHoriz, invert); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), invert); num_args++;
XtSetArg(args[num_args], XtNsensitive, how!=PICK_NONE); num_args++; XtSetArg(args[num_args], nhStr(XtNsensitive),
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; how != PICK_NONE); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
search = XtCreateManagedWidget("search", search = XtCreateManagedWidget("search",
commandWidgetClass, commandWidgetClass,
form, form,
@@ -903,18 +938,18 @@ X11_select_menu(window, how, menu_list)
XtAddCallback(search, XtNcallback, menu_search, (XtPointer) wp); XtAddCallback(search, XtNcallback, menu_search, (XtPointer) wp);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNallowVert, True); num_args++; XtSetArg(args[num_args], nhStr(XtNallowVert), True); num_args++;
XtSetArg(args[num_args], XtNallowHoriz, False); num_args++; XtSetArg(args[num_args], nhStr(XtNallowHoriz), False); num_args++;
XtSetArg(args[num_args], XtNuseBottom, True); num_args++; XtSetArg(args[num_args], nhStr(XtNuseBottom), True); num_args++;
XtSetArg(args[num_args], XtNuseRight, True); num_args++; XtSetArg(args[num_args], nhStr(XtNuseRight), True); num_args++;
/* /*
XtSetArg(args[num_args], XtNforceBars, True); num_args++; XtSetArg(args[num_args], nhStr(XtNforceBars), True); num_args++;
*/ */
XtSetArg(args[num_args], XtNfromVert, all); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), all); num_args++;
XtSetArg(args[num_args], XtNtop, XtChainTop); num_args++; XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XtChainBottom); num_args++; XtSetArg(args[num_args], nhStr(XtNbottom), XtChainBottom); num_args++;
XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
XtSetArg(args[num_args], XtNright, XtChainRight); num_args++; XtSetArg(args[num_args], nhStr(XtNright), XtChainRight); num_args++;
viewport_widget = XtCreateManagedWidget( viewport_widget = XtCreateManagedWidget(
"menu_viewport", /* name */ "menu_viewport", /* name */
viewportWidgetClass, viewportWidgetClass,
@@ -925,15 +960,15 @@ X11_select_menu(window, how, menu_list)
move_menu(&menu_info->new_menu, &menu_info->curr_menu); move_menu(&menu_info->new_menu, &menu_info->curr_menu);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNforceColumns, True); num_args++; XtSetArg(args[num_args], nhStr(XtNforceColumns), True); num_args++;
XtSetArg(args[num_args], XtNcolumnSpacing, 1); num_args++; XtSetArg(args[num_args], nhStr(XtNcolumnSpacing), 1); num_args++;
XtSetArg(args[num_args], XtNdefaultColumns, 1); num_args++; XtSetArg(args[num_args], nhStr(XtNdefaultColumns), 1); num_args++;
XtSetArg(args[num_args], XtNlist, XtSetArg(args[num_args], nhStr(XtNlist),
menu_info->curr_menu.list_pointer); num_args++; menu_info->curr_menu.list_pointer); num_args++;
#ifdef USE_FWF #ifdef USE_FWF
XtSetArg(args[num_args], XtNsensitiveArray, XtSetArg(args[num_args], nhStr(XtNsensitiveArray),
menu_info->curr_menu.sensitive); num_args++; menu_info->curr_menu.sensitive); num_args++;
XtSetArg(args[num_args], XtNmaxSelectable, XtSetArg(args[num_args], nhStr(XtNmaxSelectable),
menu_info->curr_menu.count); num_args++; menu_info->curr_menu.count); num_args++;
#endif #endif
wp->w = XtCreateManagedWidget( wp->w = XtCreateManagedWidget(
@@ -956,7 +991,8 @@ X11_select_menu(window, how, menu_list)
&menu_info->internal_height); num_args++; &menu_info->internal_height); num_args++;
XtSetArg(args[num_args], XtNinternalWidth, XtSetArg(args[num_args], XtNinternalWidth,
&menu_info->internal_width); num_args++; &menu_info->internal_width); num_args++;
XtSetArg(args[num_args], XtNrowSpacing, &row_spacing); num_args++; XtSetArg(args[num_args], nhStr(XtNrowSpacing),
&row_spacing); num_args++;
XtGetValues(wp->w, args, num_args); XtGetValues(wp->w, args, num_args);
/* font height is ascent + descent */ /* font height is ascent + descent */
+8 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 winmesg.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 winmesg.c $NHDT-Date: 1430899136 2015/05/06 07:58:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $ */
/* NetHack 3.5 winmesg.c $Date: 2009/05/06 10:55:57 $ $Revision: 1.4 $ */ /* NetHack 3.5 winmesg.c $Date: 2009/05/06 10:55:57 $ $Revision: 1.4 $ */
/* SCCS Id: @(#)winmesg.c 3.5 1996/04/05 */ /* SCCS Id: @(#)winmesg.c 3.5 1996/04/05 */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
@@ -92,8 +92,8 @@ create_message_window(wp, create_popup, parent)
mesg_info->dirty = False; mesg_info->dirty = False;
mesg_info->viewport_width = mesg_info->viewport_height = 0; mesg_info->viewport_width = mesg_info->viewport_height = 0;
if (iflags.msg_history < appResources.message_lines) if (iflags.msg_history < (unsigned) appResources.message_lines)
iflags.msg_history = appResources.message_lines; iflags.msg_history = (unsigned) appResources.message_lines;
if (iflags.msg_history > MAX_HISTORY) /* a sanity check */ if (iflags.msg_history > MAX_HISTORY) /* a sanity check */
iflags.msg_history = MAX_HISTORY; iflags.msg_history = MAX_HISTORY;
@@ -534,6 +534,8 @@ mesg_exposed(w, client_data, widget_data)
{ {
XExposeEvent *event = (XExposeEvent *) widget_data; XExposeEvent *event = (XExposeEvent *) widget_data;
nhUse(client_data);
if (XtIsRealized(w) && event->count == 0) { if (XtIsRealized(w) && event->count == 0) {
struct xwindow *wp; struct xwindow *wp;
Display *dpy; Display *dpy;
@@ -603,6 +605,9 @@ mesg_resized(w, client_data, call_data)
old_lines = wp->mesg_information->num_lines;; old_lines = wp->mesg_information->num_lines;;
#endif #endif
nhUse(call_data);
nhUse(client_data);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNwidth, &pixel_width); num_args++; XtSetArg(args[num_args], XtNwidth, &pixel_width); num_args++;
XtSetArg(args[num_args], XtNheight, &pixel_height); num_args++; XtSetArg(args[num_args], XtNheight, &pixel_height); num_args++;
+55 -9
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 winmisc.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 winmisc.c $NHDT-Date: 1430899137 2015/05/06 07:58:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* NetHack 3.5 winmisc.c $Date: 2009/05/06 10:55:57 $ $Revision: 1.7 $ */ /* NetHack 3.5 winmisc.c $Date: 2009/05/06 10:55:57 $ $Revision: 1.7 $ */
/* SCCS Id: @(#)winmisc.c 3.5 2000/05/21 */ /* SCCS Id: @(#)winmisc.c 3.5 2000/05/21 */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
@@ -89,6 +89,10 @@ ps_quit(w, client_data, call_data)
Widget w; Widget w;
XtPointer client_data, call_data; XtPointer client_data, call_data;
{ {
nhUse(w);
nhUse(client_data);
nhUse(call_data);
ps_selected = PS_QUIT; ps_selected = PS_QUIT;
exit_x_event = TRUE; /* leave event loop */ exit_x_event = TRUE; /* leave event loop */
} }
@@ -99,6 +103,10 @@ ps_random(w, client_data, call_data)
Widget w; Widget w;
XtPointer client_data, call_data; XtPointer client_data, call_data;
{ {
nhUse(w);
nhUse(client_data);
nhUse(call_data);
ps_selected = PS_RANDOM; ps_selected = PS_RANDOM;
exit_x_event = TRUE; /* leave event loop */ exit_x_event = TRUE; /* leave event loop */
} }
@@ -109,6 +117,9 @@ ps_select(w, client_data, call_data)
Widget w; Widget w;
XtPointer client_data, call_data; XtPointer client_data, call_data;
{ {
nhUse(w);
nhUse(call_data);
ps_selected = (int) client_data; ps_selected = (int) client_data;
exit_x_event = TRUE; /* leave event loop */ exit_x_event = TRUE; /* leave event loop */
} }
@@ -125,6 +136,10 @@ ps_key(w, event, params, num_params)
char rolechars[QBUFSZ]; char rolechars[QBUFSZ];
int i; int i;
nhUse(w);
nhUse(params);
nhUse(num_params);
(void)memset(rolechars, '\0', sizeof rolechars); /* for index() */ (void)memset(rolechars, '\0', sizeof rolechars); /* for index() */
for (i = 0; roles[i].name.m; ++i) { for (i = 0; roles[i].name.m; ++i) {
ch = lowc(*roles[i].name.m); ch = lowc(*roles[i].name.m);
@@ -167,6 +182,10 @@ race_key(w, event, params, num_params)
char racechars[QBUFSZ]; char racechars[QBUFSZ];
int i; int i;
nhUse(w);
nhUse(params);
nhUse(num_params);
(void)memset(racechars, '\0', sizeof racechars); /* for index() */ (void)memset(racechars, '\0', sizeof racechars); /* for index() */
for (i = 0; races[i].noun; ++i) { for (i = 0; races[i].noun; ++i) {
ch = lowc(*races[i].noun); ch = lowc(*races[i].noun);
@@ -207,6 +226,10 @@ gend_key(w, event, params, num_params)
char ch, *mark; char ch, *mark;
static char gendchars[] = "mf"; static char gendchars[] = "mf";
nhUse(w);
nhUse(params);
nhUse(num_params);
ch = key_event_to_char((XKeyEvent *) event); ch = key_event_to_char((XKeyEvent *) event);
if (ch == '\0') { /* don't accept nul char/modifier event */ if (ch == '\0') { /* don't accept nul char/modifier event */
/* don't beep */ /* don't beep */
@@ -239,6 +262,10 @@ algn_key(w, event, params, num_params)
char ch, *mark; char ch, *mark;
static char algnchars[] = "LNC"; static char algnchars[] = "LNC";
nhUse(w);
nhUse(params);
nhUse(num_params);
ch = key_event_to_char((XKeyEvent *) event); ch = key_event_to_char((XKeyEvent *) event);
if (ch == '\0') { /* don't accept nul char/modifier event */ if (ch == '\0') { /* don't accept nul char/modifier event */
/* don't beep */ /* don't beep */
@@ -565,6 +592,9 @@ extend_select(w, client_data, call_data)
{ {
int selected = (int) client_data; int selected = (int) client_data;
nhUse(w);
nhUse(call_data);
if (extended_command_selected != selected) { if (extended_command_selected != selected) {
/* visibly deselect old one */ /* visibly deselect old one */
if (extended_command_selected >= 0) if (extended_command_selected >= 0)
@@ -588,6 +618,10 @@ extend_dismiss(w, client_data, call_data)
Widget w; Widget w;
XtPointer client_data, call_data; XtPointer client_data, call_data;
{ {
nhUse(w);
nhUse(client_data);
nhUse(call_data);
ec_dismiss(); ec_dismiss();
} }
@@ -597,6 +631,10 @@ extend_help(w, client_data, call_data)
Widget w; Widget w;
XtPointer client_data, call_data; XtPointer client_data, call_data;
{ {
nhUse(w);
nhUse(client_data);
nhUse(call_data);
/* We might need to make it known that we already have one listed. */ /* We might need to make it known that we already have one listed. */
(void) doextlist(); (void) doextlist();
} }
@@ -624,6 +662,10 @@ popup_delete(w, event, params, num_params)
String *params; String *params;
Cardinal *num_params; Cardinal *num_params;
{ {
nhUse(event);
nhUse(params);
nhUse(num_params);
ps_selected = PS_QUIT; ps_selected = PS_QUIT;
nh_XtPopdown(w); nh_XtPopdown(w);
exit_x_event = TRUE; /* leave event loop */ exit_x_event = TRUE; /* leave event loop */
@@ -653,6 +695,10 @@ ec_key(w, event, params, num_params)
int i; int i;
XKeyEvent *xkey = (XKeyEvent *) event; XKeyEvent *xkey = (XKeyEvent *) event;
nhUse(w);
nhUse(params);
nhUse(num_params);
ch = key_event_to_char(xkey); ch = key_event_to_char(xkey);
if (ch == '\0') { /* don't accept nul char/modifier event */ if (ch == '\0') { /* don't accept nul char/modifier event */
@@ -812,7 +858,7 @@ make_menu(popup_name, popup_label, popup_translations,
/* Get the default distance between objects in the form widget. */ /* Get the default distance between objects in the form widget. */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNdefaultDistance, &distance); num_args++; XtSetArg(args[num_args], nhStr(XtNdefaultDistance), &distance); num_args++;
XtGetValues(form, args, num_args); XtGetValues(form, args, num_args);
/* /*
@@ -829,9 +875,9 @@ make_menu(popup_name, popup_label, popup_translations,
* Create the left button. * Create the left button.
*/ */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
/* /*
XtSetArg(args[num_args], XtNshapeStyle, XtSetArg(args[num_args], nhStr(XtNshapeStyle),
XmuShapeRoundedRectangle); num_args++; XmuShapeRoundedRectangle); num_args++;
*/ */
left = XtCreateManagedWidget(left_name, left = XtCreateManagedWidget(left_name,
@@ -846,10 +892,10 @@ make_menu(popup_name, popup_label, popup_translations,
* Create right button. * Create right button.
*/ */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromHoriz, left); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), left); num_args++;
XtSetArg(args[num_args], XtNfromVert, label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
/* /*
XtSetArg(args[num_args], XtNshapeStyle, XtSetArg(args[num_args], nhStr(XtNshapeStyle),
XmuShapeRoundedRectangle); num_args++; XmuShapeRoundedRectangle); num_args++;
*/ */
right = XtCreateManagedWidget(right_name, right = XtCreateManagedWidget(right_name,
@@ -867,10 +913,10 @@ make_menu(popup_name, popup_label, popup_translations,
for (i = 0, above = left, curr = commands; i < num_names; i++) { for (i = 0, above = left, curr = commands; i < num_names; i++) {
if (!widget_names[i]) continue; if (!widget_names[i]) continue;
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, above); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), above); num_args++;
if (above == left) { if (above == left) {
/* if first, we are farther apart */ /* if first, we are farther apart */
XtSetArg(args[num_args], XtNvertDistance, skip); num_args++; XtSetArg(args[num_args], nhStr(XtNvertDistance), skip); num_args++;
} }
*curr = XtCreateManagedWidget(widget_names[i], *curr = XtCreateManagedWidget(widget_names[i],
+40 -33
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 winstat.c $NHDT-Date: 1425083083 2015/02/28 00:24:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $ */ /* NetHack 3.5 winstat.c $NHDT-Date: 1430899137 2015/05/06 07:58:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
/* SCCS Id: @(#)winstat.c 3.5 1996/04/05 */ /* SCCS Id: @(#)winstat.c 3.5 1996/04/05 */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -85,10 +85,10 @@ create_status_window(wp, create_popup, parent)
*/ */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNdisplayCaret, False); num_args++; XtSetArg(args[num_args], nhStr(XtNdisplayCaret), False); num_args++;
XtSetArg(args[num_args], XtNscrollHorizontal, XtSetArg(args[num_args], nhStr(XtNscrollHorizontal),
XawtextScrollWhenNeeded); num_args++; XawtextScrollWhenNeeded); num_args++;
XtSetArg(args[num_args], XtNscrollVertical, XtSetArg(args[num_args], nhStr(XtNscrollVertical),
XawtextScrollWhenNeeded); num_args++; XawtextScrollWhenNeeded); num_args++;
wp->w = XtCreateManagedWidget( wp->w = XtCreateManagedWidget(
@@ -105,11 +105,15 @@ create_status_window(wp, create_popup, parent)
/* Get the font and margin information. */ /* Get the font and margin information. */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfont, &fs); num_args++; XtSetArg(args[num_args], XtNfont, &fs); num_args++;
XtSetArg(args[num_args], XtNtopMargin, &top_margin); num_args++; XtSetArg(args[num_args], nhStr(XtNtopMargin),
XtSetArg(args[num_args], XtNbottomMargin, &bottom_margin); num_args++; &top_margin); num_args++;
XtSetArg(args[num_args], XtNleftMargin, &left_margin); num_args++; XtSetArg(args[num_args], nhStr(XtNbottomMargin),
XtSetArg(args[num_args], XtNrightMargin, &right_margin); num_args++; &bottom_margin); num_args++;
XtSetArg(args[num_args], nhStr(XtNleftMargin),
&left_margin); num_args++;
XtSetArg(args[num_args], nhStr(XtNrightMargin),
&right_margin); num_args++;
XtGetValues(wp->w, args, num_args); XtGetValues(wp->w, args, num_args);
wp->pixel_height = 2 * nhFontHeight(wp->w) + top_margin + bottom_margin; wp->pixel_height = 2 * nhFontHeight(wp->w) + top_margin + bottom_margin;
@@ -182,13 +186,14 @@ adjust_status(wp, str)
static int hilight_time = 1; /* number of turns to hilight a changed value */ static int hilight_time = 1; /* number of turns to hilight a changed value */
struct X_status_value { struct X_status_value {
char *name; /* text name */ /* we have to cast away 'const' when assigning new names */
int type; /* status type */ const char *name; /* text name */
Widget w; /* widget of name/value pair */ int type; /* status type */
long last_value; /* value displayed */ Widget w; /* widget of name/value pair */
int turn_count; /* last time the value changed */ long last_value; /* value displayed */
boolean set; /* if hilighed */ int turn_count; /* last time the value changed */
boolean after_init; /* don't hilight on first change (init) */ boolean set; /* if hilighed */
boolean after_init; /* don't hilight on first change (init) */
}; };
/* valid type values */ /* valid type values */
@@ -202,7 +207,7 @@ static const char *FDECL(width_string, (int));
static void FDECL(create_widget, (Widget,struct X_status_value *,int)); static void FDECL(create_widget, (Widget,struct X_status_value *,int));
static void FDECL(get_widths, (struct X_status_value *,int *,int *)); static void FDECL(get_widths, (struct X_status_value *,int *,int *));
static void FDECL(set_widths, (struct X_status_value *,int,int)); static void FDECL(set_widths, (struct X_status_value *,int,int));
static Widget FDECL(init_column, (char *,Widget,Widget,Widget,int *)); static Widget FDECL(init_column, (const char *,Widget,Widget,Widget,int *));
static Widget FDECL(init_info_form, (Widget,Widget,Widget)); static Widget FDECL(init_info_form, (Widget,Widget,Widget));
/* /*
@@ -369,8 +374,9 @@ update_val(attr_rec, new_value)
if (strcmp(buf, attr_rec->name) == 0) return; /* same */ if (strcmp(buf, attr_rec->name) == 0) return; /* same */
/* Set the label. */ /* Set the label. 'name' field is const for most entries;
Strcpy(attr_rec->name, buf); we need to cast away that const for this assignment */
Strcpy((char *) attr_rec->name, buf);
XtSetArg(args[0], XtNlabel, buf); XtSetArg(args[0], XtNlabel, buf);
XtSetValues(attr_rec->w, args, ONE); XtSetValues(attr_rec->w, args, ONE);
@@ -714,7 +720,8 @@ create_widget(parent, sv, sv_index)
case SV_LABEL: case SV_LABEL:
/* Labels get their own buffer. */ /* Labels get their own buffer. */
sv->name = (char *) alloc(BUFSZ); sv->name = (char *) alloc(BUFSZ);
sv->name[0] = '\0'; /* we need to cast away 'const' when assigning a value */
*(char *)(sv->name) = '\0';
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNborderWidth, 0); num_args++; XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
@@ -791,7 +798,7 @@ set_widths(sv, width1, width2)
static Widget static Widget
init_column(name, parent, top, left, col_indices) init_column(name, parent, top, left, col_indices)
char *name; const char *name;
Widget parent, top, left; Widget parent, top, left;
int *col_indices; int *col_indices;
{ {
@@ -804,12 +811,12 @@ init_column(name, parent, top, left, col_indices)
num_args = 0; num_args = 0;
if (top != (Widget) 0) { if (top != (Widget) 0) {
XtSetArg(args[num_args], XtNfromVert, top); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), top); num_args++;
} }
if (left != (Widget) 0) { if (left != (Widget) 0) {
XtSetArg(args[num_args], XtNfromHoriz, left); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), left); num_args++;
} }
XtSetArg(args[num_args], XtNdefaultDistance, 0); num_args++; XtSetArg(args[num_args], nhStr(XtNdefaultDistance), 0); num_args++;
form = XtCreateManagedWidget(name, form = XtCreateManagedWidget(name,
formWidgetClass, formWidgetClass,
parent, args, num_args); parent, args, num_args);
@@ -820,8 +827,8 @@ init_column(name, parent, top, left, col_indices)
create_widget(form, sv, *ip); /* will set init width */ create_widget(form, sv, *ip); /* will set init width */
if (ip != col_indices) { /* not first */ if (ip != col_indices) { /* not first */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, shown_stats[*(ip-1)].w); XtSetArg(args[num_args], nhStr(XtNfromVert),
num_args++; shown_stats[*(ip-1)].w); num_args++;
XtSetValues(sv->w, args, num_args); XtSetValues(sv->w, args, num_args);
} }
get_widths(sv, &width1, &width2); get_widths(sv, &width1, &width2);
@@ -877,12 +884,12 @@ init_info_form(parent, top, left)
num_args = 0; num_args = 0;
if (top != (Widget) 0) { if (top != (Widget) 0) {
XtSetArg(args[num_args], XtNfromVert, top); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), top); num_args++;
} }
if (left != (Widget) 0) { if (left != (Widget) 0) {
XtSetArg(args[num_args], XtNfromHoriz, left); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), left); num_args++;
} }
XtSetArg(args[num_args], XtNdefaultDistance, 0); num_args++; XtSetArg(args[num_args], nhStr(XtNdefaultDistance), 0); num_args++;
form = XtCreateManagedWidget("status_info", form = XtCreateManagedWidget("status_info",
formWidgetClass, formWidgetClass,
parent, parent,
@@ -897,7 +904,7 @@ init_info_form(parent, top, left)
create_widget(form, sv_dlevel, F_DLEVEL); create_widget(form, sv_dlevel, F_DLEVEL);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfromVert, sv_name->w); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), sv_name->w); num_args++;
XtSetValues(sv_dlevel->w, args, num_args); XtSetValues(sv_dlevel->w, args, num_args);
/* two columns beneath */ /* two columns beneath */
@@ -939,10 +946,10 @@ create_fancy_status(parent, top)
num_args = 0; num_args = 0;
if (top != (Widget) 0) { if (top != (Widget) 0) {
XtSetArg(args[num_args], XtNfromVert, top); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), top); num_args++;
} }
XtSetArg(args[num_args], XtNdefaultDistance, 0); num_args++; XtSetArg(args[num_args], nhStr(XtNdefaultDistance), 0); num_args++;
XtSetArg(args[num_args], XtNborderWidth, 0); num_args++; XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
XtSetArg(args[num_args], XtNorientation, XtorientHorizontal); num_args++; XtSetArg(args[num_args], XtNorientation, XtorientHorizontal); num_args++;
form = XtCreateManagedWidget("fancy_status", form = XtCreateManagedWidget("fancy_status",
panedWidgetClass, panedWidgetClass,
+25 -11
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 wintext.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 wintext.c $NHDT-Date: 1430899138 2015/05/06 07:58:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* NetHack 3.5 wintext.c $Date: 2012/01/24 04:26:27 $ $Revision: 1.7 $ */ /* NetHack 3.5 wintext.c $Date: 2012/01/24 04:26:27 $ $Revision: 1.7 $ */
/* SCCS Id: @(#)wintext.c 3.5 1996/04/05 */ /* SCCS Id: @(#)wintext.c 3.5 1996/04/05 */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
@@ -66,6 +66,10 @@ delete_text(w, event, params, num_params)
struct xwindow *wp; struct xwindow *wp;
struct text_info_t *text_info; struct text_info_t *text_info;
nhUse(event);
nhUse(params);
nhUse(num_params);
wp = find_widget(w); wp = find_widget(w);
text_info = wp->text_information; text_info = wp->text_information;
@@ -94,6 +98,10 @@ dismiss_text(w, event, params, num_params)
struct xwindow *wp; struct xwindow *wp;
struct text_info_t *text_info; struct text_info_t *text_info;
nhUse(event);
nhUse(params);
nhUse(num_params);
wp = find_widget(w); wp = find_widget(w);
text_info = wp->text_information; text_info = wp->text_information;
@@ -142,6 +150,8 @@ add_to_text_window(wp, attr, str)
struct text_info_t *text_info = wp->text_information; struct text_info_t *text_info = wp->text_information;
int width; int width;
nhUse(attr);
append_text_buffer(&text_info->text, str, FALSE); append_text_buffer(&text_info->text, str, FALSE);
/* Calculate text width and save longest line */ /* Calculate text width and save longest line */
@@ -223,12 +233,12 @@ display_text_window(wp, blocking)
/* if added before the window is displayed, so do it afterward. */ /* if added before the window is displayed, so do it afterward. */
num_args = 0; num_args = 0;
if (nlines < text_info->text.num_lines) { /* add vert scrollbar */ if (nlines < text_info->text.num_lines) { /* add vert scrollbar */
XtSetArg(args[num_args], XtNscrollVertical, XawtextScrollAlways); XtSetArg(args[num_args], nhStr(XtNscrollVertical),
num_args++; XawtextScrollAlways); num_args++;
} }
if (width >= (Dimension) (XtScreen(wp->w)->width-20)) { /* too wide */ if (width >= (Dimension) (XtScreen(wp->w)->width-20)) { /* too wide */
XtSetArg(args[num_args], XtNscrollHorizontal, XawtextScrollAlways); XtSetArg(args[num_args], nhStr(XtNscrollHorizontal),
num_args++; XawtextScrollAlways); num_args++;
} }
if (num_args) XtSetValues(wp->w, args, num_args); if (num_args) XtSetValues(wp->w, args, num_args);
@@ -286,7 +296,7 @@ create_text_window(wp)
args, num_args); args, num_args);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNdisplayCaret, False); num_args++; XtSetArg(args[num_args], nhStr(XtNdisplayCaret), False); num_args++;
XtSetArg(args[num_args], XtNresize, XawtextResizeBoth); num_args++; XtSetArg(args[num_args], XtNresize, XawtextResizeBoth); num_args++;
XtSetArg(args[num_args], XtNtranslations, XtSetArg(args[num_args], XtNtranslations,
XtParseTranslationTable(text_translations)); num_args++; XtParseTranslationTable(text_translations)); num_args++;
@@ -301,11 +311,15 @@ create_text_window(wp)
/* Get the font and margin information. */ /* Get the font and margin information. */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNfont, &text_info->fs); num_args++; XtSetArg(args[num_args], XtNfont, &text_info->fs); num_args++;
XtSetArg(args[num_args], XtNtopMargin, &top_margin); num_args++; XtSetArg(args[num_args], nhStr(XtNtopMargin),
XtSetArg(args[num_args], XtNbottomMargin, &bottom_margin); num_args++; &top_margin); num_args++;
XtSetArg(args[num_args], XtNleftMargin, &left_margin); num_args++; XtSetArg(args[num_args], nhStr(XtNbottomMargin),
XtSetArg(args[num_args], XtNrightMargin, &right_margin); num_args++; &bottom_margin); num_args++;
XtSetArg(args[num_args], nhStr(XtNleftMargin),
&left_margin); num_args++;
XtSetArg(args[num_args], nhStr(XtNrightMargin),
&right_margin); num_args++;
XtGetValues(wp->w, args, num_args); XtGetValues(wp->w, args, num_args);
text_info->extra_width = left_margin + right_margin; text_info->extra_width = left_margin + right_margin;
+4 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 winval.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 winval.c $NHDT-Date: 1430899139 2015/05/06 07:58:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $ */
/* NetHack 3.5 winval.c $Date: 2009/05/06 10:56:06 $ $Revision: 1.4 $ */ /* NetHack 3.5 winval.c $Date: 2009/05/06 10:56:06 $ $Revision: 1.4 $ */
/* SCCS Id: @(#)winval.c 3.5 1992/3/7 */ /* SCCS Id: @(#)winval.c 3.5 1992/3/7 */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
@@ -45,7 +45,7 @@ create_value(parent, name_value)
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNborderWidth, 0); num_args++; XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
XtSetArg(args[num_args], XtNdefaultDistance, 0); num_args++; XtSetArg(args[num_args], nhStr(XtNdefaultDistance), 0); num_args++;
form = XtCreateManagedWidget(name_value, form = XtCreateManagedWidget(name_value,
formWidgetClass, formWidgetClass,
parent, args, num_args); parent, args, num_args);
@@ -62,7 +62,7 @@ create_value(parent, name_value)
num_args = 0; num_args = 0;
XtSetArg(args[num_args], XtNjustify, XtJustifyRight); num_args++; XtSetArg(args[num_args], XtNjustify, XtJustifyRight); num_args++;
XtSetArg(args[num_args], XtNborderWidth, 0); num_args++; XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
XtSetArg(args[num_args], XtNfromHoriz, name); num_args++; XtSetArg(args[num_args], nhStr(XtNfromHoriz), name); num_args++;
XtSetArg(args[num_args], XtNinternalHeight, 0); num_args++; XtSetArg(args[num_args], XtNinternalHeight, 0); num_args++;
(void) XtCreateManagedWidget(WVALUE, (void) XtCreateManagedWidget(WVALUE,
labelWidgetClass, labelWidgetClass,
@@ -73,7 +73,7 @@ create_value(parent, name_value)
void void
set_name(w, new_label) set_name(w, new_label)
Widget w; Widget w;
char *new_label; const char *new_label;
{ {
Arg args[1]; Arg args[1];
Widget name; Widget name;