mirror of
https://github.com/airstruck/luigi.git
synced 2025-11-18 12:25:06 +00:00
give keyboard shortcuts precedence over default tab/space/return behavior, fixes #10
This commit is contained in:
@@ -265,6 +265,16 @@ function Layout:addDefaultHandlers ()
|
||||
|
||||
self:onKeyPress(function (event)
|
||||
|
||||
-- keyboard accelerators
|
||||
local entry = self.accelerators[event.modifierFlags]
|
||||
local acceleratedWidget = entry and entry[event.key]
|
||||
if acceleratedWidget then
|
||||
acceleratedWidget.hovered = true
|
||||
self.input:handlePressStart(self, event.key, event.x, event.y,
|
||||
acceleratedWidget, event.key)
|
||||
return false
|
||||
end
|
||||
|
||||
-- tab/shift-tab cycles focused widget
|
||||
if event.key == 'tab' then
|
||||
if Backend.isKeyDown('lshift', 'rshift') then
|
||||
@@ -283,16 +293,6 @@ function Layout:addDefaultHandlers ()
|
||||
widget, event.key)
|
||||
return false
|
||||
end
|
||||
|
||||
-- accelerators
|
||||
local entry = self.accelerators[event.modifierFlags]
|
||||
local acceleratedWidget = entry and entry[event.key]
|
||||
if acceleratedWidget then
|
||||
acceleratedWidget.hovered = true
|
||||
self.input:handlePressStart(self, event.key, event.x, event.y,
|
||||
acceleratedWidget, event.key)
|
||||
return false
|
||||
end
|
||||
end)
|
||||
|
||||
self:onKeyRelease(function (event)
|
||||
|
||||
Reference in New Issue
Block a user