From 6e6d4b81cd3dd506807e226a956548f67c27712e Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Sat, 3 Aug 2019 08:33:32 -0600 Subject: [PATCH] keyboard handling when not using opus os --- sys/modules/opus/input.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/modules/opus/input.lua b/sys/modules/opus/input.lua index 62d51b4..46b58fe 100644 --- a/sys/modules/opus/input.lua +++ b/sys/modules/opus/input.lua @@ -10,6 +10,17 @@ local modifiers = Util.transpose { keys.leftAlt, keys.rightAlt, } +if not keyboard then -- not running under Opus OS + keyboard = { state = { } } + + local Event = require('opus.event') + Event.on({ 'key', 'key_up' }, function(event, code) + if modifiers[code] then + keyboard.state[code] = event == 'key' + end + end) +end + local input = { } function input:modifierPressed()