mirror of
https://github.com/airstruck/luigi.git
synced 2026-01-10 16:28:23 +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)
|
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
|
-- tab/shift-tab cycles focused widget
|
||||||
if event.key == 'tab' then
|
if event.key == 'tab' then
|
||||||
if Backend.isKeyDown('lshift', 'rshift') then
|
if Backend.isKeyDown('lshift', 'rshift') then
|
||||||
@@ -283,16 +293,6 @@ function Layout:addDefaultHandlers ()
|
|||||||
widget, event.key)
|
widget, event.key)
|
||||||
return false
|
return false
|
||||||
end
|
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)
|
end)
|
||||||
|
|
||||||
self:onKeyRelease(function (event)
|
self:onKeyRelease(function (event)
|
||||||
|
|||||||
Reference in New Issue
Block a user