author | treke <treke> | 2002-12-22 00:58:46 (UTC) |
---|---|---|
committer | treke <treke> | 2002-12-22 00:58:46 (UTC) |
commit | 17d7f11b16b650f6ee2b5c440506167ea41fbfe5 (patch) (unidiff) | |
tree | cd5924c9e374a82c1cac6433dce098f3f45f4286 /noncore/comm/keypebble/krfbdecoder.cpp | |
parent | 6853d02989fc01e5a65048aca9749c20e0f5d095 (diff) | |
download | opie-17d7f11b16b650f6ee2b5c440506167ea41fbfe5.zip opie-17d7f11b16b650f6ee2b5c440506167ea41fbfe5.tar.gz opie-17d7f11b16b650f6ee2b5c440506167ea41fbfe5.tar.bz2 |
1) Fixed a bug where double clicking a blank spot on the bookmark list
caused a segfault.
2) Removed support for copying from the server. Trying to setText in the
clipboard would segfault everytime from within the KRFBDecoder. Doesnt
seem to like being called from within a slot.
Diffstat (limited to 'noncore/comm/keypebble/krfbdecoder.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/comm/keypebble/krfbdecoder.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index 94e3b79..33418ae 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp | |||
@@ -662,117 +662,120 @@ void KRFBDecoder::sendCutEvent( const QString &unicode ) | |||
662 | // same. I've reported this problem to the ORL guys, but they apparantly have no | 662 | // same. I've reported this problem to the ORL guys, but they apparantly have no |
663 | // immediate plans to fix the issue. :-( (rich) | 663 | // immediate plans to fix the issue. :-( (rich) |
664 | // | 664 | // |
665 | 665 | ||
666 | CARD8 padding[3]; | 666 | CARD8 padding[3]; |
667 | QCString text = unicode.local8Bit(); | 667 | QCString text = unicode.local8Bit(); |
668 | CARD32 length = text.length(); | 668 | CARD32 length = text.length(); |
669 | length = Swap32IfLE( length ); | 669 | length = Swap32IfLE( length ); |
670 | 670 | ||
671 | con->write( &ClientCutTextId, 1 ); | 671 | con->write( &ClientCutTextId, 1 ); |
672 | con->write( &padding, 3 ); | 672 | con->write( &padding, 3 ); |
673 | con->write( &length, 4 ); | 673 | con->write( &length, 4 ); |
674 | con->write( text.data(), length ); | 674 | con->write( text.data(), length ); |
675 | } | 675 | } |
676 | 676 | ||
677 | void KRFBDecoder::gotServerCut() | 677 | void KRFBDecoder::gotServerCut() |
678 | { | 678 | { |
679 | qWarning( "Got server cut" ); | 679 | qWarning( "Got server cut" ); |
680 | 680 | ||
681 | currentState = AwaitingServerCutLength; | 681 | currentState = AwaitingServerCutLength; |
682 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); | 682 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); |
683 | con->waitForData( ServerCutLenLength ); | 683 | con->waitForData( ServerCutLenLength ); |
684 | } | 684 | } |
685 | 685 | ||
686 | void KRFBDecoder::gotServerCutLength() | 686 | void KRFBDecoder::gotServerCutLength() |
687 | { | 687 | { |
688 | assert( currentState = AwaitingServerCutLength ); | 688 | assert( currentState = AwaitingServerCutLength ); |
689 | disconnect( con, SIGNAL( gotEnoughData() ), | 689 | disconnect( con, SIGNAL( gotEnoughData() ), |
690 | this, SLOT( gotServerCutLength() ) ); | 690 | this, SLOT( gotServerCutLength() ) ); |
691 | 691 | ||
692 | CARD8 padding[3]; | 692 | CARD8 padding[3]; |
693 | con->read( padding, 3 ); | 693 | con->read( padding, 3 ); |
694 | 694 | ||
695 | con->read( &serverCutTextLen, 4 ); | 695 | con->read( &serverCutTextLen, 4 ); |
696 | serverCutTextLen = Swap32IfLE( serverCutTextLen ); | 696 | serverCutTextLen = Swap32IfLE( serverCutTextLen ); |
697 | 697 | ||
698 | currentState = AwaitingServerCutText; | 698 | currentState = AwaitingServerCutText; |
699 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutText() ) ); | 699 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutText() ) ); |
700 | con->waitForData( serverCutTextLen ); | 700 | con->waitForData( serverCutTextLen ); |
701 | } | 701 | } |
702 | 702 | ||
703 | void KRFBDecoder::gotServerCutText() | 703 | void KRFBDecoder::gotServerCutText() |
704 | { | 704 | { |
705 | assert( currentState = AwaitingServerCutText ); | 705 | assert( currentState = AwaitingServerCutText ); |
706 | 706 | ||
707 | disconnect( con, SIGNAL( gotEnoughData() ), | 707 | disconnect( con, SIGNAL( gotEnoughData() ), |
708 | this, SLOT( gotServerCutText() ) ); | 708 | this, SLOT( gotServerCutText() ) ); |
709 | 709 | ||
710 | |||
710 | // | 711 | // |
711 | // Warning: There is a bug in the RFB protocol because there is no way to find | 712 | // Warning: There is a bug in the RFB protocol because there is no way to find |
712 | // out the codepage in use on the remote machine. This could be fixed by requiring | 713 | // out the codepage in use on the remote machine. This could be fixed by requiring |
713 | // the remote server to use utf8 etc. but for now we have to assume they're the | 714 | // the remote server to use utf8 etc. but for now we have to assume they're the |
714 | // same. I've reported this problem to the ORL guys, but they apparantly have no | 715 | // same. I've reported this problem to the ORL guys, but they apparantly have no |
715 | // immediate plans to fix the issue. :-( (rich) | 716 | // immediate plans to fix the issue. :-( (rich) |
716 | // | 717 | // |
717 | 718 | ||
718 | char *cutbuf = new char[ serverCutTextLen + 1 ]; | 719 | char *cutbuf = new char[ serverCutTextLen + 1 ]; |
719 | CHECK_PTR( cutbuf ); | 720 | CHECK_PTR( cutbuf ); |
720 | 721 | ||
721 | con->read( cutbuf, serverCutTextLen ); | 722 | con->read( cutbuf, serverCutTextLen ); |
722 | cutbuf[ serverCutTextLen ] = '\0'; | 723 | cutbuf[ serverCutTextLen ] = '\0'; |
723 | 724 | ||
725 | /* For some reason QApplication::clipboard()->setText() segfaults when called | ||
726 | * from within keypebble's mass of signals and slots | ||
724 | qWarning( "Server cut: %s", cutbuf ); | 727 | qWarning( "Server cut: %s", cutbuf ); |
725 | 728 | ||
726 | QString cutText( cutbuf ); // DANGER!! | 729 | QString cutText( cutbuf ); // DANGER!! |
727 | qApp->clipboard()->setText( cutText ); | 730 | qApp->clipboard()->setText( cutText ); |
731 | */ | ||
728 | 732 | ||
729 | delete cutbuf; | 733 | delete cutbuf; |
730 | |||
731 | // Now wait for the update (again) | 734 | // Now wait for the update (again) |
732 | if ( oldState == AwaitingUpdate ) { | 735 | if ( oldState == AwaitingUpdate ) { |
733 | currentState = AwaitingUpdate; | 736 | currentState = AwaitingUpdate; |
734 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); | 737 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); |
735 | con->waitForData( UpdateHeaderLength ); | 738 | con->waitForData( UpdateHeaderLength ); |
736 | } | 739 | } |
737 | else if ( oldState == Idle ) { | 740 | else if ( oldState == Idle ) { |
738 | currentState = Idle; | 741 | currentState = Idle; |
739 | } | 742 | } |
740 | else { | 743 | else { |
741 | qWarning( "Async handled in weird state" ); | 744 | qWarning( "Async handled in weird state" ); |
742 | currentState = oldState; | 745 | currentState = oldState; |
743 | }; | 746 | }; |
744 | } | 747 | } |
745 | 748 | ||
746 | void KRFBDecoder::gotBell() | 749 | void KRFBDecoder::gotBell() |
747 | { | 750 | { |
748 | qWarning( "Got server bell" ); | 751 | qWarning( "Got server bell" ); |
749 | buf->soundBell(); | 752 | buf->soundBell(); |
750 | 753 | ||
751 | // Now wait for the update (again) | 754 | // Now wait for the update (again) |
752 | if ( oldState == AwaitingUpdate ) { | 755 | if ( oldState == AwaitingUpdate ) { |
753 | currentState = AwaitingUpdate; | 756 | currentState = AwaitingUpdate; |
754 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); | 757 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); |
755 | con->waitForData( UpdateHeaderLength ); | 758 | con->waitForData( UpdateHeaderLength ); |
756 | } | 759 | } |
757 | else if ( oldState == Idle ) { | 760 | else if ( oldState == Idle ) { |
758 | currentState = Idle; | 761 | currentState = Idle; |
759 | } | 762 | } |
760 | else { | 763 | else { |
761 | qWarning( "Async handled in weird state" ); | 764 | qWarning( "Async handled in weird state" ); |
762 | currentState = oldState; | 765 | currentState = oldState; |
763 | }; | 766 | }; |
764 | } | 767 | } |
765 | 768 | ||
766 | void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event ) | 769 | void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event ) |
767 | { | 770 | { |
768 | int key; | 771 | int key; |
769 | key = toKeySym( event ); | 772 | key = toKeySym( event ); |
770 | if ( key ) { | 773 | if ( key ) { |
771 | key = Swap32IfLE( key ); | 774 | key = Swap32IfLE( key ); |
772 | 775 | ||
773 | CARD8 mask = true; | 776 | CARD8 mask = true; |
774 | 777 | ||
775 | CARD16 padding = 0; | 778 | CARD16 padding = 0; |
776 | con->write( &KeyEventId, 1 ); | 779 | con->write( &KeyEventId, 1 ); |
777 | con->write( &mask, 1 ); | 780 | con->write( &mask, 1 ); |
778 | con->write( &padding, 2 ); | 781 | con->write( &padding, 2 ); |