Merge remote-tracking branch 'eswald/alt-stuck'

Conflicts:
	NEWS
develop
lethosor 2015-01-05 16:50:16 -05:00
commit 0cfe6a11a3
2 changed files with 9 additions and 1 deletions

@ -3,6 +3,7 @@ DFHack Future
plugins will not be loaded if globals they specify as required are not located (should prevent some crashes) plugins will not be loaded if globals they specify as required are not located (should prevent some crashes)
Fixes Fixes
Fixed numerous (mostly Lua-related) crashes on OS X by including a more up-to-date libstdc++ Fixed numerous (mostly Lua-related) crashes on OS X by including a more up-to-date libstdc++
Alt should no longer get stuck on Windows (and perhaps other platforms as well)
advfort works again advfort works again
devel/export-dt-ini: Updated for 0.40.20+ devel/export-dt-ini: Updated for 0.40.20+
digfort: now checks file type and existence digfort: now checks file type and existence

@ -1579,6 +1579,8 @@ int UnicodeAwareSym(const SDL::KeyboardEvent& ke)
//MEMO: return false if event is consumed //MEMO: return false if event is consumed
int Core::DFH_SDL_Event(SDL::Event* ev) int Core::DFH_SDL_Event(SDL::Event* ev)
{ {
static bool alt = 0;
// do NOT process events before we are ready. // do NOT process events before we are ready.
if(!started) return true; if(!started) return true;
if(!ev) if(!ev)
@ -1587,6 +1589,11 @@ int Core::DFH_SDL_Event(SDL::Event* ev)
{ {
auto ke = (SDL::KeyboardEvent *)ev; auto ke = (SDL::KeyboardEvent *)ev;
if (ke->ksym.sym == SDL::K_LALT || ke->ksym.sym == SDL::K_RALT)
{
alt = (ev->type == SDL::ET_KEYDOWN);
}
else
if(ke->state == SDL::BTN_PRESSED && !hotkey_states[ke->ksym.sym]) if(ke->state == SDL::BTN_PRESSED && !hotkey_states[ke->ksym.sym])
{ {
hotkey_states[ke->ksym.sym] = true; hotkey_states[ke->ksym.sym] = true;
@ -1594,7 +1601,7 @@ int Core::DFH_SDL_Event(SDL::Event* ev)
int mod = 0; int mod = 0;
if (ke->ksym.mod & SDL::KMOD_SHIFT) mod |= 1; if (ke->ksym.mod & SDL::KMOD_SHIFT) mod |= 1;
if (ke->ksym.mod & SDL::KMOD_CTRL) mod |= 2; if (ke->ksym.mod & SDL::KMOD_CTRL) mod |= 2;
if (ke->ksym.mod & SDL::KMOD_ALT) mod |= 4; if (alt) mod |= 4;
// Use unicode so Windows gives the correct value for the // Use unicode so Windows gives the correct value for the
// user's Input Language // user's Input Language