mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Kobo: Fix input on Mk. 3 (i.e., Kobo Touch A/B). (#9474)
* Kobo: Discriminate between the Touch A/B and the Touch C properly, and implement actual support for the A/B input quirks. This means the clunky touchscreen probe widget shown on fresh installs on those devices is now gone :}. * Input: Fix an off-by-one in most adjustTouchMirrorX/Y callers (only rM was doing it right), and adjust their documentation to avoid similar mistakes in the future. * GestureDetector: Unify logging to always display transformed coordinates for simple gestures. * GestureDetector: Fix two-contact hold lifts to be computed at the midpoint between the two contacts, like their holds counterpart already did.
This commit is contained in:
@@ -72,10 +72,12 @@ describe("device module", function()
|
||||
assert.is.same("Kobo_dahlia", kobo_dev.model)
|
||||
end)
|
||||
|
||||
it("should setup eventAdjustHooks properly for input in trilogy", function()
|
||||
it("should setup eventAdjustHooks properly for input on trilogy C", function()
|
||||
os.getenv.invokes(function(key)
|
||||
if key == "PRODUCT" then
|
||||
return "trilogy"
|
||||
elseif key == "MODEL_NUMBER" then
|
||||
return "320"
|
||||
else
|
||||
return osgetenv(key)
|
||||
end
|
||||
@@ -86,10 +88,8 @@ describe("device module", function()
|
||||
kobo_dev:init()
|
||||
local Screen = kobo_dev.screen
|
||||
|
||||
assert.is.same("Kobo_trilogy", kobo_dev.model)
|
||||
assert.truthy(kobo_dev:needsTouchScreenProbe())
|
||||
G_reader_settings:saveSetting("kobo_touch_switch_xy", true)
|
||||
kobo_dev:touchScreenProbe()
|
||||
assert.is.same("Kobo_trilogy_C", kobo_dev.model)
|
||||
assert.falsy(kobo_dev:needsTouchScreenProbe())
|
||||
local x, y = Screen:getWidth()-5, 10
|
||||
-- mirror x, then switch_xy
|
||||
local ev_x = {
|
||||
@@ -101,7 +101,7 @@ describe("device module", function()
|
||||
local ev_y = {
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_Y,
|
||||
value = Screen:getWidth()-x,
|
||||
value = Screen:getWidth() - 1 - x,
|
||||
time = TimeVal:realtime(),
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ describe("device module", function()
|
||||
os.getenv.invokes(function(key)
|
||||
if key == "PRODUCT" then
|
||||
return "trilogy"
|
||||
elseif key == "MODEL_NUMBER" then
|
||||
return "320"
|
||||
else
|
||||
return osgetenv(key)
|
||||
end
|
||||
@@ -135,9 +137,8 @@ describe("device module", function()
|
||||
kobo_dev:init()
|
||||
local Screen = kobo_dev.screen
|
||||
|
||||
assert.is.same("Kobo_trilogy", kobo_dev.model)
|
||||
assert.truthy(kobo_dev:needsTouchScreenProbe())
|
||||
kobo_dev:touchScreenProbe()
|
||||
assert.is.same("Kobo_trilogy_C", kobo_dev.model)
|
||||
assert.falsy(kobo_dev:needsTouchScreenProbe())
|
||||
local x, y = Screen:getWidth()-5, 10
|
||||
local ev_x = {
|
||||
type = C.EV_ABS,
|
||||
@@ -148,7 +149,7 @@ describe("device module", function()
|
||||
local ev_y = {
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_Y,
|
||||
value = Screen:getWidth()-x,
|
||||
value = Screen:getWidth() - 1 - x,
|
||||
time = {sec = 1000}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user