mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-12 11:10:29 +00:00
Fire mouse_up events in monitor.lua (#358)
We schedule a mouse_up event 0.1 seconds after receiving a monitor_touch event.
This commit is contained in:
parent
930fd59298
commit
8eae02c037
@ -39,6 +39,8 @@ local function resume( ... )
|
||||
return param
|
||||
end
|
||||
|
||||
local timers = {}
|
||||
|
||||
local ok, param = pcall( function()
|
||||
local sFilter = resume()
|
||||
while coroutine.status( co ) ~= "dead" do
|
||||
@ -48,6 +50,7 @@ local ok, param = pcall( function()
|
||||
end
|
||||
if coroutine.status( co ) ~= "dead" and (sFilter == nil or sFilter == "mouse_click") then
|
||||
if tEvent[1] == "monitor_touch" and tEvent[2] == sName then
|
||||
timers[os.startTimer( 0.1 )] = { tEvent[3], tEvent[4] }
|
||||
sFilter = resume( "mouse_click", 1, table.unpack( tEvent, 3, tEvent.n ) )
|
||||
end
|
||||
end
|
||||
@ -56,6 +59,12 @@ local ok, param = pcall( function()
|
||||
sFilter = resume( "term_resize" )
|
||||
end
|
||||
end
|
||||
if coroutine.status( co ) ~= "dead" and (sFilter == nil or sFilter == "mouse_up") then
|
||||
if tEvent[1] == "timer" and timers[tEvent[2]] then
|
||||
sFilter = resume( "mouse_up", 1, table.unpack( timers[tEvent[2]], 1, 2 ) )
|
||||
timers[tEvent[2]] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user