tweaks + Anavrins disk usage system module

This commit is contained in:
kepler155c@gmail.com
2019-07-02 10:19:08 -04:00
parent aec5ac0121
commit 1dcb6d67b7
7 changed files with 200 additions and 54 deletions

View File

@@ -10,13 +10,7 @@ local modifiers = Util.transpose {
keys.leftAlt, keys.rightAlt,
}
local input = {
state = { },
}
if not keyboard then
keyboard = { state = input.state }
end
local input = { }
function input:modifierPressed()
return keyboard.state[keys.leftCtrl] or
@@ -64,7 +58,6 @@ end
function input:reset()
self.state = { }
self.fired = nil
self.timer = nil
self.mch = nil
@@ -81,7 +74,6 @@ function input:translate(event, code, p1, p2)
if event == 'key' then
if p1 then -- key is held down
if not modifiers[code] then
self.fired = true
local ch = input:toCode(keys.getName(code), code)
if #ch == 1 then
return {
@@ -92,37 +84,19 @@ function input:translate(event, code, p1, p2)
return { code = ch }
end
elseif code then
--self.fired = true
local ch = input:toCode(keys.getName(code), code)
if #ch ~= 1 then
return { code = ch }
end
-- self.state[code] = true
local ch = input:toCode(keys.getName(code), code)
if #ch ~= 1 then
return { code = ch }
end
end
elseif event == 'char' then
local combo = isCombo()
--if not self.fired then
if combo or not (keyboard.state[keys.leftCtrl] or keyboard.state[keys.rightCtrl]) then
self.fired = not combo
return { code = event, ch = code }
--end
-- return { code = event, ch = input:toCode(code) }
if combo or not (keyboard.state[keys.leftCtrl] or keyboard.state[keys.rightCtrl]) then
return { code = event, ch = code }
end
elseif event == 'key_upx' then
if not self.fired then
--if self.state[code] then
self.fired = true
local ch = input:toCode(keys.getName(code), code)
self.state[code] = nil
return { code = ch }
--end
end
self.state[code] = nil
elseif event == 'paste' then
self.fired = true
if keyboard.state[keys.leftShift] or keyboard.state[keys.rightShift] then
return { code = 'shift-paste', text = code }
else
@@ -142,7 +116,6 @@ function input:translate(event, code, p1, p2)
elseif event == 'mouse_drag' then
self.mfired = true
self.fired = true
return {
code = input:toCode('mouse_drag', 255),
button = code,
@@ -169,7 +142,6 @@ function input:translate(event, code, p1, p2)
self.mch = 'mouse_up'
self.mfired = input:toCode(self.mch, 255)
end
self.fired = true
return {
code = self.mfired,
button = code,
@@ -182,7 +154,6 @@ function input:translate(event, code, p1, p2)
[ -1 ] = 'scroll_up',
[ 1 ] = 'scroll_down'
}
self.fired = true
return {
code = input:toCode(directions[code], 255),
x = p1,