summaryrefslogtreecommitdiff
path: root/noncore/comm/keypebble/krfbdecoder.cpp
Side-by-side diff
Diffstat (limited to 'noncore/comm/keypebble/krfbdecoder.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/krfbdecoder.cpp108
1 files changed, 52 insertions, 56 deletions
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp
index d61433f..837fcc5 100644
--- a/noncore/comm/keypebble/krfbdecoder.cpp
+++ b/noncore/comm/keypebble/krfbdecoder.cpp
@@ -26,7 +26,7 @@ const int endianTest = 1;
#define Swap32IfLE(l) \
(*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
- (((l) & 0x00ff0000) >> 8) | \
- (((l) & 0x0000ff00) << 8) | \
- (((l) & 0x000000ff) << 24)) : (l))
+ (((l) & 0x00ff0000) >> 8) | \
+ (((l) & 0x0000ff00) << 8) | \
+ (((l) & 0x000000ff) << 24)) : (l))
//
@@ -141,5 +141,5 @@ void KRFBDecoder::sendClientInit()
// Wait for server init
- owarn << "Waiting for server init" << oendl;
+ owarn << "Waiting for server init" << oendl;
static QString statusMsg = tr( "Waiting for server initialization..." );
@@ -153,5 +153,5 @@ void KRFBDecoder::sendClientInit()
void KRFBDecoder::gotServerInit()
{
- owarn << "Got server init" << oendl;
+ owarn << "Got server init" << oendl;
disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) );
@@ -187,16 +187,15 @@ void KRFBDecoder::gotServerInit()
info->nameLength = Swap32IfLE( info->nameLength );
- owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl;
- qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d",
- info->bpp, info->depth, info->bigEndian, info->trueColor );
- qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d",
- info->redMax, info->greenMax, info->blueMax );
- qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d",
- info->redShift, info->greenShift,info-> blueShift );
+ owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl;
+ owarn << "Bpp = " << info->bpp << ", Depth = " << info->depth << ", Big = " << info->bigEndian
+ << ", True = " << info->trueColor << oendl;
+ owarn << "RedMax = " << info->redMax << ", GreenMax = " << info->greenMax << ", BlueMax = " << info->blueMax << oendl;
+ owarn << "RedShift = " << info->redShift << ", GreenShift = " << info->greenShift
+ << ", BlueShift = " << info-> blueShift << oendl;
buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor);
// Wait for desktop name
- owarn << "Waiting for desktop name" << oendl;
+ owarn << "Waiting for desktop name" << oendl;
static QString statusMsg = tr( "Waiting for desktop name..." );
@@ -213,8 +212,8 @@ void KRFBDecoder::gotDesktopName()
assert( currentState == AwaitingDesktopName );
- owarn << "Got desktop name" << oendl;
+ owarn << "Got desktop name" << oendl;
disconnect( con, SIGNAL( gotEnoughData() ),
- this, SLOT( gotDesktopName() ) );
+ this, SLOT( gotDesktopName() ) );
char *buf = new char[ info->nameLength + 1 ];
@@ -225,5 +224,5 @@ void KRFBDecoder::gotDesktopName()
info->name = buf;
- owarn << "Desktop: " << info->name.latin1() << "" << oendl;
+ owarn << "Desktop: " << info->name.latin1() << "" << oendl;
delete buf;
@@ -265,10 +264,7 @@ void KRFBDecoder::decidePixelFormat()
chosenDepth = bestDepth;
- qWarning( "Screen depth=%d, server depth=%d, best depth=%d, " \
- "eight bit %d, chosenDepth=%d",
- screenDepth,
- info->depth,
- bestDepth,
- con->options()->colors256, chosenDepth );
+ owarn << "Screen depth=" << screenDepth << ", server depth=" << info->depth
+ << ", best depth=" << bestDepth << "eight bit " << con->options()->colors256
+ << ", chosenDepth=" << chosenDepth << oendl;
format->depth = chosenDepth;
@@ -377,8 +373,8 @@ void KRFBDecoder::gotUpdateHeader()
assert( currentState == AwaitingUpdate );
- // owarn << "Got update header" << oendl;
+ // owarn << "Got update header" << oendl;
disconnect( con, SIGNAL( gotEnoughData() ),
- this, SLOT( gotUpdateHeader() ) );
+ this, SLOT( gotUpdateHeader() ) );
CARD8 msgType;
@@ -412,5 +408,5 @@ void KRFBDecoder::gotUpdateHeader()
noRects = Swap16IfLE( noRects );
- // owarn << "Expecting " << noRects << " rects" << oendl;
+ // owarn << "Expecting " << noRects << " rects" << oendl;
// Now wait for the data
@@ -424,8 +420,8 @@ void KRFBDecoder::gotRectHeader()
assert( currentState == AwaitingRectHeader );
- // owarn << "Got rect header" << oendl;
+ // owarn << "Got rect header" << oendl;
disconnect( con, SIGNAL( gotEnoughData() ),
- this, SLOT( gotRectHeader() ) );
+ this, SLOT( gotRectHeader() ) );
con->read( &x, 2 );
@@ -442,6 +438,6 @@ void KRFBDecoder::gotRectHeader()
// CARD32 encodingLocal = Swap32IfLE( encoding );
- // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld",
- // x, y, w, h, encodingLocal );
+ // owarn << "Rect: x=" << x << ", y= " << y << ", w=" << w << ", h=" << h
+ // << ", encoding= " << encodingLocal << oendl;
//
@@ -452,21 +448,21 @@ void KRFBDecoder::gotRectHeader()
//
if ( encoding == RawEncoding ) {
- // owarn << "Raw encoding" << oendl;
+ // owarn << "Raw encoding" << oendl;
handleRawRect();
}
else if ( encoding == CopyRectEncoding ) {
-// owarn << "CopyRect encoding" << oendl;
+// owarn << "CopyRect encoding" << oendl;
handleCopyRect();
}
else if ( encoding == RreEncoding ) {
- owarn << "RRE encoding" << oendl;
+ owarn << "RRE encoding" << oendl;
handleRRERect();
}
else if ( encoding == CorreEncoding ) {
- owarn << "CoRRE encoding" << oendl;
+ owarn << "CoRRE encoding" << oendl;
handleCoRRERect();
}
else if ( encoding == HexTileEncoding ) {
- owarn << "HexTile encoding" << oendl;
+ owarn << "HexTile encoding" << oendl;
handleHexTileRect();
}
@@ -474,7 +470,7 @@ void KRFBDecoder::gotRectHeader()
int msg = Swap32IfLE( encoding );
QString protocolError = tr( "Protocol Error: An unknown encoding was "
- "used by the server %1" ).arg( msg );
+ "used by the server %1" ).arg( msg );
currentState = Error;
- owarn << "Unknown encoding, " << msg << "" << oendl;
+ owarn << "Unknown encoding, " << msg << "" << oendl;
emit error( protocolError );
return;
@@ -492,5 +488,5 @@ void KRFBDecoder::handleRawRect()
// overall size (but has to be in complete lines).
- // owarn << "Handling a raw rect chunk" << oendl;
+ // owarn << "Handling a raw rect chunk" << oendl;
// CARD32 lineCount = w * format->bpp / 8;
@@ -515,5 +511,5 @@ void KRFBDecoder::getRawRectChunk( int lines )
// Wait for server init
- // owarn << "Waiting for raw rect chunk, " << count << "" << oendl;
+ // owarn << "Waiting for raw rect chunk, " << count << "" << oendl;
currentState = AwaitingRawRectChunk;
@@ -529,5 +525,5 @@ void KRFBDecoder::gotRawRectChunk()
this, SLOT( gotRawRectChunk() ) );
- // owarn << "Got raw rect chunk" << oendl;
+ // owarn << "Got raw rect chunk" << oendl;
//
@@ -552,5 +548,5 @@ void KRFBDecoder::gotRawRectChunk()
noRects--;
- // owarn << "There are " << noRects << " rects left" << oendl;
+ // owarn << "There are " << noRects << " rects left" << oendl;
if ( noRects ) {
@@ -596,5 +592,5 @@ void KRFBDecoder::gotCopyRectPos()
noRects--;
- // owarn << "There are " << noRects << " rects left" << oendl;
+ // owarn << "There are " << noRects << " rects left" << oendl;
if ( noRects ) {
@@ -609,15 +605,15 @@ void KRFBDecoder::gotCopyRectPos()
void KRFBDecoder::handleRRERect()
{
- owarn << "RRE not implemented" << oendl;
+ owarn << "RRE not implemented" << oendl;
}
void KRFBDecoder::handleCoRRERect()
{
- owarn << "CoRRE not implemented" << oendl;
+ owarn << "CoRRE not implemented" << oendl;
}
void KRFBDecoder::handleHexTileRect()
{
- owarn << "HexTile not implemented" << oendl;
+ owarn << "HexTile not implemented" << oendl;
}
@@ -645,7 +641,7 @@ void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
}
- // HACK: Scaling
+ // HACK: Scaling
CARD16 x = Swap16IfLE( e->x() * con->options()->scaleFactor );
- CARD16 y = Swap16IfLE( e->y() * con->options()->scaleFactor );
+ CARD16 y = Swap16IfLE( e->y() * con->options()->scaleFactor );
con->write( &PointerEventId, 1 );
@@ -679,5 +675,5 @@ void KRFBDecoder::sendCutEvent( const QString &unicode )
void KRFBDecoder::gotServerCut()
{
- owarn << "Got server cut" << oendl;
+ owarn << "Got server cut" << oendl;
currentState = AwaitingServerCutLength;
@@ -727,5 +723,5 @@ void KRFBDecoder::gotServerCutText()
/* For some reason QApplication::clipboard()->setText() segfaults when called
* from within keypebble's mass of signals and slots
- owarn << "Server cut: " << cutbuf << "" << oendl;
+ owarn << "Server cut: " << cutbuf << "" << oendl;
QString cutText( cutbuf ); // DANGER!!
@@ -744,5 +740,5 @@ void KRFBDecoder::gotServerCutText()
}
else {
- owarn << "Async handled in weird state" << oendl;
+ owarn << "Async handled in weird state" << oendl;
currentState = oldState;
};
@@ -751,5 +747,5 @@ void KRFBDecoder::gotServerCutText()
void KRFBDecoder::gotBell()
{
- owarn << "Got server bell" << oendl;
+ owarn << "Got server bell" << oendl;
buf->soundBell();
@@ -764,5 +760,5 @@ void KRFBDecoder::gotBell()
}
else {
- owarn << "Async handled in weird state" << oendl;
+ owarn << "Async handled in weird state" << oendl;
currentState = oldState;
};
@@ -820,9 +816,9 @@ int KRFBDecoder::toKeySym( QKeyEvent *k )
//
if ((k->key() >= Qt::Key_Escape) && (k->key() <= Qt::Key_F12)) {
- for(int i = 0; keyMap[i].keycode != 0; i++) {
- if (k->key() == keyMap[i].keycode) {
- return keyMap[i].keysym;
- }
- }
+ for(int i = 0; keyMap[i].keycode != 0; i++) {
+ if (k->key() == keyMap[i].keycode) {
+ return keyMap[i].keysym;
+ }
+ }
}