]> granicus.if.org Git - nethack/commitdiff
Win32GUI: Fix permanent inventory window going away
authorBart House <bart@barthouse.com>
Sat, 7 Oct 2017 21:00:09 +0000 (14:00 -0700)
committerPasi Kallinen <paxed@alt.org>
Sat, 7 Oct 2017 22:26:24 +0000 (01:26 +0300)
Fix bug where permanent inventory window would go away after
any operation that used the inventory window to pick items. Since
we were hiding the permanent inventory window, this would also
leave a space filled with white, creating jarring visual if
using dark themed window backgrounds.

win/win32/mhmenu.c
win/win32/mswproc.c

index bbf364cd4cd3b9ceae92df52765adb89f0357637..59004e21fd528fc8b9619188eae8dc16bbab6be3 100644 (file)
@@ -246,7 +246,18 @@ mswin_menu_window_select_menu(HWND hWnd, int how, MENU_ITEM_P **_selected,
         data->is_active = FALSE;
         LayoutMenu(hWnd); // hide dialog buttons
         mswin_popup_destroy(hWnd);
+
+        /* If we just used the permanent inventory window to pick something,
+         * set the menu back to its display inventory state.
+         */
+        if (flags.perm_invent && mswin_winid_from_handle(hWnd) == WIN_INVEN
+            && how != PICK_NONE) {
+            data->menu.prompt[0] = '\0';
+            SetMenuListType(hWnd, PICK_NONE);
+            LayoutMenu(hWnd);
+        }
     }
+
     return ret_val;
 }
 /*-----------------------------------------------------------------------------*/
index db045a4ccef342ecb24dba0152bdc8432c27b9df..1b208053a8b75e0c61e593594ccd1b7dad59829d 100644 (file)
@@ -2202,7 +2202,10 @@ mswin_popup_destroy(HWND hWnd)
     }
     DrawMenuBar(GetNHApp()->hMainWnd);
 
-    ShowWindow(hWnd, SW_HIDE);
+    /* Don't hide the permanent inventory window ... leave it showing */
+    if (!flags.perm_invent || mswin_winid_from_handle(hWnd) != WIN_INVEN)
+        ShowWindow(hWnd, SW_HIDE);
+
     GetNHApp()->hPopupWnd = NULL;
 
     mswin_layout_main_window(hWnd);