-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index 02b685a..6dc1295 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -316,26 +316,22 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b | |||
316 | } | 316 | } |
317 | break; | 317 | break; |
318 | } | 318 | } |
319 | 319 | ||
320 | // Rotate cursor keys 180 or 270 | 320 | // QT has strange screen coordinate system, so depending |
321 | // on native device screen orientation, we need to rotate cursor keys | ||
321 | case Key_Left : | 322 | case Key_Left : |
322 | case Key_Right: | 323 | case Key_Right: |
323 | case Key_Up : | 324 | case Key_Up : |
324 | case Key_Down : { | 325 | case Key_Down : { |
325 | if (( d->m_model == Model_iPAQ_H31xx ) || | 326 | int quarters; |
326 | ( d->m_model == Model_iPAQ_H38xx )) { | 327 | switch (d->m_rotation) { |
327 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; | 328 | case Rot0: quarters = 3/*270deg*/; break; |
329 | case Rot90: quarters = 2/*270deg*/; break; | ||
330 | case Rot180: quarters = 1/*270deg*/; break; | ||
331 | case Rot270: quarters = 0/*270deg*/; break; | ||
328 | } | 332 | } |
329 | // Rotate the cursor keys by 270 | 333 | newkeycode = Key_Left + ( keycode - Key_Left + quarters ) % 4; |
330 | // keycode - Key_Left = position of the button starting from left clockwise | ||
331 | // add the rotation to it and modolo. No we've the original offset | ||
332 | // add the offset to the Key_Left key | ||
333 | if (( d->m_model == Model_iPAQ_H5xxx ) || | ||
334 | ( d->m_model == Model_iPAQ_H191x ) || | ||
335 | ( d->m_model == Model_iPAQ_H4xxx ) || | ||
336 | ( d->m_model == Model_iPAQ_H1940 )) | ||
337 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; | ||
338 | break; | 334 | break; |
339 | } | 335 | } |
340 | 336 | ||
341 | // map Power Button short/long press to F34/F35 | 337 | // map Power Button short/long press to F34/F35 |