diff --git a/plugins/10-delay-motion.lua b/plugins/10-delay-motion.lua index ddc122e3..2715f642 100644 --- a/plugins/10-delay-motion.lua +++ b/plugins/10-delay-motion.lua @@ -34,7 +34,7 @@ end function frame(device, frame, timestamp) for _, v in ipairs(frame) do if v.usage == evdev.REL_X or v.usage == evdev.REL_Y then - next_time = timestamp + DELAY + local next_time = timestamp + DELAY table.insert(devices[device], { time = next_time, frame = frame @@ -54,6 +54,9 @@ function device_new(device) if usages[evdev.REL_X] then devices[device] = {} device:connect("evdev-frame", frame) + device:connect("device-removed", function(dev) + devices[dev] = nil + end) end end diff --git a/plugins/10-example.lua b/plugins/10-example.lua index 957cfc96..1241a5bc 100644 --- a/plugins/10-example.lua +++ b/plugins/10-example.lua @@ -31,7 +31,7 @@ function frame(device, frame, time_in_microseconds) -- If we get a right button event, change it to left, and -- vice versa. Because this happens before libinput (or the next -- plugin in the precedence order) sees the - -- frame it doesn't know that the swap happend. + -- frame it doesn't know that the swap happened. if v.usage == evdev.BTN_RIGHT then v.usage = evdev.BTN_LEFT elseif v.usage == evdev.BTN_LEFT then diff --git a/plugins/10-pointer-go-slower.lua b/plugins/10-pointer-go-slower.lua index 900d521e..2c8c58e5 100644 --- a/plugins/10-pointer-go-slower.lua +++ b/plugins/10-pointer-go-slower.lua @@ -49,5 +49,8 @@ libinput:connect("new-evdev-device", function(device) end return frame end) + device:connect("device-removed", function(dev) + remainders[dev] = nil + end) end end)