[X2Go-Commits] [x2gokdriveclient] 01/01: send a recive feature versions.

git-admin at x2go.org git-admin at x2go.org
Mon Aug 24 18:06:51 CEST 2020


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gokdriveclient.

commit ff3dd40688d8c7a9d5d6ea1fdaeeaf738ceb75f9
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Mon Aug 24 11:06:40 2020 -0500

    send a recive feature versions.
---
 client.cpp       | 38 ++++++++++++++++++++++++++++++++++++++
 client.h         | 20 +++++++++++++++++++-
 debian/changelog |  1 +
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/client.cpp b/client.cpp
index 612519b..565c30b 100644
--- a/client.cpp
+++ b/client.cpp
@@ -798,6 +798,13 @@ void Client::setCursor()
 {
 }
 
+void Client::getServerversion()
+{
+    serverVersion=*((uint16_t*)messageBuffer+2);
+    qDebug()<<"server version:"<<serverVersion;
+}
+
+
 
 void Client::getCursor()
 {
@@ -1082,6 +1089,11 @@ void Client::readDataHeader()
             getSelection();
             break;
         }
+        case SERVER_VERSION:
+        {
+            getServerversion();
+            break;
+        }
         default:
         {
             qDebug()<<"Unsupported header type: "<<data_type;
@@ -1199,6 +1211,7 @@ void Client::socketConnected()
     }
 
     connected=true;
+
     if(geometry().width() != width || geometry().height() != height )
         resize(width, height);
     else
@@ -1207,6 +1220,8 @@ void Client::socketConnected()
         sendGeometryEvent();
     }
 
+    sendClientVersion();
+
     if(fullscreen)
     {
         QTimer::singleShot(1000, this, SLOT( slotFS()));
@@ -1343,6 +1358,29 @@ void Client::sendGeometryEvent()
 }
 
 
+void Client::sendClientVersion()
+{
+    //sending the feature vesrion and OS version to the server
+    char evmsg[EVLENGTH]{};
+    uint16_t version, os;
+    uint32_t etype;
+    version=FEATURE_VERSION;
+    os=OS_LINUX;
+#ifdef Q_OS_WIN
+    os=OS_WIN;
+#endif
+#ifdef Q_OS_DARWIN
+    os=OS_DARWIN
+#endif
+    etype=CLIENTVERSION;
+    memcpy(evmsg,(char*)&etype,4);
+    memcpy(evmsg+4,(char*)&version,2);
+    memcpy(evmsg+6,(char*)&os,2);
+    qDebug()<<"Sending version:"<<version<<"OS:"<<os;
+    sendEvent(evmsg);
+}
+
+
 void Client::geometryChanged()
 {
     if(!connected)
diff --git a/client.h b/client.h
index b706a4f..5aba47a 100644
--- a/client.h
+++ b/client.h
@@ -21,6 +21,16 @@
 #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 0 - 1: sending and recieving client and OS version
+#define FEATURE_VERSION 1
+
+//Version of client OS for same reason
+enum OS_VERSION{OS_LINUX, OS_WINDOWS, OS_DARWIN};
+
+
 #define EVLENGTH 41
 
 
@@ -47,6 +57,7 @@
 #define GEOMETRY 7
 #define UPDATE 8
 #define SELECTIONEVENT 9
+#define CLIENTVERSION 10
 
 #define ShiftMask (1<<0)
 #define LockMask (1<<1)
@@ -71,6 +82,8 @@ enum SelectionType{PRIMARY,CLIPBOARD};
 enum ClipboardMode{CLIP_BOTH, CLIP_SERVER, CLIP_CLIENT, CLIP_NONE};
 
 
+
+
 #include <QMainWindow>
 #include <QAbstractSocket>
 #include <stdlib.h>
@@ -189,8 +202,9 @@ public slots:
 
 private:
     enum{ HEADER, FRAMEREGION, REGIONDATA ,CURSORDATA, CURSORLIST, FRAMELIST, SELECTIONBUFFER } currentDataType;
-    enum HeaderType{ FRAME, DELETEDFRAMES, CURSOR, DELETEDCURSORS, SELECTION};
+    enum HeaderType{ FRAME, DELETEDFRAMES, CURSOR, DELETEDCURSORS, SELECTION, SERVER_VERSION};
 
+    void getServerversion();
     void setUseRandr(bool use);
     void exitOnError(const QString& message);
     void getImageFrame();
@@ -210,6 +224,7 @@ private:
     void setCursor();
     void sendGeometryEvent();
     void setFS(int screenNumber);
+    void sendClientVersion();
 
     bool wantRepaint=false;
 
@@ -218,6 +233,9 @@ private:
     int width=800;
     int height=600;
 
+    //feature version of server
+    u_int16_t serverVersion=0;
+
     bool fullscreen=false;
     bool multidisp=false;
     int dispNumber=1;
diff --git a/debian/changelog b/debian/changelog
index d3231a3..d4e2009 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,5 +23,6 @@ x2gokdriveclient (0.0.0.1-0x2go1) UNRELEASED; urgency=medium
     - not use QClipboard class on Linux. It has problems mit INCR properties. Using XCB API instead.
     - add xcb and xcb-fixes to deps.
     - add command line argument --selection (both|none|server|client) to specify selection mode.
+    - send a recive feature versions.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Tue, 04 Jun 2019 11:10:43 +0200

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdriveclient.git


More information about the x2go-commits mailing list