This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch feature/udp-support in repository x2gokdriveclient. commit b28603bcccbfe640618f84ade84638843d3fb760 Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Mon Dec 12 11:29:25 2022 -0600 Server to client selection in UDP mode. --- client.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++------------------ client.h | 4 ++-- xcbclip.cpp | 9 +++++---- 3 files changed, 49 insertions(+), 24 deletions(-) diff --git a/client.cpp b/client.cpp index 4c3b547..b954749 100644 --- a/client.cpp +++ b/client.cpp @@ -959,8 +959,8 @@ void Client::processServerPacket ( QByteArray data ) } case SELECTION: { -// KDRStdErr()<<"Get Selection"; -// getSelection(data); +// KDRStdErr()<<"Get Selection"<<KDR_ENDL; + getSelection(data); break; } case SERVER_VERSION: @@ -970,6 +970,7 @@ void Client::processServerPacket ( QByteArray data ) } case DEMANDCLIENTSELECTION: { + KDRStdErr()<<"Get Selection demand"<<KDR_ENDL; // getClientSelection(data); break; } @@ -1169,7 +1170,7 @@ void Client::getLastProcessedEvent(QByteArray data) { messageBuffer=data.data(); uint16_t lastEvSeq=*((uint16_t*)messageBuffer+2); - KDRStdErr()<<"Server alive, last processed event "<<lastEvSeq<<KDR_ENDL; +// KDRStdErr()<<"Server alive, last processed event "<<lastEvSeq<<KDR_ENDL; QList<uint16_t> sequences=clientEventPackets.keys(); uint16_t s; int32_t current_long,last_long; @@ -1281,15 +1282,18 @@ void Client::getCursor(QByteArray data) } } -void Client::getSelectionBuffer() +void Client::getSelectionBuffer(char *data) { + if(connectionType==UDP) + messageBuffer=data; #ifndef Q_OS_LINUX //if using qt class, not supporting on demand load of data setInputSelectionData(selectionClipboard, selectionFormat, firstChunk, lastChunk, compressed_size, selectionSize, messageBuffer); #else clipboard->setInputSelectionData(selectionClipboard, selectionFormat, firstChunk, lastChunk, compressed_size, selectionSize, messageBuffer); #endif - freeMessageBuffer(); + if(connectionType==TCP) + freeMessageBuffer(); } @@ -1681,9 +1685,17 @@ void Client::getDeletedCursors(QByteArray data) } } -void Client::getSelection() +void Client::getSelection(QByteArray data) { - bytesReady=0; + if(connectionType==UDP) + { + messageBuffer=data.data(); + bytesLeftToRead=0; + } + else + { + bytesReady=0; + } selectionClipboard=CLIPBOARD; if( *((uint32_t*)messageBuffer+1 ) != CLIPBOARD) { @@ -1703,24 +1715,25 @@ void Client::getSelection() lastChunk=*((uint32_t*)messageBuffer+5); compressed_size=*((uint32_t*)messageBuffer+6); selectionTotalSize=*((uint32_t*)messageBuffer+7); + KDRStdErr()<<"Got selection with sizes:"<<compressed_size<<" "<<selectionSize<< " "<<selectionTotalSize<<KDR_ENDL; //if we are supporting selection on demand, check if it's not selection notify event if(serverSupportsExtSelection() && firstChunk && lastChunk && (selectionSize == 0 ) && (selectionTotalSize == 0)) { //set input selection with size 0 and notify true. Clipboard will know that we have a notification -#ifdef Q_OS_LINUX + #ifdef Q_OS_LINUX clipboard->setInputSelectionData(selectionClipboard, selectionFormat, true, true, 0, 0, 0, true); -#else + #else setInputSelectionData(selectionClipboard, selectionFormat, true, true, 0, 0, 0, true); -#endif + #endif } else if(serverSupportsExtSelection() && lastChunk && (selectionSize==0)) { //it's last chunk of incr selection with size 0 -#ifdef Q_OS_LINUX + #ifdef Q_OS_LINUX clipboard->setInputSelectionData(selectionClipboard, selectionFormat, firstChunk, lastChunk, 0, 0, 0); -#else + #else setInputSelectionData(selectionClipboard, selectionFormat, firstChunk, lastChunk, 0, 0, 0); -#endif + #endif } } else @@ -1731,15 +1744,24 @@ void Client::getSelection() compressed_size=0; } - currentDataType=SELECTIONBUFFER; //if data is compressed, read the "compressed_size" bytes if(compressed_size) + { bytesLeftToRead=compressed_size; + } else bytesLeftToRead=selectionSize; - // KDRStdErr()<<"Get Selection, is Clipboard"<<selectionClipboard<<selectionFormat<<"chunk size"<<selectionSize<<"left"<<bytesLeftToRead; - freeMessageBuffer(); + KDRStdErr()<<"Get Selection, is Clipboard "<<selectionClipboard<<selectionFormat<<" chunk size "<<selectionSize<<" left "<<bytesLeftToRead<<KDR_ENDL; + if(connectionType==TCP) + { + freeMessageBuffer(); + } + else + { + if(bytesLeftToRead) + getSelectionBuffer(data.data()+4*8); + } } @@ -2154,10 +2176,10 @@ void Client::slotSynchronize() //not connected or server not supporting KEEPALIVE event if(!connected || serverVersion<3) return; - KDRStdErr()<<"Synchronizing: control seq:"<<serverControlSeq<<" frame seq:"<<serverFrameSeq<<" repaint seq:"<<serverRepaintSeq<< + /*KDRStdErr()<<"Synchronizing: control seq:"<<serverControlSeq<<" frame seq:"<<serverFrameSeq<<" repaint seq:"<<serverRepaintSeq<< " frame cache:"<<frameCache.size()<<" srv control:"<<serverControlPackets.size()<< " srv frame:"<<serverFramePackets.size()<<" srv repaint:"<<serverRepaintPackets.size()<<" contr resend: "<< - requestedControlResend.size()<<" client event:"<<clientEventPackets.size()<<KDR_ENDL; + requestedControlResend.size()<<" client event:"<<clientEventPackets.size()<<KDR_ENDL;*/ char evmsg[EVLENGTH]{}; uint32_t etype; @@ -2605,6 +2627,8 @@ void Client::requestSelectionFromServer(SelectionType sel) uint16_t selection=sel; uint32_t etype; etype=DEMANDSELECTION; + + KDRStdErr()<<"Requesting selection from server"<<KDR_ENDL; memcpy(evmsg,(char*)&etype,4); memcpy(evmsg+4,(char*)&selection,2); sendEvent(evmsg,6); diff --git a/client.h b/client.h index f69b803..4e75c40 100644 --- a/client.h +++ b/client.h @@ -315,8 +315,8 @@ private: void getDeletedCursors(QByteArray data=QByteArray()); void getDeletedFramesList(char* data=NULL); void getDeletedCursorsList(char* data=NULL); - void getSelection(); - void getSelectionBuffer(); + void getSelection(QByteArray data=QByteArray()); + void getSelectionBuffer(char* data=NULL); void getWinUpdate(); void getWinUpdateBuffer(); void renderFrame(); diff --git a/xcbclip.cpp b/xcbclip.cpp index 6adf47c..598ccb9 100644 --- a/xcbclip.cpp +++ b/xcbclip.cpp @@ -790,7 +790,8 @@ void XCBClip::setInputSelectionData(SelectionType selection, SelectionMime mime, { //if notify is true, we don't have actual data, just notification //copy data to selection buffer -// Client::KDRStdErr()<<"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<<KDR_ENDL; if(firstChunk) @@ -806,7 +807,7 @@ void XCBClip::setInputSelectionData(SelectionType selection, SelectionMime mime, { total_compressed+=compressed; inputSelection[selection].selData.append(Client::zuncompress(data, compressed, size)); -// Client::KDRStdErr()<<"uncompress from "<<compressed<<" to "<<size; + Client::KDRStdErr()<<"uncompress from "<<compressed<<" to "<<size<<KDR_ENDL; } if(lastChunk ) @@ -814,7 +815,7 @@ void XCBClip::setInputSelectionData(SelectionType selection, SelectionMime mime, if(notify) { inputSelection[selection].state=InputSelection::NOTIFIED; -// Client::KDRStdErr()<<"Got selection notify from server"; + Client::KDRStdErr()<<"Got selection notify from server"<<KDR_ENDL; own_selection(selection); } else @@ -825,7 +826,7 @@ void XCBClip::setInputSelectionData(SelectionType selection, SelectionMime mime, own_selection(selection); } inputSelection[selection].state=InputSelection::COMPLETED; -// Client::KDRStdErr()<<"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<<KDR_ENDL; } } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdriveclient.git