This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit a3ecd8eb0a58f57218b1aab1b96d9e0677e14667 Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Mon Aug 24 11:07:27 2020 -0500 send a recive feature versions. --- debian/changelog | 1 + x2gokdriveremote.c | 36 ++++++++++++++++++++++++++++++++++++ x2gokdriveremote.h | 16 +++++++++++++++- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 3ac81d3..4a8877b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ x2gokdrive (0.0.0.1-0x2go1) UNRELEASED; urgency=medium - Move selection functionality to separate thread. Use XCB API to manage selections. - add xcb-xfixes to deps. + - send a recive feature versions. [ Mihai Moldovan ] * Initial release: diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index 7732deb..e71f2a8 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -299,6 +299,20 @@ void remote_sendCursor(CursorPtr cursor) pthread_mutex_unlock(&remoteVars.sendqueue_mutex); } + +void remote_sendVersion(void) +{ + unsigned char buffer[56] = {0}; + _X_UNUSED int l; + + *((uint32_t*)buffer)=SERVERVERSION; //4B + *((uint16_t*)buffer+2)=FEATURE_VERSION; + EPHYR_DBG("Sending server version: %d", FEATURE_VERSION); + l=write(remoteVars.clientsock,buffer,56); + remoteVars.server_version_sent=TRUE; +} + + static int32_t send_cursor(struct cursorFrame* cursor) { @@ -1467,6 +1481,7 @@ void *send_frame_thread (void *threadid) SetNotifyFd(remoteVars.clientsock, clientReadNotify, X_NOTIFY_READ, NULL); #endif /* XORG_VERSION_CURRENT */ remoteVars.client_connected=TRUE; + remoteVars.server_version_sent=FALSE; if(remoteVars.checkConnectionTimer) { TimerFree(remoteVars.checkConnectionTimer); @@ -1496,6 +1511,13 @@ void *send_frame_thread (void *threadid) } remoteVars.client_connected=TRUE; + //check if we should send the server version to client + if(remoteVars.client_version && ! remoteVars.server_version_sent) + { + //the client supports versions and we didn't send our version yet + remote_sendVersion(); + } + if(!remoteVars.first_sendqueue_element && !remoteVars.firstCursor && !remoteVars.selstruct.firstOutputChunk) { @@ -2166,6 +2188,20 @@ clientReadNotify(int fd, int ready, void *data) readInputSelectionHeader(buff); break; } + case CLIENTVERSION: + { + int16_t ver=*((uint16_t*)buff+2); + int16_t os=*((uint16_t*)buff+3); + EPHYR_DBG("Client information: vesrion %d, os %d", ver, os); + remoteVars.client_version=ver; + if(os > OS_DARWIN) + { + EPHYR_DBG("Unsupported OS, assuming OS_LINUX"); + } + else + remoteVars.client_os=os; + break; + } default: { EPHYR_DBG("UNSUPPORTED EVENT: %d",event_type); diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h index a06e692..4249563 100644 --- a/x2gokdriveremote.h +++ b/x2gokdriveremote.h @@ -92,6 +92,12 @@ #endif /* XORG_VERSION_CURRENT */ +//FEATURE_VERSION is not cooresponding to actual version of server +//it used to tell server which features are supported by server +//Changes 0 - 1: sending and recieving client and OS version +#define FEATURE_VERSION 1 + + #define EPHYR_WANT_DEBUG 1 // #warning DEBUG ENABLED @@ -124,12 +130,13 @@ fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a) //always 4 #define XSERVERBPP 4 -enum msg_type{FRAME,DELETED,CURSOR, DELETEDCURSOR, SELECTION}; +enum msg_type{FRAME,DELETED, CURSOR, DELETEDCURSOR, SELECTION, SERVERVERSION}; enum AgentState{STARTING, RUNNING, RESUMING, SUSPENDING, SUSPENDED, TERMINATING, TERMINATED}; enum Compressions{JPEG,PNG}; enum SelectionType{PRIMARY,CLIPBOARD}; enum SelectionMime{STRING,UTF_STRING,PIXMAP}; enum ClipboardMode{CLIP_NONE,CLIP_CLIENT,CLIP_SERVER,CLIP_BOTH}; +enum OS_VERSION{OS_LINUX, OS_WINDOWS, OS_DARWIN}; #define DEFAULT_COMPRESSION JPEG @@ -152,6 +159,7 @@ enum ClipboardMode{CLIP_NONE,CLIP_CLIENT,CLIP_SERVER,CLIP_BOTH}; #define GEOMETRY 7 #define UPDATE 8 #define SELECTIONEVENT 9 +#define CLIENTVERSION 10 #define EVLENGTH 41 @@ -333,6 +341,11 @@ struct _remoteHostVars unsigned long send_thread_id; + //client information + enum OS_VERSION client_os; + uint16_t client_version; + BOOL server_version_sent; + //for control uint32_t cache_elements; uint32_t cache_size; @@ -447,6 +460,7 @@ void remote_sendCursor(CursorPtr cursor); void remote_removeCursor(uint32_t serialNumber); void remote_send_main_image(void); +void remote_sendVersion(void); int remote_init(void); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git