mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
keyboard and paste support for pocket
This commit is contained in:
parent
b9030d6bed
commit
58fb35e85b
@ -92,4 +92,20 @@ function renderer.handle_mouse(event)
|
|||||||
end
|
end
|
||||||
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
|
return renderer
|
||||||
|
@ -175,8 +175,14 @@ local function main()
|
|||||||
pocket_comms.handle_packet(packet)
|
pocket_comms.handle_packet(packet)
|
||||||
elseif event == "mouse_click" or event == "mouse_up" or event == "mouse_drag" or event == "mouse_scroll" or
|
elseif event == "mouse_click" or event == "mouse_up" or event == "mouse_drag" or event == "mouse_scroll" or
|
||||||
event == "double_click" then
|
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))
|
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
|
end
|
||||||
|
|
||||||
-- check for termination request
|
-- check for termination request
|
||||||
|
Loading…
Reference in New Issue
Block a user