Warn redefined key bindings
This commit is contained in:
parent
c9dce51458
commit
dc8ef845ab
|
@ -100,6 +100,9 @@ function g_keyboard.bindKeyDown(keyComboDesc, callback, widget)
|
||||||
widget = widget or rootWidget
|
widget = widget or rootWidget
|
||||||
connectKeyDownEvent(widget)
|
connectKeyDownEvent(widget)
|
||||||
local keyComboDesc = retranslateKeyComboDesc(keyComboDesc)
|
local keyComboDesc = retranslateKeyComboDesc(keyComboDesc)
|
||||||
|
if widget.boundKeyDownCombos[keyComboDesc] then
|
||||||
|
pwarning('KeyDown event \'' .. keyComboDesc .. '\' redefined on widget ' .. widget:getId())
|
||||||
|
end
|
||||||
widget.boundKeyDownCombos[keyComboDesc] = callback
|
widget.boundKeyDownCombos[keyComboDesc] = callback
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -108,6 +111,9 @@ function g_keyboard.bindKeyPress(keyComboDesc, callback, widget, autoRepeatDelay
|
||||||
widget = widget or rootWidget
|
widget = widget or rootWidget
|
||||||
connectKeyPressEvent(widget)
|
connectKeyPressEvent(widget)
|
||||||
local keyComboDesc = retranslateKeyComboDesc(keyComboDesc)
|
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.boundKeyPressCombos[keyComboDesc] = { callback = callback, autoRepeatDelay = autoRepeatDelay }
|
||||||
widget:setAutoRepeatDelay(math.min(autoRepeatDelay, widget:getAutoRepeatDelay()))
|
widget:setAutoRepeatDelay(math.min(autoRepeatDelay, widget:getAutoRepeatDelay()))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue