From 028efc7342f0e7f4941be73fd221bc1e8069160a Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 30 Nov 2018 16:02:55 -0800 Subject: [PATCH] X11 text popup fix Text popups on OSX could be dismissed with or or if user's X resources had 'NetHack*autofocus' set to True, but for the default of False they ignored all keystrokes even if you clicked inside the popup window to set focus explicitly. Clicking on the Close Window button of the popup's title bar was the only way to get the popup to go away. Fix suggested by Pasi. --- doc/fixes36.2 | 3 +++ win/X11/wintext.c | 13 ++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 6dc730b5b..94986c5b0 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -333,6 +333,9 @@ X11: don't reuse perm_invent window for picking an object X11: obey mouse_support and allow toggling it in game X11: obey menu movement keys X11: enable menu [cancel] button for PICK_NONE menus +X11: text popups on OSX wouldn't accept keyboard input unless the 'autofocus' + resource was enabled; most noticeable when trying to dismiss 'things + that are here' while walking over object piles General New Features diff --git a/win/X11/wintext.c b/win/X11/wintext.c index ada6a398d..1f743766d 100644 --- a/win/X11/wintext.c +++ b/win/X11/wintext.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 wintext.c $NHDT-Date: 1450453309 2015/12/18 15:41:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.15 $ */ +/* NetHack 3.6 wintext.c $NHDT-Date: 1543622533 2018/12/01 00:02:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.16 $ */ /* Copyright (c) Dean Luick, 1992 */ /* NetHack may be freely redistributed. See license for details. */ @@ -281,11 +281,9 @@ struct xwindow *wp; #endif num_args = 0; - XtSetArg(args[num_args], XtNallowShellResize, True); - num_args++; + XtSetArg(args[num_args], XtNallowShellResize, True), num_args++; XtSetArg(args[num_args], XtNtranslations, - XtParseTranslationTable(text_translations)); - num_args++; + XtParseTranslationTable(text_translations)), num_args++; #ifdef TRANSIENT_TEXT wp->popup = XtCreatePopupShell("text", transientShellWidgetClass, @@ -299,8 +297,9 @@ struct xwindow *wp; XtParseTranslationTable("WM_PROTOCOLS: delete_text()")); num_args = 0; - XtSetArg(args[num_args], XtNallowShellResize, True); - num_args++; + XtSetArg(args[num_args], XtNallowShellResize, True), num_args++; + XtSetArg(args[num_args], XtNtranslations, + XtParseTranslationTable(text_translations)), num_args++; form = XtCreateManagedWidget("form", formWidgetClass, wp->popup, args, num_args);