mirror of
https://github.com/airstruck/luigi.git
synced 2025-11-18 12:25:06 +00:00
don't trap key events
This commit is contained in:
@@ -46,8 +46,8 @@ local mainForm = { id = 'mainWindow', type = 'panel',
|
||||
},
|
||||
{ text = 'View',
|
||||
{ text = 'Theme',
|
||||
{ text = 'Light', key = 'ctrl-l' },
|
||||
{ text = 'Dark', key = 'ctrl-d' },
|
||||
{ text = 'Light', key = 'ctrl-l', id = 'themeLight', },
|
||||
{ text = 'Dark', key = 'ctrl-d', id = 'themeDark' },
|
||||
},
|
||||
{ text = 'Style',
|
||||
{ text = 'Default' },
|
||||
@@ -163,6 +163,6 @@ layout.mainCanvas.align = 'top'
|
||||
|
||||
layout.menuQuit:onPress(function (event) love.event.quit() end)
|
||||
|
||||
|
||||
layout.themeLight:onPress(function (event) love.event.quit() end)
|
||||
|
||||
layout:show()
|
||||
|
||||
@@ -29,53 +29,34 @@ function Input:getModifierFlags ()
|
||||
end
|
||||
|
||||
function Input:handleKeyPress (layout, key, x, y)
|
||||
local widget = layout.focusedWidget or layout:getWidgetAt(x, y)
|
||||
local hit = true
|
||||
if not widget then
|
||||
hit = nil
|
||||
widget = layout.root
|
||||
end
|
||||
local widget = layout.focusedWidget or layout.root
|
||||
local result = widget:bubbleEvent('KeyPress', {
|
||||
hit = hit,
|
||||
key = key,
|
||||
modifierFlags = self:getModifierFlags(),
|
||||
x = x,
|
||||
y = y
|
||||
})
|
||||
if result ~= nil then return result end
|
||||
return hit
|
||||
end
|
||||
|
||||
function Input:handleKeyRelease (layout, key, x, y)
|
||||
local widget = layout.focusedWidget or layout:getWidgetAt(x, y)
|
||||
local hit = true
|
||||
if not widget then
|
||||
hit = nil
|
||||
widget = layout.root
|
||||
end
|
||||
local widget = layout.focusedWidget or layout.root
|
||||
local result = widget:bubbleEvent('KeyRelease', {
|
||||
hit = hit,
|
||||
key = key,
|
||||
modifierFlags = self:getModifierFlags(),
|
||||
x = x,
|
||||
y = y
|
||||
})
|
||||
if result ~= nil then return result end
|
||||
return hit
|
||||
end
|
||||
|
||||
function Input:handleTextInput (layout, text, x, y)
|
||||
local widget = layout.focusedWidget or layout:getWidgetAt(x, y)
|
||||
local hit = true
|
||||
if not widget then
|
||||
hit = nil
|
||||
widget = layout.root
|
||||
end
|
||||
widget:bubbleEvent('TextInput', {
|
||||
local widget = layout.focusedWidget or layout.root
|
||||
local result = widget:bubbleEvent('TextInput', {
|
||||
hit = hit,
|
||||
text = text, x = x, y = y
|
||||
})
|
||||
return hit
|
||||
if result ~= nil then return result end
|
||||
end
|
||||
|
||||
function Input:handleMove (layout, x, y)
|
||||
|
||||
@@ -55,18 +55,18 @@ local function deactivateSiblings (target)
|
||||
end
|
||||
|
||||
while sibling do
|
||||
local layout = sibling.menuLayout
|
||||
local items = sibling.items
|
||||
|
||||
sibling.active = nil
|
||||
|
||||
local layout = sibling.menuLayout
|
||||
|
||||
if layout and layout.isShown then
|
||||
wasSiblingOpen = true
|
||||
layout:hide()
|
||||
end
|
||||
|
||||
if sibling.items and sibling.items[1] then
|
||||
deactivateSiblings(sibling.items[1])
|
||||
if items and items[1] then
|
||||
deactivateSiblings(items[1])
|
||||
end
|
||||
|
||||
sibling = sibling:getNextSibling()
|
||||
|
||||
Reference in New Issue
Block a user