Bugfix
- Focus fix for programs - package.path for Program object fix
This commit is contained in:
@@ -352,19 +352,6 @@ return function(name, parent, pTerm, basalt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function focusSystem(self)
|
|
||||||
if(focusedObject~=focusedObjectCache)then
|
|
||||||
if(focusedObject~=nil)then
|
|
||||||
focusedObject:loseFocusHandler()
|
|
||||||
end
|
|
||||||
if(focusedObjectCache~=nil)then
|
|
||||||
focusedObjectCache:getFocusHandler()
|
|
||||||
end
|
|
||||||
focusedObject = focusedObjectCache
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
object = {
|
object = {
|
||||||
barActive = false,
|
barActive = false,
|
||||||
barBackground = colors.gray,
|
barBackground = colors.gray,
|
||||||
@@ -386,8 +373,15 @@ return function(name, parent, pTerm, basalt)
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
setFocusedObject = function(self, obj)
|
setFocusedObject = function(self, obj)
|
||||||
focusedObjectCache = obj
|
if(focusedObject~=obj)then
|
||||||
focusSystem(self)
|
if(focusedObject~=nil)then
|
||||||
|
focusedObject:loseFocusHandler()
|
||||||
|
end
|
||||||
|
if(obj~=nil)then
|
||||||
|
obj:getFocusHandler()
|
||||||
|
end
|
||||||
|
focusedObject = obj
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -463,8 +457,10 @@ return function(name, parent, pTerm, basalt)
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
removeFocusedObject = function(self)
|
removeFocusedObject = function(self)
|
||||||
focusedObjectCache = nil
|
if(focusedObject~=nil)then
|
||||||
focusSystem(self)
|
focusedObject:loseFocusHandler()
|
||||||
|
end
|
||||||
|
focusedObject = nil
|
||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -816,7 +812,7 @@ return function(name, parent, pTerm, basalt)
|
|||||||
for _, value in rpairs(events["mouse_click"][index]) do
|
for _, value in rpairs(events["mouse_click"][index]) do
|
||||||
if (value.mouseHandler ~= nil) then
|
if (value.mouseHandler ~= nil) then
|
||||||
if (value:mouseHandler(button, x, y)) then
|
if (value:mouseHandler(button, x, y)) then
|
||||||
focusSystem(self)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -849,7 +845,6 @@ return function(name, parent, pTerm, basalt)
|
|||||||
for _, value in rpairs(events["mouse_up"][index]) do
|
for _, value in rpairs(events["mouse_up"][index]) do
|
||||||
if (value.mouseUpHandler ~= nil) then
|
if (value.mouseUpHandler ~= nil) then
|
||||||
if (value:mouseUpHandler(button, x, y)) then
|
if (value:mouseUpHandler(button, x, y)) then
|
||||||
focusSystem(self)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -857,7 +852,6 @@ return function(name, parent, pTerm, basalt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
focusSystem(self)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
@@ -871,7 +865,6 @@ return function(name, parent, pTerm, basalt)
|
|||||||
for _, value in rpairs(events["mouse_scroll"][index]) do
|
for _, value in rpairs(events["mouse_scroll"][index]) do
|
||||||
if (value.scrollHandler ~= nil) then
|
if (value.scrollHandler ~= nil) then
|
||||||
if (value:scrollHandler(dir, x, y)) then
|
if (value:scrollHandler(dir, x, y)) then
|
||||||
focusSystem(self)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -934,7 +927,6 @@ return function(name, parent, pTerm, basalt)
|
|||||||
for _, value in rpairs(events["mouse_drag"][index]) do
|
for _, value in rpairs(events["mouse_drag"][index]) do
|
||||||
if (value.dragHandler ~= nil) then
|
if (value.dragHandler ~= nil) then
|
||||||
if (value:dragHandler(button, x, y)) then
|
if (value:dragHandler(button, x, y)) then
|
||||||
focusSystem(self)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -943,7 +935,7 @@ return function(name, parent, pTerm, basalt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
focusSystem(self)
|
|
||||||
base.dragHandler(self, button, x, y)
|
base.dragHandler(self, button, x, y)
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ local processes = {}
|
|||||||
local process = {}
|
local process = {}
|
||||||
local processId = 0
|
local processId = 0
|
||||||
|
|
||||||
|
local newPackage = dofile("rom/modules/main/cc/require.lua").make
|
||||||
|
|
||||||
function process:new(path, window, newEnv, ...)
|
function process:new(path, window, newEnv, ...)
|
||||||
local args = {...}
|
local args = {...}
|
||||||
local newP = setmetatable({ path = path }, { __index = self })
|
local newP = setmetatable({ path = path }, { __index = self })
|
||||||
@@ -11,11 +13,12 @@ function process:new(path, window, newEnv, ...)
|
|||||||
newP.processId = processId
|
newP.processId = processId
|
||||||
if(type(path)=="string")then
|
if(type(path)=="string")then
|
||||||
newP.coroutine = coroutine.create(function()
|
newP.coroutine = coroutine.create(function()
|
||||||
|
local pPath = shell.resolveProgram(path)
|
||||||
local env = setmetatable(newEnv, {__index=_ENV})
|
local env = setmetatable(newEnv, {__index=_ENV})
|
||||||
env.shell = shell
|
env.shell = shell
|
||||||
env.basaltProgram=true
|
env.basaltProgram=true
|
||||||
env.arg = {[0]=path, table.unpack(args)}
|
env.arg = {[0]=path, table.unpack(args)}
|
||||||
local pPath = shell.resolveProgram(path)
|
env.require, env.package = newPackage(env, fs.getDir(pPath))
|
||||||
if(fs.exists(pPath))then
|
if(fs.exists(pPath))then
|
||||||
local file = fs.open(pPath, "r")
|
local file = fs.open(pPath, "r")
|
||||||
local content = file.readAll()
|
local content = file.readAll()
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ return function(name, parent)
|
|||||||
local obx, oby = self:getAnchorPosition()
|
local obx, oby = self:getAnchorPosition()
|
||||||
local w,h = self:getSize()
|
local w,h = self:getSize()
|
||||||
if (obx + xCur - 1 >= 1 and obx + xCur - 1 <= obx + w - 1 and yCur + oby - 1 >= 1 and yCur + oby - 1 <= oby + h - 1) then
|
if (obx + xCur - 1 >= 1 and obx + xCur - 1 <= obx + w - 1 and yCur + oby - 1 >= 1 and yCur + oby - 1 <= oby + h - 1) then
|
||||||
self.parent:setCursor(pWindow.getCursorBlink(), obx + xCur - 1, yCur + oby - 1, pWindow.getTextColor())
|
self.parent:setCursor(self:isFocused() and pWindow.getCursorBlink(), obx + xCur - 1, yCur + oby - 1, pWindow.getTextColor())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -684,11 +684,9 @@ return function(name, parent)
|
|||||||
if (self.parent ~= nil) then
|
if (self.parent ~= nil) then
|
||||||
local xCur, yCur = pWindow.getCursorPos()
|
local xCur, yCur = pWindow.getCursorPos()
|
||||||
local obx, oby = self:getAnchorPosition()
|
local obx, oby = self:getAnchorPosition()
|
||||||
if (self.parent ~= nil) then
|
local w,h = self:getSize()
|
||||||
local w,h = self:getSize()
|
if (obx + xCur - 1 >= 1 and obx + xCur - 1 <= obx + w - 1 and yCur + oby - 1 >= 1 and yCur + oby - 1 <= oby + h - 1) then
|
||||||
if (obx + xCur - 1 >= 1 and obx + xCur - 1 <= obx + w - 1 and yCur + oby - 1 >= 1 and yCur + oby - 1 <= oby + h - 1) then
|
self.parent:setCursor(pWindow.getCursorBlink(), obx + xCur - 1, yCur + oby - 1, pWindow.getTextColor())
|
||||||
self.parent:setCursor(pWindow.getCursorBlink(), obx + xCur - 1, yCur + oby - 1, pWindow.getTextColor())
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -757,9 +755,13 @@ return function(name, parent)
|
|||||||
if (base.draw(self)) then
|
if (base.draw(self)) then
|
||||||
if (self.parent ~= nil) then
|
if (self.parent ~= nil) then
|
||||||
local obx, oby = self:getAnchorPosition()
|
local obx, oby = self:getAnchorPosition()
|
||||||
|
local xCur, yCur = pWindow.getCursorPos()
|
||||||
local w,h = self:getSize()
|
local w,h = self:getSize()
|
||||||
pWindow.basalt_reposition(obx, oby)
|
pWindow.basalt_reposition(obx, oby)
|
||||||
pWindow.basalt_update()
|
pWindow.basalt_update()
|
||||||
|
if (obx + xCur - 1 >= 1 and obx + xCur - 1 <= obx + w - 1 and yCur + oby - 1 >= 1 and yCur + oby - 1 <= oby + h - 1) then
|
||||||
|
self.parent:setCursor(self:isFocused() and pWindow.getCursorBlink(), obx + xCur - 1, yCur + oby - 1, pWindow.getTextColor())
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|||||||
Reference in New Issue
Block a user