1
0
forked from mirrors/0ad

# Fix hotkey bugs.

Simplify hotkey system to use strings consistently.
Restrict scope of GUI hotkey bindings to the associated page.
Avoid hard-coding list of hotkeys.
Clean up the code a little bit and fix some bugs.
Remove unused "!" prefix for key negation.
Fixes #567.

This was SVN commit r8444.
This commit is contained in:
Ykkrosh
2010-10-23 02:37:00 +00:00
parent f6154b0d89
commit 9e499cdec5
14 changed files with 273 additions and 576 deletions
@@ -43,7 +43,6 @@ template<> jsval ScriptInterface::ToJSVal<SDL_Event_>(JSContext* cx, SDL_Event_
case SDL_MOUSEBUTTONUP: typeName = "mousebuttonup"; break;
case SDL_HOTKEYDOWN: typeName = "hotkeydown"; break;
case SDL_HOTKEYUP: typeName = "hotkeyup"; break;
case SDL_GUIHOTKEYPRESS: typeName = "guihotkeypress"; break;
default: typeName = "(unknown)"; break;
}
@@ -117,14 +116,7 @@ template<> jsval ScriptInterface::ToJSVal<SDL_Event_>(JSContext* cx, SDL_Event_
case SDL_HOTKEYDOWN:
case SDL_HOTKEYUP:
{
CStr name = HotkeyGetName(val.ev.user.code);
SET(obj, "hotkey", name.c_str());
break;
}
case SDL_GUIHOTKEYPRESS:
{
CStr* name = static_cast<CStr*>(val.ev.user.data1);
SET(obj, "object", name->c_str());
SET(obj, "hotkey", static_cast<const char*>(val.ev.user.data1));
break;
}
}