mirror of
https://github.com/kepler155c/opus
synced 2025-01-03 20:30:28 +00:00
Merge branch 'develop-1.8' of https://github.com/kepler155c/opus into develop-1.8
This commit is contained in:
commit
456d2d301f
@ -1,6 +1,6 @@
|
|||||||
Sat May 2 05:16:44 UTC 2020
|
Mon May 4 22:45:08 UTC 2020
|
||||||
commit 5afb21b68ec1ddb9d79393277a586ceda9abbbb5
|
commit d7f41f2bce51bd481b24bc6614b43af42f486f11
|
||||||
Author: kepler155c@gmail.com <kepler155c@gmail.com>
|
Author: kepler155c@gmail.com <kepler155c@gmail.com>
|
||||||
Date: Fri May 1 23:16:10 2020 -0600
|
Date: Mon May 4 16:41:35 2020 -0600
|
||||||
|
|
||||||
more work on update notification
|
multishell/kernel support for windows on different devices
|
||||||
|
@ -296,6 +296,7 @@ kernel.hook('term_resize', function(_, eventData)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
kernel.hook('mouse_click', function(_, eventData)
|
kernel.hook('mouse_click', function(_, eventData)
|
||||||
|
if not eventData[4] then
|
||||||
local x, y = eventData[2], eventData[3]
|
local x, y = eventData[2], eventData[3]
|
||||||
|
|
||||||
if y == 1 then
|
if y == 1 then
|
||||||
@ -319,17 +320,22 @@ kernel.hook('mouse_click', function(_, eventData)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
eventData[3] = eventData[3] - 1
|
eventData[3] = eventData[3] - 1
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
kernel.hook({ 'mouse_up', 'mouse_drag' }, function(_, eventData)
|
kernel.hook({ 'mouse_up', 'mouse_drag' }, function(_, eventData)
|
||||||
|
if not eventData[4] then
|
||||||
eventData[3] = eventData[3] - 1
|
eventData[3] = eventData[3] - 1
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
kernel.hook('mouse_scroll', function(_, eventData)
|
kernel.hook('mouse_scroll', function(_, eventData)
|
||||||
|
if not eventData[4] then
|
||||||
if eventData[3] == 1 then
|
if eventData[3] == 1 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
eventData[3] = eventData[3] - 1
|
eventData[3] = eventData[3] - 1
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
kernel.hook('kernel_ready', function()
|
kernel.hook('kernel_ready', function()
|
||||||
|
@ -50,8 +50,13 @@ function kernel.hook(event, fn)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- you can only unhook from within the function that hooked
|
-- you *should* only unhook from within the function that hooked
|
||||||
function kernel.unhook(event, fn)
|
function kernel.unhook(event, fn)
|
||||||
|
if type(event) == 'table' then
|
||||||
|
for _,v in pairs(event) do
|
||||||
|
kernel.unhook(v, fn)
|
||||||
|
end
|
||||||
|
else
|
||||||
local eventHooks = kernel.hooks[event]
|
local eventHooks = kernel.hooks[event]
|
||||||
if eventHooks then
|
if eventHooks then
|
||||||
Array.removeByValue(eventHooks, fn)
|
Array.removeByValue(eventHooks, fn)
|
||||||
@ -59,6 +64,7 @@ function kernel.unhook(event, fn)
|
|||||||
kernel.hooks[event] = nil
|
kernel.hooks[event] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local Routine = { }
|
local Routine = { }
|
||||||
@ -107,6 +113,9 @@ function Routine:resume(event, ...)
|
|||||||
end
|
end
|
||||||
if coroutine.status(self.co) == 'dead' then
|
if coroutine.status(self.co) == 'dead' then
|
||||||
Array.removeByValue(kernel.routines, self)
|
Array.removeByValue(kernel.routines, self)
|
||||||
|
if self.onDestroy then
|
||||||
|
self.onDestroy(self)
|
||||||
|
end
|
||||||
if #kernel.routines > 0 then
|
if #kernel.routines > 0 then
|
||||||
switch(kernel.routines[1])
|
switch(kernel.routines[1])
|
||||||
end
|
end
|
||||||
|
@ -75,11 +75,11 @@ function UI:init()
|
|||||||
term_resize = resize,
|
term_resize = resize,
|
||||||
monitor_resize = resize,
|
monitor_resize = resize,
|
||||||
|
|
||||||
mouse_scroll = function(_, direction, x, y)
|
mouse_scroll = function(_, direction, x, y, side)
|
||||||
local ie = Input:translate('mouse_scroll', direction, x, y)
|
local ie = Input:translate('mouse_scroll', direction, x, y)
|
||||||
|
|
||||||
local currentPage = self:getActivePage()
|
local currentPage = self:getActivePage()
|
||||||
if currentPage then
|
if currentPage and currentPage.parent.device.side == side then
|
||||||
local event = currentPage:pointToChild(x, y)
|
local event = currentPage:pointToChild(x, y)
|
||||||
event.type = ie.code
|
event.type = ie.code
|
||||||
event.ie = { code = ie.code, x = event.x, y = event.y }
|
event.ie = { code = ie.code, x = event.x, y = event.y }
|
||||||
@ -97,12 +97,11 @@ function UI:init()
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
mouse_click = function(_, button, x, y)
|
mouse_click = function(_, button, x, y, side)
|
||||||
local ie = Input:translate('mouse_click', button, x, y)
|
local ie = Input:translate('mouse_click', button, x, y)
|
||||||
|
|
||||||
local currentPage = self:getActivePage()
|
local currentPage = self:getActivePage()
|
||||||
if currentPage then
|
if currentPage and currentPage.parent.device.side == side then
|
||||||
if not currentPage.parent.device.side then
|
|
||||||
local event = currentPage:pointToChild(x, y)
|
local event = currentPage:pointToChild(x, y)
|
||||||
if event.element.focus and not event.element.inactive then
|
if event.element.focus and not event.element.inactive then
|
||||||
currentPage:setFocus(event.element)
|
currentPage:setFocus(event.element)
|
||||||
@ -110,10 +109,9 @@ function UI:init()
|
|||||||
end
|
end
|
||||||
self:click(currentPage, ie)
|
self:click(currentPage, ie)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
mouse_up = function(_, button, x, y)
|
mouse_up = function(_, button, x, y, side)
|
||||||
local ie = Input:translate('mouse_up', button, x, y)
|
local ie = Input:translate('mouse_up', button, x, y)
|
||||||
local currentPage = self:getActivePage()
|
local currentPage = self:getActivePage()
|
||||||
|
|
||||||
@ -124,18 +122,16 @@ function UI:init()
|
|||||||
args = { event.element },
|
args = { event.element },
|
||||||
focused = true })
|
focused = true })
|
||||||
|
|
||||||
elseif ie and currentPage then
|
elseif ie and currentPage and currentPage.parent.device.side == side then
|
||||||
if not currentPage.parent.device.side then
|
|
||||||
self:click(currentPage, ie)
|
self:click(currentPage, ie)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
mouse_drag = function(_, button, x, y)
|
mouse_drag = function(_, button, x, y, side)
|
||||||
local ie = Input:translate('mouse_drag', button, x, y)
|
local ie = Input:translate('mouse_drag', button, x, y)
|
||||||
local currentPage = self:getActivePage()
|
local currentPage = self:getActivePage()
|
||||||
|
|
||||||
if ie and currentPage then
|
if ie and currentPage and currentPage.parent.device.side == side then
|
||||||
self:click(currentPage, ie)
|
self:click(currentPage, ie)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user