From 681c78897125e5a7efbef0e40d81dcfe1caf81cb Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Mon, 4 Feb 2013 14:56:22 +0800 Subject: [PATCH] fix bug for touch event coordinates handling in landscape mode This fix might only work for KPW, need to test on other devies later. --- frontend/ui/screen.lua | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/frontend/ui/screen.lua b/frontend/ui/screen.lua index 93c17e885..a73ce2d5e 100644 --- a/frontend/ui/screen.lua +++ b/frontend/ui/screen.lua @@ -56,10 +56,21 @@ function Screen:init() _, self.height = self.fb:getSize() -- for unknown strange reason, pitch*2 is less than screen width in KPW -- so we need to calculate width by pitch here - self.width = self.fb:getPitch()*2 - self.pitch = self:getPitch() + self.pitch = self.fb:getPitch() + self.width = self.pitch * 2 self.bb = Blitbuffer.new(self.width, self.height, self.pitch) - self.native_rotation_mode = self.fb:getOrientation() + if self.width > self.height then + -- For another unknown strange reason, self.fb:getOrientation always + -- return 0 in KPW, even though we are in landscape mode. + -- Seems like the native framework change framebuffer on the fly when + -- starting booklet. Starting KPV from ssh and KPVBooklet will get + -- different framebuffer height and width. + -- + --self.native_rotation_mode = self.fb:getOrientation() + self.native_rotation_mode = 1 + else + self.native_rotation_mode = 0 + end self.cur_rotation_mode = self.native_rotation_mode end @@ -143,11 +154,6 @@ end @return adjusted gesture. --]] function Screen:adjustGesCoordinate(ges) - -- we do nothing is screen is not rotated - if self.native_rotation_mode == self.cur_rotation_mode then - return ges - end - if self.cur_rotation_mode == 1 then --@TODO fix wipe direction 03.02 2013 (houqp) ges.pos.x, ges.pos.y = (self.width - ges.pos.y), (ges.pos.x)