mirror of
https://github.com/koreader/koreader
synced 2024-11-18 03:25:46 +00:00
Input: Minor simplification for the Mk. 3 input quirk (#9481)
I was afraid that ABS_PRESSURE could be sent out of order, but that appears to never be the case, so we can simplify the code a bit :}.
This commit is contained in:
parent
02ce99b231
commit
1ac35cb865
@ -839,6 +839,19 @@ function Input:handleTouchEvLegacy(ev)
|
||||
self:setCurrentMtSlotChecked("id", 1)
|
||||
else
|
||||
self:setCurrentMtSlotChecked("id", -1)
|
||||
|
||||
-- On Kobo Mk. 3 devices, the frame that reports a contact lift *actually* does the coordinates transform for us...
|
||||
-- Unfortunately, our own transforms are not stateful, so, just revert 'em here,
|
||||
-- since we can't simply avoid not doing 'em for that frame...
|
||||
-- c.f., https://github.com/koreader/koreader/issues/2128#issuecomment-1236289909 for logs on a Touch B
|
||||
-- NOTE: We can afford to do this here instead of on SYN_REPORT because the kernel *always*
|
||||
-- reports ABS_PRESSURE after ABS_X/ABS_Y.
|
||||
if self.touch_kobo_mk3_protocol then
|
||||
local y = 599 - self:getCurrentMtSlotData("x") -- Mk. 3 devices are all 600x800, so just hard-code it here.
|
||||
local x = self:getCurrentMtSlotData("y")
|
||||
self:setCurrentMtSlot("x", x)
|
||||
self:setCurrentMtSlot("y", y)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif ev.type == C.EV_SYN then
|
||||
@ -847,20 +860,6 @@ function Input:handleTouchEvLegacy(ev)
|
||||
self:setMtSlot(MTSlot.slot, "timev", time.timeval(ev.time))
|
||||
end
|
||||
|
||||
-- On Kobo Mk. 3 devices, the frame that reports a contact lift *actually* does the coordinates transform for us...
|
||||
-- Unfortunately, our own transforms are not stateful, so, just revert 'em here,
|
||||
-- since we can't simply avoid not doing 'em for that frame...
|
||||
-- c.f., https://github.com/koreader/koreader/issues/2128#issuecomment-1236289909 for logs on a Touch B
|
||||
if self.touch_kobo_mk3_protocol then
|
||||
if self:getCurrentMtSlotData("id") == -1 then
|
||||
-- Technically, it's the frame where ABS_PRESSURE is set to 0 ;).
|
||||
local y = 599 - self:getCurrentMtSlotData("x") -- Mk. 3 devices are all 600x800, so just hard-code it here.
|
||||
local x = self:getCurrentMtSlotData("y")
|
||||
self:setCurrentMtSlot("x", x)
|
||||
self:setCurrentMtSlot("y", y)
|
||||
end
|
||||
end
|
||||
|
||||
-- feed ev in all slots to state machine
|
||||
local touch_gestures = self.gesture_detector:feedEvent(self.MTSlots)
|
||||
self:newFrame()
|
||||
|
Loading…
Reference in New Issue
Block a user