mirror of
https://github.com/airstruck/luigi.git
synced 2026-01-10 08:18:22 +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 = 'View',
|
||||||
{ text = 'Theme',
|
{ text = 'Theme',
|
||||||
{ text = 'Light', key = 'ctrl-l' },
|
{ text = 'Light', key = 'ctrl-l', id = 'themeLight', },
|
||||||
{ text = 'Dark', key = 'ctrl-d' },
|
{ text = 'Dark', key = 'ctrl-d', id = 'themeDark' },
|
||||||
},
|
},
|
||||||
{ text = 'Style',
|
{ text = 'Style',
|
||||||
{ text = 'Default' },
|
{ text = 'Default' },
|
||||||
@@ -163,6 +163,6 @@ layout.mainCanvas.align = 'top'
|
|||||||
|
|
||||||
layout.menuQuit:onPress(function (event) love.event.quit() end)
|
layout.menuQuit:onPress(function (event) love.event.quit() end)
|
||||||
|
|
||||||
|
layout.themeLight:onPress(function (event) love.event.quit() end)
|
||||||
|
|
||||||
layout:show()
|
layout:show()
|
||||||
|
|||||||
@@ -29,53 +29,34 @@ function Input:getModifierFlags ()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Input:handleKeyPress (layout, key, x, y)
|
function Input:handleKeyPress (layout, key, x, y)
|
||||||
local widget = layout.focusedWidget or layout:getWidgetAt(x, y)
|
local widget = layout.focusedWidget or layout.root
|
||||||
local hit = true
|
|
||||||
if not widget then
|
|
||||||
hit = nil
|
|
||||||
widget = layout.root
|
|
||||||
end
|
|
||||||
local result = widget:bubbleEvent('KeyPress', {
|
local result = widget:bubbleEvent('KeyPress', {
|
||||||
hit = hit,
|
|
||||||
key = key,
|
key = key,
|
||||||
modifierFlags = self:getModifierFlags(),
|
modifierFlags = self:getModifierFlags(),
|
||||||
x = x,
|
x = x,
|
||||||
y = y
|
y = y
|
||||||
})
|
})
|
||||||
if result ~= nil then return result end
|
if result ~= nil then return result end
|
||||||
return hit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Input:handleKeyRelease (layout, key, x, y)
|
function Input:handleKeyRelease (layout, key, x, y)
|
||||||
local widget = layout.focusedWidget or layout:getWidgetAt(x, y)
|
local widget = layout.focusedWidget or layout.root
|
||||||
local hit = true
|
|
||||||
if not widget then
|
|
||||||
hit = nil
|
|
||||||
widget = layout.root
|
|
||||||
end
|
|
||||||
local result = widget:bubbleEvent('KeyRelease', {
|
local result = widget:bubbleEvent('KeyRelease', {
|
||||||
hit = hit,
|
|
||||||
key = key,
|
key = key,
|
||||||
modifierFlags = self:getModifierFlags(),
|
modifierFlags = self:getModifierFlags(),
|
||||||
x = x,
|
x = x,
|
||||||
y = y
|
y = y
|
||||||
})
|
})
|
||||||
if result ~= nil then return result end
|
if result ~= nil then return result end
|
||||||
return hit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Input:handleTextInput (layout, text, x, y)
|
function Input:handleTextInput (layout, text, x, y)
|
||||||
local widget = layout.focusedWidget or layout:getWidgetAt(x, y)
|
local widget = layout.focusedWidget or layout.root
|
||||||
local hit = true
|
local result = widget:bubbleEvent('TextInput', {
|
||||||
if not widget then
|
|
||||||
hit = nil
|
|
||||||
widget = layout.root
|
|
||||||
end
|
|
||||||
widget:bubbleEvent('TextInput', {
|
|
||||||
hit = hit,
|
hit = hit,
|
||||||
text = text, x = x, y = y
|
text = text, x = x, y = y
|
||||||
})
|
})
|
||||||
return hit
|
if result ~= nil then return result end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Input:handleMove (layout, x, y)
|
function Input:handleMove (layout, x, y)
|
||||||
|
|||||||
@@ -55,18 +55,18 @@ local function deactivateSiblings (target)
|
|||||||
end
|
end
|
||||||
|
|
||||||
while sibling do
|
while sibling do
|
||||||
|
local layout = sibling.menuLayout
|
||||||
|
local items = sibling.items
|
||||||
|
|
||||||
sibling.active = nil
|
sibling.active = nil
|
||||||
|
|
||||||
local layout = sibling.menuLayout
|
|
||||||
|
|
||||||
if layout and layout.isShown then
|
if layout and layout.isShown then
|
||||||
wasSiblingOpen = true
|
wasSiblingOpen = true
|
||||||
layout:hide()
|
layout:hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
if sibling.items and sibling.items[1] then
|
if items and items[1] then
|
||||||
deactivateSiblings(sibling.items[1])
|
deactivateSiblings(items[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
sibling = sibling:getNextSibling()
|
sibling = sibling:getNextSibling()
|
||||||
|
|||||||
Reference in New Issue
Block a user