From 28aee35366609fba4f55a2e5528999f05a328cc5 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 26 Jul 2009 20:43:30 +0000 Subject: Experimentally mark the Alt key as unpressed everytime we get a CMD_NO_CMD result with Tiles in case it's the result of the Alt-Tab bug. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10421 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/settings/tiles_options.txt | 2 +- crawl-ref/source/tilesdl.cc | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/crawl-ref/settings/tiles_options.txt b/crawl-ref/settings/tiles_options.txt index ae4bd6a41a..2599f7beec 100644 --- a/crawl-ref/settings/tiles_options.txt +++ b/crawl-ref/settings/tiles_options.txt @@ -30,7 +30,7 @@ # tile_excl_centre = darkblue # tile_window_col = yellow -# If Crawl's response rate is to slow, try increasing the update rate. +# If Crawl's response rate is top slow, try increasing the update rate. # tile_update_rate = 1000 # tile_key_repeat_delay = 200 diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index 9a6fc6a5dd..0db1d9fdf0 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -7,6 +7,7 @@ REVISION("$Rev$"); #include "items.h" #include "itemprop.h" #include "files.h" +#include "macro.h" #include "message.h" #include "mon-util.h" #include "player.h" @@ -825,6 +826,14 @@ int TilesFramework::getch_ck() case SDL_KEYDOWN: m_key_mod |= _get_modifiers(event.key.keysym); key = _translate_keysym(event.key.keysym); + if (m_key_mod == MOD_ALT + && key_to_command(key, KMC_DEFAULT) == CMD_NO_CMD) + { + // If the Alt key is pressed and the command is invalid, + // try clearing the Alt key in case it got stuck in + // the stupid Windows/SDL bug with Alt-Tab. + m_key_mod &= ~MOD_ALT; + } m_region_tile->place_cursor(CURSOR_MOUSE, Region::NO_CURSOR); // If you hit a key, disable tooltips until the mouse -- cgit v1.2.3-54-g00ecf