keyboard and paste support for pocket

This commit is contained in:
Mikayla 2024-06-05 00:31:47 +00:00
parent b9030d6bed
commit 58fb35e85b
2 changed files with 23 additions and 1 deletions

View File

@ -92,4 +92,20 @@ function renderer.handle_mouse(event)
end
end
-- handle a keyboard event
---@param event key_interaction|nil
function renderer.handle_key(event)
if ui.display ~= nil and event ~= nil then
ui.display.handle_key(event)
end
end
-- handle a paste event
---@param text string
function renderer.handle_paste(text)
if ui.display ~= nil then
ui.display.handle_paste(text)
end
end
return renderer

View File

@ -175,8 +175,14 @@ local function main()
pocket_comms.handle_packet(packet)
elseif event == "mouse_click" or event == "mouse_up" or event == "mouse_drag" or event == "mouse_scroll" or
event == "double_click" then
-- handle a monitor touch event
-- handle a mouse event
renderer.handle_mouse(core.events.new_mouse_event(event, param1, param2, param3))
elseif event == "char" or event == "key" or event == "key_up" then
-- handle a keyboard event
renderer.handle_key(core.events.new_key_event(event, param1, param2))
elseif event == "paste" then
-- handle a paste event
renderer.handle_paste(param1)
end
-- check for termination request