1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-11-23 10:58:06 +11:00

Make task manager and filedialog resizable

This commit is contained in:
20kdc 2018-04-25 15:27:13 +01:00
parent 2081cd8e49
commit 5c4d9ac17f
2 changed files with 53 additions and 14 deletions

View File

@ -67,6 +67,7 @@ local function updateConsistentProcList(pt, lp)
end
local p = os.uptime()
neo.scheduleTimer(p)
local ctrl = false
while true do
local n = {coroutine.yield()}
if n[1] == "x.neo.pub.window" then
@ -77,20 +78,38 @@ while true do
return
end
if n[3] == "key" then
if n[6] then
if n[4] == 8 or n[5] == 211 then
if consistentProcList[camY] then
kill(consistentProcList[camY][1])
if n[5] == 29 then
ctrl = n[6]
elseif n[6] then
if ctrl then
if n[5] == 200 then
sH = math.max(headlines + 1, sH - 1)
window.setSize(sW, sH)
elseif n[5] == 208 then
sH = sH + 1
window.setSize(sW, sH)
elseif n[5] == 203 then
sW = math.max(20, sW - 1)
window.setSize(sW, sH)
elseif n[5] == 205 then
sW = sW + 1
window.setSize(sW, sH)
end
else
if n[4] == 8 or n[5] == 211 then
if consistentProcList[camY] then
kill(consistentProcList[camY][1])
end
end
if n[5] == 200 then
camY = camY - 1
if camY < 1 then camY = 1 end
for i = (headlines + 1), sH do drawLine(i) end
end
if n[5] == 208 then
camY = camY + 1
for i = (headlines + 1), sH do drawLine(i) end
end
end
if n[5] == 200 then
camY = camY - 1
if camY < 1 then camY = 1 end
for i = (headlines + 1), sH do drawLine(i) end
end
if n[5] == 208 then
camY = camY + 1
for i = (headlines + 1), sH do drawLine(i) end
end
end
end

View File

@ -34,9 +34,10 @@ local function cb(...)
end
end
local w, h = 30, 8
local function prepareNodeI(node)
local l = node.list()
local w, h = 30, 8
-- Local State
-- Selection. Having this equal to #l + 1 means typing area ('unknown')
local selection = 1
@ -71,8 +72,27 @@ local function prepareNodeI(node)
updateLine(wnd, i)
end
end
local ctrl = false
local function key(wnd, ka, kc, down)
if kc == 29 then
ctrl = down
end
if not down then return end
if ctrl then
if kc == 200 then
h = math.max(2, h - 1)
elseif kc == 208 then
h = h + 1
elseif kc == 203 then
w = math.max(1, w - 1)
elseif kc == 205 then
w = w + 1
else
return
end
wnd.setSize(w, h)
return
end
if (ka == 9) or (kc == 208) then
local lo = selection
selection = selection + 1