From 5ae26dde5e4e334ae902e23eb6791a9ef537f11e Mon Sep 17 00:00:00 2001 From: ennewalker Date: Thu, 12 Jun 2008 00:42:21 +0000 Subject: [1909218] Fixing issue where keymaps were affecting menu choices done by keyboard or through the tiles mouse interface. I couldn't think of any reason why keymaps should ever apply to menu selections (and certainly not the KC_DEFAULT map), so I added a new special keymap context called KC_NONE which doesn't apply keymaps to new input. This is used for all menus. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5739 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/macro.cc | 6 ++++-- crawl-ref/source/macro.h | 3 ++- crawl-ref/source/menu.cc | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc index 74e294c4d7..2f2ad22ff3 100644 --- a/crawl-ref/source/macro.cc +++ b/crawl-ref/source/macro.cc @@ -641,8 +641,10 @@ int getchm(KeymapContext mc, int (*rgetch)()) // Read some keys... keyseq keys = getch_mul(rgetch); - // ... and add them into the buffer - macro_buf_add_long( keys, Keymaps[mc] ); + if (mc == KC_NONE) + macro_buf_add(keys); + else + macro_buf_add_long(keys, Keymaps[mc]); return (macro_buf_get()); } diff --git a/crawl-ref/source/macro.h b/crawl-ref/source/macro.h index 90d0557cda..1405cb7e19 100644 --- a/crawl-ref/source/macro.h +++ b/crawl-ref/source/macro.h @@ -29,7 +29,8 @@ enum KeymapContext { KC_TARGETING, // Only during 'x' and other targeting modes KC_CONFIRM, // When being asked y/n/q questions - KC_CONTEXT_COUNT // Must always be the last + KC_CONTEXT_COUNT, // Must always be the last real context + KC_NONE // Don't apply any keymaps (for menus) }; class key_recorder; diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index 82e43a0a76..3418517ea8 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -214,7 +214,7 @@ void Menu::do_menu() TileRedrawInv(REGION_INV2); mouse_control mc(MOUSE_MODE_COMMAND); #endif - int keyin = getchm(c_getch); + int keyin = getchm(KC_NONE, c_getch); if (!process_key( keyin )) return; -- cgit v1.2.3-54-g00ecf