From dc8ef845abdeeec9381b89f8eeca9005cb7f2b97 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Mon, 23 Jul 2012 01:44:15 -0300 Subject: [PATCH] Warn redefined key bindings --- modules/corelib/keyboard.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/corelib/keyboard.lua b/modules/corelib/keyboard.lua index d8bd46ff..b1750f38 100644 --- a/modules/corelib/keyboard.lua +++ b/modules/corelib/keyboard.lua @@ -100,6 +100,9 @@ function g_keyboard.bindKeyDown(keyComboDesc, callback, widget) widget = widget or rootWidget connectKeyDownEvent(widget) local keyComboDesc = retranslateKeyComboDesc(keyComboDesc) + if widget.boundKeyDownCombos[keyComboDesc] then + pwarning('KeyDown event \'' .. keyComboDesc .. '\' redefined on widget ' .. widget:getId()) + end widget.boundKeyDownCombos[keyComboDesc] = callback end @@ -108,6 +111,9 @@ function g_keyboard.bindKeyPress(keyComboDesc, callback, widget, autoRepeatDelay widget = widget or rootWidget connectKeyPressEvent(widget) local keyComboDesc = retranslateKeyComboDesc(keyComboDesc) + if widget.boundKeyPressCombos[keyComboDesc] then + pwarning('KeyPress event \'' .. keyComboDesc .. '\' redefined on widget ' .. widget:getId()) + end widget.boundKeyPressCombos[keyComboDesc] = { callback = callback, autoRepeatDelay = autoRepeatDelay } widget:setAutoRepeatDelay(math.min(autoRepeatDelay, widget:getAutoRepeatDelay())) end