This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2gokdriveclient. from f4a5826 wait for server version before requesting main image. new cf3d89c use QTextStream(stderr) instead of qDebug. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: client.cpp | 220 ++++++++++++++++++++++++++++++------------------------- client.h | 9 ++- debian/changelog | 1 + displayarea.cpp | 59 ++++++++------- menuframe.cpp | 9 +-- xcbclip.cpp | 107 ++++++++++++++------------- 6 files changed, 216 insertions(+), 189 deletions(-) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdriveclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdriveclient. commit cf3d89c139344d1a63754f641033070a2a9465b7 Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Thu Oct 14 12:07:48 2021 -0500 use QTextStream(stderr) instead of qDebug. --- client.cpp | 220 ++++++++++++++++++++++++++++++------------------------- client.h | 9 ++- debian/changelog | 1 + displayarea.cpp | 59 ++++++++------- menuframe.cpp | 9 +-- xcbclip.cpp | 107 ++++++++++++++------------- 6 files changed, 216 insertions(+), 189 deletions(-) diff --git a/client.cpp b/client.cpp index eb0c948..7388bd6 100644 --- a/client.cpp +++ b/client.cpp @@ -23,7 +23,6 @@ #include "displayarea.h" #include <QApplication> #include <QMessageBox> -#include <QDebug> #include <QTimer> #include <QTcpSocket> #include <QPainter> @@ -62,6 +61,9 @@ #include <zlib.h> +//stderr + + X2GoCursor::X2GoCursor(uint16_t width, uint16_t height, uint16_t xhot, uint16_t yhot, uint32_t serialNumber, uint32_t dataSize) { this->width=width; @@ -121,7 +123,35 @@ OutputChunk::OutputChunk(SelectionType selection, SelectionMime mime) firstChunk=lastChunk=false; } +QString Client::QRectToStr(const QRect& rec) +{ + QString str; + QTextStream(&str) << rec.x()<<","<<rec.y()<<" "<<rec.width()<<"x"<<rec.height(); + return str; +} +QString Client::QSizeToStr(const QSizeF& sz) +{ + QString str; + QTextStream(&str) <<sz.width()<<"x"<<sz.height(); + return str; +} + +QTextStream& Client::KDRStdErr(bool dbg) +{ + static QTextStream out(stderr); + static QString nls; + nls.clear(); + static QTextStream nl(&nls); + if(debug || !dbg) + { + out<<Qt::endl; + return out; + } + return nl; +} + +bool Client::debug=false; Client::Client() { @@ -211,7 +241,7 @@ Client::Client() Client::~Client() { - qDebug()<<"Client destructor"; + KDRStdErr()<<"Client destructor"<<Qt::endl; freeMessageBuffer(); @@ -257,7 +287,7 @@ void Client::slotIdentifyScreen() if(number >= QGuiApplication::screens().size()) { - qDebug()<<"screen not connected"; + KDRStdErr()<<"screen not connected"; if(screenIdentifier) screenIdentifier->hide(); return; @@ -352,7 +382,7 @@ void Client::resizeToSaved() setWindowState(Qt::WindowNoState); setWindowState(windowState() & ~Qt::WindowMaximized); #endif - qDebug()<<"restore to "<<savedSize<<savedPosition; + KDRStdErr()<<"restore to "<<savedSize.width()<<"x"<<savedSize.height()<<" "<<savedPosition.x()<<","<<savedPosition.y(); resize(savedSize); move(savedPosition); showNormal(); @@ -414,7 +444,7 @@ void Client::setFS(int screenNumber) { showNormal(); } - qDebug()<<"setting FS on screen"<<screenNumber; + KDRStdErr()<<"setting FS on screen"<<screenNumber; isFs=true; FSScreen=screenNumber; if(screenNumber==-1) @@ -512,14 +542,12 @@ void Client::connectToServer() for(int i=0;i<args.count();++i) { - qDebug()<<args[i]; + KDRStdErr()<<args[i]; if(args[i]=="--debug") { -#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) - QLoggingCategory::setFilterRules("default.debug=true"); -#endif - qDebug()<<"Running in debug mode"; + debug=true; + KDRStdErr()<<"Running in debug mode"; continue; } if(args[i]=="--connect") @@ -535,7 +563,7 @@ void Client::connectToServer() if(args[i]=="--title") { setWindowTitle("X2GO-"+args[++i]); - qDebug()<<"set title to "<<windowTitle(); + KDRStdErr()<<"set title to "<<windowTitle(); continue; } @@ -586,7 +614,7 @@ void Client::connectToServer() } else { - qDebug()<<"Unsupported selections mode:"<<smode; + KDRStdErr()<<"Unsupported selections mode: "<<smode; } } @@ -623,7 +651,7 @@ void Client::connectToServer() } - qDebug()<<"options file:"<<optFile; + KDRStdErr()<<"options file: "<<optFile; if(optFile.length()) { @@ -647,7 +675,7 @@ void Client::connectToServer() cookie=part.replace("cookie=",""); if(cookie.length()!=32) { - qDebug()<<"Wrong cookie: "<<cookie; + KDRStdErr()<<"Wrong cookie: "<<cookie; exitOnError(tr("Wrong cookie")); } continue; @@ -663,14 +691,12 @@ void Client::connectToServer() } else { - qDebug()<<"Error! Can't open options File for reading"<<optFile; + KDRStdErr()<<"Error! Can't open options File for reading "<<optFile; exitOnError(tr("Error! Can't open options File for reading")); } } - QString nxmsg="Connecting to remote host 'localhost:"; - nxmsg+=QString::number(port)+"'\n"; - fprintf(stderr, "%s", nxmsg.toLatin1().data()); + KDRStdErr(false)<<"Connecting to remote host "<<host<<":"<<port; clientSocket->connectToHost(host, port); } @@ -679,7 +705,7 @@ QPixmap Client::getPixmapFromCache(uint32_t crc) { if(!frameCache.contains(crc)) { - qDebug()<<"GETPIXMAP: frame"<<hex<<crc<<"not found in cache"; + KDRStdErr()<<"GETPIXMAP: frame "<<Qt::hex<<crc<<" not found in cache"; if(serverVersion<5) exitOnError(tr("Frame not found in cache")); else @@ -697,14 +723,14 @@ void Client::renderFrame() //we got a whole display copy if(currentFrame->x==-1) { - qDebug()<<"got initial Image:"<<currentFrame->width<< currentFrame->height<<currentFrame->regions[0]->pix.size(); + KDRStdErr()<<"got initial Image: "<<currentFrame->width<<"x"<<currentFrame->height<<" "<<QSizeToStr(currentFrame->regions[0]->pix.size()); displayArea->resize(currentFrame->width, currentFrame->height); this->resize(currentFrame->width, currentFrame->height); displayArea->setDisplayPix(currentFrame->regions[0]->pix); } else { -// qDebug()<<"got Screen update:"<<currentFrame->width<< currentFrame->height<<currentFrame->regions[0]->pix.size(); + // KDRStdErr()<<"got Screen update:"<<currentFrame->width<< currentFrame->height<<currentFrame->regions[0]->pix.size(); displayArea->setDisplayPix(currentFrame->regions[0]->pix, currentFrame->x, currentFrame->y); } } @@ -723,20 +749,20 @@ void Client::renderFrame() { if(!frameCache.contains(reg->source_crc)) { - qDebug()<<"region"<<hex<<reg->source_crc<<"not found in cache"; + KDRStdErr()<<"region "<<Qt::hex<<reg->source_crc<<" not found in cache"; if(serverVersion<5) exitOnError(tr("region not found in cache")); else requestCacheRebuild(); return; } - //qDebug()<<"REG:"<<reg->x<<reg->y<<reg->width<< reg->height<<"SOURCE:"<<reg->source_x<<reg->source_y; + //KDRStdErr()<<"REG:"<<reg->x<<reg->y<<reg->width<< reg->height<<"SOURCE:"<<reg->source_x<<reg->source_y; painter.drawPixmap(reg->x,reg->y,reg->width, reg->height, frameCache[reg->source_crc], reg->source_x, reg->source_y, reg->width, reg->height); } else { - //qDebug()<<"REG:"<<reg->x<<reg->y<<reg->width<< reg->height; + //KDRStdErr()<<"REG:"<<reg->x<<reg->y<<reg->width<< reg->height; painter.drawPixmap(reg->x,reg->y, reg->pix); } } @@ -747,13 +773,13 @@ void Client::renderFrame() frameCount++; - /*qDebug()<<"Insert in cache Frame:"<<frameCount<<dec<<frameSize<<pix.size()<< + /*KDRStdErr()<<"Insert in cache Frame:"<<frameCount<<dec<<frameSize<<pix.size()<< frameCache.count()<<"Total(MB)"<<cacheSize/(1024*1024);*/ } } wantRepaint=true; displayArea->repaint(currentFrame->x, currentFrame->y, currentFrame->width, currentFrame->height); -// qDebug()<<"repaint: "<<currentFrame->x<<currentFrame->y<< currentFrame->width<< currentFrame->height<<displayArea->geometry(); + // KDRStdErr()<<"repaint: "<<currentFrame->x<<currentFrame->y<< currentFrame->width<< currentFrame->height<<displayArea->geometry(); } void Client::setUptodate() @@ -771,7 +797,7 @@ void Client::getImageFrame() *((uint32_t*)messageBuffer+4), *((uint32_t*)messageBuffer+5), *((uint32_t*)messageBuffer+6)); -// qDebug()<<"got frame "<<currentFrame->crc<<currentFrame->numOfRegions; + // KDRStdErr()<<"got frame "<<currentFrame->crc<<currentFrame->numOfRegions; if(!currentFrame->numOfRegions) { //we have no regions, render frame @@ -793,12 +819,12 @@ void Client::getCursorImage() //get cursor image from buffer -// qDebug()<<"got cursor image"; + // KDRStdErr()<<"got cursor image"; QCursor* cursor; if(currentCursor->dataSize == (uint32_t) currentCursor->width*currentCursor->height*4) { -// qDebug()<<"get ARGB cursor"; + // KDRStdErr()<<"get ARGB cursor"; QImage img((uchar*)messageBuffer, currentCursor->width, currentCursor->height, QImage::Format_ARGB32); cursor=new QCursor(QPixmap::fromImage(img), currentCursor->xhot, currentCursor->yhot); } @@ -821,7 +847,7 @@ void Client::getServerversion() serverVersion=*((uint16_t*)messageBuffer+2); serverExtSelection = (serverVersion>1); - qDebug()<<"server version:"<<serverVersion; + KDRStdErr()<<"server version: "<<serverVersion; initGeometry(); } @@ -831,7 +857,7 @@ void Client::getClientSelection() SelectionType selection=PRIMARY; if(sel) selection=CLIPBOARD; - qDebug()<<"server demands data for "<<selection; + KDRStdErr()<<"server demands data for "<<selection; #ifdef Q_OS_LINUX clipboard->requestSelectionData(selection); #else @@ -852,7 +878,7 @@ void Client::getCursor() *((uint16_t*)messageBuffer+7), *((uint16_t*)messageBuffer+8), *((uint32_t*)messageBuffer+5),*((uint32_t*)messageBuffer+6)); -// qDebug()<<"got cursor with serial"<<currentCursor->serialNumber<<" size: "<<currentCursor->dataSize; + // KDRStdErr()<<"got cursor with serial"<<currentCursor->serialNumber<<" size: "<<currentCursor->dataSize; if(!currentCursor->dataSize) @@ -860,7 +886,7 @@ void Client::getCursor() //we don't have data, set cursor if(!cursorCache.contains(currentCursor->serialNumber)) { - qDebug()<<"cursor not found:"<<currentCursor->serialNumber; + KDRStdErr()<<"cursor not found: "<<currentCursor->serialNumber; if(serverVersion<5) exitOnError(tr("Cursor not found in cache")); else @@ -911,7 +937,7 @@ QByteArray Client::zuncompress(const char* data, uint compressed_size, uint size if(!stream.total_out || stream.total_out != size) { - qDebug()<<"zlib decompression error, "<<"output size: "<<stream.total_out<<", expected: "<<size; + KDRStdErr()<<"zlib decompression error, "<<"output size: "<<stream.total_out<<", expected: "<<size; } QByteArray ba( (const char*)out, size); delete[] out; @@ -924,7 +950,7 @@ void Client::setInputSelectionData(SelectionType, SelectionMime mime, bool first { //if notify is true, we don't have actual data, just notification //copy data to selection buffer - // qDebug()<<"Get chunk of input selection: selection, myme, firstChunk, lastChunk, compressed, size:"<<selection<<mime<<firstChunk<<lastChunk<<compressed<<size<<notify; + // KDRStdErr()<<"Get chunk of input selection: selection, myme, firstChunk, lastChunk, compressed, size:"<<selection<<mime<<firstChunk<<lastChunk<<compressed<<size<<notify; if(firstChunk) @@ -940,18 +966,18 @@ void Client::setInputSelectionData(SelectionType, SelectionMime mime, bool first { total_compressed+=compressed; selData.append(zuncompress(data, compressed, size)); -// qDebug()<<"uncompress from "<<compressed<<" to "<<size; + // KDRStdErr()<<"uncompress from "<<compressed<<" to "<<size; } if(lastChunk ) { if(notify) { - qDebug()<<"Got selection notify from server"; + KDRStdErr()<<"Got selection notify from server"; } else { -// qDebug()<<"total size: "<<selData.size()<<"compressed size"<<total_compressed; + // KDRStdErr()<<"total size: "<<selData.size()<<"compressed size"<<total_compressed; QClipboard* clipboard=QGuiApplication::clipboard(); QClipboard::Mode mode=QClipboard::Clipboard; switch(selectionFormat) @@ -975,13 +1001,13 @@ void Client::setInputSelectionData(SelectionType, SelectionMime mime, bool first void Client::getDeletedCursorsList() { //process list from messageBuffer -// qDebug()<<"get deleted cursors: "<<deletedCursorsSize; +// KDRStdErr()<<"get deleted cursors: "<<deletedCursorsSize; for(uint i=0;i<deletedCursorsSize;++i) { uint32_t serial=*((uint32_t*)messageBuffer+i); if(!cursorCache.contains(serial)) { - qDebug()<<"cursor not found in cache: "<<serial; + KDRStdErr()<<"cursor not found in cache: "<<serial; if(serverVersion<5) exitOnError(tr("cursor not found in cache")); else @@ -998,20 +1024,20 @@ void Client::getDeletedFramesList() { //process list from messageBuffer -// qDebug()<<"get deleted frames: "<<deletedFramesSize; +// KDRStdErr()<<"get deleted frames: "<<deletedFramesSize; for(uint i=0;i<deletedFramesSize;++i) { uint32_t crc=*((uint32_t*)messageBuffer+i); if(!frameCache.contains(crc)) { - qDebug()<<"DELETING: frame not found in cache: "<<hex<<crc; + KDRStdErr()<<"DELETING: frame not found in cache: "<<Qt::hex<<crc; if(serverVersion<5) exitOnError(tr("frame not found in cache")); else requestCacheRebuild(); return; } -// qDebug()<<"deleting frame from cache with crc"<<hex<<crc; +// KDRStdErr()<<"deleting frame from cache with crc"<<hex<<crc; QPixmap pix=frameCache[crc]; cacheSize-=pix.width()*pix.height()*pix.depth()/8; @@ -1088,7 +1114,7 @@ void Client::getSelection() bytesLeftToRead=compressed_size; else bytesLeftToRead=selectionSize; - // qDebug()<<"Get Selection, is Clipboard"<<selectionClipboard<<selectionFormat<<"chunk size"<<selectionSize<<"left"<<bytesLeftToRead; + // KDRStdErr()<<"Get Selection, is Clipboard"<<selectionClipboard<<selectionFormat<<"chunk size"<<selectionSize<<"left"<<bytesLeftToRead; freeMessageBuffer(); } @@ -1106,7 +1132,7 @@ void Client::getDeletedFrames() void Client::getRegionImage() { -// qDebug()<<"got image for region "<<currentFrame->regions.count()-1<<"from"<<currentFrame->numOfRegions; +// KDRStdErr()<<"got image for region "<<currentFrame->regions.count()-1<<"from"<<currentFrame->numOfRegions; // currentFrame->regions.last()->pix=new QPixmap(); if(currentFrame->regions.last()->pix.loadFromData((uchar*)messageBuffer, currentFrame->regions.last()->dataSize)) @@ -1117,8 +1143,8 @@ void Client::getRegionImage() } else { - qDebug()<<"Image loading failed:"<<hex<<currentFrame->crc; -/* qDebug()<<currentFrame->regions.last()->dataSize; + KDRStdErr()<<"Image loading failed: "<<Qt::hex<<currentFrame->crc; +/* KDRStdErr()<<currentFrame->regions.last()->dataSize; QFile fl("/tmp/client/failed.jpg"); fl.open(QFile::WriteOnly); fl.write((const char*)messageBuffer, currentFrame->regions.last()->dataSize); @@ -1151,7 +1177,7 @@ void Client::getFrameRegion() currentFrame->regions.append(region); -// qDebug()<<"got region "<<currentFrame->regions.count()-1<<"from" +// KDRStdErr()<<"got region "<<currentFrame->regions.count()-1<<"from" // <<currentFrame->numOfRegions<<"source: "<<region->source_crc<<"size: "<<region->dataSize; if(!region->source_crc) { @@ -1188,31 +1214,31 @@ void Client::readDataHeader() case FRAME: { -// qDebug()<<"frame"; +// KDRStdErr()<<"frame"; getImageFrame(); break; } case CURSOR: { -// qDebug()<<"cursor"; +// KDRStdErr()<<"cursor"; getCursor(); break; } case DELETEDFRAMES: { -// qDebug()<<"deleted frames"; +// KDRStdErr()<<"deleted frames"; getDeletedFrames(); break; } case DELETEDCURSORS: { -// qDebug()<<"deleted cursors"; +// KDRStdErr()<<"deleted cursors"; getDeletedCursors(); break; } case SELECTION: { -// qDebug()<<"Get Selection"; +// KDRStdErr()<<"Get Selection"; getSelection(); break; } @@ -1233,7 +1259,7 @@ void Client::readDataHeader() } default: { - qDebug()<<"Unsupported header type: "<<data_type; + KDRStdErr()<<"Unsupported header type: "<<data_type; exitOnError(tr("Unsupported header type")); break; } @@ -1244,7 +1270,7 @@ void Client::readDataHeader() void Client::dataArrived() { -// qDebug()<<"Have available:"<<clientSocket->bytesAvailable(); +// KDRStdErr()<<"Have available:"<<clientSocket->bytesAvailable(); if(!bytesLeftToRead) { bytesLeftToRead=HEADER_SIZE; @@ -1254,10 +1280,10 @@ void Client::dataArrived() } if(!messageBuffer) { -// qDebug()<<"init message buffer: "<<bytesLeftToRead; +// KDRStdErr()<<"init message buffer: "<<bytesLeftToRead; messageBuffer=new char[bytesLeftToRead]; } -// qDebug()<<"trying to read bytes:"<<bytesLeftToRead; +// KDRStdErr()<<"trying to read bytes:"<<bytesLeftToRead; int length=clientSocket->read(messageBuffer+bytesReady, bytesLeftToRead); bytesLeftToRead-=length; bytesReady+=length; @@ -1268,49 +1294,49 @@ void Client::dataArrived() { case HEADER: { -// qDebug()<<"header"; +// KDRStdErr()<<"header"; readDataHeader(); break; } case FRAMEREGION: { -// qDebug()<<"frame region"; +// KDRStdErr()<<"frame region"; getFrameRegion(); break; } case REGIONDATA: { -// qDebug()<<"region data"; +// KDRStdErr()<<"region data"; getRegionImage(); break; } case CURSORDATA: { -// qDebug()<<"cursor data"; +// KDRStdErr()<<"cursor data"; getCursorImage(); break; } case SELECTIONBUFFER: { -// qDebug()<<"selection"; +// KDRStdErr()<<"selection"; getSelectionBuffer(); break; } case CURSORLIST: { -// qDebug()<<"cursor list"; +// KDRStdErr()<<"cursor list"; getDeletedCursorsList(); break; } case FRAMELIST: { -// qDebug()<<"frame list"; +// KDRStdErr()<<"frame list"; getDeletedFramesList(); break; } default: { - qDebug()<<"not ready"; + KDRStdErr()<<"not ready"; exitOnError(tr("This function not ready yet")); } } @@ -1324,27 +1350,25 @@ void Client::dataArrived() void Client::socketConnected() { displayArea->setStyleSheet("QFrame#DisplayArea{background-color:black;}"); - fprintf(stderr,"Connected to server\n"); - - fprintf(stderr,"Established X server connection\n"); + KDRStdErr(false)<<"Connected to server"<<Qt::endl<<"Established X server connection"; if(cookie.length()) { if(cookie.length()!=32) { - qDebug()<<"Wrong length of cookie should be 32, not"<<cookie.length(); + KDRStdErr()<<"Wrong length of cookie should be 32, not "<<cookie.length(); exitOnError(tr("Wrong cookie length")); } - qDebug()<<"Sending Cookie to server"; + KDRStdErr()<<"Sending Cookie to server"; if(clientSocket->write(cookie.toLatin1().data(), 32)!=32) { - qDebug()<<"Failed to send auth cookie to server"; + KDRStdErr()<<"Failed to send auth cookie to server"; exitOnError(tr("Failed to send auth cookie to server")); } } else { - qDebug()<<"Not sending cookie to server"; + KDRStdErr()<<"Not sending cookie to server"; } connected=true; @@ -1358,7 +1382,7 @@ void Client::checkServerVersion() { if(!serverVersion) { - qDebug()<<"Server Version is 0, please update your x2gokdrive package"; + KDRStdErr()<<"Server Version is 0, please update your x2gokdrive package"; //if the server bversion is 0, we didn't init the geometry yet initGeometry(); } @@ -1384,7 +1408,7 @@ void Client::initGeometry() void Client::socketDisconnected() { connected=false; - qDebug()<<"Disconnected from Server"; + KDRStdErr()<<"Disconnected from Server"; QApplication::closeAllWindows(); close(); QApplication::exit(0); @@ -1392,7 +1416,7 @@ void Client::socketDisconnected() void Client::socketError(QAbstractSocket::SocketError ) { - qDebug()<<clientSocket->errorString(); + KDRStdErr()<<clientSocket->errorString(); exitOnError(clientSocket->errorString()); } @@ -1444,14 +1468,14 @@ void Client::resizeToOldSize() void Client::slotScreenAdded(QScreen* screen) { - qDebug()<<"Add screen:"<<screen->geometry()<<"Dimensions(mm)"<<screen->physicalSize(); + KDRStdErr()<<"Add screen: "<<QRectToStr(screen->geometry())<<" Dimensions(mm) "<<QSizeToStr(screen->physicalSize()); connect(screen, &QScreen::geometryChanged, this, &Client::geometryChanged); geometryChanged(); } void Client::slotScreenRemoved(QScreen* screen) { - qDebug()<<"Remove screen:"<<screen->geometry(); + KDRStdErr()<<"Remove screen: "<<QRectToStr(screen->geometry()); disconnect(screen, &QScreen::geometryChanged, this, &Client::geometryChanged); geometryChanged(); } @@ -1478,7 +1502,7 @@ void Client::sendGeometryEvent() { bool isPrimary=(i==primaryScreenIndex); QRect* scr=&ephyrScreens[i]; -// qDebug()<<"X2GoKDrive-"<<i<<scr->size().width()<<scr->size().height()<<scr->topLeft().x()<<scr->topLeft().y()<<isPrimary; +// KDRStdErr()<<"X2GoKDrive-"<<i<<scr->size().width()<<scr->size().height()<<scr->topLeft().x()<<scr->topLeft().y()<<isPrimary; if(isPrimary) { memcpy(evmsg+8,(char*)&i,1); @@ -1498,7 +1522,7 @@ void Client::sendGeometryEvent() } else { - qDebug()<<"not supporting more then 4 displays yet, not sending this display to server"; + KDRStdErr()<<"not supporting more then 4 displays yet, not sending this display to server"; } } sendEvent(evmsg); @@ -1523,7 +1547,7 @@ void Client::sendClientVersion() memcpy(evmsg,(char*)&etype,4); memcpy(evmsg+4,(char*)&version,2); memcpy(evmsg+6,(char*)&os,2); - qDebug()<<"Sending version:"<<version<<"OS:"<<os; + KDRStdErr()<<"Sending version: "<<version<<" OS: "<<os; sendEvent(evmsg); } @@ -1552,7 +1576,7 @@ void Client::geometryChanged() newGeometry.setTopLeft(geometry().topLeft()); newGeometry.setSize(geometry().size()); - qDebug()<<"geometry changed: "<<newGeometry<<currentGeometry; + KDRStdErr()<<"geometry changed: "<<QRectToStr(newGeometry)<<" "<<QRectToStr(currentGeometry); QGuiApplication* app=(QGuiApplication*)QGuiApplication::instance(); QRect newScreens[4]; @@ -1564,12 +1588,12 @@ void Client::geometryChanged() QList <QScreen*> screens=app->screens(); foreach(QScreen* screen, screens) { - // qDebug()<<screen->geometry()<<primary; + // KDRStdErr()<<screen->geometry()<<primary; if(screen->geometry().intersects(newGeometry)) { QRect inter=newGeometry.intersected(screen->geometry()); newScreens[screenIndex++]=QRect(inter.topLeft().x()-newGeometry.topLeft().x(), inter.topLeft().y()-newGeometry.topLeft().y(), inter.width(), inter.height()); - // qDebug()<<"Virtual screen:"<<screenIndex-1<<newScreens[screenIndex-1]; + // KDRStdErr()<<"Virtual screen:"<<screenIndex-1<<newScreens[screenIndex-1]; if(app->primaryScreen()==screen) { if ( screenIndex != primaryScreenIndex) @@ -1613,7 +1637,7 @@ void Client::geometryChanged() //so we first resize window with width-1 and then resize it to original size if(!geometryChanged) { -// qDebug()<<"Screen Changed without geometry, running resize hack!!!!!"; + // KDRStdErr()<<"Screen Changed without geometry, running resize hack!!!!!"; restoreGeometry=currentGeometry; currentGeometry.setWidth(currentGeometry.width()-1); QTimer::singleShot(100,this, &Client::resizeToOldSize); @@ -1657,7 +1681,7 @@ void Client::slotSelectionChanged(QClipboard::Mode mode) if(mode == QClipboard::Selection && clipboard->ownsSelection()) return; const QMimeData *mimeData = clipboard->mimeData(mode); - qDebug()<<"selection changed for"<<mode<<mimeData->formats(); + KDRStdErr()<<"selection changed for "<<mode<<mimeData->formats(); SelectionType destination=PRIMARY; if(mode== QClipboard::Clipboard) @@ -1668,17 +1692,17 @@ void Client::slotSelectionChanged(QClipboard::Mode mode) if(mimeData->hasImage()) { - qDebug()<<"Have new Image"; + KDRStdErr()<<"Have new Image"; mime=PIXMAP; } else if(mimeData->hasText()) { - qDebug()<<"Have new Text"; + KDRStdErr()<<"Have new Text"; mime=UTF_STRING; } else { - qDebug()<<"Unsupported MIME type in clipboard"; + KDRStdErr()<<"Unsupported MIME type in clipboard"; return; } @@ -1727,24 +1751,24 @@ void Client::sendSelectionToServer(SelectionType selection) buffer.open(QIODevice::WriteOnly); QPixmap pix=clipboard->pixmap(mode); pix.save(&buffer, "PNG"); - qDebug()<<"Selection image size"<<pix<<data.size(); + KDRStdErr()<<"Selection image size "<< data.size(); mime=PIXMAP; } else if(mimeData->hasText()) { data=clipboard->text(mode).toUtf8(); - qDebug()<<"Selection Text"<<data.size(); + KDRStdErr()<<"Selection Text "<< data.size(); mime=UTF_STRING; } else { - qDebug()<<"Unsupported MIME type in clipboard"; + KDRStdErr()<<"Unsupported MIME type in clipboard"; return; } if(!data.size()) { - qDebug()<<"no data"; + KDRStdErr()<<"no data"; return; } @@ -1772,7 +1796,7 @@ void Client::sendOutputSelChunk() if(!serverSupportsExtSelection() && (!chunk->firstChunk || !chunk->lastChunk)) { //selection has multiply chunks, but this server doesn't support ext selection, not sending anything - qDebug()<<"Server doesn't support extended selections"; + KDRStdErr()<<"Server doesn't support extended selections"; delete chunk; return; } @@ -1808,14 +1832,14 @@ void Client::sendOutputSelChunk() memcpy(evmsg+11,(char*)&lastChunk,1); memcpy(evmsg+12,(char*)&compressed_size,4); memcpy(evmsg+16,(char*)&totalSize,4); -// qDebug()<<"size of chunk: "<<size<<" compressed: "<<compressed_size<<"total: "<<totalSize; + // KDRStdErr()<<"size of chunk: "<<size<<" compressed: "<<compressed_size<<"total: "<<totalSize; } uint headerSize=10; if(serverSupportsExtSelection()) headerSize=20; -// qDebug()<<"SEND SELECTION"<<size<<destination<<mime; +// KDRStdErr()<<"SEND SELECTION"<<size<<destination<<mime; char* data_ptr=chunk->data.data(); if(compressed_size) @@ -1835,7 +1859,7 @@ void Client::sendOutputSelChunk() sentData+=msg_length; sendEvent(evmsg); } -// qDebug()<<"sent: "<<sentData<<"from"<<size; +// KDRStdErr()<<"sent: "<<sentData<<"from"<<size; delete chunk; } @@ -1860,13 +1884,13 @@ void Client::requestCacheRebuild() uint32_t etype; etype=CACHEREBUILD; memcpy(evmsg,(char*)&etype,4); - qDebug()<<"Requesting cache rebuild"; + KDRStdErr()<<"Requesting cache rebuild"; sendEvent(evmsg); } void Client::reinitCaches() { - qDebug()<<"Clearing all caches"; + KDRStdErr()<<"Clearing all caches"; cursorCache.clear(); frameCache.clear(); wantRepaint=false; diff --git a/client.h b/client.h index bb42f5e..c71e234 100644 --- a/client.h +++ b/client.h @@ -21,7 +21,6 @@ #ifndef CLIENT_H #define CLIENT_H - //FEATURE_VERSION is not cooresponding to actual version of client //it used to tell server which features are supported by client //Changes 1 - 2: supporting extended selection and sending selection on demand @@ -92,6 +91,9 @@ enum ClipboardMode{CLIP_BOTH, CLIP_SERVER, CLIP_CLIENT, CLIP_NONE}; #include <QAbstractSocket> #include <stdlib.h> #include <QClipboard> +#include <stdio.h> +#include <QTextStream> + #ifdef Q_OS_LINUX @@ -174,6 +176,9 @@ public: void send_selnotify_to_server(SelectionType selection, SelectionMime mime); int max_chunk(); static QByteArray zuncompress(const char* data, uint compressed_size, uint size); + static QTextStream& KDRStdErr(bool dbg=true); + static QString QRectToStr(const QRect& rec); + static QString QSizeToStr(const QSizeF& sz); public slots: void sendOutputSelChunk(); @@ -243,7 +248,7 @@ private: void setInputSelectionData(SelectionType selection, SelectionMime mime, bool firstChunk, bool lastChunk, uint32_t compressed, uint size, char* data, bool notify=false); #endif - + static bool debug; //initial values int width=800; int height=600; diff --git a/debian/changelog b/debian/changelog index cac49e4..62560ad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,5 +34,6 @@ x2gokdriveclient (0.0.0.1-0x2go1) UNRELEASED; urgency=medium - reiniting of frame and cursors caches if cache is corrupted. - support for --debug command line argument. - wait for server version before requesting main image. + - use QTextStream(stderr) instead of qDebug. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Tue, 04 Jun 2019 11:10:43 +0200 diff --git a/displayarea.cpp b/displayarea.cpp index c536b44..c4622e7 100644 --- a/displayarea.cpp +++ b/displayarea.cpp @@ -19,7 +19,6 @@ */ #include "displayarea.h" #include <QPainter> -#include <QDebug> #include <QPaintEvent> #include <QMouseEvent> #include <QWheelEvent> @@ -49,12 +48,12 @@ LRESULT CALLBACK LowLevelKeyboardProc( { if(!display->hasFocus()) { -// qDebug()<<"Not in focus, not processing events"; +// Client::KDRStdErr()<<"Not in focus, not processing events"; return CallNextHookEx(0, nCode, wParam,lParam); } if(nCode<0) { -// qDebug()<<"Not processing this event"; +// Client::KDRStdErr()<<"Not processing this event"; return CallNextHookEx(0, nCode, wParam,lParam); } @@ -100,16 +99,16 @@ DisplayArea::DisplayArea(Client* parent):QFrame(parent) void DisplayArea::grabKeyboard() { #ifdef Q_OS_LINUX - qDebug()<<"Grab X11 Keyboard"; + Client::KDRStdErr()<<"Grab X11 Keyboard"; xcb_grab_key(QX11Info::connection(), 0, winId(), XCB_MOD_MASK_ANY, XCB_GRAB_ANY, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); #endif #ifdef Q_OS_WIN display=this; - qDebug()<<"Setting Windows Keyboard hook"; + Client::KDRStdErr()<<"Setting Windows Keyboard hook"; if(!SetWindowsHookExA( WH_KEYBOARD_LL,LowLevelKeyboardProc,0, 0 )) { - qDebug()<<"Set kbd hook Failed"<<GetLastError(); + Client::KDRStdErr()<<"Set kbd hook Failed "<<GetLastError(); } #endif } @@ -122,7 +121,7 @@ void DisplayArea::slotGrabDisplay() { if(hasUpdates) { -// qDebug()<<"save display"; +// Client::KDRStdErr()<<"save display"; QScreen *screen = QGuiApplication::primaryScreen(); displayPix = screen->grabWindow(winId()); hasUpdates=false; @@ -149,7 +148,7 @@ void DisplayArea::setDisplayPix(QPixmap pix, int32_t x, int32_t y) void DisplayArea::paintEvent(QPaintEvent* ev) { -// qDebug()<<"paint event:"<<ev->rect(); +// Client::KDRStdErr()<<"paint event:"<<ev->rect(); QPainter painter; if(! displayPix.isNull()) { @@ -201,7 +200,7 @@ void DisplayArea::paintEvent(QPaintEvent* ev) painter.end(); } else - qDebug()<<"DISPLAY PIX IS NULL"; + Client::KDRStdErr()<<"DISPLAY PIX IS NULL"; } uint32_t DisplayArea::X11MouseButtonsState(Qt::MouseButtons qtMouseButtons) @@ -244,7 +243,7 @@ void DisplayArea::mouseMoveEvent(QMouseEvent* event) uint32_t etype, x, y; etype=MOUSEMOTION; -// qDebug()<<"kbd mods"<<event->modifiers(); +// Client::KDRStdErr()<<"kbd mods"<<event->modifiers(); x=event->x(); y=event->y(); @@ -255,13 +254,13 @@ void DisplayArea::mouseMoveEvent(QMouseEvent* event) parent->sendEvent(evmsg); -// qDebug()<<"mouse move"<<event->x()<<event->y(); +// Client::KDRStdErr()<<"mouse move"<<event->x()<<event->y(); } void DisplayArea::mousePressEvent(QMouseEvent* event) { -// qDebug()<<"kbd mods"<<event->modifiers(); +// Client::KDRStdErr()<<"kbd mods"<<event->modifiers(); char evmsg[EVLENGTH]={}; uint32_t etype, state, button; etype=MOUSEPRESS; @@ -275,12 +274,12 @@ void DisplayArea::mousePressEvent(QMouseEvent* event) parent->sendEvent(evmsg); -// qDebug()<<"mouse press"<<event->button()<<event->buttons()<<button<<state; +// Client::KDRStdErr()<<"mouse press"<<event->button()<<event->buttons()<<button<<state; } void DisplayArea::mouseReleaseEvent(QMouseEvent* event) { -// qDebug()<<"kbd mods"<<event->modifiers(); +// Client::KDRStdErr()<<"kbd mods"<<event->modifiers(); char evmsg[EVLENGTH]={}; uint32_t etype, state, button; etype=MOUSERELEASE; @@ -294,12 +293,12 @@ void DisplayArea::mouseReleaseEvent(QMouseEvent* event) parent->sendEvent(evmsg); -// qDebug()<<"mouse release"<<event->button()<<event->buttons()<<button<<state; +// Client::KDRStdErr()<<"mouse release"<<event->button()<<event->buttons()<<button<<state; } void DisplayArea::wheelEvent(QWheelEvent* event) { -// qDebug()<<"mouse wheel event"<<event->buttons()<<event->angleDelta(); +// Client::KDRStdErr()<<"mouse wheel event"<<event->buttons()<<event->angleDelta(); char evmsg[EVLENGTH]={}; uint32_t etype, state, button; @@ -320,7 +319,7 @@ void DisplayArea::wheelEvent(QWheelEvent* event) memcpy(evmsg+4,(char*)&state,4); memcpy(evmsg+8,(char*)&button,4); -// qDebug()<<etype<<state<<button; +// Client::KDRStdErr()<<etype<<state<<button; parent->sendEvent(evmsg); etype=MOUSERELEASE; @@ -341,7 +340,7 @@ void DisplayArea::wheelEvent(QWheelEvent* event) memcpy(evmsg+4,(char*)&state,4); memcpy(evmsg+8,(char*)&button,4); -// qDebug()<<etype<<state<<button; +// Client::KDRStdErr()<<etype<<state<<button; parent->sendEvent(evmsg); } @@ -349,32 +348,32 @@ void DisplayArea::wheelEvent(QWheelEvent* event) void DisplayArea::debugLinuxMods(uint32_t nativeModifiers) { if(nativeModifiers&ShiftMask) - qDebug()<<"shift"; + Client::KDRStdErr()<<"shift"; if(nativeModifiers&ControlMask) - qDebug()<<"ctrl"; + Client::KDRStdErr()<<"ctrl"; if(nativeModifiers&LockMask) - qDebug()<<"lock"; + Client::KDRStdErr()<<"lock"; if(nativeModifiers&Mod1Mask) - qDebug()<<"mod1"; + Client::KDRStdErr()<<"mod1"; if(nativeModifiers&Mod2Mask) - qDebug()<<"mod2"; + Client::KDRStdErr()<<"mod2"; if(nativeModifiers&Mod3Mask) - qDebug()<<"mod3"; + Client::KDRStdErr()<<"mod3"; if(nativeModifiers&Mod4Mask) - qDebug()<<"mod4"; + Client::KDRStdErr()<<"mod4"; if(nativeModifiers&Mod5Mask) - qDebug()<<"mod5"; + Client::KDRStdErr()<<"mod5"; if(nativeModifiers&WINCAPS) - qDebug()<<"win caps"; + Client::KDRStdErr()<<"win caps"; if(nativeModifiers&WINNUM) - qDebug()<<"win num"; + Client::KDRStdErr()<<"win num"; } */ void DisplayArea::keyPressEvent(QKeyEvent* event) { /* - qDebug()<<"Press key:"<<event->key()<<"mod:"<<event->modifiers()<<"nat mod:"<<event->nativeModifiers()<< + Client::KDRStdErr()<<"Press key:"<<event->key()<<"mod:"<<event->modifiers()<<"nat mod:"<<event->nativeModifiers()<< "nat scan:"<<event->nativeScanCode()<<"nat vkey:"<<event->nativeVirtualKey()<<"text:"<<event->text(); // debugLinuxMods(event->nativeModifiers());*/ @@ -397,7 +396,7 @@ void DisplayArea::keyPressEvent(QKeyEvent* event) void DisplayArea::keyReleaseEvent(QKeyEvent* event) { /* - qDebug()<<"Release key:"<<event->key()<<"mod:"<<event->modifiers()<<"nat mod:"<<event->nativeModifiers()<< + Client::KDRStdErr()<<"Release key:"<<event->key()<<"mod:"<<event->modifiers()<<"nat mod:"<<event->nativeModifiers()<< "nat scan:"<<event->nativeScanCode()<<"nat vkey:"<<event->nativeVirtualKey()<<"text:"<<event->text(); */ diff --git a/menuframe.cpp b/menuframe.cpp index 4db0ffe..a46cd75 100644 --- a/menuframe.cpp +++ b/menuframe.cpp @@ -19,7 +19,6 @@ */ #include <menuframe.h> -#include <QDebug> #include <QMouseEvent> #include <QCursor> #include <QToolButton> @@ -234,7 +233,7 @@ void MenuFrame::adjustPosition() int y=0; int x=0; -// qDebug()<<"Widget width"<<width(); +// Client::KDRStdErr()<<"Widget width"<<width(); switch(orientation) { case BOTTOM: @@ -325,7 +324,7 @@ void MenuFrame::applyStyle() QString bgCol; QColor col=pal.color(QPalette::Window); - bgCol.sprintf("rgba(%d,%d,%d,%d)",col.red(), col.green(), col.blue() ,col.alpha()) ; + bgCol.asprintf("rgba(%d,%d,%d,%d)",col.red(), col.green(), col.blue() ,col.alpha()) ; switch(orientation) { @@ -470,7 +469,7 @@ void MenuFrame::setHasPointer(bool hasPointer) if(hasPointer==hovered) return; hovered=hasPointer; -// qDebug()<<"hovered:"<<hovered; +// Client::KDRStdErr()<<"hovered:"<<hovered; int newY=y(); int newX=x(); @@ -514,7 +513,7 @@ void MenuFrame::mouseReleaseEvent(QMouseEvent* ) void MenuFrame::setPinned(bool toggled) { - qDebug()<<"pinned: "<<toggled; + Client::KDRStdErr()<<"pinned: "<<toggled; isPinned=toggled; QSettings s( "Obviously Nice","x2gokdriveclient"); s.setValue("pinned",isPinned); diff --git a/xcbclip.cpp b/xcbclip.cpp index c5a9c51..6adf47c 100644 --- a/xcbclip.cpp +++ b/xcbclip.cpp @@ -19,7 +19,6 @@ */ #include "xcbclip.h" -#include <QDebug> #include <QX11Info> #include <QTimer> #include <QBuffer> @@ -74,7 +73,7 @@ XCBClip::XCBClip(Client* parent) xfixes_query = xcb_xfixes_query_version_reply (con, xfixes_query_cookie, &error); if (!xfixes_query || error || xfixes_query->major_version < 2) { - qDebug()<<"XFixes query failed"; + Client::KDRStdErr()<<"XFixes query failed"; free(error); } else @@ -113,7 +112,7 @@ xcb_atom_t XCBClip::atom(const QString& name) cookie = xcb_intern_atom(con, 0, name.length(), name.toLatin1().data()); if ((reply = xcb_intern_atom_reply(con, cookie, NULL))) { -// qDebug()<<"found atom for "<<name; +// Client::KDRStdErr()<<"found atom for "<<name; a=reply->atom; free(reply); } @@ -267,27 +266,27 @@ void XCBClip::processDelayedRequests() SelectionType selection = selection_from_atom( d->request->selection); if(currentXTime() > (d->request->time + SELECTION_DELAY)) { -// qDebug()<<"timeout selection: "<<selection; +// Client::KDRStdErr()<<"timeout selection: "<<selection; discardDelayedRequest(i); continue; } if(!inputSelection[selection].owner) { -// qDebug()<<"we are not owner of requested selection: "<<selection; +// Client::KDRStdErr()<<"we are not owner of requested selection: "<<selection; //we are not anymore owners of this selection discardDelayedRequest(i); continue; } if(inputSelection[selection].timestamp > d->request->time ) { -// qDebug()<<"selection request for "<<selection<<" is too old"; +// Client::KDRStdErr()<<"selection request for "<<selection<<" is too old"; //requested selection is older than the current one discardDelayedRequest(i); continue; } if(!check_req_sanity(d->request)) { -// qDebug()<<"can't convert selection "<<selection<<" to requested myme type "<<d->request->property; +// Client::KDRStdErr()<<"can't convert selection "<<selection<<" to requested myme type "<<d->request->property; //our selection don't support requested mime type discardDelayedRequest(i); continue; @@ -311,7 +310,7 @@ void XCBClip::updateCurrentTime(xcb_timestamp_t t) //update current time lastXTime=t; timeDifference=QDateTime::currentMSecsSinceEpoch() - t; -// qDebug()<<"X time dif:"<<QDateTime::currentMSecsSinceEpoch() - t<<"x11 time"<<t<<"calculated: "<<currentXTime(); +// Client::KDRStdErr()<<"X time dif:"<<QDateTime::currentMSecsSinceEpoch() - t<<"x11 time"<<t<<"calculated: "<<currentXTime(); } } @@ -346,10 +345,10 @@ void XCBClip::checkEvents() updateCurrentTime(notify_event->timestamp); -// qDebug()<<"SEL OWNER notify, selection:"<<notify_event->selection<< " window "<< notify_event->window<< "owner"<< notify_event->owner; +// Client::KDRStdErr()<<"SEL OWNER notify, selection:"<<notify_event->selection<< " window "<< notify_event->window<< "owner"<< notify_event->owner; if(notify_event->owner == clipWinId) { -// qDebug()<<"not processing, we are the owner of this notify"; +// Client::KDRStdErr()<<"not processing, we are the owner of this notify"; } else { @@ -357,7 +356,7 @@ void XCBClip::checkEvents() { case CLIP_SERVER: case CLIP_NONE: - qDebug()<<"Client selection is disabled"; + Client::KDRStdErr()<<"Client selection is disabled"; return; default: break; @@ -401,7 +400,7 @@ void XCBClip::checkEvents() } else { -// qDebug()<<"not processing this event "<<response_type; +// Client::KDRStdErr()<<"not processing this event "<<response_type; } } @@ -418,7 +417,7 @@ void XCBClip::process_selection_notify(xcb_generic_event_t *e) { xcb_selection_notify_event_t *sel_event; -// qDebug()<<"selection notify"; +// Client::KDRStdErr()<<"selection notify"; sel_event=(xcb_selection_notify_event_t *)e; updateCurrentTime(sel_event->time); @@ -429,15 +428,15 @@ void XCBClip::process_selection_notify(xcb_generic_event_t *e) if (sel_event->requestor != clipWinId) { -// qDebug()<<("not our window"); +// Client::KDRStdErr()<<("not our window"); return; } else { -// qDebug()<<"selection notify sel , target , property "<< sel_event->selection<< sel_event->target<< sel_event->property; +// Client::KDRStdErr()<<"selection notify sel , target , property "<< sel_event->selection<< sel_event->target<< sel_event->property; if(sel_event->property==XCB_NONE) { -// qDebug()<<( "NO SELECTION"); +// Client::KDRStdErr()<<( "NO SELECTION"); } else { @@ -471,7 +470,7 @@ void XCBClip::remove_obsolete_incr_transactions( bool checkTs) { if( (!checkTs) || ( incrTransactions[i]->timestamp+SELECTION_DELAY < QDateTime::currentMSecsSinceEpoch())) { - qDebug()<<"timeout INCR selection for "<<incrTransactions[i]->requestor<<incrTransactions[i]->timestamp<< QDateTime::currentMSecsSinceEpoch(); + Client::KDRStdErr()<<"timeout INCR selection for "<<incrTransactions[i]->requestor<<" "<<incrTransactions[i]->timestamp<<" "<<QDateTime::currentMSecsSinceEpoch(); destroy_incr_transaction(i); } } @@ -490,7 +489,7 @@ void XCBClip::process_incr_transaction_property(xcb_property_notify_event_t * pn uint left=tr->data.size()-tr->sentBytes; if(!left) { -// qDebug()<<"all INCR data sent to"<<tr->requestor; +// Client::KDRStdErr()<<"all INCR data sent to "<<tr->requestor; //all data sent, sending NULL data and destroying transaction xcb_change_property(con, XCB_PROP_MODE_REPLACE, tr->requestor, tr->property, tr->target, 8, 0, NULL); @@ -500,7 +499,7 @@ void XCBClip::process_incr_transaction_property(xcb_property_notify_event_t * pn } uint sendingBytes=(INCR_SIZE< left)?INCR_SIZE:left; -// qDebug()<<"sending incr bytes"<<sendingBytes ; +// Client::KDRStdErr()<<"sending incr bytes "<<sendingBytes ; xcb_change_property(con, XCB_PROP_MODE_REPLACE, tr->requestor, tr->property, tr->target, 8, sendingBytes, tr->data.constData() + tr->sentBytes); @@ -518,7 +517,7 @@ void XCBClip::process_property_notify(xcb_generic_event_t *e) { xcb_property_notify_event_t *pn; -// qDebug()<<("property notify"); +// Client::KDRStdErr()<<("property notify"); pn = (xcb_property_notify_event_t *)e; updateCurrentTime(pn->time); @@ -530,13 +529,13 @@ void XCBClip::process_property_notify(xcb_generic_event_t *e) process_incr_transaction_property(pn); return; } -// qDebug()<<"property, state "<< pn->atom<< pn->state; +// Client::KDRStdErr()<<"property, state "<< pn->atom<< pn->state; if(pn->state==XCB_PROPERTY_NEW_VALUE) { if(incrAtom==pn->atom && incrementalSize) { //we recieveing the selection data incrementally, let's read a next chunk -// qDebug()<<"reading incr property "<< pn->atom; +// Client::KDRStdErr()<<"reading incr property "<< pn->atom; read_selection_property(currentSelection, pn->atom); } } @@ -558,13 +557,13 @@ void XCBClip::read_selection_property(xcb_atom_t selection, xcb_atom_t property) reply=xcb_get_property_reply(con, cookie, NULL); if(!reply) { - qDebug()<<( "NULL reply"); + Client::KDRStdErr()<< "NULL reply"; } else { if(reply->type==XCB_NONE) { -// qDebug()<<( "NONE reply"); +// Client::KDRStdErr()<< "NONE reply"; } else { @@ -572,12 +571,12 @@ void XCBClip::read_selection_property(xcb_atom_t selection, xcb_atom_t property) stype=atom_name(reply->type); sprop=atom_name(property); -// qDebug()<< "Property, type, format, length"<< sprop<< stype<< reply->format<< reply->length; +// Client::KDRStdErr()<< "Property, type, format, length"<< sprop<< stype<< reply->format<< reply->length; //need to read property incrementally if(reply->type == atom("INCR")) { unsigned int sz=*((unsigned int*) xcb_get_property_value(reply)); -// qDebug()<< "have incr property size: "<< sz; +// Client::KDRStdErr()<< "have incr property size: "<< sz; incrAtom=property; incrementalSize=sz; incrementalSizeRead=0; @@ -593,12 +592,12 @@ void XCBClip::read_selection_property(xcb_atom_t selection, xcb_atom_t property) { if(reply->format!=32) { - qDebug()<<( "wrong format for TARGETS"); + Client::KDRStdErr()<<( "wrong format for TARGETS"); } else { QStringList atoms=atomsInReply(reply); -// qDebug() << "target supports mime types:"<<atoms; +// Client::KDRStdErr() << "target supports mime types:"<<atoms; data_atom=0; //get the best of supported mime types and request the selection in this format data_atom=best_atom_from_list(atoms); @@ -615,7 +614,7 @@ void XCBClip::read_selection_property(xcb_atom_t selection, xcb_atom_t property) mime = PIXMAP; } -// qDebug()<<"MIME"<<mime; +// Client::KDRStdErr()<<"MIME"<<mime; parent->send_selnotify_to_server(sel,mime); } else @@ -629,7 +628,7 @@ void XCBClip::read_selection_property(xcb_atom_t selection, xcb_atom_t property) request_selection_data( selection, data_atom, data_atom, 0); else { -// qDebug()<<( "there are no supported mime types in the target"); +// Client::KDRStdErr()<<( "there are no supported mime types in the target"); } } } @@ -687,7 +686,7 @@ void XCBClip::read_selection_property(xcb_atom_t selection, xcb_atom_t property) if(!bytes_left && ! bytes_read && !xcb_get_property_value_length(reply)) { //we got the property with 0 size it means that we recieved all data of incr property -// qDebug()<<"INCR Property done, read " << incrementalSizeRead; +// Client::KDRStdErr()<<"INCR Property done, read " << incrementalSizeRead; incrAtom=0; incrementalSize=0; //it's the last chunk @@ -712,7 +711,7 @@ void XCBClip::read_selection_property(xcb_atom_t selection, xcb_atom_t property) } bytes_read+=xcb_get_property_value_length(reply); -// qDebug()<<"read chunk of selection - size, total read, left, first:, last:"<< xcb_get_property_value_length(reply)<< bytes_read<< bytes_left<< chunk->firstChunk<< chunk->lastChunk; +// Client::KDRStdErr()<<"read chunk of selection - size, total read, left, first:, last:"<< xcb_get_property_value_length(reply)<< bytes_read<< bytes_left<< chunk->firstChunk<< chunk->lastChunk; //attach chunk to the end of output chunk queue parent-> addToSelectionOutput(chunk); @@ -728,7 +727,7 @@ void XCBClip::read_selection_property(xcb_atom_t selection, xcb_atom_t property) if(!reply) { //something is wrong - qDebug()<<("NULL reply"); + Client::KDRStdErr()<<("NULL reply"); break; } } @@ -738,7 +737,7 @@ void XCBClip::read_selection_property(xcb_atom_t selection, xcb_atom_t property) else { stype=atom_name(reply->type); - qDebug()<<"Not supported mime type: "<<stype << reply->type; + Client::KDRStdErr()<<"Not supported mime type: "<<stype << reply->type; } } if(reply) @@ -791,7 +790,7 @@ void XCBClip::setInputSelectionData(SelectionType selection, SelectionMime mime, { //if notify is true, we don't have actual data, just notification //copy data to selection buffer -// qDebug()<<"Get chunk of input selection: selection, myme, firstChunk, lastChunk, compressed, size:"<<selection<<mime<<firstChunk<<lastChunk<<compressed<<size<<notify; +// Client::KDRStdErr()<<"Get chunk of input selection: selection, myme, firstChunk, lastChunk, compressed, size:"<<selection<<mime<<firstChunk<<lastChunk<<compressed<<size<<notify; if(firstChunk) @@ -807,7 +806,7 @@ void XCBClip::setInputSelectionData(SelectionType selection, SelectionMime mime, { total_compressed+=compressed; inputSelection[selection].selData.append(Client::zuncompress(data, compressed, size)); -// qDebug()<<"uncompress from "<<compressed<<" to "<<size; +// Client::KDRStdErr()<<"uncompress from "<<compressed<<" to "<<size; } if(lastChunk ) @@ -815,7 +814,7 @@ void XCBClip::setInputSelectionData(SelectionType selection, SelectionMime mime, if(notify) { inputSelection[selection].state=InputSelection::NOTIFIED; -// qDebug()<<"Got selection notify from server"; +// Client::KDRStdErr()<<"Got selection notify from server"; own_selection(selection); } else @@ -826,7 +825,7 @@ void XCBClip::setInputSelectionData(SelectionType selection, SelectionMime mime, own_selection(selection); } inputSelection[selection].state=InputSelection::COMPLETED; -// qDebug()<<"Got selection data for "<<selection<<"total size: "<<inputSelection[selection].selData.size()<<"compressed size"<<total_compressed; +// Client::KDRStdErr()<<"Got selection data for "<<selection<<"total size: "<<inputSelection[selection].selData.size()<<"compressed size"<<total_compressed; } } @@ -838,7 +837,7 @@ void XCBClip::own_selection(SelectionType selection) { case CLIP_CLIENT: case CLIP_NONE: - qDebug()<<"Server selection is disabled"; + Client::KDRStdErr()<<"Server selection is disabled"; return; default: break; @@ -878,11 +877,11 @@ bool XCBClip::process_selection_request(xcb_generic_event_t *e) SelectionType sel=selection_from_atom(req->selection); -// qDebug()<<"selection request for"<<atom_name(req->selection)<<atom_name(req->target)<<atom_name(req->property)<< "from "<<req->requestor<<"we are "<<clipWinId; +// Client::KDRStdErr()<<"selection request for"<<atom_name(req->selection)<<atom_name(req->target)<<atom_name(req->property)<< "from "<<req->requestor<<"we are "<<clipWinId; if(!inputSelection[sel].owner) { //we don't own this selection -// qDebug()<<"not our selection"; +// Client::KDRStdErr()<<"not our selection"; xcb_send_event(con, false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (char*)event); xcb_flush(con); free(event); @@ -892,7 +891,7 @@ bool XCBClip::process_selection_request(xcb_generic_event_t *e) if(inputSelection[sel].timestamp > req->time) { //selection changed after request -// qDebug()<<"requested selection doesn't exist anymore"; +// Client::KDRStdErr()<<"requested selection doesn't exist anymore"; xcb_send_event(con, false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (char*)event); xcb_flush(con); free(event); @@ -903,7 +902,7 @@ bool XCBClip::process_selection_request(xcb_generic_event_t *e) if(req->target==atom("TIMESTAMP")) { event->property=property; -// qDebug()<<"requested TIMESTAMP"; +// Client::KDRStdErr()<<"requested TIMESTAMP"; xcb_change_property(con, XCB_PROP_MODE_REPLACE, req->requestor, property, XCB_ATOM_INTEGER, 32, 1, &inputSelection[sel].timestamp); @@ -911,7 +910,7 @@ bool XCBClip::process_selection_request(xcb_generic_event_t *e) else if(req->target==atom("TARGETS")) { event->property=property; -// qDebug()<<"requested TARGETS"; +// Client::KDRStdErr()<<"requested TARGETS"; send_mime_types(req); } else @@ -972,7 +971,7 @@ xcb_atom_t XCBClip::set_data_property(xcb_selection_request_event_t* req, QByteA //this types of application not supporting incr selection if(atom_name(req->property)=="_XT_SELECTION_0" || atom_name(req->property)=="_QT_SELECTION") { -// qDebug()<<atom_name(req->property)<<"doesn't support INCR"; +// Client::KDRStdErr()<<atom_name(req->property)<<"doesn't support INCR"; support_incr=false; } @@ -989,7 +988,7 @@ xcb_atom_t XCBClip::set_data_property(xcb_selection_request_event_t* req, QByteA xcb_flush(con); return req->property; } - qDebug()<<"data is too big"; + Client::KDRStdErr()<<"data is too big"; return XCB_NONE; } @@ -1004,7 +1003,7 @@ xcb_atom_t XCBClip::set_data_property(xcb_selection_request_event_t* req, QByteA //sending INCR atom to let requester know that we are starting data incrementally uint bytes=data->size(); - qDebug()<<"starting INCR send of size"<<data->size()<<" for win ID "<<req->requestor; + Client::KDRStdErr()<<"starting INCR send of size "<<data->size()<<" for win ID "<<req->requestor; xcb_change_property(con, XCB_PROP_MODE_REPLACE, req->requestor, req->property, atom("INCR"), 32, 1, (const void *)&bytes); startIncrTransaction(req->requestor, req->property, req->target, *data ); @@ -1026,7 +1025,7 @@ void XCBClip::startIncrTransaction(xcb_window_t requestor, xcb_atom_t property, tr->sentBytes=0; tr->timestamp=QDateTime::currentMSecsSinceEpoch(); incrTransactions<<tr; - qDebug()<<"INCR start"<<tr->timestamp; + Client::KDRStdErr()<<"INCR start "<<tr->timestamp; const quint32 mask[] = { XCB_EVENT_MASK_PROPERTY_CHANGE }; //we'll recive property change events for requestor window from now xcb_change_window_attributes(con, requestor, @@ -1043,12 +1042,12 @@ bool XCBClip::check_req_sanity(xcb_selection_request_event_t* req) //if it's one of supported text formats send without convertion if(is_string_atom(req->target)) { - // qDebug()<<"sending UTF text"; + // Client::KDRStdErr()<<"sending UTF text"; return true; } else { - qDebug()<<"unsupported property requested:"<<atom_name(req->target); + Client::KDRStdErr()<<"unsupported property requested: "<<atom_name(req->target); return false; } } @@ -1056,10 +1055,10 @@ bool XCBClip::check_req_sanity(xcb_selection_request_event_t* req) { if(!is_image_atom(req->target)) { - qDebug()<<"unsupported property requested:"<<atom_name(req->target); + Client::KDRStdErr()<<"unsupported property requested: "<<atom_name(req->target); return false; } - // qDebug()<<"sending "<<atom_name(req->target); + // Client::KDRStdErr()<<"sending "<<atom_name(req->target); return true; } } @@ -1076,14 +1075,14 @@ xcb_atom_t XCBClip::send_data(xcb_selection_request_event_t* req) } else { -// qDebug()<<"sending "<<atom_name(req->target); +// Client::KDRStdErr()<<"sending "<<atom_name(req->target); //convert to desireable format QImage img=QImage::fromData(inputSelection[sel].selData); QByteArray ba; QBuffer buffer(&ba); buffer.open(QIODevice::WriteOnly); img.save(&buffer, mime_to_QT_img(atom_name(req->target)).toLatin1()); -// qDebug()<<"converted to"<<mime_to_QT_img(atom_name(req->target))<<ba.size(); +// Client::KDRStdErr()<<"converted to"<<mime_to_QT_img(atom_name(req->target))<<ba.size(); return set_data_property(req, &ba); } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdriveclient.git