From: PatR Date: Sun, 13 Dec 2020 21:45:04 +0000 (-0800) Subject: Qt: remove "Search [______]" from Help menu X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04724fc5a0df4e887116900cd172a0f93936b56e;p=nethack Qt: remove "Search [______]" from Help menu Prevent Qt from inserting an extra entry in the Help dropdown menu displayed in the menu bar across the top of the screen when nethack has focus. "Search [______]" lets the user enter a string to search for but doesn't give nethack any control over that so we can't have it. I haven't found a sane way to get rid of it. The insane way of not naming any menu "Help" works. This uses "\177Help" so that it still looks like "Help" but won't match that string. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 01ae61a10..2ead283a6 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.386 $ $NHDT-Date: 1607754748 2020/12/12 06:32:28 $ +NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.390 $ $NHDT-Date: 1607895902 2020/12/13 21:45:02 $ General Fixes and Modified Features ----------------------------------- @@ -551,6 +551,8 @@ Qt+OSX: add a separate nethack->Quit menu entry with different functionality; Qt+OSX: since menu entry help->"About Qt NetHack" gets hijacked and becomes "nethack->About nethack", add a separate help->_About_Qt_NetHack_ which stays where intended and brings up the same information +Qt+OSX: suppress unwanted "Search [______]" action from being inserted as the + first entry in the menubar's "Help" dropdown menu tiles: add indicator of thonged portion to aklys tile tty: role and race selection menus weren't filtering out potential choices which got excluded by OPTIONS=align:!lawful or !neutral or !chaotic diff --git a/win/Qt/Qt-issues.txt b/win/Qt/Qt-issues.txt index 98c4621a6..c38fca661 100644 --- a/win/Qt/Qt-issues.txt +++ b/win/Qt/Qt-issues.txt @@ -26,12 +26,6 @@ around by giving focus to some other application (which will put up its own menu bar) and then back to nethack (thereby reloading nethack's menu bar). -On OSX, a "Search [______]" action is inserted as the first entry of -the dropdown Help menu on the toolbar. NetHack has no control over -what it does or where it looks, so it should be eliminated somehow. -(It is not releated to nethack's search command, nor the interception -of an attempt to insert "Search" into the dropdown Action menu.) - Sometimes scrolling a menu leaves the displayed text not matching what nethack thinks is displayed, so making a selection by mouse click may occasionally pick the wrong item. There's usually a visual clue when diff --git a/win/Qt/qt_main.cpp b/win/Qt/qt_main.cpp index a8bbebed8..eb6cd8af9 100644 --- a/win/Qt/qt_main.cpp +++ b/win/Qt/qt_main.cpp @@ -781,7 +781,28 @@ NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) : info->setTitle("Info"); menubar->addMenu(info); menubar->addSeparator(); +#ifndef MACOSX help->setTitle("Help"); +#else + // On OSX, an entry in the menubar called "Help" will get an + // extra action, "Search [______]", inserted as the first entry. + // We have no control over what it does and don't want it. + // + // Using actions() to fetch a list of all entries doesn't find it, + // so we don't have its widget pointer to pass to removeAction(). + // + // Altering the name with an invisible character to inhibit + // string matching is ludicrous but keeps the unwanted action + // from getting inserted into the "Help" menu behind our back. + // Underscore works too and is more robust but unless we prepend + // it to every entry, "_Help" would stand out as strange. + help->setTitle("\177Help"); + // (Renaming back to "Help" after the fact does reset the menu's + // name but it also results in the Search action being added. + // Perhaps a custom context menu that changes its name to "Help" + // as it is being shown--and possibly changes back afterward-- + // would work but the name mangling hack is much simpler.) +#endif menubar->addMenu(help); }