Skip to content
Browse files

stop key repeat from messing up input events

  • Loading branch information...
1 parent bf42e3c commit bb758004d08d535d3354a5df87608f2f366266f9 @leafo committed May 11, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/input.cpp
View
10 src/input.cpp
@@ -15,11 +15,19 @@ namespace aroma {
}
void InputHandler::dispatch_key_event(const char* event_name, int key) {
+ const char* name = key_name(key);
+
+ // don't let key repeat send events when holding
+ if (event_name == KEY_PRESSED_EVENT &&
+ keys_down.find(name) != keys_down.end())
+ {
+ return;
+ }
+
lua_State* l = binding->lua();
int top = lua_gettop(l);
binding->push_self();
- const char* name = key_name(key);
if (event_name == KEY_RELEASED_EVENT) {
keys_down.erase(name);
} else if (event_name == KEY_PRESSED_EVENT) {

0 comments on commit bb75800

Please sign in to comment.
Something went wrong with that request. Please try again.