author | erik <erik> | 2007-02-21 16:59:03 (UTC) |
---|---|---|
committer | erik <erik> | 2007-02-21 16:59:03 (UTC) |
commit | 6b0fa616c4aac654c549621eb0009ab3eb32fe34 (patch) (unidiff) | |
tree | b5a592194a9cbf3b02b38b0d2e412201beb5b49c /libopie2/opiecore/device/odevice_ipaq.cpp | |
parent | 45f2e4cdc6e185439ef4bde6e2b8181a4decd032 (diff) | |
download | opie-6b0fa616c4aac654c549621eb0009ab3eb32fe34.zip opie-6b0fa616c4aac654c549621eb0009ab3eb32fe34.tar.gz opie-6b0fa616c4aac654c549621eb0009ab3eb32fe34.tar.bz2 |
This commit fixes Opie bug 1839:
http://opie-bugs.oszine.de/view.php?id=1839
Diffstat (limited to 'libopie2/opiecore/device/odevice_ipaq.cpp') (more/less context) (ignore whitespace changes)
-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 | |||
@@ -296,66 +296,62 @@ bool iPAQ::setLedState ( OLed l, OLedState st ) | |||
296 | m_leds [0] = st; | 296 | m_leds [0] = st; |
297 | return true; | 297 | return true; |
298 | } | 298 | } |
299 | } | 299 | } |
300 | } | 300 | } |
301 | return false; | 301 | return false; |
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 305 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
306 | { | 306 | { |
307 | int newkeycode = keycode; | 307 | int newkeycode = keycode; |
308 | 308 | ||
309 | switch ( keycode ) { | 309 | switch ( keycode ) { |
310 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key | 310 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key |
311 | case HardKey_Menu: { | 311 | case HardKey_Menu: { |
312 | if (( d->m_model == Model_iPAQ_H38xx ) || | 312 | if (( d->m_model == Model_iPAQ_H38xx ) || |
313 | ( d->m_model == Model_iPAQ_H39xx ) || | 313 | ( d->m_model == Model_iPAQ_H39xx ) || |
314 | ( d->m_model == Model_iPAQ_H5xxx)) { | 314 | ( d->m_model == Model_iPAQ_H5xxx)) { |
315 | newkeycode = HardKey_Mail; | 315 | newkeycode = HardKey_Mail; |
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 |
342 | case HardKey_Suspend: // Hope we don't have infinite recursion here | 338 | case HardKey_Suspend: // Hope we don't have infinite recursion here |
343 | case Key_SysReq: { | 339 | case Key_SysReq: { |
344 | if ( isPress ) { | 340 | if ( isPress ) { |
345 | if ( m_power_timer ) | 341 | if ( m_power_timer ) |
346 | killTimer ( m_power_timer ); | 342 | killTimer ( m_power_timer ); |
347 | m_power_timer = startTimer ( 500 ); | 343 | m_power_timer = startTimer ( 500 ); |
348 | } | 344 | } |
349 | else if ( m_power_timer ) { | 345 | else if ( m_power_timer ) { |
350 | killTimer ( m_power_timer ); | 346 | killTimer ( m_power_timer ); |
351 | m_power_timer = 0; | 347 | m_power_timer = 0; |
352 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | 348 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); |
353 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | 349 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); |
354 | } | 350 | } |
355 | newkeycode = Key_unknown; | 351 | newkeycode = Key_unknown; |
356 | break; | 352 | break; |
357 | } | 353 | } |
358 | } | 354 | } |
359 | 355 | ||
360 | if ( newkeycode != keycode ) { | 356 | if ( newkeycode != keycode ) { |
361 | if ( newkeycode != Key_unknown ) | 357 | if ( newkeycode != Key_unknown ) |