mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-01-10 13:12:40 +01:00
New focusing system
This commit is contained in:
parent
49bbdd4204
commit
280ac05ec6
@ -105,7 +105,7 @@ local overrideCodeViewDraw = codeView.draw
|
||||
codeView.draw = function(...)
|
||||
overrideCodeViewDraw(...)
|
||||
|
||||
if cursorBlinkState then
|
||||
if cursorBlinkState and GUI.focusedObject == window then
|
||||
local x, y = codeView.codeAreaPosition + cursorPositionSymbol - codeView.fromSymbol + 1, codeView.y + cursorPositionLine - codeView.fromLine
|
||||
if
|
||||
x >= codeView.codeAreaPosition + 1 and
|
||||
|
||||
@ -4261,12 +4261,7 @@ local function windowEventHandler(workspace, window, e1, e2, e3, e4, ...)
|
||||
end
|
||||
|
||||
if window ~= window.parent.children[#window.parent.children] then
|
||||
window:moveToFront()
|
||||
|
||||
if window.onFocus then
|
||||
window.onFocus(workspace, window, e1, e2, e3, e4, ...)
|
||||
end
|
||||
|
||||
window:focus()
|
||||
workspace:draw()
|
||||
end
|
||||
elseif e1 == "drag" and window.lastTouchX and not windowCheck(window, e3, e4) then
|
||||
@ -4337,11 +4332,22 @@ function GUI.windowMinimize(window)
|
||||
window.hidden = not window.hidden
|
||||
end
|
||||
|
||||
function GUI.windowFocus(window)
|
||||
GUI.focusedObject = window
|
||||
window.hidden = false
|
||||
window:moveToFront()
|
||||
|
||||
if window.onFocus then
|
||||
window.onFocus()
|
||||
end
|
||||
end
|
||||
|
||||
function GUI.window(x, y, width, height)
|
||||
local window = GUI.container(x, y, width, height)
|
||||
|
||||
window.passScreenEvents = false
|
||||
|
||||
window.focus = GUI.windowFocus
|
||||
window.resize = windowResize
|
||||
window.maximize = GUI.windowMaximize
|
||||
window.minimize = GUI.windowMinimize
|
||||
|
||||
@ -1663,7 +1663,7 @@ local function windowRemove(window)
|
||||
window.dockIcon.windowCount = window.dockIcon.windowCount - 1
|
||||
|
||||
-- Если в докиконке еще остались окна
|
||||
if not next(window.dockIcon.windows) then
|
||||
if window.dockIcon.windowCount < 1 then
|
||||
window.dockIcon.windows = nil
|
||||
window.dockIcon.windowCount = nil
|
||||
|
||||
@ -2251,12 +2251,16 @@ function system.updateDesktop()
|
||||
|
||||
icon.onLeftClick = function(icon, ...)
|
||||
if icon.windows then
|
||||
for window in pairs(icon.windows) do
|
||||
GUI.focusedObject = window
|
||||
window.hidden = false
|
||||
window:moveToFront()
|
||||
local topmostWindow
|
||||
|
||||
-- Unhide all windows
|
||||
for w in pairs(icon.windows) do
|
||||
topmostWindow = w
|
||||
topmostWindow.hidden = false
|
||||
end
|
||||
|
||||
topmostWindow:focus()
|
||||
|
||||
updateMenu()
|
||||
event.sleep(0.2)
|
||||
else
|
||||
@ -2915,9 +2919,8 @@ _G.print = function(...)
|
||||
|
||||
args = table.concat(args, " ")
|
||||
|
||||
system.consoleWindow.hidden = false
|
||||
system.consoleWindow.addLine(args)
|
||||
system.consoleWindow:moveToFront()
|
||||
system.consoleWindow:focus()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user