From 6d9ac874dd859492f88913ede2c7daf59b2bd9db Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 6 Feb 2016 18:25:42 -0800 Subject: [PATCH] X11 scrolling message window The scroll bar on the message window doesn't work for me, just like the one on the extend commands menu. Moving the pointer to it does change the cursor, but neither trying to drag the slider nor clicking above it will make it do anything. However, at some point I managed to accidentally scroll the message window, and new messages never restored it to the unscrolled state. New messages were hidden until enough even newer ones had been delivered to push the hidden ones into view. So this adds key translations to scroll the message window via the arrow keys. Clicking on the scroll bar doesn't change focus to the right place, so I have to click the text display area of the message window. That triggers a beep (I suspect it's interpreted as an attempt to move the hero beyond the map.) But then the messages can be scrolled via the cursor keys. Getting focus back to the map seems tricky since doing it via pointer is interpreted as a travel command. Not quite optimal.... Anyway, being able to scroll the message window let me figure out how to unscroll it when new messages are delivered. --- win/X11/winmesg.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/win/X11/winmesg.c b/win/X11/winmesg.c index 0d537d2ff..5a019ee2c 100644 --- a/win/X11/winmesg.c +++ b/win/X11/winmesg.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 winmesg.c $NHDT-Date: 1432512808 2015/05/25 00:13:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */ +/* NetHack 3.6 winmesg.c $NHDT-Date: 1454811935 2016/02/07 02:25:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -46,8 +46,11 @@ static void FDECL(get_gc, (Widget, struct mesg_info_t *)); static void FDECL(mesg_resized, (Widget, XtPointer, XtPointer)); static char mesg_translations[] = "#override\n\ - : input() \ -"; + Left: scroll(4)\n\ + Right: scroll(6)\n\ + Up: scroll(8)\n\ + Down: scroll(2)\n\ + : input()"; /* Move the message window's vertical scrollbar's slider to the bottom. */ void @@ -79,7 +82,7 @@ Widget parent; wp->type = NHW_MESSAGE; wp->mesg_information = mesg_info = - (struct mesg_info_t *) alloc(sizeof(struct mesg_info_t)); + (struct mesg_info_t *) alloc(sizeof (struct mesg_info_t)); mesg_info->fs = 0; mesg_info->num_lines = 0; @@ -228,6 +231,7 @@ void display_message_window(wp) struct xwindow *wp; { + set_message_slider(wp); if (wp->mesg_information->dirty) redraw_message_window(wp); } -- 2.40.0