Qt menu sanity

The Qt menu entries which were executing nethack's help command
(the '?' menu) were doing so because their command keystroke was
a meta-character and such characters are being converted to '?'
to indicate an error in conversion to Latin1 character set.  The
old Qt3 code didn't perform any such conversion.

This fix feels fragile because there are two different places
deciding how to disambiguate partial extended commands (the code
for Qt's '#' handling and a new routine in the core).  Qt menus
now send '#' and enough letters to satisfy '#' handling for any
command which uses M-c or has no regular keystroke nor M-c one.
(If it were to send the full extended command name, the letters
after the unambiguous prefix would be left in the input queue to
be processed as subsequent commands.)

There is a fundamental problem that this doesn't address:  if
the player uses BIND directives in the run-time config file, the
Qt menu bindings will break unless the BINDs are all done before
selecting windowtype.  Qt's menu bindings translate a click on
a menu entry into the keystroke used to invoke the corresponding
command, so using BIND to change that after the menus are set up
will result in the wrong commands being executed.
This commit is contained in:
PatR
2020-08-10 07:24:16 -07:00
parent ef9caca4da
commit 264cbed2cc
4 changed files with 79 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 extern.h $NHDT-Date: 1596498536 2020/08/03 23:48:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.854 $ */
/* NetHack 3.7 extern.h $NHDT-Date: 1597069374 2020/08/10 14:22:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.855 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -204,6 +204,7 @@ E void FDECL(random_response, (char *, int));
E int NDECL(rnd_extcmd_idx);
E int NDECL(domonability);
E char FDECL(cmd_from_func, (int NDECL((*))));
E const char *FDECL(cmdname_from_func, (int NDECL((*)), char *, BOOLEAN_P));
E boolean FDECL(redraw_cmd, (CHAR_P));
E const char *FDECL(levltyp_to_name, (int));
#ifdef USE_TRAMPOLI