This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Screen rotation not sending correct keycodes


Screen rotation not sending correct keycodes

Postby mm40 » Apr 30, 2008 @ 12:50am

I am testing on a HTC Tilt. When the OS Screen Rotaiton is set to portrait everything works fine, but when I set it to Landscape1 or Landscape2 then things don't work correctly.

To test I put the OS in Landscape2 (270) and the keyboard closed, I then pressed the down directional key (down relative to the device in portrait mode).

app started
pressing down generates keycode 40 (incorrect)
keyboard opened
pressing down generates keycode 37
keyboard closed
pressing down generates keycode 39

so even though the device is in the exact same configurations in keypress 1 and 3, they generate different keycodes!

further testing, I start the app with the keyboard already open.

app started
pressing down generates keycode 40 (incorrect)
keyboard closed
pressing down generates keycode 39
keyboard open
pressing down generates keycode 37

and again keypresses 1 and 3 are different but they should match. does anyone know what is going on here?
User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby Kzinti » Apr 30, 2008 @ 1:51am

Assuming you are using GAPI, the behaviour is explained as follow:

1) GAPI will restore the screen to portrait mode when you call GXOpenDIsplay. So when you press down, you get VK_DOWN (ie: 40)
2) You open the keyboard. The screen/shell is rotated (landscape 90) and pressing down sends VK_LEFT (37).
3) You close the kayboard. The screen/shell is restored to the user's settings (ie: landscape 270). You get VK_RIGHT (39).

Similar reasoning for your second test case.
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby mm40 » Apr 30, 2008 @ 4:47am

Should I make a system call to set the screen/shell to the user rotation immediately after calling GXOpenDIsplay?
User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby Kzinti » Apr 30, 2008 @ 7:09am

It probably would work, but changing the screen orientation is a slow operation.

In PocketHAL, I decided to do it differently: I query for the current screen orientation vs the one specified at initialization time. If they are different, I simply rotate the arrow keys.
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron