entirely rework event handling take 7
This commit is contained in:
20
handlers.lua
20
handlers.lua
@ -53,10 +53,6 @@ function handlers.handlePasswordInput()
|
||||
local password = ""
|
||||
state.enteringPassword = true
|
||||
|
||||
-- Store old handlers to restore later
|
||||
local oldHandlers = eventHandlers["monitor_touch"] or {}
|
||||
local oldPriorities = handlerPriorities["monitor_touch"] or {}
|
||||
|
||||
-- Register high-priority click handler for password input
|
||||
local function passwordClickHandler(eventType, side, x, y)
|
||||
if not state.enteringPassword then
|
||||
@ -100,9 +96,9 @@ function handlers.handlePasswordInput()
|
||||
return true -- Consume all clicks during password entry
|
||||
end
|
||||
|
||||
-- Clear monitor_touch handlers and register only password handler
|
||||
eventHandlers["monitor_touch"] = { passwordClickHandler }
|
||||
handlerPriorities["monitor_touch"] = { events.PRIORITY.PASSWORD_INPUT }
|
||||
-- Clear all monitor_touch handlers and register only password handler
|
||||
events.clearHandlers("monitor_touch")
|
||||
events.registerHandler("monitor_touch", passwordClickHandler, events.PRIORITY.PASSWORD_INPUT)
|
||||
|
||||
-- Wait for password submission
|
||||
while state.enteringPassword do
|
||||
@ -113,14 +109,10 @@ function handlers.handlePasswordInput()
|
||||
-- Don't process the result here - the handler already did it
|
||||
end
|
||||
|
||||
-- Restore old handlers
|
||||
eventHandlers["monitor_touch"] = oldHandlers
|
||||
handlerPriorities["monitor_touch"] = oldPriorities
|
||||
-- Re-register connection handlers after password entry completes
|
||||
handlers.setupConnectionHandlers()
|
||||
|
||||
-- If no handlers to restore, re-register connection handlers
|
||||
if #oldHandlers == 0 then
|
||||
handlers.setupConnectionHandlers()
|
||||
end -- Send password attempt
|
||||
-- Send password attempt
|
||||
utils.sendPasswordAttempt(password)
|
||||
|
||||
return password
|
||||
|
||||
Reference in New Issue
Block a user