mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 14:40:26 +01:00
plugins: fix some minor issues with the example plugins
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
This commit is contained in:
parent
037c07d76f
commit
f0d8002255
3 changed files with 8 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue