]> granicus.if.org Git - nethack/commitdiff
X11 perm_invent: handle 'O' toggling off perm_invent
authorPatR <rankin@nethack.org>
Sun, 14 Feb 2021 03:17:20 +0000 (19:17 -0800)
committerPatR <rankin@nethack.org>
Sun, 14 Feb 2021 03:17:20 +0000 (19:17 -0800)
When persistent inventory window is up, remove it if 'perm_invent'
option gets set to False.  This has a side-effect of fixing the
end-of-game prompting problem it caused.

doc/fixes37.0
include/winX.h
win/X11/X11-issues.txt
win/X11/winX.c
win/X11/winmenu.c

index 8e2a912d4409d52c54c1f9a7524fb88bc07509fa..d7537d19533fe4e7132ee117082f75acf18416fc 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.451 $ $NHDT-Date: 1613258116 2021/02/13 23:15:16 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.452 $ $NHDT-Date: 1613272633 2021/02/14 03:17:13 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -664,6 +664,11 @@ X11: extend fancy status one-turn inverse video status-change highlighting to
 X11: stop including unused column 0 in the map
 X11: avoid 'bad Atom X Error' when perm_invent is enabled (seemingly window
        manager dependent)
+X11: toggling 'perm_invent' off via 'O' didn't dismiss persistent inventory
+       window
+X11: (possibly X11+OSX): if persistent inventory was displayed at time of
+       end-of-game prompting, prompting would stall until that window was
+       manually dismissed
 
 
 General New Features
index 97375fae2e8ec0358240055c933d304b33b9ee8a..af1ea596e8cfddc19a978f84f08d7c3308d104e1 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 winX.h  $NHDT-Date: 1611697182 2021/01/26 21:39:42 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.42 $ */
+/* NetHack 3.7 winX.h  $NHDT-Date: 1613272633 2021/02/14 03:17:13 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.45 $ */
 /* Copyright (c) Dean Luick, 1992                                 */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -357,6 +357,7 @@ extern int x_event(int);
 /* ### winmenu.c ### */
 extern void menu_delete(Widget, XEvent *, String *, Cardinal *);
 extern void menu_key(Widget, XEvent *, String *, Cardinal *);
+extern void x11_no_perminv(struct xwindow *);
 extern void create_menu_window(struct xwindow *);
 extern void destroy_menu_window(struct xwindow *);
 
index dd74208e311beabe24e367fc23bcbaba966c57d3..89607f76521ee5b1b69ec57b9fd5615918affe02 100644 (file)
@@ -1,14 +1,11 @@
-End of game stalls after death is reported if the persistent inventory
-window is shown at the time.  Closing it manually lets the game-over
-sequence proceed.  Answering 'y' to "Really quit?" and any valid response
-to "Dump core?" behaves likewise.
-
-Toggling 'perm_invent' Off with the 'O' command while the persistent
-inventory window is displayed does not remove it.
-
 Starting or restoring a game with 'perm_invent' enabled via config file
 or NETHACKOPTIONS does not begin with inventory shown.
 
+When persistent inventory window is first populated, focus is given to
+its window (behavior might be window manager-specific; it happens with
+default window manager on OSX).  Focus should be explicitly directed
+back to the main window.
+
 When persistent inventory window is displayed, an update that ought to
 make it grow won't do so even if there is room on the screen for that.
 It will add scrollbar(s) when not already there, and it can be resized
index beaa3305117c4f621922352d180eebf8d50a439c..054c6000c49658894699d93867354a46fcb6a06e 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 winX.c  $NHDT-Date: 1613171266 2021/02/12 23:07:46 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.95 $ */
+/* NetHack 3.7 winX.c  $NHDT-Date: 1613272634 2021/02/14 03:17:14 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.96 $ */
 /* Copyright (c) Dean Luick, 1992                                 */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1242,10 +1242,17 @@ X11_destroy_nhwindow(winid window)
 void
 X11_update_inventory(void)
 {
-    if (x_inited && window_list[WIN_INVEN].menu_information->is_up) {
-        updated_inventory = 1; /* hack to avoid mapping&raising window */
-        (void) display_inventory((char *) 0, FALSE);
-        updated_inventory = 0;
+    if (!x_inited)
+        return;
+
+    if (window_list[WIN_INVEN].menu_information->is_up) {
+        if (iflags.perm_invent) {
+            updated_inventory = 1; /* hack to avoid mapping&raising window */
+            (void) display_inventory((char *) 0, FALSE);
+            updated_inventory = 0;
+        } else {
+            x11_no_perminv(&window_list[WIN_INVEN]);
+        }
     }
 }
 
index 690e0fef74880863049238df34bf2b8077b88a19..1eb2dde9c3175e4d609ad81be0decfeec3b85559 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 winmenu.c       $NHDT-Date: 1596498373 2020/08/03 23:46:13 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.39 $ */
+/* NetHack 3.7 winmenu.c       $NHDT-Date: 1613272635 2021/02/14 03:17:15 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.42 $ */
 /* Copyright (c) Dean Luick, 1992                                */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -575,6 +575,20 @@ menu_popdown(struct xwindow *wp)
 
 /* Global functions ======================================================= */
 
+/* called by X11_update_inventory() if persistent inventory is currently
+   displayed but the 'perm_invent' option is now Off */
+void
+x11_no_perminv(struct xwindow *wp)
+{
+    if (wp && wp->type == NHW_MENU && wp->menu_information->is_up) {
+        destroy_menu_entry_widgets(wp);
+        nh_XtPopdown(wp->popup);
+        XtDestroyWidget(wp->popup);
+        wp->w = wp->popup = (Widget) 0;
+        wp->menu_information->is_up = FALSE;
+    }
+}
+
 void
 X11_start_menu(winid window, unsigned long mbehavior UNUSED)
 {