Diffstat (limited to 'noncore/comm/keypebble/krfbdecoder.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/comm/keypebble/krfbdecoder.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index 837fcc5..27ae101 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp | |||
@@ -204,49 +204,49 @@ void KRFBDecoder::gotServerInit() | |||
204 | currentState = AwaitingDesktopName; | 204 | currentState = AwaitingDesktopName; |
205 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) ); | 205 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) ); |
206 | con->waitForData( info->nameLength ); | 206 | con->waitForData( info->nameLength ); |
207 | } | 207 | } |
208 | 208 | ||
209 | void KRFBDecoder::gotDesktopName() | 209 | void KRFBDecoder::gotDesktopName() |
210 | { | 210 | { |
211 | assert( info ); | 211 | assert( info ); |
212 | assert( currentState == AwaitingDesktopName ); | 212 | assert( currentState == AwaitingDesktopName ); |
213 | 213 | ||
214 | owarn << "Got desktop name" << oendl; | 214 | owarn << "Got desktop name" << oendl; |
215 | 215 | ||
216 | disconnect( con, SIGNAL( gotEnoughData() ), | 216 | disconnect( con, SIGNAL( gotEnoughData() ), |
217 | this, SLOT( gotDesktopName() ) ); | 217 | this, SLOT( gotDesktopName() ) ); |
218 | 218 | ||
219 | char *buf = new char[ info->nameLength + 1 ]; | 219 | char *buf = new char[ info->nameLength + 1 ]; |
220 | CHECK_PTR( buf ); | 220 | CHECK_PTR( buf ); |
221 | 221 | ||
222 | con->read( buf, info->nameLength ); | 222 | con->read( buf, info->nameLength ); |
223 | buf[ info->nameLength ] = '\0'; | 223 | buf[ info->nameLength ] = '\0'; |
224 | info->name = buf; | 224 | info->name = buf; |
225 | 225 | ||
226 | owarn << "Desktop: " << info->name.latin1() << "" << oendl; | 226 | owarn << "Desktop: " << info->name.latin1() << "" << oendl; |
227 | 227 | ||
228 | delete buf; | 228 | delete [] buf; |
229 | 229 | ||
230 | // Get the format we'll really use and tell the server | 230 | // Get the format we'll really use and tell the server |
231 | decidePixelFormat(); | 231 | decidePixelFormat(); |
232 | sendPixelFormat(); | 232 | sendPixelFormat(); |
233 | sendAllowedEncodings(); | 233 | sendAllowedEncodings(); |
234 | currentState = Idle; | 234 | currentState = Idle; |
235 | 235 | ||
236 | QString msg; | 236 | QString msg; |
237 | msg = tr( "Connected to %1" ); | 237 | msg = tr( "Connected to %1" ); |
238 | msg = msg.arg( info->name ); | 238 | msg = msg.arg( info->name ); |
239 | emit status( msg ); | 239 | emit status( msg ); |
240 | 240 | ||
241 | sendUpdateRequest( false ); | 241 | sendUpdateRequest( false ); |
242 | } | 242 | } |
243 | 243 | ||
244 | void KRFBDecoder::decidePixelFormat() | 244 | void KRFBDecoder::decidePixelFormat() |
245 | { | 245 | { |
246 | assert( info ); | 246 | assert( info ); |
247 | 247 | ||
248 | if ( format ) | 248 | if ( format ) |
249 | delete format; | 249 | delete format; |
250 | format = new KRFBPixelFormat; | 250 | format = new KRFBPixelFormat; |
251 | CHECK_PTR( format ); | 251 | CHECK_PTR( format ); |
252 | 252 | ||
@@ -514,49 +514,49 @@ void KRFBDecoder::getRawRectChunk( int lines ) | |||
514 | 514 | ||
515 | currentState = AwaitingRawRectChunk; | 515 | currentState = AwaitingRawRectChunk; |
516 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); | 516 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); |
517 | con->waitForData( count ); | 517 | con->waitForData( count ); |
518 | } | 518 | } |
519 | 519 | ||
520 | void KRFBDecoder::gotRawRectChunk() | 520 | void KRFBDecoder::gotRawRectChunk() |
521 | { | 521 | { |
522 | assert( currentState == AwaitingRawRectChunk ); | 522 | assert( currentState == AwaitingRawRectChunk ); |
523 | 523 | ||
524 | disconnect( con, SIGNAL( gotEnoughData() ), | 524 | disconnect( con, SIGNAL( gotEnoughData() ), |
525 | this, SLOT( gotRawRectChunk() ) ); | 525 | this, SLOT( gotRawRectChunk() ) ); |
526 | 526 | ||
527 | // owarn << "Got raw rect chunk" << oendl; | 527 | // owarn << "Got raw rect chunk" << oendl; |
528 | 528 | ||
529 | // | 529 | // |
530 | // Read the rect data and copy it to the buffer. | 530 | // Read the rect data and copy it to the buffer. |
531 | // | 531 | // |
532 | 532 | ||
533 | // TODO: Replace this! | 533 | // TODO: Replace this! |
534 | int count = lines * w * format->bpp / 8; | 534 | int count = lines * w * format->bpp / 8; |
535 | char *hack = new char[ count ]; | 535 | char *hack = new char[ count ]; |
536 | con->read( hack, count ); | 536 | con->read( hack, count ); |
537 | buf->drawRawRectChunk( hack, x, y, w, lines ); | 537 | buf->drawRawRectChunk( hack, x, y, w, lines ); |
538 | delete hack; | 538 | delete [] hack; |
539 | // /TODO: | 539 | // /TODO: |
540 | 540 | ||
541 | h = h - lines; | 541 | h = h - lines; |
542 | y = y + lines; | 542 | y = y + lines; |
543 | 543 | ||
544 | if ( h > 0 ) { | 544 | if ( h > 0 ) { |
545 | handleRawRect(); | 545 | handleRawRect(); |
546 | } | 546 | } |
547 | else { | 547 | else { |
548 | noRects--; | 548 | noRects--; |
549 | 549 | ||
550 | // owarn << "There are " << noRects << " rects left" << oendl; | 550 | // owarn << "There are " << noRects << " rects left" << oendl; |
551 | 551 | ||
552 | if ( noRects ) { | 552 | if ( noRects ) { |
553 | currentState = AwaitingRectHeader; | 553 | currentState = AwaitingRectHeader; |
554 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); | 554 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); |
555 | con->waitForData( RectHeaderLength ); | 555 | con->waitForData( RectHeaderLength ); |
556 | } | 556 | } |
557 | else { | 557 | else { |
558 | // we are now ready for the next update - no need to wait for the timer | 558 | // we are now ready for the next update - no need to wait for the timer |
559 | currentState = Idle; | 559 | currentState = Idle; |
560 | sendUpdateRequest (1); | 560 | sendUpdateRequest (1); |
561 | } | 561 | } |
562 | } | 562 | } |
@@ -707,49 +707,49 @@ void KRFBDecoder::gotServerCutText() | |||
707 | 707 | ||
708 | 708 | ||
709 | // | 709 | // |
710 | // Warning: There is a bug in the RFB protocol because there is no way to find | 710 | // Warning: There is a bug in the RFB protocol because there is no way to find |
711 | // out the codepage in use on the remote machine. This could be fixed by requiring | 711 | // out the codepage in use on the remote machine. This could be fixed by requiring |
712 | // the remote server to use utf8 etc. but for now we have to assume they're the | 712 | // the remote server to use utf8 etc. but for now we have to assume they're the |
713 | // same. I've reported this problem to the ORL guys, but they apparantly have no | 713 | // same. I've reported this problem to the ORL guys, but they apparantly have no |
714 | // immediate plans to fix the issue. :-( (rich) | 714 | // immediate plans to fix the issue. :-( (rich) |
715 | // | 715 | // |
716 | 716 | ||
717 | char *cutbuf = new char[ serverCutTextLen + 1 ]; | 717 | char *cutbuf = new char[ serverCutTextLen + 1 ]; |
718 | CHECK_PTR( cutbuf ); | 718 | CHECK_PTR( cutbuf ); |
719 | 719 | ||
720 | con->read( cutbuf, serverCutTextLen ); | 720 | con->read( cutbuf, serverCutTextLen ); |
721 | cutbuf[ serverCutTextLen ] = '\0'; | 721 | cutbuf[ serverCutTextLen ] = '\0'; |
722 | 722 | ||
723 | /* For some reason QApplication::clipboard()->setText() segfaults when called | 723 | /* For some reason QApplication::clipboard()->setText() segfaults when called |
724 | * from within keypebble's mass of signals and slots | 724 | * from within keypebble's mass of signals and slots |
725 | owarn << "Server cut: " << cutbuf << "" << oendl; | 725 | owarn << "Server cut: " << cutbuf << "" << oendl; |
726 | 726 | ||
727 | QString cutText( cutbuf ); // DANGER!! | 727 | QString cutText( cutbuf ); // DANGER!! |
728 | qApp->clipboard()->setText( cutText ); | 728 | qApp->clipboard()->setText( cutText ); |
729 | */ | 729 | */ |
730 | 730 | ||
731 | delete cutbuf; | 731 | delete [] cutbuf; |
732 | // Now wait for the update (again) | 732 | // Now wait for the update (again) |
733 | if ( oldState == AwaitingUpdate ) { | 733 | if ( oldState == AwaitingUpdate ) { |
734 | currentState = AwaitingUpdate; | 734 | currentState = AwaitingUpdate; |
735 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); | 735 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); |
736 | con->waitForData( UpdateHeaderLength ); | 736 | con->waitForData( UpdateHeaderLength ); |
737 | } | 737 | } |
738 | else if ( oldState == Idle ) { | 738 | else if ( oldState == Idle ) { |
739 | currentState = Idle; | 739 | currentState = Idle; |
740 | } | 740 | } |
741 | else { | 741 | else { |
742 | owarn << "Async handled in weird state" << oendl; | 742 | owarn << "Async handled in weird state" << oendl; |
743 | currentState = oldState; | 743 | currentState = oldState; |
744 | }; | 744 | }; |
745 | } | 745 | } |
746 | 746 | ||
747 | void KRFBDecoder::gotBell() | 747 | void KRFBDecoder::gotBell() |
748 | { | 748 | { |
749 | owarn << "Got server bell" << oendl; | 749 | owarn << "Got server bell" << oendl; |
750 | buf->soundBell(); | 750 | buf->soundBell(); |
751 | 751 | ||
752 | // Now wait for the update (again) | 752 | // Now wait for the update (again) |
753 | if ( oldState == AwaitingUpdate ) { | 753 | if ( oldState == AwaitingUpdate ) { |
754 | currentState = AwaitingUpdate; | 754 | currentState = AwaitingUpdate; |
755 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); | 755 | connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); |