1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-23 11:47:39 +00:00

transition tot kernel

This commit is contained in:
kepler155c@gmail.com
2018-01-11 20:53:32 -05:00
parent d224f5df25
commit fc8d44b60d
19 changed files with 425 additions and 366 deletions

View File

@@ -30,6 +30,7 @@ local Util = require('util')
local device = _G.device
local kernel = _G.kernel
local keyboard = _G.device.keyboard
local mouse = _G.device.mouse
local os = _G.os
kernel.hook('peripheral', function(_, eventData)
@@ -74,6 +75,23 @@ kernel.hook({ 'key', 'key_up', 'char', 'paste' }, function(event, eventData)
end
end)
kernel.hook({ 'mouse_click', 'mouse_up', 'mouse_drag' }, function(event, eventData)
local button = eventData[1]
if event == 'mouse_click' then
mouse.state[button] = true
else
if not mouse.state[button] then
return true -- ensure mouse ups are only generated if a mouse down was sent
end
mouse.state[button] = nil
end
end)
kernel.hook('kernel_focus', function()
Util.clear(keyboard.state)
Util.clear(mouse.state)
end)
function keyboard.addHotkey(code, fn)
keyboard.hotkeys[code] = fn
end

View File

@@ -1,16 +1,13 @@
local kernel = _G.kernel
local multishell = _ENV.multishell
_G.network = { }
kernel.hook('device_attach', function(_, eventData)
if eventData[1] == 'wireless_modem' then
local s, m = multishell.openTab({
local routine = kernel.newRoutine({
path = 'sys/services/network.lua',
hidden = true
})
if not s and m then
debug(m)
end
kernel.run(routine)
end
end)

View File

@@ -295,8 +295,9 @@ function fs.loadTab(path)
fs.mount(table.unpack(Util.matches(l)))
end)
if not s then
printError('Mount failed')
printError(l)
_G.printError('Mount failed')
_G.printError(l)
_G.printError(m)
end
end
end