-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 08318bd..84c0c74 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -343,67 +343,66 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
343 | 343 | ||
344 | // might need to repaint if two or more of the same keys. | 344 | // might need to repaint if two or more of the same keys. |
345 | // should be faster if just paint one key even though multiple keys exist. | 345 | // should be faster if just paint one key even though multiple keys exist. |
346 | bool need_repaint = FALSE; | 346 | bool need_repaint = FALSE; |
347 | 347 | ||
348 | // circumflex and diaeresis support | 348 | // circumflex and diaeresis support |
349 | // messy to have this here, but too hard to implement any other method | 349 | // messy to have this here, but too hard to implement any other method |
350 | if (unicode == 0x2c6) { | 350 | if (unicode == 0x2c6) { |
351 | 351 | ||
352 | unicode = 0; | 352 | unicode = 0; |
353 | if (shift || lock) { | 353 | if (shift || lock) { |
354 | 354 | ||
355 | // diaeresis | 355 | // diaeresis |
356 | qkeycode = 0x2001; | 356 | qkeycode = 0x2001; |
357 | } | 357 | } |
358 | else { | 358 | else { |
359 | 359 | ||
360 | // circumflex | 360 | // circumflex |
361 | qkeycode = 0x2000; | 361 | qkeycode = 0x2000; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | // Back accent character support | 365 | // Back accent character support |
366 | 366 | ||
367 | //if (unicode == 0x60) { // the keys from 2c6 ~ 2cf should be used instead of the ascii one | 367 | // the keys from 2c6 ~ 2cf should be used instead of the ascii one |
368 | if (unicode == 0x2cb) { | 368 | if (unicode == 0x2cb) { |
369 | 369 | ||
370 | unicode = 0; | 370 | unicode = 0; |
371 | if (shift || lock) { | 371 | if (shift || lock) { |
372 | 372 | ||
373 | // circumblex | 373 | // circumblex |
374 | qkeycode = 0x2000; | 374 | qkeycode = 0x2000; |
375 | } | 375 | } |
376 | else { | 376 | else { |
377 | 377 | ||
378 | // back accent | 378 | // back accent |
379 | qkeycode = 0x2002; | 379 | qkeycode = 0x2002; |
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | // Accent character support | 383 | // Accent character support |
384 | 384 | ||
385 | //if (unicode == 0xb4) { | ||
386 | if (unicode == 0x2ca) { | 385 | if (unicode == 0x2ca) { |
387 | 386 | ||
388 | unicode = 0; | 387 | unicode = 0; |
389 | if (shift || lock) { | 388 | if (shift || lock) { |
390 | 389 | ||
391 | // diaeresis | 390 | // diaeresis |
392 | qkeycode = 0x2001; | 391 | qkeycode = 0x2001; |
393 | } | 392 | } |
394 | else { | 393 | else { |
395 | 394 | ||
396 | // accent | 395 | // accent |
397 | qkeycode = 0x2003; | 396 | qkeycode = 0x2003; |
398 | } | 397 | } |
399 | } | 398 | } |
400 | 399 | ||
401 | 400 | ||
402 | if (unicode == 0) { // either Qt char, or nothing | 401 | if (unicode == 0) { // either Qt char, or nothing |
403 | 402 | ||
404 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard | 403 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard |
405 | 404 | ||
406 | if ( configdlg ) { | 405 | if ( configdlg ) { |
407 | 406 | ||
408 | delete (ConfigDlg *) configdlg; | 407 | delete (ConfigDlg *) configdlg; |
409 | configdlg = 0; | 408 | configdlg = 0; |
@@ -504,50 +503,50 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
504 | /* | 503 | /* |
505 | if (meta) { *meta = 0; meta = 0; } | 504 | if (meta) { *meta = 0; meta = 0; } |
506 | if (circumflex) { *circumflex = 0; circumflex = 0; } | 505 | if (circumflex) { *circumflex = 0; circumflex = 0; } |
507 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } | 506 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } |
508 | */ | 507 | */ |
509 | 508 | ||
510 | } else if (qkeycode == Qt::Key_Meta) { | 509 | } else if (qkeycode == Qt::Key_Meta) { |
511 | need_repaint = TRUE; | 510 | need_repaint = TRUE; |
512 | 511 | ||
513 | if (meta) { | 512 | if (meta) { |
514 | *meta = 0; | 513 | *meta = 0; |
515 | meta = 0; | 514 | meta = 0; |
516 | 515 | ||
517 | } else { | 516 | } else { |
518 | 517 | ||
519 | meta = keys->pressedPtr(row, col); | 518 | meta = keys->pressedPtr(row, col); |
520 | *meta = true; | 519 | *meta = true; |
521 | } | 520 | } |
522 | 521 | ||
523 | // reset all the other keys | 522 | // reset all the other keys |
524 | if (shift) { *shift = 0; shift = 0; } | 523 | if (shift) { *shift = 0; shift = 0; } |
525 | if (lock) { *lock = 0; lock = 0; } | 524 | if (lock) { *lock = 0; lock = 0; } |
526 | if (circumflex) { *circumflex = 0; circumflex = 0; } | 525 | if (circumflex) { *circumflex = 0; circumflex = 0; } |
527 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } | 526 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } |
528 | if (baccent) { *baccent = 0; baccent = 0; } | 527 | if (baccent) { *baccent = 0; baccent = 0; } |
529 | if (accent) { *accent = 0; accent = 0; } | 528 | if (accent) { *accent = 0; accent = 0; } |
530 | 529 | ||
531 | // dont need to emit this key... acts same as alt | 530 | // dont need to emit this key... acts same as alt |
532 | qkeycode = 0; | 531 | qkeycode = 0; |
533 | 532 | ||
534 | // circumflex | 533 | // circumflex |
535 | } else if (qkeycode == 0x2000) { | 534 | } else if (qkeycode == 0x2000) { |
536 | need_repaint = TRUE; | 535 | need_repaint = TRUE; |
537 | 536 | ||
538 | if (circumflex) { | 537 | if (circumflex) { |
539 | 538 | ||
540 | *circumflex = 0; | 539 | *circumflex = 0; |
541 | circumflex = 0; | 540 | circumflex = 0; |
542 | 541 | ||
543 | } else { | 542 | } else { |
544 | 543 | ||
545 | circumflex = keys->pressedPtr(row, col); | 544 | circumflex = keys->pressedPtr(row, col); |
546 | *circumflex = true; | 545 | *circumflex = true; |
547 | } | 546 | } |
548 | 547 | ||
549 | /* no need to turn off shift or lock if circumflex | 548 | /* no need to turn off shift or lock if circumflex |
550 | * keys are pressed | 549 | * keys are pressed |
551 | 550 | ||
552 | if (shift) { *shift = 0; shift = 0; } | 551 | if (shift) { *shift = 0; shift = 0; } |
553 | if (lock) { *lock = 0; lock = 0; } | 552 | if (lock) { *lock = 0; lock = 0; } |
@@ -604,87 +603,87 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
604 | circumflex = 0; | 603 | circumflex = 0; |
605 | } | 604 | } |
606 | 605 | ||
607 | 606 | ||
608 | qkeycode = 0; | 607 | qkeycode = 0; |
609 | 608 | ||
610 | // Back accent | 609 | // Back accent |
611 | } else if (qkeycode == 0x2002) { | 610 | } else if (qkeycode == 0x2002) { |
612 | need_repaint = TRUE; | 611 | need_repaint = TRUE; |
613 | 612 | ||
614 | if (baccent) { | 613 | if (baccent) { |
615 | 614 | ||
616 | *baccent = 0; | 615 | *baccent = 0; |
617 | baccent = 0; | 616 | baccent = 0; |
618 | 617 | ||
619 | } else { | 618 | } else { |
620 | 619 | ||
621 | baccent = keys->pressedPtr(row, col); | 620 | baccent = keys->pressedPtr(row, col); |
622 | *baccent = true; | 621 | *baccent = true; |
623 | } | 622 | } |
624 | 623 | ||
625 | 624 | ||
626 | if (shift) { *shift = 0; shift = 0; } | 625 | if (shift) { *shift = 0; shift = 0; } |
627 | if (meta) { *meta = 0; meta = 0; } | 626 | if (meta) { *meta = 0; meta = 0; } |
628 | if (accent) { *accent = 0; accent = 0; } | 627 | if (accent) { *accent = 0; accent = 0; } |
629 | 628 | ||
630 | qkeycode = 0; | 629 | qkeycode = 0; |
631 | 630 | ||
632 | // Accent | 631 | // Accent |
633 | } else if (qkeycode == 0x2003) { | 632 | } else if (qkeycode == 0x2003) { |
634 | need_repaint = TRUE; | 633 | need_repaint = TRUE; |
635 | 634 | ||
636 | if (accent) { | 635 | if (accent) { |
637 | 636 | ||
638 | *accent = 0; | 637 | *accent = 0; |
639 | accent = 0; | 638 | accent = 0; |
640 | 639 | ||
641 | } else { | 640 | } else { |
642 | 641 | ||
643 | accent = keys->pressedPtr(row, col); | 642 | accent = keys->pressedPtr(row, col); |
644 | *accent = true; | 643 | *accent = true; |
645 | } | 644 | } |
646 | 645 | ||
647 | 646 | ||
648 | if (shift) { *shift = 0; shift = 0; } | 647 | if (shift) { *shift = 0; shift = 0; } |
649 | if (meta) { *meta = 0; meta = 0; } | 648 | if (meta) { *meta = 0; meta = 0; } |
650 | if (baccent) { *baccent = 0; } | 649 | if (baccent) { *baccent = 0; } |
651 | 650 | ||
652 | qkeycode = 0; | 651 | qkeycode = 0; |
653 | } | 652 | } |
654 | 653 | ||
655 | } | 654 | } |
656 | else { // normal char | 655 | else { // normal char |
657 | if ((shift || lock) && keys->shift(unicode)) { | 656 | if ((shift || lock) && keys->shift(unicode)) { |
658 | 657 | ||
659 | // make diaeresis/circumflex -> shift input shifted | 658 | // make diaeresis/circumflex -> shift input shifted |
660 | // diaeresis/circumflex chars | 659 | // diaeresis/circumflex chars |
661 | 660 | ||
662 | if (circumflex && keys->circumflex(keys->shift(unicode))) | 661 | if (circumflex && keys->circumflex(keys->shift(unicode))) |
663 | unicode = keys->circumflex(keys->shift(unicode)); | 662 | unicode = keys->circumflex(keys->shift(unicode)); |
664 | else if (diaeresis && keys->diaeresis(keys->shift(unicode))) | 663 | else if (diaeresis && keys->diaeresis(keys->shift(unicode))) |
665 | unicode = keys->diaeresis(keys->shift(unicode)); | 664 | unicode = keys->diaeresis(keys->shift(unicode)); |
666 | else if (baccent && keys->baccent(keys->shift(unicode))) | 665 | else if (baccent && keys->baccent(keys->shift(unicode))) |
667 | unicode = keys->baccent(keys->shift(unicode)); | 666 | unicode = keys->baccent(keys->shift(unicode)); |
668 | else if (accent && keys->accent(keys->shift(unicode))) | 667 | else if (accent && keys->accent(keys->shift(unicode))) |
669 | unicode = keys->accent(keys->shift(unicode)); | 668 | unicode = keys->accent(keys->shift(unicode)); |
670 | else if (meta && keys->meta(keys->shift(unicode))) | 669 | else if (meta && keys->meta(keys->shift(unicode))) |
671 | unicode = keys->meta(keys->shift(unicode)); | 670 | unicode = keys->meta(keys->shift(unicode)); |
672 | else | 671 | else |
673 | unicode = keys->shift(unicode); | 672 | unicode = keys->shift(unicode); |
674 | } | 673 | } |
675 | else if (meta && keys->meta(unicode)) { | 674 | else if (meta && keys->meta(unicode)) { |
676 | unicode = keys->meta(unicode); | 675 | unicode = keys->meta(unicode); |
677 | } | 676 | } |
678 | else if (circumflex && keys->circumflex(unicode)) { | 677 | else if (circumflex && keys->circumflex(unicode)) { |
679 | unicode = keys->circumflex(unicode); | 678 | unicode = keys->circumflex(unicode); |
680 | } | 679 | } |
681 | else if (diaeresis && keys->diaeresis(unicode)) { | 680 | else if (diaeresis && keys->diaeresis(unicode)) { |
682 | 681 | ||
683 | unicode = keys->diaeresis(unicode); | 682 | unicode = keys->diaeresis(unicode); |
684 | } | 683 | } |
685 | else if (baccent && keys->baccent(unicode)) { | 684 | else if (baccent && keys->baccent(unicode)) { |
686 | unicode = keys->baccent(unicode); | 685 | unicode = keys->baccent(unicode); |
687 | } | 686 | } |
688 | else if (accent && keys->accent(unicode)) { | 687 | else if (accent && keys->accent(unicode)) { |
689 | unicode = keys->accent(unicode); | 688 | unicode = keys->accent(unicode); |
690 | } | 689 | } |
@@ -754,48 +753,55 @@ void Keyboard::mouseReleaseEvent(QMouseEvent*) | |||
754 | { | 753 | { |
755 | pressed = FALSE; | 754 | pressed = FALSE; |
756 | //if ( pressTid == 0 ) | 755 | //if ( pressTid == 0 ) |
757 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 756 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
758 | if ( unicode != -1 ) { | 757 | if ( unicode != -1 ) { |
759 | emit key( unicode, qkeycode, modifiers, false, false ); | 758 | emit key( unicode, qkeycode, modifiers, false, false ); |
760 | repeatTimer->stop(); | 759 | repeatTimer->stop(); |
761 | } | 760 | } |
762 | #endif | 761 | #endif |
763 | if (shift && unicode != 0) { | 762 | if (shift && unicode != 0) { |
764 | 763 | ||
765 | 764 | ||
766 | *shift = 0; // unpress shift key | 765 | *shift = 0; // unpress shift key |
767 | shift = 0; // reset the shift pointer | 766 | shift = 0; // reset the shift pointer |
768 | repaint(FALSE); | 767 | repaint(FALSE); |
769 | 768 | ||
770 | } | 769 | } |
771 | if (ctrl && unicode != 0) { | 770 | if (ctrl && unicode != 0) { |
772 | 771 | ||
773 | *ctrl = 0; | 772 | *ctrl = 0; |
774 | ctrl = 0; | 773 | ctrl = 0; |
775 | repaint(FALSE); | 774 | repaint(FALSE); |
776 | 775 | ||
777 | } | 776 | } |
777 | if (alt && alt != 0) { | ||
778 | |||
779 | *alt = 0; | ||
780 | alt = 0; | ||
781 | repaint(FALSE); | ||
782 | |||
783 | } | ||
778 | 784 | ||
779 | /* | 785 | /* |
780 | * do not make the meta key release after being pressed | 786 | * do not make the meta key release after being pressed |
781 | * | 787 | * |
782 | 788 | ||
783 | else if (meta && unicode != 0) { | 789 | else if (meta && unicode != 0) { |
784 | 790 | ||
785 | *meta = 0; | 791 | *meta = 0; |
786 | meta = 0; | 792 | meta = 0; |
787 | repaint(FALSE); | 793 | repaint(FALSE); |
788 | } | 794 | } |
789 | 795 | ||
790 | */ | 796 | */ |
791 | 797 | ||
792 | else clearHighlight(); | 798 | else clearHighlight(); |
793 | } | 799 | } |
794 | 800 | ||
795 | /* Keyboard::timerEvent {{{1 */ | 801 | /* Keyboard::timerEvent {{{1 */ |
796 | 802 | ||
797 | /* dont know what this does, but i think it is here so that if your screen | 803 | /* dont know what this does, but i think it is here so that if your screen |
798 | * sticks (like on an ipaq) then it will stop repeating if you click another | 804 | * sticks (like on an ipaq) then it will stop repeating if you click another |
799 | * key... but who knows what anything does in this thing anyway? | 805 | * key... but who knows what anything does in this thing anyway? |
800 | 806 | ||
801 | void Keyboard::timerEvent(QTimerEvent* e) | 807 | void Keyboard::timerEvent(QTimerEvent* e) |