-/* NetHack 3.6 winX.h $NHDT-Date: 1454455159 2016/02/02 23:19:19 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.21 $ */
+/* NetHack 3.6 winX.h $NHDT-Date: 1454977916 2016/02/09 00:31:56 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.22 $ */
/* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */
E int click_x, click_y, click_button, updated_inventory;
typedef struct {
- Boolean slow;
- Boolean autofocus;
- Boolean message_line;
+ Boolean slow; /* issue prompts between map and message wins */
+ Boolean autofocus; /* grab pointer focus for popup windows */
+ Boolean message_line; /* separate current turn mesgs from prev ones */
+ Boolean highlight_prompt; /* if 'slow', highlight yn prompts */
Boolean double_tile_size; /* double tile size */
String tile_file; /* name of file to open for tiles */
String icon; /* name of desired icon */
E Dimension FDECL(nhFontHeight, (Widget));
E char FDECL(key_event_to_char, (XKeyEvent *));
E void FDECL(msgkey, (Widget, XtPointer, XEvent *));
+E void FDECL(highlight_yn, (BOOLEAN_P));
E void FDECL(nh_XtPopup, (Widget, int, Widget));
E void FDECL(nh_XtPopdown, (Widget));
E void FDECL(win_X11_init, (int));
-! $NHDT-Date: 1452920161 2016/01/16 04:56:01 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.9 $
+! $NHDT-Date: 1454977917 2016/02/09 00:31:57 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $
! The display_file, tombstone, and menu windows are all formatted assuming
! a fixed width font. Text windows may or may not be formatted as above.
! questions is _not_ used.
NetHack*slow: True
+! If 'slow' is True, setting 'highlight_prompt' to True will cause the line
+! between map and message display that's used for prompting to be "hidden"
+! as part of the map when no prompt is active, then invert foreground and
+! background to stand out when a prompt is issued and waiting for a response.
+! If 'slow' is False, 'highlight_prompt' will have no effect.
+NetHack*highlight_prompt: True
+
! The number of lines the message window will show without scrolling.
!NetHack*message_lines: 12
!
-/* NetHack 3.6 winX.c $NHDT-Date: 1454834200 2016/02/07 08:36:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.38 $ */
+/* NetHack 3.6 winX.c $NHDT-Date: 1454977918 2016/02/09 00:31:58 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.39 $ */
/* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */
* can find the template file for NetHack.ad in the current directory,
* load its contents into memory so that the application startup call
* in X11_init_nhwindows() can use them as fallback resources.
+ *
+ * No attempt to support the 'include' directive has been made.
*/
fp = fopen("./NetHack.ad", "r");
if (!fp)
{ nhStr("message_line"), nhStr("Message_line"), XtRBoolean,
sizeof(Boolean), XtOffset(AppResources *, message_line), XtRString,
nhStr("False") },
+ { nhStr("highlight_prompt"), nhStr("Highlight_prompt"), XtRBoolean,
+ sizeof(Boolean), XtOffset(AppResources *, highlight_prompt), XtRString,
+ nhStr("True") },
{ nhStr("double_tile_size"), nhStr("Double_tile_size"), XtRBoolean,
sizeof(Boolean), XtOffset(AppResources *, double_tile_size), XtRString,
nhStr("False") },
* handler and reset its label to be the prompt text (below).
*/
input_func = yn_key;
- swap_fg_bg(yn_label); /* highlight the prompt line */
+ highlight_yn(FALSE); /* expose yn_label as separate from map */
} else if (!yn_label) {
/*
* Not 'slow'; create a persistent widget that will be popped up
num_args = 0;
XtSetArg(args[num_args], XtNlabel, " "); num_args++;
XtSetValues(yn_label, args, num_args);
- swap_fg_bg(yn_label); /* un-highlight the prompt line */
+ highlight_yn(FALSE); /* disguise yn_label as part of map */
} else {
nh_XtPopdown(yn_popup); /* this removes the event grab */
}
}
}
+/* if 'slow' and 'highlight_prompt', set the yn_label widget to look like
+ part of the map when idle or to invert background and foreground when
+ a prompt is active */
+void
+highlight_yn(init)
+boolean init;
+{
+ struct xwindow *xmap;
+
+ if (!appResources.slow || !appResources.highlight_prompt)
+ return;
+
+ /* first time through, WIN_MAP isn't fully initiialized yet */
+ xmap = ((map_win != WIN_ERR) ? &window_list[map_win]
+ : (WIN_MAP != WIN_ERR) ? &window_list[WIN_MAP] : 0);
+
+ if (init && xmap) {
+ Arg args[2];
+ XGCValues vals;
+ unsigned long fg_bg = (GCForeground | GCBackground);
+ GC gc = (xmap->map_information->is_tile
+ ? xmap->map_information->tile_map.white_gc
+ : xmap->map_information->text_map.copy_gc);
+
+ (void) memset((genericptr_t) &vals, 0, sizeof vals);
+ if (XGetGCValues(XtDisplay(xmap->w), gc, fg_bg, &vals)) {
+ XtSetArg(args[0], XtNforeground, vals.foreground);
+ XtSetArg(args[1], XtNbackground, vals.background);
+ XtSetValues(yn_label, args, TWO);
+ }
+ } else
+ swap_fg_bg(yn_label);
+}
+
/*
* Set up the playing console. This has three major parts: the
* message window, the map, and the status window.
XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
XtSetArg(args[num_args], nhStr(XtNlabel), " "); num_args++;
XtSetValues(yn_label, args, num_args);
- /* switch foreground and background so that the prompt line looks
- like part of the map */
- swap_fg_bg(yn_label);
}
/*
/* attempt to catch fatal X11 errors before the program quits */
(void) XtAppSetErrorHandler(app_context, (XtErrorHandler) hangup);
+ highlight_yn(TRUE); /* switch foreground and background */
+
/* We can now print to the message window. */
iflags.window_inited = 1;
}