I was not missing an end, I've only pasted the partial function because it also had handling for keys (altough those are unused on KT/Paperwhite)
This was my implementation for autodetection of screen orientation, however produces wrong results if you leave the book mode in Landscape even while the dispay is not set to Landscape orientation:
Code:
f = io.popen('/usr/bin/lipc-get-prop com.lab126.winmgr orientationLock', 'r')
orient = f:read('*l')
f:close()
function handleInput(channel, itype, code, value)
if itype == 3 and channel == 0 then
if code == 57 then
clickevent = value + 1
SendPointerEvent(orient == 'U' and x or math.min(client_width, 1023)-y, orient == 'U' and y or x, 0)
elseif code == 53 then
x = value
elseif code == 54 then
y = value
if clickevent == 1 then
SendPointerEvent(orient == 'U' and x or math.min(client_width, 1023)-y, orient == 'U' and y or x, 1)
end
end