From 64af750c6c2e9e34fcb4500f67d660ca57b9509f Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sun, 8 Jan 2023 19:37:00 +0100 Subject: [PATCH] Kobo: Unbreak input translation when a viewport is active Generic is responsible for setting up the translation via input hooks; since our own input hooks involve swapping or mirroring X/Y, we need to run our own hooks *first*, so that the viewport translation actually does the right thing... Probably broken for a good long while, I'd just assumed the inaccuracies on the H2O were due to the IR grid... :/. Reported @ https://www.mobileread.com/forums/showthread.php?t=351340 --- frontend/device/generic/device.lua | 3 +++ frontend/device/kobo/device.lua | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/device/generic/device.lua b/frontend/device/generic/device.lua index 42bfe980a..445f1e0cb 100644 --- a/frontend/device/generic/device.lua +++ b/frontend/device/generic/device.lua @@ -197,6 +197,9 @@ function Device:init() self.powerd = require("device/generic/powerd"):new{device = self} end + -- NOTE: This needs to run *after* implementation-specific event hooks, + -- especially if those require swapping/mirroring... + -- (e.g., Device implementations should setup their own hooks *before* calling this via Generic.init(self)). if self.viewport then logger.dbg("setting a viewport:", self.viewport) self.screen:setViewport(self.viewport) diff --git a/frontend/device/kobo/device.lua b/frontend/device/kobo/device.lua index 88b44229f..e90d55862 100644 --- a/frontend/device/kobo/device.lua +++ b/frontend/device/kobo/device.lua @@ -752,7 +752,13 @@ function Kobo:init() dodgy_rtc = dodgy_rtc, } + -- Input handling on Kobo is a thing of nightmares, start by setting up the actual evdev handler... + self:setTouchEventHandler() + -- And then handle the extra shenanigans if necessary. + self:initEventAdjustHooks() + -- Let generic properly setup the standard stuff + -- (*after* we've set our input hooks, so that the viewport translation runs last). Generic.init(self) -- Various HW Buttons, Switches & Synthetic NTX events @@ -771,11 +777,6 @@ function Kobo:init() -- NOTE: usb hotplug event is also available in /tmp/nickel-hardware-status (... but only when Nickel is running ;p) self.input.open("fake_events") - -- Input handling on Kobo is a thing of nightmares, start by setting up the actual evdev handler... - self:setTouchEventHandler() - -- And then handle the extra shenanigans if necessary. - self:initEventAdjustHooks() - -- See if the device supports key repeat if not self:getKeyRepeat() then -- NOP unsupported methods