mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-06-25 14:43:02 +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
|
return param
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local timers = {}
|
||||||
|
|
||||||
local ok, param = pcall( function()
|
local ok, param = pcall( function()
|
||||||
local sFilter = resume()
|
local sFilter = resume()
|
||||||
while coroutine.status( co ) ~= "dead" do
|
while coroutine.status( co ) ~= "dead" do
|
||||||
@ -48,6 +50,7 @@ local ok, param = pcall( function()
|
|||||||
end
|
end
|
||||||
if coroutine.status( co ) ~= "dead" and (sFilter == nil or sFilter == "mouse_click") then
|
if coroutine.status( co ) ~= "dead" and (sFilter == nil or sFilter == "mouse_click") then
|
||||||
if tEvent[1] == "monitor_touch" and tEvent[2] == sName 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 ) )
|
sFilter = resume( "mouse_click", 1, table.unpack( tEvent, 3, tEvent.n ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -56,6 +59,12 @@ local ok, param = pcall( function()
|
|||||||
sFilter = resume( "term_resize" )
|
sFilter = resume( "term_resize" )
|
||||||
end
|
end
|
||||||
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
|
||||||
end )
|
end )
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user