-rw-r--r-- | libopie/odevice.cpp | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index d8415ad..bc43c52 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -493,90 +493,88 @@ bool iPAQ::setLedState ( OLed l, OLedState st ) | |||
493 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 493 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
494 | } | 494 | } |
495 | 495 | ||
496 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { | 496 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { |
497 | m_leds [0] = st; | 497 | m_leds [0] = st; |
498 | return true; | 498 | return true; |
499 | } | 499 | } |
500 | } | 500 | } |
501 | } | 501 | } |
502 | return false; | 502 | return false; |
503 | } | 503 | } |
504 | 504 | ||
505 | 505 | ||
506 | //QValueList <int> iPAQ::keyList ( ) const | 506 | //QValueList <int> iPAQ::keyList ( ) const |
507 | //{ | 507 | //{ |
508 | //QValueList <int> vl; | 508 | //QValueList <int> vl; |
509 | //vl << HardKey_Datebook << HardKey_Contacts << ( model ( ) == Model_iPAQ_H38xx ? HardKey_Mail : HardKey_Menu ) << HardKey_Home << HardKey_Record << HardKey_Suspend << HardKey_Backlight; | 509 | //vl << HardKey_Datebook << HardKey_Contacts << ( model ( ) == Model_iPAQ_H38xx ? HardKey_Mail : HardKey_Menu ) << HardKey_Home << HardKey_Record << HardKey_Suspend << HardKey_Backlight; |
510 | //return vl; | 510 | //return vl; |
511 | //} | 511 | //} |
512 | 512 | ||
513 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 513 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
514 | { | 514 | { |
515 | int newkeycode = keycode; | 515 | int newkeycode = keycode; |
516 | 516 | ||
517 | 517 | switch ( keycode ) { | |
518 | // simple susbstitutions | 518 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key |
519 | switch ( d-> m_model ) { | 519 | case HardKey_Menu: { |
520 | case Model_iPAQ_H38xx: | 520 | if (( d-> m_model == Model_iPAQ_H38xx ) || |
521 | // H38xx has no "Q" key anymore - this is now the Mail key | 521 | ( d-> m_model == Model_iPAQ_H39xx )) { |
522 | if ( keycode == HardKey_Menu ) | ||
523 | newkeycode = HardKey_Mail; | 522 | newkeycode = HardKey_Mail; |
524 | //nobreak | ||
525 | |||
526 | case Model_iPAQ_H31xx: | ||
527 | // Rotate cursor keys 180° | ||
528 | switch ( keycode ) { | ||
529 | case Key_Left : newkeycode = Key_Right; break; | ||
530 | case Key_Right: newkeycode = Key_Left; break; | ||
531 | case Key_Up : newkeycode = Key_Down; break; | ||
532 | case Key_Down : newkeycode = Key_Up; break; | ||
533 | } | 523 | } |
534 | //nobreak; | 524 | break; |
535 | 525 | } | |
536 | case Model_iPAQ_H36xx: | 526 | |
537 | case Model_iPAQ_H37xx: | 527 | // Rotate cursor keys 180° |
538 | // map Power Button short/long press to F34/F35 | 528 | case Key_Left : |
539 | if ( keycode == Key_SysReq ) { | 529 | case Key_Right: |
540 | if ( isPress ) { | 530 | case Key_Up : |
541 | if ( m_power_timer ) | 531 | case Key_Down : { |
542 | killTimer ( m_power_timer ); | 532 | if (( d-> m_model == Model_iPAQ_H31xx ) || |
543 | m_power_timer = startTimer ( 500 ); | 533 | ( d-> m_model == Model_iPAQ_H38xx )) { |
544 | } | 534 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; |
545 | else if ( m_power_timer ) { | ||
546 | killTimer ( m_power_timer ); | ||
547 | m_power_timer = 0; | ||
548 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | ||
549 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | ||
550 | } | ||
551 | newkeycode = Key_unknown; | ||
552 | } | 535 | } |
553 | //nobreak; | ||
554 | |||
555 | default: | ||
556 | break; | 536 | break; |
557 | } | 537 | } |
558 | 538 | ||
539 | // map Power Button short/long press to F34/F35 | ||
540 | case Key_SysReq: { | ||
541 | if ( isPress ) { | ||
542 | if ( m_power_timer ) | ||
543 | killTimer ( m_power_timer ); | ||
544 | m_power_timer = startTimer ( 500 ); | ||
545 | } | ||
546 | else if ( m_power_timer ) { | ||
547 | killTimer ( m_power_timer ); | ||
548 | m_power_timer = 0; | ||
549 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); | ||
550 | QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); | ||
551 | } | ||
552 | newkeycode = Key_unknown; | ||
553 | break; | ||
554 | } | ||
555 | } | ||
556 | |||
559 | if ( newkeycode != keycode ) { | 557 | if ( newkeycode != keycode ) { |
560 | if ( newkeycode != Key_unknown ) | 558 | if ( newkeycode != Key_unknown ) |
561 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); | 559 | QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); |
562 | return true; | 560 | return true; |
563 | } | 561 | } |
564 | else | 562 | else |
565 | return false; | 563 | return false; |
566 | } | 564 | } |
567 | 565 | ||
568 | void iPAQ::timerEvent ( QTimerEvent * ) | 566 | void iPAQ::timerEvent ( QTimerEvent * ) |
569 | { | 567 | { |
570 | killTimer ( m_power_timer ); | 568 | killTimer ( m_power_timer ); |
571 | m_power_timer = 0; | 569 | m_power_timer = 0; |
572 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 570 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
573 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 571 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
574 | } | 572 | } |
575 | 573 | ||
576 | 574 | ||
577 | void iPAQ::alarmSound ( ) | 575 | void iPAQ::alarmSound ( ) |
578 | { | 576 | { |
579 | #ifndef QT_NO_SOUND | 577 | #ifndef QT_NO_SOUND |
580 | static Sound snd ( "alarm" ); | 578 | static Sound snd ( "alarm" ); |
581 | int fd; | 579 | int fd; |
582 | int vol; | 580 | int vol; |