mirror of
https://github.com/kepler155c/opus
synced 2025-01-03 20:30:28 +00:00
altgr combos
This commit is contained in:
parent
d32030bec4
commit
8a030cbc50
@ -71,6 +71,12 @@ function input:reset()
|
|||||||
self.mfired = nil
|
self.mfired = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function isCombo()
|
||||||
|
-- allow control-alt combinations for certain keyboards
|
||||||
|
return (keyboard.state[keys.leftAlt] or keyboard.state[keys.rightAlt]) and
|
||||||
|
(keyboard.state[keys.leftCtrl] or keyboard.state[keys.rightCtrl])
|
||||||
|
end
|
||||||
|
|
||||||
function input:translate(event, code, p1, p2)
|
function input:translate(event, code, p1, p2)
|
||||||
if event == 'key' then
|
if event == 'key' then
|
||||||
if p1 then -- key is held down
|
if p1 then -- key is held down
|
||||||
@ -87,19 +93,16 @@ function input:translate(event, code, p1, p2)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.state[code] = true
|
self.state[code] = true
|
||||||
if self:modifierPressed() and not modifiers[code] then --or code == 57 then
|
self.fired = false
|
||||||
-- why was i firing here ??
|
|
||||||
--self.fired = true
|
|
||||||
--return { code = input:toCode(keys.getName(code), code) }
|
|
||||||
else
|
|
||||||
self.fired = false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif event == 'char' then
|
elseif event == 'char' then
|
||||||
|
local combo = isCombo()
|
||||||
if not self.fired then
|
if not self.fired then
|
||||||
self.fired = true
|
if combo or not (keyboard.state[keys.leftCtrl] or keyboard.state[keys.rightCtrl]) then
|
||||||
return { code = event, ch = code }
|
self.fired = not combo
|
||||||
|
return { code = event, ch = code }
|
||||||
|
end
|
||||||
-- return { code = event, ch = input:toCode(code) }
|
-- return { code = event, ch = input:toCode(code) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user