This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2gokdrive. from b70a5a5 x2gokdrive*.c: Include kdrive-config.h when building against X.Org server before 1.19.99.901. new 041844c x2gokdriveremote.{c|h}: Avoid remote.h as include file. Too commonly used. new 974c2c8 x2gokdrive*.h: Use uniform names for include guards. new 12294a9 x2gokdrive*.{c|h}: Use new-style function definitions for parameter-less functions. new 82d8942 x2gokdrive*.{c|h}: Comment out dead code (needs to be removed later) that throws compiler warnings. new 629362d x2gokdriveinit.c: Provide prototypes for ephyrInitFake and ddxInputThread (if not ifdef'ed out). new 100d36e x2gokdrive*.c: Make all comments and deactivate code passages look uniform. new 8e45834 x2gokdrive*.c: Silence "ISO C90 forbids mixed declarations and code" warnings. new cc647f8 x2gokdrive*.c: Comment out defined, but unused code. Fixes several compiler warnings. new 870ba0e rebase comments new 63d4b8b x2gokdriveremote.c: Declare non-prototyped as static, probably more static functions in the code, needs more investigation. new 99806b8 x2gokdriveremote.c: Attribute ln integer as _X_UNUSED. new bc93ad9 x2gokdrive*.c: Remove unused variables (or mark them with _X_UNUSED). The 12 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: Makefile | 2 +- Makefile.am | 4 +- x2gokdrive.c | 484 ++++++++++----------- x2gokdrive.h | 8 +- x2gokdrivecursor.c | 42 +- x2gokdriveinit.c | 45 +- x2gokdrivelog.h | 7 +- remote.c => x2gokdriveremote.c | 946 ++++++++++++++++++++++------------------- remote.h => x2gokdriveremote.h | 21 +- x2gokdriveselection.c | 24 +- x2gokdriveselection.h | 8 +- 11 files changed, 822 insertions(+), 769 deletions(-) rename remote.c => x2gokdriveremote.c (80%) rename remote.h => x2gokdriveremote.h (97%) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 974c2c85d4aecd79fd3cfe60d9893af99864d25e Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 14:07:02 2019 +0200 x2gokdrive*.h: Use uniform names for include guards. --- x2gokdrive.h | 6 +++--- x2gokdrivelog.h | 7 ++++--- x2gokdriveremote.h | 7 +++---- x2gokdriveselection.h | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/x2gokdrive.h b/x2gokdrive.h index b956094..020a78c 100644 --- a/x2gokdrive.h +++ b/x2gokdrive.h @@ -25,8 +25,8 @@ * */ -#ifndef _X2GOKDRIVE_H_ -#define _X2GOKDRIVE_H_ +#ifndef X2GOKDRIVE_H +#define X2GOKDRIVE_H #include <stdio.h> #include <unistd.h> #include <libgen.h> @@ -229,4 +229,4 @@ void void ephyrDrawFini(ScreenPtr pScreen); -#endif +#endif /* X2GOKDRIVE_H */ diff --git a/x2gokdrivelog.h b/x2gokdrivelog.h index 0dbdc2a..5fcede4 100644 --- a/x2gokdrivelog.h +++ b/x2gokdrivelog.h @@ -25,8 +25,9 @@ * Authors: * Dodji Seketeli <dodji@openedhand.com> */ -#ifndef __X2GOKDRIVELOG_H__ -#define __X2GOKDRIVELOG_H__ + +#ifndef X2GOKDRIVELOG_H +#define X2GOKDRIVELOG_H #include <assert.h> #include "os.h" @@ -64,4 +65,4 @@ if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return;} if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return val;} #endif /*nomadik_return_val_if_fail */ -#endif /*__EPHYRLOG_H__*/ +#endif /* X2GOKDRIVELOG_H */ diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h index e7ab121..a14a4f4 100644 --- a/x2gokdriveremote.h +++ b/x2gokdriveremote.h @@ -26,8 +26,8 @@ */ -#ifndef _XLIBS_STUFF_H_ -#define _XLIBS_STUFF_H_ +#ifndef X2GOKDRIVE_REMOTE_H +#define X2GOKDRIVE_REMOTE_H #include <X11/X.h> #include <X11/Xmd.h> @@ -442,5 +442,4 @@ void remote_paint_rect(KdScreenInfo *screen, int sx, int sy, int dx, int dy, int width, int height); - -#endif /*_XLIBS_STUFF_H_*/ +#endif /* X2GOKDRIVE_REMOTE_H */ diff --git a/x2gokdriveselection.h b/x2gokdriveselection.h index 4928075..2841cb9 100644 --- a/x2gokdriveselection.h +++ b/x2gokdriveselection.h @@ -25,8 +25,8 @@ * */ -#ifndef X2GOKDRIVESELECTION -#define X2GOKDRIVESELECTION +#ifndef X2GOKDRIVESELECTION_H +#define X2GOKDRIVESELECTION_H #include "x2gokdriveremote.h" void selection_init( struct RemoteHostVars* obj); @@ -35,4 +35,4 @@ static int create_selection_window(void); int own_selection(int target); -#endif +#endif /* X2GOKDRIVESELECTION_H */ -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 041844c9ca8efe6f9c71e98338b60e32959f98b7 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 13:43:08 2019 +0200 x2gokdriveremote.{c|h}: Avoid remote.h as include file. Too commonly used. --- Makefile | 2 +- Makefile.am | 4 ++-- x2gokdrive.h | 2 +- x2gokdrivecursor.c | 2 +- x2gokdriveinit.c | 2 +- remote.c => x2gokdriveremote.c | 2 +- remote.h => x2gokdriveremote.h | 0 x2gokdriveselection.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index ddfa5fe..a39ee84 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ include ../ephyr/Makefile VPATH = ../../../../../../hw/kdrive/x2gokdrive X2GO_OBJECTS = x2gokdriveselection.o x2gokdrive.o \ - x2gokdriveinit.o x2gokdrivecursor.o remote.o + x2gokdriveinit.o x2gokdrivecursor.o x2gokdriveremote.o x2gokdrive: $(X2GO_OBJECTS) $(Xephyr_DEPENDENCIES) $(EXTRA_Xephyr_DEPENDENCIES) $(AM_V_CCLD)$(Xephyr_LINK) $(X2GO_OBJECTS) $(Xephyr_LDADD) $(LIBS) -lz -ljpeg -lpng -lpthread diff --git a/Makefile.am b/Makefile.am index 8468d9c..361e1e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,8 +33,8 @@ AM_CPPFLAGS = \ bin_PROGRAMS = x2gokdrive x2gokdrive_SOURCES = \ - remote.c \ - remote.h \ + x2gokdriveremote.c \ + x2gokdriveremote.h \ x2gokdrive.c \ x2gokdrivecursor.c \ x2gokdrive.h \ diff --git a/x2gokdrive.h b/x2gokdrive.h index 6415de2..b956094 100644 --- a/x2gokdrive.h +++ b/x2gokdrive.h @@ -34,7 +34,7 @@ #include "os.h" /* for OsSignal() */ #include "kdrive.h" -#include "remote.h" +#include "x2gokdriveremote.h" //#include "exa.h" #ifdef RANDR diff --git a/x2gokdrivecursor.c b/x2gokdrivecursor.c index e491f34..dd46f7e 100644 --- a/x2gokdrivecursor.c +++ b/x2gokdrivecursor.c @@ -35,7 +35,7 @@ #endif #include "x2gokdrive.h" #include "x2gokdrivelog.h" -#include "remote.h" +#include "x2gokdriveremote.h" #include "cursorstr.h" #include <xcb/render.h> #include <xcb/xcb_renderutil.h> diff --git a/x2gokdriveinit.c b/x2gokdriveinit.c index b7b3767..8951c5f 100644 --- a/x2gokdriveinit.c +++ b/x2gokdriveinit.c @@ -37,7 +37,7 @@ #include "x2gokdrive.h" #include "x2gokdrivelog.h" #include "glx_extinit.h" -#include "remote.h" +#include "x2gokdriveremote.h" extern Window EphyrPreExistingHostWin; extern Bool EphyrWantGrayScale; diff --git a/remote.c b/x2gokdriveremote.c similarity index 99% rename from remote.c rename to x2gokdriveremote.c index 9bbd4ac..cdc79ee 100644 --- a/remote.c +++ b/x2gokdriveremote.c @@ -34,7 +34,7 @@ #endif /* XORG_VERSION_CURRENT */ #endif -#include "remote.h" +#include "x2gokdriveremote.h" /*init it in os init*/ static RemoteHostVars remoteVars; diff --git a/remote.h b/x2gokdriveremote.h similarity index 100% rename from remote.h rename to x2gokdriveremote.h diff --git a/x2gokdriveselection.h b/x2gokdriveselection.h index 7b9b097..4928075 100644 --- a/x2gokdriveselection.h +++ b/x2gokdriveselection.h @@ -27,7 +27,7 @@ #ifndef X2GOKDRIVESELECTION #define X2GOKDRIVESELECTION -#include "remote.h" +#include "x2gokdriveremote.h" void selection_init( struct RemoteHostVars* obj); void install_selection_callbacks(void ); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 82d89428d27388629e96781f3d7a8ae40271b340 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 14:17:29 2019 +0200 x2gokdrive*.{c|h}: Comment out dead code (needs to be removed later) that throws compiler warnings. --- x2gokdrivecursor.c | 6 +++--- x2gokdriveinit.c | 12 ++++++------ x2gokdriveremote.c | 25 +++++++++++++++---------- x2gokdriveremote.h | 4 ++-- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/x2gokdrivecursor.c b/x2gokdrivecursor.c index dd46f7e..37abc0a 100644 --- a/x2gokdrivecursor.c +++ b/x2gokdrivecursor.c @@ -72,9 +72,9 @@ can_argb_cursor(void) static Bool ephyrRealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor) { - KdScreenPriv(screen); - KdScreenInfo *kscr = pScreenPriv->screen; - EphyrScrPriv *scr = kscr->driver; +// KdScreenPriv(screen); +// KdScreenInfo *kscr = pScreenPriv->screen; +// EphyrScrPriv *scr = kscr->driver; return TRUE; } diff --git a/x2gokdriveinit.c b/x2gokdriveinit.c index 8951c5f..f01685d 100644 --- a/x2gokdriveinit.c +++ b/x2gokdriveinit.c @@ -179,8 +179,8 @@ processScreenOrOutputArg(const char *screen_size, const char *output, char *pare if (card) { KdScreenInfo *screen; - unsigned long p_id = 0; - Bool use_geometry; +// unsigned long p_id = 0; +// Bool use_geometry; screen = KdScreenInfoAdd(card); KdParseScreen(screen, screen_size); @@ -188,11 +188,11 @@ processScreenOrOutputArg(const char *screen_size, const char *output, char *pare if (!screen->driver) FatalError("Couldn't alloc screen private\n"); - if (parent_id) { - p_id = strtol(parent_id, NULL, 0); - } +// if (parent_id) { +// p_id = strtol(parent_id, NULL, 0); +// } - use_geometry = (strchr(screen_size, '+') != NULL); +// use_geometry = (strchr(screen_size, '+') != NULL); EPHYR_DBG("screen number:%d, size: %s, output %s\n", screen->mynum, screen_size, output); // hostx_add_screen(screen, p_id, screen->mynum, use_geometry, output); } diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index d638d48..ebbd128 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -308,7 +308,7 @@ int32_t send_cursor(struct cursorFrame* cursor) // EPHYR_DBG("SENDING CURSOR %d with size %d", cursor->serialNumber, cursor->size); - #warning check this +// #warning check this int ln=write(remoteVars.clientsock,buffer,56); int sent=0; @@ -355,7 +355,7 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin else EPHYR_DBG("SENDING REFERENCE %x", crc);*/ -#warning check this +// #warning check this int ln=write(remoteVars.clientsock, buffer,56); uint32_t total=0; for(int i=0;i<9;++i) @@ -379,7 +379,7 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin *((uint32_t*)buffer+6)=regions[i].rect.size.height; *((uint32_t*)buffer+7)=regions[i].size; - #warning check this +// #warning check this int ln=write(remoteVars.clientsock, buffer, 64); int sent=0; @@ -417,7 +417,7 @@ int send_deleted_elements(void) *((uint32_t*)buffer)=DELETED; *((uint32_t*)buffer+1)=remoteVars.deleted_list_size; - #warning check this +// #warning check this int ln=write(remoteVars.clientsock,buffer,56); // data_sent+=48; int sent=0; @@ -460,7 +460,7 @@ int send_deleted_cursors(void) *((uint32_t*)buffer)=DELETEDCURSOR; *((uint32_t*)buffer+1)=remoteVars.deletedcursor_list_size; - #warning check this +// #warning check this int ln=write(remoteVars.clientsock,buffer,56); int sent=0; @@ -504,7 +504,7 @@ int send_selection(int sel, char* data, uint32_t length, uint32_t format) *((uint32_t*)buffer+2)=format; *((uint32_t*)buffer+3)=length; - #warning check this +// #warning check this int ln=write(remoteVars.clientsock,buffer,56); int sent=0; @@ -2732,8 +2732,9 @@ void initFrameRegions(struct cache_elem* frame) regions[i].rect.size.width,regions[i].rect.size.height); */ - #warning check this +// #warning check this uint8_t *data=malloc(regions[i].rect.size.width*regions[i].rect.size.height*CACHEBPP); + for(int line=0;line<regions[i].rect.size.height;++line) { memcpy(data+line*regions[i].rect.size.width*CACHEBPP, @@ -2752,8 +2753,9 @@ void initFrameRegions(struct cache_elem* frame) } else { - #warning check this +// #warning check this uint8_t *data=malloc(regions[1].rect.size.width*regions[1].rect.size.height*CACHEBPP); + for(int line=0;line<regions[1].rect.size.height;++line) { memcpy(data+line*regions[1].rect.size.width*CACHEBPP, @@ -2945,7 +2947,9 @@ remote_paint_rect(KdScreenInfo *screen, width=dirtyx_max-dirtyx_min+1; height=dirtyy_max-dirtyy_min+1; - int oldsize=size; + /* + * int oldsize=size; + */ size=width*height*XSERVERBPP; if(width<=0 || height<=0||size<=0) { @@ -2958,7 +2962,8 @@ remote_paint_rect(KdScreenInfo *screen, * if(size!=oldsize) * { * EPHYR_DBG("new update rect demensions: %dx%d", width, height); - }*/ + * } + */ add_frame(width, height, dx, dy, calculate_crc(width, height,dx,dy), size); } diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h index 8f5dab1..df84661 100644 --- a/x2gokdriveremote.h +++ b/x2gokdriveremote.h @@ -92,7 +92,7 @@ #define EPHYR_WANT_DEBUG 1 -#warning DEBUG ENABLED +// #warning DEBUG ENABLED #if (EPHYR_WANT_DEBUG) @@ -328,7 +328,7 @@ struct RemoteHostVars KdScreenInfo* ephyrScreen; uint32_t main_img_height, main_img_width; - #warning remove this hack +// #warning remove this hack int numofimg; int clientsock, serversock; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 629362d3db29d8e26ce8c1b592e97f1773e626f8 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 14:53:41 2019 +0200 x2gokdriveinit.c: Provide prototypes for ephyrInitFake and ddxInputThread (if not ifdef'ed out). --- x2gokdriveinit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x2gokdriveinit.c b/x2gokdriveinit.c index f01685d..ff02396 100644 --- a/x2gokdriveinit.c +++ b/x2gokdriveinit.c @@ -57,6 +57,14 @@ void processScreenOrOutputArg(const char *screen_size, const char *output, char void processOutputArg(const char *output, char *parent_id); void processScreenArg(const char *screen_size, char *parent_id); +#if XORG_VERSION_CURRENT < 11999901 +int ephyrInitFake(void); +#endif /* XORG_VERSION_CURRENT */ + +#if INPUTTHREAD +void ddxInputThreadInit(void); +#endif /* INPUTTHREAD */ + int main(int argc, char *argv[], char *envp[]) { -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 8e458340ed2436549478928a0ef3fcc9d15bd5eb Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 16:22:43 2019 +0200 x2gokdrive*.c: Silence "ISO C90 forbids mixed declarations and code" warnings. --- x2gokdriveremote.c | 365 +++++++++++++++++++++++++++++--------------------- x2gokdriveselection.c | 10 +- 2 files changed, 214 insertions(+), 161 deletions(-) diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index e06ad95..1a2d47e 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -171,14 +171,18 @@ void addCursorToQueue(struct cursorFrame* cframe) void freeCursors(void) { - struct sentCursor* cur=remoteVars.sentCursorsHead; + struct sentCursor* cur = NULL; + struct cursorFrame* curf = NULL; + + cur=remoteVars.sentCursorsHead; while(cur) { struct sentCursor* next=cur->next; free(cur); cur=next; } - struct cursorFrame* curf=remoteVars.firstCursor; + + curf=remoteVars.firstCursor; while(curf) { struct cursorFrame* next=curf->next; @@ -193,9 +197,13 @@ void freeCursors(void) void remote_removeCursor(uint32_t serialNumber) { + struct sentCursor* cur = NULL; + struct sentCursor* prev = NULL; + struct deletedCursor* dcur = NULL; + pthread_mutex_lock(&remoteVars.sendqueue_mutex); - struct sentCursor* cur=remoteVars.sentCursorsHead; - struct sentCursor* prev=0; + cur=remoteVars.sentCursorsHead; + while(cur) { if(cur->serialNumber==serialNumber) @@ -212,7 +220,7 @@ void remote_removeCursor(uint32_t serialNumber) prev=cur; cur=cur->next; } - struct deletedCursor* dcur=malloc(sizeof(struct deletedCursor)); + dcur=malloc(sizeof(struct deletedCursor)); dcur->serialNumber=serialNumber; dcur->next=0; if(remoteVars.last_deleted_cursor) @@ -230,15 +238,15 @@ void remote_removeCursor(uint32_t serialNumber) void remote_sendCursor(CursorPtr cursor) { + BOOL cursorSent=FALSE; // #warning check memory struct cursorFrame* cframe=malloc(sizeof(struct cursorFrame)); + cframe->serialNumber=cursor->serialNumber; cframe->size=0; cframe->data=0; cframe->next=0; - BOOL cursorSent=FALSE; - pthread_mutex_lock(&remoteVars.sendqueue_mutex); cursorSent=isCursorSent(cursor->serialNumber); pthread_mutex_unlock(&remoteVars.sendqueue_mutex); @@ -287,8 +295,10 @@ void remote_sendCursor(CursorPtr cursor) int32_t send_cursor(struct cursorFrame* cursor) { + int ln, l = 0; + int sent=0; + unsigned char buffer[64] = {0}; - unsigned char buffer[64]={}; *((uint32_t*)buffer)=CURSOR; //4B *((uint8_t*)buffer+4)=cursor->forR; @@ -310,13 +320,11 @@ int32_t send_cursor(struct cursorFrame* cursor) // EPHYR_DBG("SENDING CURSOR %d with size %d", cursor->serialNumber, cursor->size); // #warning check this - int ln=write(remoteVars.clientsock,buffer,56); - - int sent=0; + ln=write(remoteVars.clientsock,buffer,56); while(sent<cursor->size) { - int l=write(remoteVars.clientsock, cursor->data+sent,((cursor->size-sent)<MAXMSGSIZE)?(cursor->size-sent):MAXMSGSIZE); + l=write(remoteVars.clientsock, cursor->data+sent,((cursor->size-sent)<MAXMSGSIZE)?(cursor->size-sent):MAXMSGSIZE); if(l<0) { EPHYR_DBG("Error sending cursor!!!!!"); @@ -335,14 +343,16 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin { uint32_t numofregions=0; - + int ln, l = 0; + uint32_t total=0; + int sent = 0; + unsigned char buffer[64] = {0}; for(int i=0;i<9;++i) { if(regions[i].rect.size.width && regions[i].rect.size.height) ++numofregions; } - unsigned char buffer[64]={}; *((uint32_t*)buffer)=FRAME; *((uint32_t*)buffer+1)=width; *((uint32_t*)buffer+2)=height; @@ -357,8 +367,7 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin // EPHYR_DBG("SENDING REFERENCE %x", crc); // #warning check this - int ln=write(remoteVars.clientsock, buffer,56); - uint32_t total=0; + ln=write(remoteVars.clientsock, buffer,56); for(int i=0;i<9;++i) { if(!(regions[i].rect.size.width && regions[i].rect.size.height)) @@ -381,15 +390,12 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin *((uint32_t*)buffer+7)=regions[i].size; // #warning check this - int ln=write(remoteVars.clientsock, buffer, 64); - - int sent=0; - + ln=write(remoteVars.clientsock, buffer, 64); while(sent<regions[i].size) { - int l=write(remoteVars.clientsock,regions[i].compressed_data+sent, - ((regions[i].size-sent)<MAXMSGSIZE)?(regions[i].size-sent):MAXMSGSIZE); + l=write(remoteVars.clientsock,regions[i].compressed_data+sent, + ((regions[i].size-sent)<MAXMSGSIZE)?(regions[i].size-sent):MAXMSGSIZE); if(l<0) { EPHYR_DBG("Error sending file!!!!!"); @@ -415,24 +421,29 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin int send_deleted_elements(void) { - unsigned char buffer[56]; + unsigned char buffer[56] = {0}; + unsigned char* list = NULL; + + int ln, l = 0; + int length, sent=0; + + unsigned int i = 0; + struct deleted_elem* elem = NULL; + *((uint32_t*)buffer)=DELETED; *((uint32_t*)buffer+1)=remoteVars.deleted_list_size; + list=malloc(sizeof(uint32_t)*remoteVars.deleted_list_size); + // #warning check this - int ln=write(remoteVars.clientsock,buffer,56); + ln=write(remoteVars.clientsock,buffer,56); // data_sent+=48; - int sent=0; - - unsigned char* list=malloc(sizeof(uint32_t)*remoteVars.deleted_list_size); - - unsigned int i=0; while(remoteVars.first_deleted_elements) { // EPHYR_DBG("To DELETE FRAME %x", remoteVars.first_deleted_elements->crc); *((uint32_t*)list+i)=remoteVars.first_deleted_elements->crc; - struct deleted_elem* elem=remoteVars.first_deleted_elements; + elem=remoteVars.first_deleted_elements; remoteVars.first_deleted_elements=elem->next; free(elem); ++i; @@ -441,10 +452,10 @@ int send_deleted_elements(void) remoteVars.last_deleted_elements=0l; // EPHYR_DBG("SENDING IMG length - %d, number - %d\n",length,framenum_sent++); - int length=remoteVars.deleted_list_size*sizeof(uint32_t); + length=remoteVars.deleted_list_size*sizeof(uint32_t); while(sent<length) { - int l=write(remoteVars.clientsock,list+sent,((length-sent)<MAXMSGSIZE)?(length-sent):MAXMSGSIZE); + l=write(remoteVars.clientsock,list+sent,((length-sent)<MAXMSGSIZE)?(length-sent):MAXMSGSIZE); if(l<0) { EPHYR_DBG("Error sending list of deleted elements!!!!!"); @@ -458,23 +469,27 @@ int send_deleted_elements(void) int send_deleted_cursors(void) { - unsigned char buffer[56]; + unsigned char buffer[56] = {0}; + unsigned char* list = NULL; + int ln, l = 0; + int length, sent = 0; + unsigned int i=0; + struct deletedCursor* elem = NULL; + *((uint32_t*)buffer)=DELETEDCURSOR; *((uint32_t*)buffer+1)=remoteVars.deletedcursor_list_size; // #warning check this - int ln=write(remoteVars.clientsock,buffer,56); - int sent=0; + ln=write(remoteVars.clientsock,buffer,56); - unsigned char* list=malloc(sizeof(uint32_t)*remoteVars.deletedcursor_list_size); + list=malloc(sizeof(uint32_t)*remoteVars.deletedcursor_list_size); - unsigned int i=0; while(remoteVars.first_deleted_cursor) { *((uint32_t*)list+i)=remoteVars.first_deleted_cursor->serialNumber; // EPHYR_DBG("delete cursord %d",first_deleted_cursor->serialNumber); - struct deletedCursor* elem=remoteVars.first_deleted_cursor; + elem=remoteVars.first_deleted_cursor; remoteVars.first_deleted_cursor=elem->next; free(elem); ++i; @@ -483,10 +498,10 @@ int send_deleted_cursors(void) remoteVars.last_deleted_cursor=0l; // EPHYR_DBG("Sending list from %d elements", deletedcursor_list_size); - int length=remoteVars.deletedcursor_list_size*sizeof(uint32_t); + length=remoteVars.deletedcursor_list_size*sizeof(uint32_t); while(sent<length) { - int l=write(remoteVars.clientsock,list+sent,((length-sent)<MAXMSGSIZE)?(length-sent):MAXMSGSIZE); + l=write(remoteVars.clientsock,list+sent,((length-sent)<MAXMSGSIZE)?(length-sent):MAXMSGSIZE); if(l<0) { EPHYR_DBG("Error sending list of deleted cursors!!!!!"); @@ -500,19 +515,21 @@ int send_deleted_cursors(void) int send_selection(int sel, char* data, uint32_t length, uint32_t format) { - unsigned char buffer[56]; + unsigned char buffer[56] = {0}; + int ln, l = 0; + int sent = 0; + *((uint32_t*)buffer)=SELECTION; *((uint32_t*)buffer+1)=sel; *((uint32_t*)buffer+2)=format; *((uint32_t*)buffer+3)=length; // #warning check this - int ln=write(remoteVars.clientsock,buffer,56); - int sent=0; + ln=write(remoteVars.clientsock,buffer,56); while(sent<length) { - int l=write(remoteVars.clientsock,data+sent,((length-sent)<MAXMSGSIZE)?(length-sent):MAXMSGSIZE); + l=write(remoteVars.clientsock,data+sent,((length-sent)<MAXMSGSIZE)?(length-sent):MAXMSGSIZE); if(l<0) { EPHYR_DBG("Error sending selection!!!!!"); @@ -530,12 +547,16 @@ int send_selection(int sel, char* data, uint32_t length, uint32_t format) */ struct cache_elem* find_best_match(struct cache_elem* frame, unsigned int* match_val) { - struct cache_elem* current=frame->prev; - struct cache_elem* best_match_frame=0; + struct cache_elem* current = NULL; + struct cache_elem* best_match_frame = NULL; unsigned int distance=0; unsigned int best_match_value=99999; + + current =frame->prev; while(current) { + unsigned int matchVal=0; + if((best_match_frame&& best_match_value<=distance) || distance > MAX_MATCH_VAL) { break; @@ -546,7 +567,6 @@ struct cache_elem* find_best_match(struct cache_elem* frame, unsigned int* match continue; } - unsigned int matchVal=0; matchVal+=abs(current->width-frame->width)/10; matchVal+=abs(current->height-frame->height)/10; matchVal+=abs(current->rval-frame->rval); @@ -574,6 +594,9 @@ BOOL checkShiftedRegion( struct cache_elem* src, struct cache_elem* dst, int32_ // EPHYR_DBG("FENTER %d %d %d %d %d",x,y,width,height,shift); int32_t vert_point=20; int32_t hor_point=20; + int32_t vert_inc = 0; + int32_t hor_inc = 0; + uint32_t i=0; if(vert_point>height) { @@ -584,8 +607,8 @@ BOOL checkShiftedRegion( struct cache_elem* src, struct cache_elem* dst, int32_ hor_point=width; } - int32_t vert_inc=height/vert_point; - int32_t hor_inc=width/hor_point; + vert_inc=height/vert_point; + hor_inc=width/hor_point; if(vert_inc<1) { @@ -598,8 +621,6 @@ BOOL checkShiftedRegion( struct cache_elem* src, struct cache_elem* dst, int32_ } - uint32_t i=0; - for(int32_t ry=y;ry<height+y ;ry+=vert_inc) { for(int32_t rx=x+(i++)%vert_inc; rx<width+x; rx+=hor_inc) @@ -607,7 +628,6 @@ BOOL checkShiftedRegion( struct cache_elem* src, struct cache_elem* dst, int32_ int32_t src_ind=(ry*src->width+rx)*CACHEBPP; int32_t dst_ind=((ry+vert_shift)*dst->width+rx+horiz_shift)*CACHEBPP; - if (src_ind<0 || src_ind +2 > src->size || dst_ind <0 || dst_ind > dst->size ) { EPHYR_DBG("!!!!!WARNING BROKEN BOUNDARIES: sind %d, dind %d, ssize %d, dsize %d", @@ -640,11 +660,14 @@ BOOL checkShiftedRegion( struct cache_elem* src, struct cache_elem* dst, int32_ int32_t checkScrollUp(struct cache_elem* source, struct cache_elem* dest) { // EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); + int32_t max_shift=source->height/3; + int32_t x=source->width/10; int32_t y=source->height/10; - int32_t width=source->width/2-source->width/5; + int32_t width = source->width/2-source->width/5; + int32_t height=source->height/2-source->height/10; if(x+width >= dest->width) { @@ -656,8 +679,6 @@ int32_t checkScrollUp(struct cache_elem* source, struct cache_elem* dest) return -1; } - int32_t height=source->height/2-source->height/10; - if(y+height+max_shift >=dest->height) { height=dest->height-max_shift-y; @@ -688,6 +709,7 @@ int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) { // EPHYR_DBG("checking for down scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); int32_t max_shift=source->height/3*-1; + int32_t x=source->width/10; int32_t y=source->height/2; @@ -706,7 +728,6 @@ int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) return 1; } - if(y+height+abs(max_shift) >=dest->height) { height=dest->height-abs(max_shift)-y; @@ -717,7 +738,6 @@ int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) return 1; } - for(int32_t shift=0;shift>max_shift;--shift) { if(!checkShiftedRegion( source, dest, x, y, width, height, 0,shift)) @@ -733,9 +753,11 @@ int32_t checkScrollRight(struct cache_elem* source, struct cache_elem* dest) { // EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); int32_t max_shift=source->width/3; + int32_t x=source->width/10; int32_t y=source->height/10; + int32_t width=source->width/2-source->width/10; int32_t height=source->height/2-source->height/5; if(y+height >= dest->height) @@ -748,8 +770,6 @@ int32_t checkScrollRight(struct cache_elem* source, struct cache_elem* dest) return -1; } - int32_t width=source->width/2-source->width/10; - if(x+width+max_shift >=dest->width) { width=dest->width-abs(max_shift)-x; @@ -780,9 +800,11 @@ int32_t checkScrollLeft(struct cache_elem* source, struct cache_elem* dest) { // EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); int32_t max_shift=source->width/3*-1; + int32_t x=source->width/2; int32_t y=source->height/10; + int32_t width=source->width/2-source->width/10; int32_t height=source->height/2-source->height/5; if(y+height >= dest->height) @@ -795,8 +817,6 @@ int32_t checkScrollLeft(struct cache_elem* source, struct cache_elem* dest) return 1; } - int32_t width=source->width/2-source->width/10; - if(x+width+abs(max_shift) >=dest->width) { width=dest->width-abs(max_shift)-x; @@ -809,7 +829,6 @@ int32_t checkScrollLeft(struct cache_elem* source, struct cache_elem* dest) // EPHYR_DBG(" %d %d %d %d %d",x,y,width, height, max_shift); - for(int32_t shift=0;shift>max_shift;--shift) { if(!checkShiftedRegion( source, dest, x, y, width, height, shift, 0 )) @@ -833,21 +852,21 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, int32_t x, y=center_y; int32_t right_x=src->width; - --right_x; int32_t down_y=src->height; - --down_y; int32_t left_x=0; int32_t top_y=0; + --right_x; + --down_y; + if(center_x+shift_horiz >= dst->width || center_y+shift_vert >=dst->height) { /* dst is too small for shift */ return FALSE; } - if(left_x+shift_horiz<0) { left_x=0-shift_horiz; @@ -868,11 +887,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, down_y=dst->height-shift_vert-1; } - // EPHYR_DBG("Center: %dx%d", center_x, center_y); - - - // EPHYR_DBG("initial down_right %dx%d",right_x,down_y); for(y=center_y;y<=down_y;++y) @@ -1058,18 +1073,18 @@ BOOL checkMovedContent(struct cache_elem* source, struct cache_elem* dest, int32 // EPHYR_DBG("checking for moved content %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); int32_t max_shift=source->width/8; + int32_t x=source->width/2; + int32_t y=source->height/2; + + int32_t width=source->width/4; + int32_t height=source->height/4; + if(max_shift>source->height/8) max_shift=source->height/8; if(max_shift>20) max_shift=20; - - int32_t x=source->width/2; - int32_t y=source->height/2; - - int32_t height=source->height/4; - if(y+height+max_shift >= dest->height) { height=dest->height-max_shift-y-1; @@ -1080,8 +1095,6 @@ BOOL checkMovedContent(struct cache_elem* source, struct cache_elem* dest, int32 return FALSE; } - int32_t width=source->width/4; - if(x+width+max_shift >=dest->width) { width=dest->width-max_shift-x; @@ -1098,7 +1111,6 @@ BOOL checkMovedContent(struct cache_elem* source, struct cache_elem* dest, int32 { for(int32_t vshift=0;vshift<max_shift;vshift++) { - if(checkShiftedRegion( source, dest, x, y, width, height, hshift, vshift )) { *horiz_shift=hshift; @@ -1131,6 +1143,8 @@ BOOL checkMovedContent(struct cache_elem* source, struct cache_elem* dest, int32 BOOL findDiff(struct cache_elem* source, struct cache_elem* dest, rectangle* diff_rect) { int32_t left_x=source->width-1, top_y=source->height-1, right_x=0, bot_y=0; + float eff = 0; + for(int32_t y=0;y<source->height;++y) { for(int32_t x=0;x<source->width;++x) @@ -1157,7 +1171,7 @@ BOOL findDiff(struct cache_elem* source, struct cache_elem* dest, rectangle* dif diff_rect->lt_corner.x=left_x; diff_rect->lt_corner.y=top_y; - float eff= (float)(diff_rect->size.width*diff_rect->size.height)/ (float)(source->width*source->height); + eff= (float)(diff_rect->size.width*diff_rect->size.height)/ (float)(source->width*source->height); if(eff>0.8) return FALSE; @@ -1172,9 +1186,6 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO { // EPHYR_DBG("checking for common regions"); - - - *diff=FALSE; *hshift=0; @@ -1197,7 +1208,6 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO #warning stop here for the moment, let's see later if we'll use it' return FALSE; - *vshift=0; *hshift=checkScrollRight(source, dest); if(*hshift>0) @@ -1215,9 +1225,10 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO if((source->width != dest->width) && (source->height!=dest->height)) { + int32_t h_shift, v_shift; + *vshift=0; *hshift=0; - int32_t h_shift, v_shift; if(checkMovedContent(source, dest, &h_shift, &v_shift)) { *hshift=h_shift; @@ -1227,7 +1238,6 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO } } - if((source->width == dest->width) && (source->height==dest->height)) { *diff=TRUE; @@ -1242,6 +1252,18 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO /* use only from send thread */ void sendMainImageFromSendThread(uint32_t width, uint32_t height, int32_t dx ,int32_t dy) { + uint32_t length = 0; + char fname[255] = {0}; + char* f = NULL; + struct frame_region regions[9] = {0}; + + uint32_t isize = 0; + unsigned char* data = NULL; + + uint32_t i = 0; + uint32_t ind = 0; + + BOOL mainImage=FALSE; if(width!=0) { @@ -1253,13 +1275,7 @@ void sendMainImageFromSendThread(uint32_t width, uint32_t height, int32_t dx ,in } pthread_mutex_lock(&remoteVars.mainimg_mutex); - uint32_t length=0; - - char fname[255]; - char* f; - - struct frame_region regions[9]; for(int i=0;i<9;++i) { regions[i].rect.size.width=0; @@ -1268,7 +1284,6 @@ void sendMainImageFromSendThread(uint32_t width, uint32_t height, int32_t dx ,in regions[i].size=0; } - BOOL mainImage=FALSE; if(!width || (dx==0 && dy==0 && width==remoteVars.main_img_width && height==remoteVars.main_img_height)) { mainImage=TRUE; @@ -1277,16 +1292,14 @@ void sendMainImageFromSendThread(uint32_t width, uint32_t height, int32_t dx ,in height=remoteVars.main_img_height; } - uint32_t isize=width*height*CACHEBPP; - unsigned char* data=malloc(isize); - - u_int32_t i=0; + isize=width*height*CACHEBPP; + data=malloc(isize); for(int32_t y=0;y<height;++y) { for(int32_t x=0; x< width; ++x) { - uint32_t ind=((y+dy)*remoteVars.main_img_width+dx+x)*XSERVERBPP; + ind=((y+dy)*remoteVars.main_img_width+dx+x)*XSERVERBPP; memcpy(data+i*CACHEBPP, remoteVars.main_img+ind, CACHEBPP); ++i; } @@ -1317,6 +1330,7 @@ void *send_frame_thread (void *threadid) { long tid; tid = (long)threadid; + EPHYR_DBG("Started sending thread: #%ld!\n", tid); while (1) @@ -1332,7 +1346,6 @@ void *send_frame_thread (void *threadid) if(strlen(remoteVars.acceptAddr)) { - struct addrinfo hints, *res; int errcode; char addrstr[100]; @@ -1359,13 +1372,16 @@ void *send_frame_thread (void *threadid) } if(strlen(remoteVars.cookie)) { -// EPHYR_DBG("Checking cookie: %s",remoteVars.cookie); char msg[33]; int length=32; int ready=0; + +// EPHYR_DBG("Checking cookie: %s",remoteVars.cookie); + while(ready<length) { int chunk=read(remoteVars.clientsock, msg+ready, 32-ready); + if(chunk<=0) { EPHYR_DBG("READ COOKIE ERROR"); @@ -1374,6 +1390,7 @@ void *send_frame_thread (void *threadid) continue; } ready+=chunk; + EPHYR_DBG("got %d COOKIE BYTES from client", ready); } if(strncmp(msg,remoteVars.cookie,32)) @@ -1460,9 +1477,11 @@ void *send_frame_thread (void *threadid) { size_t sz=remoteVars.selstruct.clipboard.size; char* data=malloc(sz); + int format = 0; + memcpy(data, remoteVars.selstruct.clipboard.data, sz); remoteVars.selstruct.clipboard.changed=FALSE; - int format=remoteVars.selstruct.clipboard.mimeData; + format=remoteVars.selstruct.clipboard.mimeData; pthread_mutex_unlock(&remoteVars.sendqueue_mutex); send_selection(CLIPBOARD,data,sz, format); free(data); @@ -1475,9 +1494,11 @@ void *send_frame_thread (void *threadid) { size_t sz=remoteVars.selstruct.selection.size; char* data=malloc(sz); + int format = 0; + memcpy(data, remoteVars.selstruct.selection.data, sz); remoteVars.selstruct.selection.changed=FALSE; - int format=remoteVars.selstruct.selection.mimeData; + format=remoteVars.selstruct.selection.mimeData; pthread_mutex_unlock(&remoteVars.sendqueue_mutex); send_selection(PRIMARY, data, sz, format); free(data); @@ -1489,15 +1510,20 @@ void *send_frame_thread (void *threadid) if(remoteVars.first_sendqueue_element) { int elems=queue_elements(); + struct cache_elem* frame = NULL; + struct sendqueue_element* current = NULL; + uint32_t x, y = 0; + int32_t width, height = 0; + if(remoteVars.maxfr<elems) { remoteVars.maxfr=elems; } // EPHYR_DBG("have %d max frames in queue, current %d", remoteVars.,elems); - struct cache_elem* frame=remoteVars.first_sendqueue_element->frame; + frame=remoteVars.first_sendqueue_element->frame; /* delete first element from frame queue */ - struct sendqueue_element* current=remoteVars.first_sendqueue_element; + current=remoteVars.first_sendqueue_element; if(remoteVars.first_sendqueue_element->next) { remoteVars.first_sendqueue_element=remoteVars.first_sendqueue_element->next; @@ -1506,10 +1532,8 @@ void *send_frame_thread (void *threadid) { remoteVars.first_sendqueue_element=remoteVars.last_sendqueue_element=NULL; } - uint32_t x, y; x=current->x; y=current->y; - int32_t width, height; width=current->width; height=current->height; free(current); @@ -1590,7 +1614,10 @@ void *send_frame_thread (void *threadid) /* warning! sendqueue_mutex should be locked by thread calling this function! */ void clear_send_queue(void) { - struct sendqueue_element* current=remoteVars.first_sendqueue_element; + struct sendqueue_element* current = NULL; + struct sendqueue_element* next = NULL; + + current=remoteVars.first_sendqueue_element; while(current) { if(current->frame) @@ -1600,7 +1627,7 @@ void clear_send_queue(void) current->frame->source->busy--; current->frame->source=0; } - struct sendqueue_element* next=current->next; + next=current->next; free(current); current=next; } @@ -1616,13 +1643,15 @@ void clear_frame_cache(uint32_t max_elements) // EPHYR_DBG("cache elements %d, cache size %lu\n",cache_elements, cache_size); while(remoteVars.first_cache_element && remoteVars.cache_elements > max_elements) { + struct cache_elem* next = NULL; + /* don't delete it now, return to it later */ if(remoteVars.first_cache_element->busy) { EPHYR_DBG("%x - is busy (%d), not deleting", remoteVars.first_cache_element->crc, remoteVars.first_cache_element->busy); return; } - struct cache_elem* next=remoteVars.first_cache_element->next; + next = remoteVars.first_cache_element->next; if(remoteVars.first_cache_element->size) { free(remoteVars.first_cache_element->data); @@ -1633,6 +1662,7 @@ void clear_frame_cache(uint32_t max_elements) { /* add deleted element to the list for sending */ struct deleted_elem* delem=malloc(sizeof(struct deleted_elem)); + ++remoteVars.deleted_list_size; delem->next=0l; delem->crc=remoteVars.first_cache_element->crc; @@ -1672,13 +1702,15 @@ void clear_cache_data(uint32_t maxsize) struct cache_elem* cur=remoteVars.first_cache_element; while(cur && remoteVars.cache_size>maxsize) { + struct cache_elem* next = NULL; + /* don't delete it now, return to it later */ if(cur->busy) { EPHYR_DBG("%x - busy (%d)", cur->crc, cur->busy); return; } - struct cache_elem* next=cur->next; + next=cur->next; if(cur->size) { free(cur->data); @@ -1745,6 +1777,10 @@ void clientReadNotify(int fd, int ready, void *data) { BOOL con; + int length = 0; + int iterations = 0; + int restDataLength, restDataPos = 0; + pthread_mutex_lock(&remoteVars.sendqueue_mutex); con=remoteVars.client_connected; pthread_mutex_unlock(&remoteVars.sendqueue_mutex); @@ -1752,8 +1788,7 @@ clientReadNotify(int fd, int ready, void *data) return; /* read max 99 events */ - int length=read(remoteVars.clientsock,remoteVars.eventBuffer + remoteVars.evBufferOffset, EVLENGTH*99); - + length=read(remoteVars.clientsock,remoteVars.eventBuffer + remoteVars.evBufferOffset, EVLENGTH*99); if(length<0) { @@ -1770,8 +1805,7 @@ clientReadNotify(int fd, int ready, void *data) length+=remoteVars.evBufferOffset; - int iterations=length/EVLENGTH; - + iterations=length/EVLENGTH; for(int i=0;i<iterations;++i) { @@ -1781,6 +1815,7 @@ clientReadNotify(int fd, int ready, void *data) { int leftToRead=remoteVars.selstruct.inBuffer.size - remoteVars.selstruct.inBuffer.position; int chunk=(leftToRead < EVLENGTH)?leftToRead:EVLENGTH; + memcpy(remoteVars.selstruct.inBuffer.data+remoteVars.selstruct.inBuffer.position, buff, chunk); remoteVars.selstruct.inBuffer.position+=chunk; if(! (remoteVars.selstruct.inBuffer.position < remoteVars.selstruct.inBuffer.size)) @@ -1812,12 +1847,14 @@ clientReadNotify(int fd, int ready, void *data) else { uint32_t event_type=*((uint32_t*)buff); + switch(event_type) { case MotionNotify: { uint32_t x=*((uint32_t*)buff+1); uint32_t y=*((uint32_t*)buff+2); + // EPHYR_DBG("HAVE MOTION EVENT %d, %d from client\n",x,y); ephyrClientMouseMotion(x,y); break; @@ -1827,6 +1864,7 @@ clientReadNotify(int fd, int ready, void *data) { uint32_t state=*((uint32_t*)buff+1); uint32_t button=*((uint32_t*)buff+2); + // EPHYR_DBG("HAVE BUTTON PRESS/RELEASE EVENT %d, %d from client\n",state,button); ephyrClientButton(event_type,state, button); break; @@ -1835,6 +1873,7 @@ clientReadNotify(int fd, int ready, void *data) { uint32_t state=*((uint32_t*)buff+1); uint32_t key=*((uint32_t*)buff+2); + // EPHYR_DBG("HAVE KEY PRESS EVENT state: %d(%x), key: %d(%x) from client\n",state,state, key, key); // if (state & ShiftMask) // { @@ -1876,6 +1915,7 @@ clientReadNotify(int fd, int ready, void *data) { uint32_t state=*((uint32_t*)buff+1); uint32_t key=*((uint32_t*)buff+2); + // EPHYR_DBG("HAVE KEY RELEASE EVENT state: %d(%x), key: %d(%x) from client\n",state,state, key, key); // if (state & ShiftMask) // { @@ -1914,14 +1954,14 @@ clientReadNotify(int fd, int ready, void *data) } case GEOMETRY: { - remoteVars.client_initialized=TRUE; uint16_t width=*((uint16_t*)buff+2); uint16_t height=*((uint16_t*)buff+3); uint8_t primaryInd=*((uint8_t*)buff+8); + struct VirtScreen screens[4] = {0}; + remoteVars.client_initialized=TRUE; EPHYR_DBG("Client want resize to %dx%d",width,height); - struct VirtScreen screens[4]; memset(screens,0, sizeof(struct VirtScreen)*4); for(int i=0;i<4;++i) { @@ -1969,11 +2009,14 @@ clientReadNotify(int fd, int ready, void *data) { uint32_t size; uint8_t destination, mime; + inputBuffer* selbuff = NULL; + size=*((uint32_t*)buff+1); destination=*((uint8_t*)buff+8); mime=*((uint8_t*)buff+9); + EPHYR_DBG("HAVE NEW INCOMING SELECTION: %d %d %d",size, destination, mime); - inputBuffer* selbuff; + if(destination==CLIPBOARD) selbuff=&(remoteVars.selstruct.inClipboard); else @@ -2019,8 +2062,8 @@ clientReadNotify(int fd, int ready, void *data) } // EPHYR_DBG("Processed event - %d %d\n",eventnum++, eventbytes); } - int restDataLength=length%EVLENGTH; - int restDataPos=length-restDataLength; + restDataLength=length%EVLENGTH; + restDataPos=length-restDataLength; if(restDataLength) memcpy(remoteVars.eventBuffer, remoteVars.eventBuffer+restDataPos, restDataLength); @@ -2051,6 +2094,8 @@ void open_socket(void) { ssize_t size; const int y = 1; + int ret = -1; + remoteVars.serversock=socket (AF_INET, SOCK_STREAM, 0); setsockopt( remoteVars.serversock, SOL_SOCKET, SO_REUSEADDR, &y, sizeof(int)); remoteVars.address.sin_family = AF_INET; @@ -2083,7 +2128,7 @@ void open_socket(void) remoteVars.checkConnectionTimer=TimerSet(0,0,ACCEPT_TIMEOUT, checkSocketConnection, NULL); - int ret = pthread_create(&remoteVars.send_thread_id, NULL, send_frame_thread, (void *)remoteVars.send_thread_id); + ret = pthread_create(&remoteVars.send_thread_id, NULL, send_frame_thread, (void *)remoteVars.send_thread_id); if (ret) { EPHYR_DBG("ERROR; return code from pthread_create() is %d\n", ret); @@ -2266,6 +2311,8 @@ int remote_init(void) { + char* displayVar = NULL; + /*int it in os init*/ fclose(stdout); @@ -2276,23 +2323,21 @@ remote_init(void) remoteVars.jpegQuality=JPG_QUALITY; remoteVars.compression=DEFAULT_COMPRESSION; - pthread_mutex_init(&remoteVars.mainimg_mutex, NULL); pthread_mutex_init(&remoteVars.sendqueue_mutex,NULL); pthread_cond_init(&remoteVars.have_sendqueue_cond,NULL); - - char *displayVar=secure_getenv("DISPLAY"); - + displayVar=secure_getenv("DISPLAY"); if(displayVar) { if(!strncmp(displayVar,"nx/nx,options=",strlen("nx/nx,options="))) { - EPHYR_DBG("running in NXAGENT MODE"); - remoteVars.nxagentMode=TRUE; int i=strlen("nx/nx,options="); int j=0; + + EPHYR_DBG("running in NXAGENT MODE"); + remoteVars.nxagentMode=TRUE; while(displayVar[i]!=':' && i<strlen(displayVar) && j<254) { remoteVars.optionsFile[j++]=displayVar[i++]; @@ -2327,6 +2372,13 @@ static void PngWriteCallback(png_structp png_ptr, png_bytep data, png_size_t le unsigned char* png_compress( uint32_t image_width, uint32_t image_height, unsigned char* RGBA_buffer, uint32_t* png_size) { + unsigned char** rows=calloc(sizeof(unsigned char*),image_height); + struct + { + uint32_t* size; + unsigned char *out; + }outdata; + png_structp p = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); png_infop info_ptr = png_create_info_struct(p); @@ -2337,21 +2389,11 @@ unsigned char* png_compress( uint32_t image_width, uint32_t image_height, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - - *png_size=0; - - struct - { - uint32_t* size; - unsigned char *out; - }outdata; - outdata.size=png_size; outdata.out=0; - unsigned char** rows=calloc(sizeof(unsigned char*),image_height); for (uint32_t y = 0; y < image_height; ++y) rows[y] = (unsigned char*)RGBA_buffer + y * image_width * CACHEBPP; @@ -2466,7 +2508,11 @@ struct cache_elem* add_cache_element(uint32_t crc, int32_t dx, int32_t dy, uint3 // } // else { + + uint32_t i=0; + uint32_t numOfPix=size/4; uint32_t isize=size/4*3; + el->size=isize; // EPHYR_DBG("SIZE %d %d %d, %d, %d",isize, dx, dy, width, height); el->data=malloc(isize); @@ -2478,8 +2524,6 @@ struct cache_elem* add_cache_element(uint32_t crc, int32_t dx, int32_t dy, uint3 remoteVars.cache_size+=isize; /* copy RGB channels of every pixel and ignore A channel */ - uint32_t numOfPix=size/4; - uint32_t i=0; pthread_mutex_lock(&remoteVars.mainimg_mutex); @@ -2568,7 +2612,6 @@ void initFrameRegions(struct cache_elem* frame) struct frame_region* regions=frame->regions; BOOL diff; - if(frame->width>4 && frame->height>4 && frame->width * frame->height > 100 ) { unsigned int match_val = 0; @@ -2589,15 +2632,17 @@ void initFrameRegions(struct cache_elem* frame) bestm_crc=best_match->crc; if(best_match && match_val<=MAX_MATCH_VAL) { - clock_t t = clock(); - rectangle rect; - int hshift, vshift; + + rectangle rect = {0}; + int hshift, vshift = 0; if(find_common_regions(best_match, frame, &diff, &rect, &hshift, &vshift)) { haveMultplyRegions=TRUE; if(!diff) { + int prev = -1; + // EPHYR_DBG("SOURCE: %x %d:%d - %dx%d- shift %d, %d",bestm_crc, // rect.lt_corner.x, rect.lt_corner.y, // rect.size.width, rect.size.height, hshift, vshift); @@ -2651,7 +2696,6 @@ void initFrameRegions(struct cache_elem* frame) regions[3].rect.size.height=regions[4].rect.size.height=base->size.height; - int prev=-1; for(int i=0;i<8;++i) { if(regions[i].rect.size.width && regions[i].rect.size.height) @@ -2748,6 +2792,8 @@ void initFrameRegions(struct cache_elem* frame) } else { + + char fname[255]; // #warning check this uint8_t *data=malloc(regions[1].rect.size.width*regions[1].rect.size.height*CACHEBPP); @@ -2759,7 +2805,6 @@ void initFrameRegions(struct cache_elem* frame) regions[1].rect.size.width*CACHEBPP); } - char fname[255]; sprintf(fname,"/tmp/ephyrdbg/%x-rect_inv.jpg",frame->crc); regions[1].compressed_data=image_compress(regions[1].rect.size.width, regions[1].rect.size.height, @@ -2773,6 +2818,9 @@ void initFrameRegions(struct cache_elem* frame) void add_frame(uint32_t width, uint32_t height, int32_t x, int32_t y, uint32_t crc, uint32_t size) { + Bool isNewElement = FALSE; + struct cache_elem* frame = 0; + struct sendqueue_element* element = NULL; pthread_mutex_lock(&remoteVars.sendqueue_mutex); if(! (remoteVars.client_connected && remoteVars.client_initialized)) @@ -2782,9 +2830,6 @@ void add_frame(uint32_t width, uint32_t height, int32_t x, int32_t y, uint32_t c return; } - Bool isNewElement=FALSE; - - struct cache_elem* frame=0; if(crc==0) { /* sending main image */ @@ -2818,7 +2863,7 @@ void add_frame(uint32_t width, uint32_t height, int32_t x, int32_t y, uint32_t c pthread_mutex_lock(&remoteVars.sendqueue_mutex); /* add element in the queue for sending */ - struct sendqueue_element* element=malloc(sizeof(struct sendqueue_element)); + element=malloc(sizeof(struct sendqueue_element)); element->frame=frame; element->next=NULL; element->x=x; @@ -2858,12 +2903,25 @@ remote_paint_rect(KdScreenInfo *screen, if(size) { + int32_t dirtyx_max = 0; + int32_t dirtyy_max = 0; + + int32_t dirtyx_min = 0; + int32_t dirtyy_min = 0; + + char maxdiff = 0; + char mindiff = 0; + // EPHYR_DBG("REPAINT %dx%d sx %d, sy %d, dx %d, dy %d", width, height, sx, sy, dx, dy); - int32_t dirtyx_max=dx-1; - int32_t dirtyy_max=dy-1; - int32_t dirtyx_min=dx+width; - int32_t dirtyy_min=dy+height; + dirtyx_max=dx-1; + dirtyy_max=dy-1; + + dirtyx_min=dx+width; + dirtyy_min=dy+height; + + maxdiff=2; + mindiff=-2; /* * OK, here we assuming that XSERVERBPP is 4. If not, we'll have troubles @@ -2871,9 +2929,6 @@ remote_paint_rect(KdScreenInfo *screen, */ pthread_mutex_lock(&remoteVars.mainimg_mutex); - char maxdiff=2; - char mindiff=-2; - /* check if updated rec really is as big */ for(int32_t y=dy; y< dy+height;++y) { @@ -2982,6 +3037,7 @@ remote_screen_init(KdScreenInfo *screen, int width, int height, int buffer_height, int *bytes_per_line, int *bits_per_pixel) { + EphyrScrPriv *scrpriv = screen->driver; //We should not install callback at first screen init, it was installed by selection_init //but we need to reinstall it by the next screen init. @@ -2998,7 +3054,6 @@ remote_screen_init(KdScreenInfo *screen, install_selection_callbacks(); } - EphyrScrPriv *scrpriv = screen->driver; EPHYR_DBG("host_screen=%p x=%d, y=%d, wxh=%dx%d, buffer_height=%d", screen, x, y, width, height, buffer_height); diff --git a/x2gokdriveselection.c b/x2gokdriveselection.c index 71886b3..7b944b3 100644 --- a/x2gokdriveselection.c +++ b/x2gokdriveselection.c @@ -54,6 +54,10 @@ static int (*proc_change_property_orig)(ClientPtr); int own_selection(int target) { + Selection *pSel = NULL; + SelectionInfoRec info = {0}; + Atom selection=atomPrimary; + int rc; if(remoteVars->selstruct.selectionMode == CLIP_SERVER || remoteVars->selstruct.selectionMode == CLIP_NONE) { @@ -61,12 +65,6 @@ int own_selection(int target) return Success; } - Selection *pSel; - int rc; - - SelectionInfoRec info; - - Atom selection=atomPrimary; if(target==CLIPBOARD) selection=atomClipboard; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 100d36ed03f27cdebadb0c3bdd7eb0263e7de4d4 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 14:47:23 2019 +0200 x2gokdrive*.c: Make all comments and deactivate code passages look uniform. --- x2gokdrive.c | 80 +++----- x2gokdriveinit.c | 23 ++- x2gokdriveremote.c | 512 +++++++++++++++++++++++++------------------------- x2gokdriveselection.c | 12 +- 4 files changed, 300 insertions(+), 327 deletions(-) diff --git a/x2gokdrive.c b/x2gokdrive.c index 004a3dd..02290be 100644 --- a/x2gokdrive.c +++ b/x2gokdrive.c @@ -406,7 +406,7 @@ ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); - //remove all sizes. This keep randr from changing our config + /* remove all sizes. This keep randr from changing our config */ if (pScrPriv->nSizes) { free(pScrPriv->pSizes); @@ -417,7 +417,7 @@ ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations) EPHYR_DBG("GET RANDR INFO END, SENDING SIZE NOTIFY"); -// RRScreenSizeNotify(pScreen); +// RRScreenSizeNotify(pScreen); return TRUE; } @@ -576,15 +576,15 @@ ephyrRandRSetConfig(ScreenPtr pScreen, pScrPriv->pSizes = NULL; pScrPriv->nSizes = 0; - //do not register any sizes -/* - pSize = RRRegisterSize(pScreen, - screen->width, - screen->height, - screen->width_mm, - screen->height_mm); + /* do not register any sizes */ - EPHYR_DBG("new size registered");*/ +// pSize = RRRegisterSize(pScreen, +// screen->width, +// screen->height, +// screen->width_mm, +// screen->height_mm); +// +// EPHYR_DBG("new size registered"); randr = KdSubRotation(scrpriv->randr, screen->randr); @@ -638,16 +638,16 @@ ephyrRandRSetConfig(ScreenPtr pScreen, -// RRSetCurrentConfig(pScreen, randr, 0, pSize); +// RRSetCurrentConfig(pScreen, randr, 0, pSize); RRScreenSetSizeRange(pScreen, screen->width, screen->height, screen->width, screen->height); RRScreenSizeNotify(pScreen); RRSendConfigNotify(pScreen); -/* EPHYR_DBG("OUTPUTS: %d, CRTCS: %d, SIZES: %d, MODES %d" , pScrPriv->numOutputs, - pScrPriv->numCrtcs, pScrPriv->nSizes, pScrPriv->outputs[0]->numModes);*/ +// EPHYR_DBG("OUTPUTS: %d, CRTCS: %d, SIZES: %d, MODES %d" , pScrPriv->numOutputs, +// pScrPriv->numCrtcs, pScrPriv->nSizes, pScrPriv->outputs[0]->numModes); -// EPHYR_DBG("Have now sizes: %d",pScrPriv->nSizes); +// EPHYR_DBG("Have now sizes: %d",pScrPriv->nSizes); EPHYR_DBG("END RANDR SET CONFIG"); remote_send_main_image(); @@ -717,15 +717,15 @@ void setOutput(ScreenPtr pScreen, RROutputPtr output, RRCrtcPtr crtc, int width, FreeResource(mode->mode.id, 0); terminateServer(-1); } - // modes[output->numUserModes++] = mode; - // output->userModes = modes; +// modes[output->numUserModes++] = mode; +// output->userModes = modes; modes[output->numModes++] = mode; output->modes = modes; output->changed = TRUE; pScrPriv->changed = TRUE; pScrPriv->configChanged = TRUE; - // output->numPreferred=0; +// output->numPreferred=0; @@ -760,7 +760,7 @@ void setOutput(ScreenPtr pScreen, RROutputPtr output, RRCrtcPtr crtc, int width, void updateOutput(ScreenPtr pScreen, RROutputPtr output, int width, int height, int x, int y, BOOL primary, BOOL connected) { - //clear old modes + /* clear old modes */ RROutputSetModes(output, NULL, 0, 0); if(!output->numCrtcs) { @@ -781,7 +781,7 @@ void addOutput(ScreenPtr pScreen, char* name, int width, int height, int x, int RROutputPtr output; int n = 0; - //add new Output + /* add new Output */ EPHYR_DBG("CREATE OUTPUT %s",name); output = RROutputCreate(pScreen, name, strlen(name), NULL); if (!output) @@ -818,23 +818,14 @@ ephyrRandRInit(ScreenPtr pScreen) scrpriv->virtualScreens=NULL; scrpriv->localRandrCall=FALSE; - - - if (!RRScreenInit(pScreen)) return FALSE; - - pScrPriv = rrGetScrPriv(pScreen); pScrPriv->rrGetInfo = ephyrRandRGetInfo; pScrPriv->rrSetConfig = ephyrRandRSetConfig; pScrPriv->rrCrtcSet = ephyrRandRSetCRTC; - - - - EPHYR_DBG("RANDR INIT, HERE WE ARE DOING OUR RANDR INITIALIZATION"); EPHYR_DBG("OUTPUTS: %d, CRTCS: %d, SIZES: %d", pScrPriv->numOutputs, pScrPriv->numCrtcs, pScrPriv->nSizes); @@ -849,8 +840,6 @@ ephyrRandRInit(ScreenPtr pScreen) addOutput(pScreen,"X2GoEphyr-0", screen->width, screen->height, 0,0, TRUE, TRUE); - - return TRUE; } @@ -875,7 +864,6 @@ ephyrResizeScreen (ScreenPtr pScreen, Bool ret; int t; - if (screen->randr & (RR_Rotate_90|RR_Rotate_270)) { t = newwidth; newwidth = newheight; @@ -883,7 +871,7 @@ ephyrResizeScreen (ScreenPtr pScreen, } if (newwidth == screen->width && newheight == screen->height) { - //return FALSE; +// return FALSE; } size.width = newwidth; @@ -892,18 +880,16 @@ ephyrResizeScreen (ScreenPtr pScreen, scrpriv->localRandrCall=TRUE; ret = ephyrRandRSetConfig (pScreen, screen->randr, 0, &size ); -/* if (ret) { - RROutputPtr output; - - output = RRFirstOutput(pScreen); - if (!output) - return FALSE; - RROutputSetModes(output, NULL, 0, 0); - }*/ +// if (ret) { +// RROutputPtr output; +// +// output = RRFirstOutput(pScreen); +// if (!output) +// return FALSE; +// RROutputSetModes(output, NULL, 0, 0); +// } EPHYR_DBG("END EPHYR RESIZE SCREEN!!!"); - - return ret; } #endif @@ -927,7 +913,6 @@ ephyrInitScreen(ScreenPtr pScreen) } - Bool ephyrFinishInitScreen(ScreenPtr pScreen) { @@ -949,14 +934,10 @@ ephyrFinishInitScreen(ScreenPtr pScreen) scrpriv->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = ephyrScreenBlockHandler; - - - - return TRUE; } -/** +/* * Called by kdrive after calling down the * pScreen->CreateScreenResources() chain, this gives us a chance to * make any pixmaps after the screen and all extensions have been @@ -1312,7 +1293,6 @@ ephyrProcessKeyPress(xcb_generic_event_t *xev) KdEnqueueKeyboardEvent(ephyrKbd, key->detail, FALSE); } - static void ephyrProcessKeyRelease(xcb_generic_event_t *xev) { @@ -1332,8 +1312,6 @@ ephyrProcessConfigureNotify(xcb_generic_event_t *xev) #endif /* RANDR */ } - - static void ephyrXcbProcessEvents(Bool queued_only) { diff --git a/x2gokdriveinit.c b/x2gokdriveinit.c index ff02396..39d7693 100644 --- a/x2gokdriveinit.c +++ b/x2gokdriveinit.c @@ -68,7 +68,7 @@ void ddxInputThreadInit(void); int main(int argc, char *argv[], char *envp[]) { -// hostx_use_resname(basename(argv[0]), 0); +// hostx_use_resname(basename(argv[0]), 0); return dix_main(argc, argv, envp); } @@ -224,14 +224,13 @@ processOutputArg(const char *output, char *parent_id) int ddxProcessArgument(int argc, char **argv, int i) { - static char *parent = NULL; EPHYR_DBG("mark argv[%d]='%s'", i, argv[i]); if (!strcmp(argv[i], "-geometry")) { if ((i + 1) < argc) { - //compat with nxagent + /* compat with nxagent */ return 2; } @@ -242,7 +241,7 @@ ddxProcessArgument(int argc, char **argv, int i) { if ((i + 1) < argc) { - //compat with nxagent + /* compat with nxagent */ return 2; } @@ -250,11 +249,11 @@ ddxProcessArgument(int argc, char **argv, int i) exit(1); } else if (!strcmp(argv[i], "-D")) { - //compat with nxagent + /* compat with nxagent */ return 1; } else if (!strcmp(argv[i], "-K")) { - //compat with nxagent + /* compat with nxagent */ return 1; } @@ -268,12 +267,16 @@ OsVendorInit(void) restartTimerOnInit(); -/* if (SeatId) - hostx_use_sw_cursor(); -*/ +// if (SeatId) +// hostx_use_sw_cursor(); +// // if (hostx_want_host_cursor()) - ephyrFuncs.initCursor = &ephyrCursorInit; +// { + + ephyrFuncs.initCursor = &ephyrCursorInit; + +// } #if XORG_VERSION_CURRENT < 11999901 KdOsInit(&EphyrOsFuncs); diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index ebbd128..e06ad95 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -230,7 +230,7 @@ void remote_removeCursor(uint32_t serialNumber) void remote_sendCursor(CursorPtr cursor) { -#warning check memory +// #warning check memory struct cursorFrame* cframe=malloc(sizeof(struct cursorFrame)); cframe->serialNumber=cursor->serialNumber; cframe->size=0; @@ -262,8 +262,10 @@ void remote_sendCursor(CursorPtr cursor) cframe->xhot=cursor->bits->xhot; cframe->yhot=cursor->bits->yhot; - //in X11 implementation we have 2bits for color, not from 0 to 255 but from 0 to 65535. - //no idea why, RGBA is still 4bytes. I think one byte per color component is suuficient, so let's just recalculate to 1byte per component + /* In X11 implementation we have 2bits for color, not from 0 to 255 but from 0 to 65535. + * no idea why, RGBA is still 4bytes. I think one byte per color component is suuficient, + * so let's just recalculate to 1byte per component + */ cframe->backR=cursor->backRed*255./65535.0; cframe->backG=cursor->backGreen*255./65535.0; @@ -283,7 +285,6 @@ void remote_sendCursor(CursorPtr cursor) pthread_mutex_unlock(&remoteVars.sendqueue_mutex); } - int32_t send_cursor(struct cursorFrame* cursor) { @@ -324,7 +325,7 @@ int32_t send_cursor(struct cursorFrame* cursor) sent+=l; } remoteVars.data_sent+=sent; - // EPHYR_DBG("SENT total %d", total); +// EPHYR_DBG("SENT total %d", total); return sent; } @@ -349,13 +350,13 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin *((uint32_t*)buffer+4)=y; *((uint32_t*)buffer+5)=numofregions; *((uint32_t*)buffer+6)=crc; -/* - if(numofregions) - EPHYR_DBG("SENDING NEW FRAME %x", crc); - else - EPHYR_DBG("SENDING REFERENCE %x", crc);*/ -// #warning check this +// if(numofregions) +// EPHYR_DBG("SENDING NEW FRAME %x", crc); +// else +// EPHYR_DBG("SENDING REFERENCE %x", crc); + +// #warning check this int ln=write(remoteVars.clientsock, buffer,56); uint32_t total=0; for(int i=0;i<9;++i) @@ -363,13 +364,13 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin if(!(regions[i].rect.size.width && regions[i].rect.size.height)) continue; -/* EPHYR_DBG("SENDING FRAME REGION %x %dx%d %d",regions[i].source_crc, regions[i].rect.size.width, regions[i].rect.size.height, - regions[i].size); -*/ +// EPHYR_DBG("SENDING FRAME REGION %x %dx%d %d",regions[i].source_crc, regions[i].rect.size.width, regions[i].rect.size.height, +// regions[i].size); + *((uint32_t*)buffer)=regions[i].source_crc; - /*if(*((uint32_t*)buffer)=regions[i].source_crc) - EPHYR_DBG("SENDING REFERENCE %x", *((uint32_t*)buffer)=regions[i].source_crc);*/ +// if(*((uint32_t*)buffer)=regions[i].source_crc) +// EPHYR_DBG("SENDING REFERENCE %x", *((uint32_t*)buffer)=regions[i].source_crc); *((uint32_t*)buffer+1)=regions[i].source_coordinates.x; *((uint32_t*)buffer+2)=regions[i].source_coordinates.y; @@ -397,15 +398,16 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin sent+=l; } total+=sent; -// EPHYR_DBG("SENT %d",sent); -/* - EPHYR_DBG("\ncache elements %d, cache size %lu(%dMB), connection time=%d, sent %lu(%dMB)\n", - cache_elements, cache_size, (int) (cache_size/1024/1024), - time(NULL)-con_start_time, data_sent, (int) (data_sent/1024/1024)); -*/ +// EPHYR_DBG("SENT %d",sent); +// +// EPHYR_DBG("\ncache elements %d, cache size %lu(%dMB), connection time=%d, sent %lu(%dMB)\n", +// cache_elements, cache_size, (int) (cache_size/1024/1024), +// time(NULL)-con_start_time, data_sent, (int) (data_sent/1024/1024)); +// } remoteVars.data_sent+=total; + // EPHYR_DBG("SENT total %d", total); return total; @@ -419,7 +421,7 @@ int send_deleted_elements(void) // #warning check this int ln=write(remoteVars.clientsock,buffer,56); - // data_sent+=48; +// data_sent+=48; int sent=0; unsigned char* list=malloc(sizeof(uint32_t)*remoteVars.deleted_list_size); @@ -427,7 +429,7 @@ int send_deleted_elements(void) unsigned int i=0; while(remoteVars.first_deleted_elements) { -// EPHYR_DBG("To DELETE FRAME %x", remoteVars.first_deleted_elements->crc); +// EPHYR_DBG("To DELETE FRAME %x", remoteVars.first_deleted_elements->crc); *((uint32_t*)list+i)=remoteVars.first_deleted_elements->crc; struct deleted_elem* elem=remoteVars.first_deleted_elements; @@ -438,7 +440,7 @@ int send_deleted_elements(void) remoteVars.last_deleted_elements=0l; - // EPHYR_DBG("SENDING IMG length - %d, number - %d\n",length,framenum_sent++); +// EPHYR_DBG("SENDING IMG length - %d, number - %d\n",length,framenum_sent++); int length=remoteVars.deleted_list_size*sizeof(uint32_t); while(sent<length) { @@ -471,7 +473,7 @@ int send_deleted_cursors(void) { *((uint32_t*)list+i)=remoteVars.first_deleted_cursor->serialNumber; -// EPHYR_DBG("delete cursord %d",first_deleted_cursor->serialNumber); +// EPHYR_DBG("delete cursord %d",first_deleted_cursor->serialNumber); struct deletedCursor* elem=remoteVars.first_deleted_cursor; remoteVars.first_deleted_cursor=elem->next; free(elem); @@ -480,7 +482,7 @@ int send_deleted_cursors(void) remoteVars.last_deleted_cursor=0l; -// EPHYR_DBG("Sending list from %d elements", deletedcursor_list_size); +// EPHYR_DBG("Sending list from %d elements", deletedcursor_list_size); int length=remoteVars.deletedcursor_list_size*sizeof(uint32_t); while(sent<length) { @@ -523,7 +525,9 @@ int send_selection(int sel, char* data, uint32_t length, uint32_t format) -//sendqueue_mutex should be locked when calling this function +/* + * sendqueue_mutex should be locked when calling this function + */ struct cache_elem* find_best_match(struct cache_elem* frame, unsigned int* match_val) { struct cache_elem* current=frame->prev; @@ -567,7 +571,7 @@ BOOL checkShiftedRegion( struct cache_elem* src, struct cache_elem* dst, int32_ int32_t width, int32_t height, int32_t horiz_shift, int32_t vert_shift) { -// EPHYR_DBG("FENTER %d %d %d %d %d",x,y,width,height,shift); +// EPHYR_DBG("FENTER %d %d %d %d %d",x,y,width,height,shift); int32_t vert_point=20; int32_t hor_point=20; @@ -611,32 +615,31 @@ BOOL checkShiftedRegion( struct cache_elem* src, struct cache_elem* dst, int32_ } -// EPHYR_DBG("Indexes %d, %d, %d, %d %d", src_ind, dst_ind, src->size, dst->size, i); +// EPHYR_DBG("Indexes %d, %d, %d, %d %d", src_ind, dst_ind, src->size, dst->size, i); if(src->data[src_ind]!=dst->data[dst_ind]) { -// EPHYR_DBG("FEXIT"); +// EPHYR_DBG("FEXIT"); return FALSE; } if(src->data[src_ind+1]!=dst->data[dst_ind+1]) { -// EPHYR_DBG("FEXIT"); +// EPHYR_DBG("FEXIT"); return FALSE; } if(src->data[src_ind+2]!=dst->data[dst_ind+2]) { -// EPHYR_DBG("FEXIT"); +// EPHYR_DBG("FEXIT"); return FALSE; } } } -// EPHYR_DBG("FEXIT"); +// EPHYR_DBG("FEXIT"); return TRUE; } - int32_t checkScrollUp(struct cache_elem* source, struct cache_elem* dest) { -// EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); int32_t max_shift=source->height/3; int32_t x=source->width/10; int32_t y=source->height/10; @@ -649,7 +652,7 @@ int32_t checkScrollUp(struct cache_elem* source, struct cache_elem* dest) } if(width<2) { -// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return -1; } @@ -661,11 +664,11 @@ int32_t checkScrollUp(struct cache_elem* source, struct cache_elem* dest) } if(height<2) { -// EPHYR_DBG("DST too small(h), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(h), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return -1; } -// EPHYR_DBG(" %u %u %u %u %u",x,y,width, height, max_shift); +// EPHYR_DBG(" %u %u %u %u %u",x,y,width, height, max_shift); for(int32_t shift=0;shift<max_shift;++shift) @@ -674,17 +677,16 @@ int32_t checkScrollUp(struct cache_elem* source, struct cache_elem* dest) continue; if(shift) { -// EPHYR_DBG("Shift %d, Cursor is matched!\n",shift); +// EPHYR_DBG("Shift %d, Cursor is matched!\n",shift); return shift; } } return -1; } - int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) { -// EPHYR_DBG("checking for down scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("checking for down scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); int32_t max_shift=source->height/3*-1; int32_t x=source->width/10; int32_t y=source->height/2; @@ -692,7 +694,7 @@ int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) int32_t width=source->width/2-source->width/5; int32_t height=source->height/2-source->height/10; -// EPHYR_DBG(" %u %u %u %u %u",x,y,width, height, max_shift); +// EPHYR_DBG(" %u %u %u %u %u",x,y,width, height, max_shift); if(x+width >= dest->width) { @@ -700,7 +702,7 @@ int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) } if(width<2) { -// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return 1; } @@ -711,7 +713,7 @@ int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) } if(height<2) { -// EPHYR_DBG("DST too small(h), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(h), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return 1; } @@ -721,16 +723,15 @@ int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) if(!checkShiftedRegion( source, dest, x, y, width, height, 0,shift)) continue; if(shift) - // EPHYR_DBG("Shift %d, Cursor is matched!\n",shift); +// EPHYR_DBG("Shift %d, Cursor is matched!\n",shift); return shift; } return 1; } - int32_t checkScrollRight(struct cache_elem* source, struct cache_elem* dest) { - // EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); int32_t max_shift=source->width/3; int32_t x=source->width/10; int32_t y=source->height/10; @@ -743,7 +744,7 @@ int32_t checkScrollRight(struct cache_elem* source, struct cache_elem* dest) } if(height<2) { -// EPHYR_DBG("DST too small(d), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(d), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return -1; } @@ -755,11 +756,11 @@ int32_t checkScrollRight(struct cache_elem* source, struct cache_elem* dest) } if(width<2) { -// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return -1; } -// EPHYR_DBG(" %u %u %u %u %u",x,y,width, height, max_shift); +// EPHYR_DBG(" %u %u %u %u %u",x,y,width, height, max_shift); for(int32_t shift=0;shift<max_shift;++shift) @@ -768,18 +769,16 @@ int32_t checkScrollRight(struct cache_elem* source, struct cache_elem* dest) continue; if(shift) { - // EPHYR_DBG("Shift %d, Cursor is matched!\n",shift); +// EPHYR_DBG("Shift %d, Cursor is matched!\n",shift); return shift; } } return -1; } - - int32_t checkScrollLeft(struct cache_elem* source, struct cache_elem* dest) { - // EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); int32_t max_shift=source->width/3*-1; int32_t x=source->width/2; int32_t y=source->height/10; @@ -792,7 +791,7 @@ int32_t checkScrollLeft(struct cache_elem* source, struct cache_elem* dest) } if(height<2) { -// EPHYR_DBG("DST too small(d), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(d), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return 1; } @@ -804,11 +803,11 @@ int32_t checkScrollLeft(struct cache_elem* source, struct cache_elem* dest) } if(width<2) { -// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return 1; } -// EPHYR_DBG(" %d %d %d %d %d",x,y,width, height, max_shift); +// EPHYR_DBG(" %d %d %d %d %d",x,y,width, height, max_shift); for(int32_t shift=0;shift>max_shift;--shift) @@ -817,15 +816,13 @@ int32_t checkScrollLeft(struct cache_elem* source, struct cache_elem* dest) continue; if(shift) { -// EPHYR_DBG("Shift %d, Cursor is matched!\n",shift); +// EPHYR_DBG("Shift %d, Cursor is matched!\n",shift); return shift; } } return 1; } - - BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, int32_t shift_horiz, int32_t shift_vert, rectangle* common_rect) { @@ -846,7 +843,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, if(center_x+shift_horiz >= dst->width || center_y+shift_vert >=dst->height) { - //dst is too small for shift + /* dst is too small for shift */ return FALSE; } @@ -872,11 +869,11 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, } -// EPHYR_DBG("Center: %dx%d", center_x, center_y); +// EPHYR_DBG("Center: %dx%d", center_x, center_y); -// EPHYR_DBG("initial down_right %dx%d",right_x,down_y); +// EPHYR_DBG("initial down_right %dx%d",right_x,down_y); for(y=center_y;y<=down_y;++y) { @@ -885,7 +882,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, int32_t src_ind=(y*src->width+x)*CACHEBPP; int32_t dst_ind=((y+shift_vert)*dst->width+x+shift_horiz)*CACHEBPP; -// EPHYR_DBG("%d %d %d %d %d %d", x, y, right_x, down_y, dst->height, shift_vert); +// EPHYR_DBG("%d %d %d %d %d %d", x, y, right_x, down_y, dst->height, shift_vert); if (src_ind<0 || src_ind +2 > src->size || dst_ind <0 || dst_ind > dst->size ) { @@ -910,7 +907,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, { down_y=y-1; } -// EPHYR_DBG("limit right down to %dx%d",right_x,down_y); +// EPHYR_DBG("limit right down to %dx%d",right_x,down_y); break; } } @@ -918,7 +915,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, loop_exit_0: -// EPHYR_DBG("initial down_left %dx%d",left_x,down_y); +// EPHYR_DBG("initial down_left %dx%d",left_x,down_y); for(y=center_y;y<=down_y;++y) { for(x=center_x; x>=left_x;--x) @@ -948,7 +945,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, { down_y=y-1; } -// EPHYR_DBG("limit left down to %dx%d",left_x,down_y); +// EPHYR_DBG("limit left down to %dx%d",left_x,down_y); break; } } @@ -956,7 +953,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, loop_exit_1: -// EPHYR_DBG("initial top_right %dx%d",right_x,top_y); +// EPHYR_DBG("initial top_right %dx%d",right_x,top_y); for(y=center_y;y>=top_y;--y) { @@ -988,7 +985,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, { top_y=y+1; } -// EPHYR_DBG("limit right top to %dx%d",right_x,top_y); +// EPHYR_DBG("limit right top to %dx%d",right_x,top_y); break; } } @@ -996,11 +993,11 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, loop_exit_2:; -// EPHYR_DBG("top_right %dx%d",right_x,top_y); +// EPHYR_DBG("top_right %dx%d",right_x,top_y); -// EPHYR_DBG("initial top_left %dx%d\n",left_x,top_y); +// EPHYR_DBG("initial top_left %dx%d\n",left_x,top_y); for(y=center_y;y>=top_y;--y) { for(x=center_x; x>=left_x;--x) @@ -1032,7 +1029,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, { top_y=y+1; } -// EPHYR_DBG("limit left down to %dx%d",left_x,down_y); +// EPHYR_DBG("limit left down to %dx%d",left_x,down_y); break; } } @@ -1045,21 +1042,20 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, if(common_rect->size.width<1 || common_rect->size.height <1) { -// EPHYR_DBG("!!!!!!!NEGATIVE OR NULL GEOMETRY!!!!!!!"); +// EPHYR_DBG("!!!!!!!NEGATIVE OR NULL GEOMETRY!!!!!!!"); return FALSE; } common_rect->lt_corner.x=left_x; common_rect->lt_corner.y=top_y; -// EPHYR_DBG("Geometry: %d:%d %dx%d shift - %d %d ", left_x, top_y, common_rect->size.width, -// common_rect->size.height, shift_horiz, shift_vert); +// EPHYR_DBG("Geometry: %d:%d %dx%d shift - %d %d ", left_x, top_y, common_rect->size.width, +// common_rect->size.height, shift_horiz, shift_vert); return TRUE; } - BOOL checkMovedContent(struct cache_elem* source, struct cache_elem* dest, int32_t* horiz_shift, int32_t* vert_shift) { -// EPHYR_DBG("checking for moved content %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("checking for moved content %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); int32_t max_shift=source->width/8; if(max_shift>source->height/8) @@ -1080,7 +1076,7 @@ BOOL checkMovedContent(struct cache_elem* source, struct cache_elem* dest, int32 } if(height<2) { -// EPHYR_DBG("DST too small(d), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(d), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return FALSE; } @@ -1092,12 +1088,11 @@ BOOL checkMovedContent(struct cache_elem* source, struct cache_elem* dest, int32 } if(width<2) { -// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); +// EPHYR_DBG("DST too small(w), skeep checking %d %d %d %d", source->width, source->height, dest->width, dest->height); return FALSE; } - // EPHYR_DBG(" %d %d %d %d %d",x,y,width, height, max_shift); - +// EPHYR_DBG(" %d %d %d %d %d",x,y,width, height, max_shift); for(int32_t hshift=0;hshift<max_shift;hshift++) { @@ -1167,15 +1162,15 @@ BOOL findDiff(struct cache_elem* source, struct cache_elem* dest, rectangle* dif if(eff>0.8) return FALSE; -// EPHYR_DBG("REG_GEOM: %dx%d. DIF_GEOM %d,%d - %dx%d EFF=%f", source->width, source->height, left_x,top_y, -// diff_rect->size.width, diff_rect->size.height,eff); +// EPHYR_DBG("REG_GEOM: %dx%d. DIF_GEOM %d,%d - %dx%d EFF=%f", source->width, source->height, left_x,top_y, +// diff_rect->size.width, diff_rect->size.height,eff); return TRUE; } BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOOL* diff, rectangle* common_rect, int32_t* hshift, int32_t* vshift) { - // EPHYR_DBG("checking for common regions"); +// EPHYR_DBG("checking for common regions"); @@ -1186,7 +1181,7 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO *vshift=checkScrollDown(source,dest); if(*vshift<0) { -// EPHYR_DBG("Found scroll down, vert shift %d %u %u %u %u" , *vshift, dest->width, dest->height, dest->crc, source->crc); +// EPHYR_DBG("Found scroll down, vert shift %d %u %u %u %u" , *vshift, dest->width, dest->height, dest->crc, source->crc); return checkEquality(source, dest, 0, *vshift, common_rect); } @@ -1194,7 +1189,7 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO *vshift=checkScrollUp(source, dest); if(*vshift>0) { -// EPHYR_DBG("Found scroll up, vert shift %d %u %u %u %u" , *vshift, dest->width, dest->height, dest->crc, source->crc); +// EPHYR_DBG("Found scroll up, vert shift %d %u %u %u %u" , *vshift, dest->width, dest->height, dest->crc, source->crc); return checkEquality(source, dest, 0, *vshift, common_rect); } @@ -1214,7 +1209,7 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO *hshift=checkScrollLeft(source, dest); if(*hshift<0) { -// EPHYR_DBG("SCROLL LEFT %d", *hshift); +// EPHYR_DBG("SCROLL LEFT %d", *hshift); return checkEquality(source, dest, *hshift, 0, common_rect); } @@ -1227,7 +1222,7 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO { *hshift=h_shift; *vshift=v_shift; -// EPHYR_DBG("found moved content %d, %d", *hshift, *vshift); +// EPHYR_DBG("found moved content %d, %d", *hshift, *vshift); return checkEquality(source, dest, *hshift, *vshift, common_rect); } } @@ -1240,11 +1235,11 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO return findDiff(source, dest, common_rect); } -// EPHYR_DBG("Scroll not found %d",dest->crc); +// EPHYR_DBG("Scroll not found %d",dest->crc); return FALSE; } -//use only from send thread +/* use only from send thread */ void sendMainImageFromSendThread(uint32_t width, uint32_t height, int32_t dx ,int32_t dy) { @@ -1273,7 +1268,6 @@ void sendMainImageFromSendThread(uint32_t width, uint32_t height, int32_t dx ,in regions[i].size=0; } - BOOL mainImage=FALSE; if(!width || (dx==0 && dy==0 && width==remoteVars.main_img_width && height==remoteVars.main_img_height)) { @@ -1365,7 +1359,7 @@ void *send_frame_thread (void *threadid) } if(strlen(remoteVars.cookie)) { -// EPHYR_DBG("Checking cookie: %s",remoteVars.cookie); +// EPHYR_DBG("Checking cookie: %s",remoteVars.cookie); char msg[33]; int length=32; int ready=0; @@ -1434,15 +1428,15 @@ void *send_frame_thread (void *threadid) if(!remoteVars.first_sendqueue_element && !remoteVars.firstCursor) { - //sleep if frame queue is empty + /* sleep if frame queue is empty */ pthread_cond_wait(&remoteVars.have_sendqueue_cond, &remoteVars.sendqueue_mutex); } - //mutex is locked on this point + /* mutex is locked on this point */ if(remoteVars.firstCursor) { - //get cursor from queue, delete it from queue, unlock mutex and send cursor. After sending free cursor + /* get cursor from queue, delete it from queue, unlock mutex and send cursor. After sending free cursor */ struct cursorFrame* cframe=remoteVars.firstCursor; if(remoteVars.firstCursor->next) @@ -1499,9 +1493,10 @@ void *send_frame_thread (void *threadid) { remoteVars.maxfr=elems; } - // EPHYR_DBG("have %d max frames in queue, current %d", remoteVars.,elems); +// EPHYR_DBG("have %d max frames in queue, current %d", remoteVars.,elems); struct cache_elem* frame=remoteVars.first_sendqueue_element->frame; - //delete first element from frame queue + + /* delete first element from frame queue */ struct sendqueue_element* current=remoteVars.first_sendqueue_element; if(remoteVars.first_sendqueue_element->next) { @@ -1526,7 +1521,7 @@ void *send_frame_thread (void *threadid) uint32_t height=frame->height; BOOL show_time=FALSE; - //unlock sendqueue for main thread + /* unlock sendqueue for main thread */ pthread_mutex_unlock(&remoteVars.sendqueue_mutex); send_frame(width, height, x, y, crc, frame->regions); } @@ -1588,11 +1583,11 @@ void *send_frame_thread (void *threadid) } pthread_exit(0); } - #warning add some conditions to exit thread properly +// #warning add some conditions to exit thread properly pthread_exit(0); } -//warning! sendqueue_mutex should be locked by thread calling this function! +/* warning! sendqueue_mutex should be locked by thread calling this function! */ void clear_send_queue(void) { struct sendqueue_element* current=remoteVars.first_sendqueue_element; @@ -1612,14 +1607,16 @@ void clear_send_queue(void) remoteVars.first_sendqueue_element=remoteVars.last_sendqueue_element=NULL; } -//remove elements from cache and release all images if existing. -//warning! sendqueue_mutex should be locked by thread calling this function! +/* + * remove elements from cache and release all images if existing. + * warning! sendqueue_mutex should be locked by thread calling this function! + */ void clear_frame_cache(uint32_t max_elements) { -// EPHYR_DBG("cache elements %d, cache size %lu\n",cache_elements, cache_size); +// EPHYR_DBG("cache elements %d, cache size %lu\n",cache_elements, cache_size); while(remoteVars.first_cache_element && remoteVars.cache_elements > max_elements) { - //don't delete it now, return to it later; + /* don't delete it now, return to it later */ if(remoteVars.first_cache_element->busy) { EPHYR_DBG("%x - is busy (%d), not deleting", remoteVars.first_cache_element->crc, remoteVars.first_cache_element->busy); @@ -1634,12 +1631,12 @@ void clear_frame_cache(uint32_t max_elements) if(remoteVars.client_connected) { - //add deleted element to the list for sending + /* add deleted element to the list for sending */ struct deleted_elem* delem=malloc(sizeof(struct deleted_elem)); ++remoteVars.deleted_list_size; delem->next=0l; delem->crc=remoteVars.first_cache_element->crc; - // EPHYR_DBG("delete %x",delem->crc); +// EPHYR_DBG("delete %x",delem->crc); if(remoteVars.last_deleted_elements) { @@ -1661,18 +1658,21 @@ void clear_frame_cache(uint32_t max_elements) if(next) next->prev=NULL; } - if(!remoteVars.first_cache_element) + if(!remoteVars.first_cache_element) { remoteVars.last_cache_element=NULL; -// EPHYR_DBG("cache elements %d, cache size %d\n", cache_elements, cache_size); + } +// EPHYR_DBG("cache elements %d, cache size %d\n", cache_elements, cache_size); } -//only release images, keep the older frames for crc check +/* + * only release images, keep the older frames for crc check * + */ void clear_cache_data(uint32_t maxsize) { struct cache_elem* cur=remoteVars.first_cache_element; while(cur && remoteVars.cache_size>maxsize) { - //don't delete it now, return to it later; + /* don't delete it now, return to it later */ if(cur->busy) { EPHYR_DBG("%x - busy (%d)", cur->crc, cur->busy); @@ -1751,7 +1751,7 @@ clientReadNotify(int fd, int ready, void *data) if(!con) return; - //read max 99 events + /* read max 99 events */ int length=read(remoteVars.clientsock,remoteVars.eventBuffer + remoteVars.evBufferOffset, EVLENGTH*99); @@ -1766,7 +1766,7 @@ clientReadNotify(int fd, int ready, void *data) disconnect_client(); return; } - // EPHYR_DBG("Got ev bytes - %d\n",eventnum++); +// EPHYR_DBG("Got ev bytes - %d\n",eventnum++); length+=remoteVars.evBufferOffset; @@ -1807,7 +1807,7 @@ clientReadNotify(int fd, int ready, void *data) remoteVars.selstruct.inBuffer.position, selbuff->size); own_selection(selbuff->target); } -// EPHYR_DBG("CHUNK IS DONE %d",remoteVars.selstruct.readingInputBuffer); +// EPHYR_DBG("CHUNK IS DONE %d",remoteVars.selstruct.readingInputBuffer); } else { @@ -1818,7 +1818,7 @@ clientReadNotify(int fd, int ready, void *data) { uint32_t x=*((uint32_t*)buff+1); uint32_t y=*((uint32_t*)buff+2); - // EPHYR_DBG("HAVE MOTION EVENT %d, %d from client\n",x,y); +// EPHYR_DBG("HAVE MOTION EVENT %d, %d from client\n",x,y); ephyrClientMouseMotion(x,y); break; } @@ -1827,7 +1827,7 @@ clientReadNotify(int fd, int ready, void *data) { uint32_t state=*((uint32_t*)buff+1); uint32_t button=*((uint32_t*)buff+2); - // EPHYR_DBG("HAVE BUTTON PRESS/RELEASE EVENT %d, %d from client\n",state,button); +// EPHYR_DBG("HAVE BUTTON PRESS/RELEASE EVENT %d, %d from client\n",state,button); ephyrClientButton(event_type,state, button); break; } @@ -1835,40 +1835,39 @@ clientReadNotify(int fd, int ready, void *data) { uint32_t state=*((uint32_t*)buff+1); uint32_t key=*((uint32_t*)buff+2); - /*EPHYR_DBG("HAVE KEY PRESS EVENT state: %d(%x), key: %d(%x) from client\n",state,state, key, key); - * - * if (state & ShiftMask) - * { - * EPHYR_DBG("SHIFT"); - } - if (state & LockMask) - { - EPHYR_DBG("LOCK"); - } - if (state & ControlMask) - { - EPHYR_DBG("CONTROL"); - } - if (state & Mod1Mask) - { - EPHYR_DBG("MOD1"); - } - if (state & Mod2Mask) - { - EPHYR_DBG("MOD2"); - } - if (state & Mod3Mask) - { - EPHYR_DBG("MOD3"); - } - if (state & Mod4Mask) - { - EPHYR_DBG("MOD4"); - } - if (state & Mod5Mask) - { - EPHYR_DBG("MOD5"); - }*/ +// EPHYR_DBG("HAVE KEY PRESS EVENT state: %d(%x), key: %d(%x) from client\n",state,state, key, key); +// if (state & ShiftMask) +// { +// EPHYR_DBG("SHIFT"); +// } +// if (state & LockMask) +// { +// EPHYR_DBG("LOCK"); +// } +// if (state & ControlMask) +// { +// EPHYR_DBG("CONTROL"); +// } +// if (state & Mod1Mask) +// { +// EPHYR_DBG("MOD1"); +// } +// if (state & Mod2Mask) +// { +// EPHYR_DBG("MOD2"); +// } +// if (state & Mod3Mask) +// { +// EPHYR_DBG("MOD3"); +// } +// if (state & Mod4Mask) +// { +// EPHYR_DBG("MOD4"); +// } +// if (state & Mod5Mask) +// { +// EPHYR_DBG("MOD5"); +// } ephyrClientKey(event_type,state, key); break; @@ -1877,39 +1876,39 @@ clientReadNotify(int fd, int ready, void *data) { uint32_t state=*((uint32_t*)buff+1); uint32_t key=*((uint32_t*)buff+2); - /*EPHYR_DBG("HAVE KEY RELEASE EVENT state: %d(%x), key: %d(%x) from client\n",state,state, key, key); - * if (state & ShiftMask) - * { - * EPHYR_DBG("SHIFT"); - } - if (state & LockMask) - { - EPHYR_DBG("LOCK"); - } - if (state & ControlMask) - { - EPHYR_DBG("CONTROL"); - } - if (state & Mod1Mask) - { - EPHYR_DBG("MOD1"); - } - if (state & Mod2Mask) - { - EPHYR_DBG("MOD2"); - } - if (state & Mod3Mask) - { - EPHYR_DBG("MOD3"); - } - if (state & Mod4Mask) - { - EPHYR_DBG("MOD4"); - } - if (state & Mod5Mask) - { - EPHYR_DBG("MOD5"); - }*/ +// EPHYR_DBG("HAVE KEY RELEASE EVENT state: %d(%x), key: %d(%x) from client\n",state,state, key, key); +// if (state & ShiftMask) +// { +// EPHYR_DBG("SHIFT"); +// } +// if (state & LockMask) +// { +// EPHYR_DBG("LOCK"); +// } +// if (state & ControlMask) +// { +// EPHYR_DBG("CONTROL"); +// } +// if (state & Mod1Mask) +// { +// EPHYR_DBG("MOD1"); +// } +// if (state & Mod2Mask) +// { +// EPHYR_DBG("MOD2"); +// } +// if (state & Mod3Mask) +// { +// EPHYR_DBG("MOD3"); +// } +// if (state & Mod4Mask) +// { +// EPHYR_DBG("MOD4"); +// } +// if (state & Mod5Mask) +// { +// EPHYR_DBG("MOD5"); +// } ephyrClientKey(event_type,state, key); break; } @@ -2011,14 +2010,14 @@ clientReadNotify(int fd, int ready, void *data) default: { EPHYR_DBG("UNSUPPORTED EVENT: %d",event_type); - //looks like we have some corrupted data, let's try to reset event buffer + /* looks like we have some corrupted data, let's try to reset event buffer */ remoteVars.evBufferOffset=0; length=0; break; } } } - // EPHYR_DBG("Processed event - %d %d\n",eventnum++, eventbytes); +// EPHYR_DBG("Processed event - %d %d\n",eventnum++, eventbytes); } int restDataLength=length%EVLENGTH; int restDataPos=length-restDataLength; @@ -2149,7 +2148,7 @@ void terminateServer(int exitStatus) void processConfigFileSetting(char* key, char* value) { -// EPHYR_DBG("process setting %s %s", key, value); +// EPHYR_DBG("process setting %s %s", key, value); if(!strcmp(key, "state")) { strncpy(remoteVars.stateFile, value, 255); @@ -2230,7 +2229,7 @@ void readOptionsFromFile(void) int c=fgetc(ptr); if(c==EOF) break; -// EPHYR_DBG("%c",c); +// EPHYR_DBG("%c",c); if(c=='=') { key[ind]='\0'; @@ -2252,7 +2251,7 @@ void readOptionsFromFile(void) value[ind++]=(unsigned char)c; else key[ind++]=(unsigned char)c; - /////read file and get quality and state file + /* read file and get quality and state file */ } fclose(ptr); } @@ -2437,8 +2436,6 @@ unsigned char* image_compress(uint32_t image_width, uint32_t image_height, return png_compress(image_width, image_height, RGBA_buffer, compressed_size); } - - struct cache_elem* add_cache_element(uint32_t crc, int32_t dx, int32_t dy, uint32_t size, uint32_t width, uint32_t height) { struct cache_elem* el=malloc(sizeof(struct cache_elem)); @@ -2460,19 +2457,18 @@ struct cache_elem* add_cache_element(uint32_t crc, int32_t dx, int32_t dy, uint3 el->regions[i].rect.size.width=0; } -/* if(CACHEBPP==4) - { - el->size=size; - el->data=malloc(size); - remoteVars.cache_size+=size; - memcpy(el->data, data, size); - } - else*/ +// if(CACHEBPP==4) +// { +// el->size=size; +// el->data=malloc(size); +// remoteVars.cache_size+=size; +// memcpy(el->data, data, size); +// } +// else { - uint32_t isize=size/4*3; el->size=isize; -// EPHYR_DBG("SIZE %d %d %d, %d, %d",isize, dx, dy, width, height); +// EPHYR_DBG("SIZE %d %d %d, %d, %d",isize, dx, dy, width, height); el->data=malloc(isize); if(!el->data) { @@ -2481,15 +2477,12 @@ struct cache_elem* add_cache_element(uint32_t crc, int32_t dx, int32_t dy, uint3 } remoteVars.cache_size+=isize; - //copy RGB channels of every pixel and ignore A channel - + /* copy RGB channels of every pixel and ignore A channel */ uint32_t numOfPix=size/4; uint32_t i=0; pthread_mutex_lock(&remoteVars.mainimg_mutex); - - for(int32_t y=0;y<height;++y) { for(int32_t x=0; x< width; ++x) @@ -2512,8 +2505,8 @@ struct cache_elem* add_cache_element(uint32_t crc, int32_t dx, int32_t dy, uint3 remoteVars.cache_elements++; el->prev=remoteVars.last_cache_element; -// EPHYR_DBG("\ncache elements %d, cache size %u(%dMB) %u, %u, %u\n", cache_elements, cache_size, (int) (cache_size/1024/1024), el->rval, -// el->gval, el->bval); +// EPHYR_DBG("\ncache elements %d, cache size %u(%dMB) %u, %u, %u\n", cache_elements, cache_size, (int) (cache_size/1024/1024), el->rval, +// el->gval, el->bval); if(remoteVars.last_cache_element) { remoteVars.last_cache_element->next=el; @@ -2528,9 +2521,12 @@ struct cache_elem* add_cache_element(uint32_t crc, int32_t dx, int32_t dy, uint3 -//this function looking for the cache elements with specified crc -//if the element is found we moving it in the end of list -//in this case we keeping the most recent elements in the tail of list for faster search +/* + * this function looking for the cache elements with specified crc + * if the element is found we moving it in the end of list + * in this case we keeping the most recent elements in the tail of + * list for faster search + */ struct cache_elem* find_cache_element(uint32_t crc) { struct cache_elem* current=remoteVars.last_cache_element; @@ -2564,7 +2560,6 @@ struct cache_elem* find_cache_element(uint32_t crc) } - void initFrameRegions(struct cache_elem* frame) { BOOL haveMultplyRegions=FALSE; @@ -2576,35 +2571,37 @@ void initFrameRegions(struct cache_elem* frame) if(frame->width>4 && frame->height>4 && frame->width * frame->height > 100 ) { - unsigned int match_val=0; + unsigned int match_val = 0; + uint32_t bestm_crc = 0; + struct cache_elem* best_match = NULL; + pthread_mutex_lock(&remoteVars.sendqueue_mutex); - struct cache_elem* best_match = find_best_match(frame, &match_val); + best_match = find_best_match(frame, &match_val); + if(best_match) { best_match->busy+=1; } pthread_mutex_unlock(&remoteVars.sendqueue_mutex); - uint32_t bestm_crc=0; if(best_match && best_match->width>4 && best_match->height>4 && best_match->width * best_match->height > 100 ) { bestm_crc=best_match->crc; if(best_match && match_val<=MAX_MATCH_VAL) { - clock_t t = clock(); rectangle rect; int hshift, vshift; + if(find_common_regions(best_match, frame, &diff, &rect, &hshift, &vshift)) { haveMultplyRegions=TRUE; if(!diff) { +// EPHYR_DBG("SOURCE: %x %d:%d - %dx%d- shift %d, %d",bestm_crc, +// rect.lt_corner.x, rect.lt_corner.y, +// rect.size.width, rect.size.height, hshift, vshift); -/* EPHYR_DBG("SOURCE: %x %d:%d - %dx%d- shift %d, %d",bestm_crc, - rect.lt_corner.x, rect.lt_corner.y, - rect.size.width, rect.size.height, hshift, vshift); -*/ rectangle* base=&(regions[8].rect); base->size.width=rect.size.width; base->size.height=rect.size.height; @@ -2684,7 +2681,7 @@ void initFrameRegions(struct cache_elem* frame) base->lt_corner.x=0; base->lt_corner.y=0; - //regions[0] represents common with bestmatch region + /* regions[0] represents common with bestmatch region */ regions[0].source_coordinates.x=0; regions[0].source_coordinates.y=0; regions[0].source_crc=bestm_crc; @@ -2694,11 +2691,11 @@ void initFrameRegions(struct cache_elem* frame) } } } - //if we didn't find any common regions and have best match element, mark it as not busy + /* if we didn't find any common regions and have best match element, mark it as not busy */ pthread_mutex_lock(&remoteVars.sendqueue_mutex); if(best_match && frame->source != best_match) { -// EPHYR_DBG("Have best mutch but not common region"); +// EPHYR_DBG("Have best mutch but not common region"); best_match->busy-=1; } pthread_mutex_unlock(&remoteVars.sendqueue_mutex); @@ -2707,7 +2704,7 @@ void initFrameRegions(struct cache_elem* frame) if(!haveMultplyRegions) { - //EPHYR_DBG("HAVE SINGLE REGION"); +// EPHYR_DBG("HAVE SINGLE REGION"); regions[0].compressed_data=image_compress(frame->width, frame->height, frame->data, &(regions[0].size), CACHEBPP, 0); @@ -2725,12 +2722,10 @@ void initFrameRegions(struct cache_elem* frame) if(regions[i].rect.size.width && regions[i].rect.size.height) { - /* - uint32_t send_data=regions[i].rect.size.width*regions[i].rect.size.height; - uint32_t total_data=frame->width*frame->height; - EPHYR_DBG("saved space: %d%% %d %d %dx%d %dx%d", 100 - (int)((send_data*1./total_data)*100), total_data, send_data,frame->width, frame->height, - regions[i].rect.size.width,regions[i].rect.size.height); - */ +// uint32_t send_data=regions[i].rect.size.width*regions[i].rect.size.height; +// uint32_t total_data=frame->width*frame->height; +// EPHYR_DBG("saved space: %d%% %d %d %dx%d %dx%d", 100 - (int)((send_data*1./total_data)*100), total_data, send_data,frame->width, frame->height, +// regions[i].rect.size.width,regions[i].rect.size.height); // #warning check this uint8_t *data=malloc(regions[i].rect.size.width*regions[i].rect.size.height*CACHEBPP); @@ -2782,18 +2777,17 @@ void add_frame(uint32_t width, uint32_t height, int32_t x, int32_t y, uint32_t c pthread_mutex_lock(&remoteVars.sendqueue_mutex); if(! (remoteVars.client_connected && remoteVars.client_initialized)) { - //don't have any clients connected, return + /* don't have any clients connected, return */ pthread_mutex_unlock(&remoteVars.sendqueue_mutex); return; } - Bool isNewElement=FALSE; struct cache_elem* frame=0; if(crc==0) { - //sending main image + /* sending main image */ pthread_mutex_unlock(&remoteVars.sendqueue_mutex); } else @@ -2802,28 +2796,28 @@ void add_frame(uint32_t width, uint32_t height, int32_t x, int32_t y, uint32_t c frame=find_cache_element(crc); if(!frame) { -// EPHYR_DBG("ADD NEW FRAME %x",crc); +// EPHYR_DBG("ADD NEW FRAME %x",crc); frame=add_cache_element(crc, x, y, size, width, height); isNewElement=TRUE; } else { - // EPHYR_DBG("ADD EXISTING FRAME %x",crc); +// EPHYR_DBG("ADD EXISTING FRAME %x",crc); } frame->busy+=1; pthread_mutex_unlock(&remoteVars.sendqueue_mutex); - //if element is new find common regions and compress the data + /* if element is new find common regions and compress the data */ if(isNewElement) { - //find bestmatch and lock it + /* find bestmatch and lock it */ initFrameRegions(frame); } } pthread_mutex_lock(&remoteVars.sendqueue_mutex); - //add element in the queue for sending + /* add element in the queue for sending */ struct sendqueue_element* element=malloc(sizeof(struct sendqueue_element)); element->frame=frame; element->next=NULL; @@ -2843,7 +2837,7 @@ void add_frame(uint32_t width, uint32_t height, int32_t x, int32_t y, uint32_t c pthread_cond_signal(&remoteVars.have_sendqueue_cond); pthread_mutex_unlock(&remoteVars.sendqueue_mutex); - //on this point will be sent wakeup single to send mutex + /* on this point will be sent wakeup single to send mutex */ } @@ -2857,30 +2851,30 @@ remote_paint_rect(KdScreenInfo *screen, int sx, int sy, int dx, int dy, int width, int height) { - // EphyrScrPriv *scrpriv = screen->driver; +// EphyrScrPriv *scrpriv = screen->driver; uint32_t size=width*height*XSERVERBPP; if(size) { - //EPHYR_DBG("REPAINT %dx%d sx %d, sy %d, dx %d, dy %d", width, height, sx, sy, dx, dy); +// EPHYR_DBG("REPAINT %dx%d sx %d, sy %d, dx %d, dy %d", width, height, sx, sy, dx, dy); int32_t dirtyx_max=dx-1; int32_t dirtyy_max=dy-1; int32_t dirtyx_min=dx+width; int32_t dirtyy_min=dy+height; - //OK, here we assuming that XSERVERBPP is 4. If not, we'll have troubles - //but it should work faster like this - + /* + * OK, here we assuming that XSERVERBPP is 4. If not, we'll have troubles + * but it should work faster like this + */ pthread_mutex_lock(&remoteVars.mainimg_mutex); + char maxdiff=2; char mindiff=-2; - - - // check if updated rec really is as big + /* check if updated rec really is as big */ for(int32_t y=dy; y< dy+height;++y) { uint32_t ind=(y*remoteVars.main_img_width+dx)*XSERVERBPP; @@ -2889,10 +2883,11 @@ remote_paint_rect(KdScreenInfo *screen, BOOL pixIsDirty=FALSE; //CHECK R-COMPONENT int16_t diff=remoteVars.main_img[ind]-remoteVars.second_buffer[ind]; - /*if(x > 250 && x<255 && y >5 && y< 7) - * { - * EPHYR_DBG("rdiff %d - %u %u ", diff, remoteVars.main_img[ind],remoteVars.second_buffer[ind]); - }*/ + +// if(x > 250 && x<255 && y >5 && y< 7) +// { +// EPHYR_DBG("rdiff %d - %u %u ", diff, remoteVars.main_img[ind],remoteVars.second_buffer[ind]); +// } if(diff>maxdiff || diff< mindiff) { pixIsDirty=TRUE; @@ -2942,28 +2937,25 @@ remote_paint_rect(KdScreenInfo *screen, pthread_mutex_unlock(&remoteVars.mainimg_mutex); - // EPHYR_DBG("DIRTY %d,%d - %d,%d", dirtyx_min, dirtyy_min, dirtyx_max, dirtyy_max); +// EPHYR_DBG("DIRTY %d,%d - %d,%d", dirtyx_min, dirtyy_min, dirtyx_max, dirtyy_max); width=dirtyx_max-dirtyx_min+1; height=dirtyy_max-dirtyy_min+1; - /* - * int oldsize=size; - */ +// int oldsize=size; size=width*height*XSERVERBPP; if(width<=0 || height<=0||size<=0) { - // EPHYR_DBG("NO CHANGES DETECTED, NOT UPDATING"); +// EPHYR_DBG("NO CHANGES DETECTED, NOT UPDATING"); return; } dx=sx=dirtyx_min; dy=sy=dirtyy_min; - /* - * if(size!=oldsize) - * { - * EPHYR_DBG("new update rect demensions: %dx%d", width, height); - * } - */ + +// if(size!=oldsize) +// { +// EPHYR_DBG("new update rect demensions: %dx%d", width, height); +// } add_frame(width, height, dx, dy, calculate_crc(width, height,dx,dy), size); } diff --git a/x2gokdriveselection.c b/x2gokdriveselection.c index 75eccf2..71886b3 100644 --- a/x2gokdriveselection.c +++ b/x2gokdriveselection.c @@ -328,7 +328,7 @@ static void process_selection(Atom selection, Atom target, if (prop->type != XA_ATOM) return; -// listAtoms((const Atom*)prop->data, prop->size); +// listAtoms((const Atom*)prop->data, prop->size); if(prop_has_atom(atomUTFString, (const Atom*)prop->data, prop->size)) @@ -341,7 +341,7 @@ static void process_selection(Atom selection, Atom target, } else { - //requesting pixmap only for clipboard + /* requesting pixmap only for clipboard */ if((selection == atomClipboard) && find_image_atom((const Atom*)prop->data, prop->size) && imageAtom) { request_selection(selection, imageAtom); @@ -358,7 +358,7 @@ static void process_selection(Atom selection, Atom target, { format=PIXMAP; } - //read incrementinal data only for clipboard + /* read incrementinal data only for clipboard */ if(!strcmp( NameForAtom(prop->type), "INCR") && selection==atomClipboard) { EPHYR_DBG("GOT INCR PROPERTY: %d",*((int*)prop->data)); @@ -399,7 +399,7 @@ static void process_selection(Atom selection, Atom target, memcpy(buff->data, prop->data, prop->size); buff->changed=TRUE; buff->mimeData=format; - // EPHYR_DBG("Have new Clipboard %s %d",remoteVars->selstruct.clipboard, remoteVars->selstruct.clipboardSize); +// EPHYR_DBG("Have new Clipboard %s %d",remoteVars->selstruct.clipboard, remoteVars->selstruct.clipboardSize); } pthread_cond_signal(&remoteVars->have_sendqueue_cond); pthread_mutex_unlock(&remoteVars->sendqueue_mutex); @@ -451,7 +451,7 @@ static int convert_selection(ClientPtr client, Atom selection, if(selection==atomClipboard) buff=&remoteVars->selstruct.inClipboard; -// EPHYR_DBG("Selection request for %s (type %s)", NameForAtom(selection), NameForAtom(target)); +// EPHYR_DBG("Selection request for %s (type %s)", NameForAtom(selection), NameForAtom(target)); @@ -676,7 +676,7 @@ void install_selection_callbacks(void) remoteVars->selstruct.clipWinPtr=0; - //try to dele callback to avaid double call + /* try to dele callback to avaid double call */ DeleteCallback(&SelectionCallback, selection_callback, 0); if (!AddCallback(&SelectionCallback, selection_callback, 0)) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit cc647f865e8d01ab99b753aad867d84ad1282143 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 16:39:59 2019 +0200 x2gokdrive*.c: Comment out defined, but unused code. Fixes several compiler warnings. --- x2gokdrive.c | 388 ++++++++++++++++++++++++++--------------------------- x2gokdrivecursor.c | 38 +++--- 2 files changed, 213 insertions(+), 213 deletions(-) diff --git a/x2gokdrive.c b/x2gokdrive.c index 02290be..4de4779 100644 --- a/x2gokdrive.c +++ b/x2gokdrive.c @@ -1095,60 +1095,60 @@ miPointerScreenFuncRec ephyrPointerScreenFuncs = { ephyrWarpCursor, }; -static KdScreenInfo * -screen_from_window(Window w) -{ - int i = 0; - - for (i = 0; i < screenInfo.numScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - KdPrivScreenPtr kdscrpriv = KdGetScreenPriv(pScreen); - KdScreenInfo *screen = kdscrpriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - - } - - return NULL; -} - -static void -ephyrProcessErrorEvent(xcb_generic_event_t *xev) -{ - xcb_generic_error_t *e = (xcb_generic_error_t *)xev; - - FatalError("X11 error\n" - "Error code: %hhu\n" - "Sequence number: %hu\n" - "Major code: %hhu\tMinor code: %hu\n" - "Error value: %u\n", - e->error_code, - e->sequence, - e->major_code, e->minor_code, - e->resource_id); -} - -static void -ephyrProcessExpose(xcb_generic_event_t *xev) -{ - xcb_expose_event_t *expose = (xcb_expose_event_t *)xev; - KdScreenInfo *screen = screen_from_window(expose->window); - EphyrScrPriv *scrpriv = screen->driver; - - /* Wait for the last expose event in a series of cliprects - * to actually paint our screen. - */ - if (expose->count != 0) - return; - +//static KdScreenInfo * +//screen_from_window(Window w) +//{ +// int i = 0; +// +// for (i = 0; i < screenInfo.numScreens; i++) { +// ScreenPtr pScreen = screenInfo.screens[i]; +// KdPrivScreenPtr kdscrpriv = KdGetScreenPriv(pScreen); +// KdScreenInfo *screen = kdscrpriv->screen; +// EphyrScrPriv *scrpriv = screen->driver; +// +// } +// +// return NULL; +//} - if (scrpriv) { - remote_paint_rect(scrpriv->screen, 0, 0, 0, 0, - scrpriv->win_width, - scrpriv->win_height); - } else { - EPHYR_LOG_ERROR("failed to get host screen\n"); - } -} +//static void +//ephyrProcessErrorEvent(xcb_generic_event_t *xev) +//{ +// xcb_generic_error_t *e = (xcb_generic_error_t *)xev; +// +// FatalError("X11 error\n" +// "Error code: %hhu\n" +// "Sequence number: %hu\n" +// "Major code: %hhu\tMinor code: %hu\n" +// "Error value: %u\n", +// e->error_code, +// e->sequence, +// e->major_code, e->minor_code, +// e->resource_id); +//} + +//static void +//ephyrProcessExpose(xcb_generic_event_t *xev) +//{ +// xcb_expose_event_t *expose = (xcb_expose_event_t *)xev; +// KdScreenInfo *screen = screen_from_window(expose->window); +// EphyrScrPriv *scrpriv = screen->driver; +// +// /* Wait for the last expose event in a series of cliprects +// * to actually paint our screen. +// */ +// if (expose->count != 0) +// return; +// +// +// if (scrpriv) { +// remote_paint_rect(scrpriv->screen, 0, 0, 0, 0, +// scrpriv->win_width, +// scrpriv->win_height); +// } else { +// EPHYR_LOG_ERROR("failed to get host screen\n"); +// } +//} void @@ -1179,149 +1179,149 @@ ephyrClientButton(int event_type, int state, int button) KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0); } -static void -ephyrProcessMouseMotion(xcb_generic_event_t *xev) -{ - xcb_motion_notify_event_t *motion = (xcb_motion_notify_event_t *)xev; - KdScreenInfo *screen = screen_from_window(motion->event); - - if (!ephyrMouse || - !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { - EPHYR_LOG("skipping mouse motion:%d\n", screen->pScreen->myNum); - return; - } - - if (ephyrCursorScreen != screen->pScreen) { - EPHYR_LOG("warping mouse cursor. " - "cur_screen:%d, motion_screen:%d\n", - ephyrCursorScreen->myNum, screen->pScreen->myNum); - ephyrWarpCursor(inputInfo.pointer, screen->pScreen, - motion->event_x, motion->event_y); - } - else { - int x = 0, y = 0; - - EPHYR_LOG("enqueuing mouse motion:%d\n", screen->pScreen->myNum); - x = motion->event_x; - y = motion->event_y; - EPHYR_LOG("initial (x,y):(%d,%d)\n", x, y); - EPHYR_DBG("initial (x,y):(%d,%d)\n", x, y); - - /* convert coords into desktop-wide coordinates. - * fill_pointer_events will convert that back to - * per-screen coordinates where needed */ - x += screen->pScreen->x; - y += screen->pScreen->y; - - KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_POINTER_DESKTOP, x, y, 0); - } -} - -static void -ephyrProcessButtonPress(xcb_generic_event_t *xev) -{ - xcb_button_press_event_t *button = (xcb_button_press_event_t *)xev; - - if (!ephyrMouse || - !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { - EPHYR_LOG("skipping mouse press:%d\n", screen_from_window(button->event)->pScreen->myNum); - return; - } - - ephyrUpdateModifierState(button->state); - /* This is a bit hacky. will break for button 5 ( defined as 0x10 ) - * Check KD_BUTTON defines in kdrive.h - */ - mouseState |= 1 << (button->detail - 1); - - EPHYR_LOG("enqueuing mouse press:%d\n", screen_from_window(button->event)->pScreen->myNum); - KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0); -} - -static void -ephyrProcessButtonRelease(xcb_generic_event_t *xev) -{ - xcb_button_press_event_t *button = (xcb_button_press_event_t *)xev; - - if (!ephyrMouse || - !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { - return; - } - - ephyrUpdateModifierState(button->state); - mouseState &= ~(1 << (button->detail - 1)); - - EPHYR_LOG("enqueuing mouse release:%d\n", screen_from_window(button->event)->pScreen->myNum); - KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0); -} - -/* Xephyr wants ctrl+shift to grab the window, but that conflicts with - ctrl+alt+shift key combos. Remember the modifier state on key presses and - releases, if mod1 is pressed, we need ctrl, shift and mod1 released - before we allow a shift-ctrl grab activation. - - note: a key event contains the mask _before_ the current key takes - effect, so mod1_was_down will be reset on the first key press after all - three were released, not on the last release. That'd require some more - effort. - */ -static int -ephyrUpdateGrabModifierState(int state) -{ - static int mod1_was_down = 0; - - if ((state & (XCB_MOD_MASK_CONTROL|XCB_MOD_MASK_SHIFT|XCB_MOD_MASK_1)) == 0) - mod1_was_down = 0; - else if (state & XCB_MOD_MASK_1) - mod1_was_down = 1; - - return mod1_was_down; -} - -static void -ephyrProcessKeyPress(xcb_generic_event_t *xev) -{ - xcb_key_press_event_t *key = (xcb_key_press_event_t *)xev; - - if (!ephyrKbd || - !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled) { - return; - } - - ephyrUpdateGrabModifierState(key->state); - ephyrUpdateModifierState(key->state); - KdEnqueueKeyboardEvent(ephyrKbd, key->detail, FALSE); -} - -static void -ephyrProcessKeyRelease(xcb_generic_event_t *xev) -{ -} - -static void -ephyrProcessConfigureNotify(xcb_generic_event_t *xev) -{ - xcb_configure_notify_event_t *configure = - (xcb_configure_notify_event_t *)xev; - KdScreenInfo *screen = screen_from_window(configure->window); - EphyrScrPriv *scrpriv = screen->driver; - - -#ifdef RANDR - ephyrResizeScreen(screen->pScreen, configure->width, configure->height, NULL); -#endif /* RANDR */ -} +//static void +//ephyrProcessMouseMotion(xcb_generic_event_t *xev) +//{ +// xcb_motion_notify_event_t *motion = (xcb_motion_notify_event_t *)xev; +// KdScreenInfo *screen = screen_from_window(motion->event); +// +// if (!ephyrMouse || +// !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { +// EPHYR_LOG("skipping mouse motion:%d\n", screen->pScreen->myNum); +// return; +// } +// +// if (ephyrCursorScreen != screen->pScreen) { +// EPHYR_LOG("warping mouse cursor. " +// "cur_screen:%d, motion_screen:%d\n", +// ephyrCursorScreen->myNum, screen->pScreen->myNum); +// ephyrWarpCursor(inputInfo.pointer, screen->pScreen, +// motion->event_x, motion->event_y); +// } +// else { +// int x = 0, y = 0; +// +// EPHYR_LOG("enqueuing mouse motion:%d\n", screen->pScreen->myNum); +// x = motion->event_x; +// y = motion->event_y; +// EPHYR_LOG("initial (x,y):(%d,%d)\n", x, y); +// EPHYR_DBG("initial (x,y):(%d,%d)\n", x, y); +// +// /* convert coords into desktop-wide coordinates. +// * fill_pointer_events will convert that back to +// * per-screen coordinates where needed */ +// x += screen->pScreen->x; +// y += screen->pScreen->y; +// +// KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_POINTER_DESKTOP, x, y, 0); +// } +//} -static void -ephyrXcbProcessEvents(Bool queued_only) -{ -} +//static void +//ephyrProcessButtonPress(xcb_generic_event_t *xev) +//{ +// xcb_button_press_event_t *button = (xcb_button_press_event_t *)xev; +// +// if (!ephyrMouse || +// !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { +// EPHYR_LOG("skipping mouse press:%d\n", screen_from_window(button->event)->pScreen->myNum); +// return; +// } +// +// ephyrUpdateModifierState(button->state); +// /* This is a bit hacky. will break for button 5 ( defined as 0x10 ) +// * Check KD_BUTTON defines in kdrive.h +// */ +// mouseState |= 1 << (button->detail - 1); +// +// EPHYR_LOG("enqueuing mouse press:%d\n", screen_from_window(button->event)->pScreen->myNum); +// KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0); +//} + +//static void +//ephyrProcessButtonRelease(xcb_generic_event_t *xev) +//{ +// xcb_button_press_event_t *button = (xcb_button_press_event_t *)xev; +// +// if (!ephyrMouse || +// !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { +// return; +// } +// +// ephyrUpdateModifierState(button->state); +// mouseState &= ~(1 << (button->detail - 1)); +// +// EPHYR_LOG("enqueuing mouse release:%d\n", screen_from_window(button->event)->pScreen->myNum); +// KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0); +//} + +///* Xephyr wants ctrl+shift to grab the window, but that conflicts with +// ctrl+alt+shift key combos. Remember the modifier state on key presses and +// releases, if mod1 is pressed, we need ctrl, shift and mod1 released +// before we allow a shift-ctrl grab activation. +// +// note: a key event contains the mask _before_ the current key takes +// effect, so mod1_was_down will be reset on the first key press after all +// three were released, not on the last release. That'd require some more +// effort. +// */ +//static int +//ephyrUpdateGrabModifierState(int state) +//{ +// static int mod1_was_down = 0; +// +// if ((state & (XCB_MOD_MASK_CONTROL|XCB_MOD_MASK_SHIFT|XCB_MOD_MASK_1)) == 0) +// mod1_was_down = 0; +// else if (state & XCB_MOD_MASK_1) +// mod1_was_down = 1; +// +// return mod1_was_down; +//} -static void -ephyrXcbNotify(int fd, int ready, void *data) -{ - ephyrXcbProcessEvents(FALSE); -} +//static void +//ephyrProcessKeyPress(xcb_generic_event_t *xev) +//{ +// xcb_key_press_event_t *key = (xcb_key_press_event_t *)xev; +// +// if (!ephyrKbd || +// !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled) { +// return; +// } +// +// ephyrUpdateGrabModifierState(key->state); +// ephyrUpdateModifierState(key->state); +// KdEnqueueKeyboardEvent(ephyrKbd, key->detail, FALSE); +//} + +//static void +//ephyrProcessKeyRelease(xcb_generic_event_t *xev) +//{ +//} + +//static void +//ephyrProcessConfigureNotify(xcb_generic_event_t *xev) +//{ +// xcb_configure_notify_event_t *configure = +// (xcb_configure_notify_event_t *)xev; +// KdScreenInfo *screen = screen_from_window(configure->window); +// EphyrScrPriv *scrpriv = screen->driver; +// +//// +//#ifdef RANDR +// ephyrResizeScreen(screen->pScreen, configure->width, configure->height, NULL); +//#endif /* RANDR */ +//} + +//static void +//ephyrXcbProcessEvents(Bool queued_only) +//{ +//} + +//static void +//ephyrXcbNotify(int fd, int ready, void *data) +//{ +// ephyrXcbProcessEvents(FALSE); +//} void ephyrCardFini(KdCardInfo * card) diff --git a/x2gokdrivecursor.c b/x2gokdrivecursor.c index 37abc0a..b8c2d5b 100644 --- a/x2gokdrivecursor.c +++ b/x2gokdrivecursor.c @@ -53,21 +53,21 @@ ephyrGetCursor(CursorPtr cursor) } -static void -ephyrRealizeCoreCursor(EphyrScrPriv *scr, CursorPtr cursor) -{ -} - -static void -ephyrRealizeARGBCursor(EphyrScrPriv *scr, CursorPtr cursor) -{ -} - -static Bool -can_argb_cursor(void) -{ - return TRUE; -} +//static void +//ephyrRealizeCoreCursor(EphyrScrPriv *scr, CursorPtr cursor) +//{ +//} + +//static void +//ephyrRealizeARGBCursor(EphyrScrPriv *scr, CursorPtr cursor) +//{ +//} + +//static Bool +//can_argb_cursor(void) +//{ +// return TRUE; +//} static Bool ephyrRealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor) @@ -95,10 +95,10 @@ static void ephyrSetCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor, int x, int y) { - KdScreenPriv(screen); - KdScreenInfo *kscr = pScreenPriv->screen; - EphyrScrPriv *scr = kscr->driver; - uint32_t attr = None; +// KdScreenPriv(screen); +// KdScreenInfo *kscr = pScreenPriv->screen; +// EphyrScrPriv *scr = kscr->driver; +// uint32_t attr = None; if(cursor) remote_sendCursor(cursor); } -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 12294a93154d9c1bff8485f3d7ba42203ae9fc1a Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 14:13:05 2019 +0200 x2gokdrive*.{c|h}: Use new-style function definitions for parameter-less functions. --- x2gokdriveremote.c | 24 ++++++++++++------------ x2gokdriveremote.h | 10 +++++----- x2gokdriveselection.c | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index cdc79ee..d638d48 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -42,13 +42,13 @@ static RemoteHostVars remoteVars; static BOOL remoteInitialized=FALSE; -void remote_selection_init() +void remote_selection_init(void) { selection_init(&remoteVars); } -void restartTimerOnInit() +void restartTimerOnInit(void) { if(remoteInitialized) { @@ -62,7 +62,7 @@ void restartTimerOnInit() } -void cancelThreadBeforeStart() +void cancelThreadBeforeStart(void) { shutdown(remoteVars.serversock, SHUT_RDWR); close(remoteVars.serversock); @@ -115,7 +115,7 @@ void remote_handle_signal(int signum) } -int queue_elements() +int queue_elements(void) { int elems=0; struct sendqueue_element* current=remoteVars.first_sendqueue_element; @@ -169,7 +169,7 @@ void addCursorToQueue(struct cursorFrame* cframe) } } -void freeCursors() +void freeCursors(void) { struct sentCursor* cur=remoteVars.sentCursorsHead; while(cur) @@ -411,7 +411,7 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin return total; } -int send_deleted_elements() +int send_deleted_elements(void) { unsigned char buffer[56]; *((uint32_t*)buffer)=DELETED; @@ -454,7 +454,7 @@ int send_deleted_elements() return sent; } -int send_deleted_cursors() +int send_deleted_cursors(void) { unsigned char buffer[56]; *((uint32_t*)buffer)=DELETEDCURSOR; @@ -1593,7 +1593,7 @@ void *send_frame_thread (void *threadid) } //warning! sendqueue_mutex should be locked by thread calling this function! -void clear_send_queue() +void clear_send_queue(void) { struct sendqueue_element* current=remoteVars.first_sendqueue_element; while(current) @@ -1728,7 +1728,7 @@ void setAgentState(int state) remoteVars.agentState=state; } -void disconnect_client() +void disconnect_client(void) { EPHYR_DBG("DISCONNECTING CLIENT, DOING SOME CLEAN UP"); pthread_mutex_lock(&remoteVars.sendqueue_mutex); @@ -2048,7 +2048,7 @@ unsigned int checkSocketConnection(OsTimerPtr timer, CARD32 time, void* args) return 0; } -void open_socket() +void open_socket(void) { ssize_t size; const int y = 1; @@ -2216,7 +2216,7 @@ void processConfigFileSetting(char* key, char* value) } } -void readOptionsFromFile() +void readOptionsFromFile(void) { FILE *ptr=fopen(remoteVars.optionsFile,"rt"); if(ptr) @@ -2845,7 +2845,7 @@ void add_frame(uint32_t width, uint32_t height, int32_t x, int32_t y, uint32_t c } -void remote_send_main_image() +void remote_send_main_image(void) { add_frame(0, 0, 0, 0, 0, 0); } diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h index a14a4f4..8f5dab1 100644 --- a/x2gokdriveremote.h +++ b/x2gokdriveremote.h @@ -385,12 +385,12 @@ void clear_frame_cache(uint32_t max_elements); uint32_t calculate_crc(uint32_t width, uint32_t height, int32_t dx, int32_t dy); -void readOptionsFromFile(); +void readOptionsFromFile(void); unsigned int checkSocketConnection(OsTimerPtr timer, CARD32 time, void* args); -void restartTimerOnInit(); +void restartTimerOnInit(void); -void open_socket(); +void open_socket(void); void setAgentState(int state); @@ -416,7 +416,7 @@ void add_frame(uint32_t width, uint32_t height, int32_t x, int32_t y, uint32_t c -void disconnect_client(); +void disconnect_client(void); void remote_handle_signal(int signum); @@ -425,7 +425,7 @@ void remote_handle_signal(int signum); void remote_sendCursor(CursorPtr cursor); void remote_removeCursor(uint32_t serialNumber); -void remote_send_main_image(); +void remote_send_main_image(void); int remote_init(void); diff --git a/x2gokdriveselection.c b/x2gokdriveselection.c index adb3095..75eccf2 100644 --- a/x2gokdriveselection.c +++ b/x2gokdriveselection.c @@ -655,7 +655,7 @@ void selection_init(struct RemoteHostVars *obj) } -void install_selection_callbacks() +void install_selection_callbacks(void) { if(remoteVars->selstruct.selectionMode == CLIP_CLIENT || remoteVars->selstruct.selectionMode == CLIP_NONE) { -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 63d4b8b850d5765890ba67a6e0173210fcf8cdba Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 16:54:07 2019 +0200 x2gokdriveremote.c: Declare non-prototyped as static, probably more static functions in the code, needs more investigation. --- x2gokdriveremote.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index dbbfb64..8bcdbac 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -62,6 +62,7 @@ void restartTimerOnInit(void) } +static void cancelThreadBeforeStart(void) { shutdown(remoteVars.serversock, SHUT_RDWR); @@ -114,7 +115,7 @@ void remote_handle_signal(int signum) } } - +static int queue_elements(void) { int elems=0; @@ -127,6 +128,7 @@ int queue_elements(void) return elems; } +static BOOL isCursorSent(uint32_t serialNumber) { struct sentCursor* current=remoteVars.sentCursorsHead; @@ -139,6 +141,7 @@ BOOL isCursorSent(uint32_t serialNumber) return FALSE; } +static void addSentCursor(uint32_t serialNumber) { // #warning check memory @@ -156,6 +159,7 @@ void addSentCursor(uint32_t serialNumber) } } +static void addCursorToQueue(struct cursorFrame* cframe) { if(!remoteVars.firstCursor) @@ -169,6 +173,7 @@ void addCursorToQueue(struct cursorFrame* cframe) } } +static void freeCursors(void) { struct sentCursor* cur = NULL; @@ -293,6 +298,7 @@ void remote_sendCursor(CursorPtr cursor) pthread_mutex_unlock(&remoteVars.sendqueue_mutex); } +static int32_t send_cursor(struct cursorFrame* cursor) { int ln, l = 0; @@ -338,7 +344,7 @@ int32_t send_cursor(struct cursorFrame* cursor) return sent; } - +static int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uint32_t crc, struct frame_region* regions) { @@ -419,6 +425,7 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin return total; } +static int send_deleted_elements(void) { unsigned char buffer[56] = {0}; @@ -467,6 +474,7 @@ int send_deleted_elements(void) return sent; } +static int send_deleted_cursors(void) { unsigned char buffer[56] = {0}; @@ -545,6 +553,7 @@ int send_selection(int sel, char* data, uint32_t length, uint32_t format) /* * sendqueue_mutex should be locked when calling this function */ +static struct cache_elem* find_best_match(struct cache_elem* frame, unsigned int* match_val) { struct cache_elem* current = NULL; @@ -587,6 +596,7 @@ struct cache_elem* find_best_match(struct cache_elem* frame, unsigned int* match return best_match_frame; } +static BOOL checkShiftedRegion( struct cache_elem* src, struct cache_elem* dst, int32_t x, int32_t y, int32_t width, int32_t height, int32_t horiz_shift, int32_t vert_shift) { @@ -657,6 +667,7 @@ BOOL checkShiftedRegion( struct cache_elem* src, struct cache_elem* dst, int32_ return TRUE; } +static int32_t checkScrollUp(struct cache_elem* source, struct cache_elem* dest) { // EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); @@ -705,6 +716,7 @@ int32_t checkScrollUp(struct cache_elem* source, struct cache_elem* dest) return -1; } +static int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) { // EPHYR_DBG("checking for down scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); @@ -749,6 +761,7 @@ int32_t checkScrollDown(struct cache_elem* source, struct cache_elem* dest) return 1; } +static int32_t checkScrollRight(struct cache_elem* source, struct cache_elem* dest) { // EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); @@ -796,6 +809,7 @@ int32_t checkScrollRight(struct cache_elem* source, struct cache_elem* dest) return -1; } +static int32_t checkScrollLeft(struct cache_elem* source, struct cache_elem* dest) { // EPHYR_DBG("checking for up scroll %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); @@ -842,6 +856,7 @@ int32_t checkScrollLeft(struct cache_elem* source, struct cache_elem* dest) return 1; } +static BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, int32_t shift_horiz, int32_t shift_vert, rectangle* common_rect) { @@ -1068,6 +1083,7 @@ BOOL checkEquality(struct cache_elem* src, struct cache_elem* dst, return TRUE; } +static BOOL checkMovedContent(struct cache_elem* source, struct cache_elem* dest, int32_t* horiz_shift, int32_t* vert_shift) { // EPHYR_DBG("checking for moved content %u, %u, %u, %u", source->width, source->height, dest->width, dest->height); @@ -1140,6 +1156,7 @@ BOOL checkMovedContent(struct cache_elem* source, struct cache_elem* dest, int32 return FALSE; } +static BOOL findDiff(struct cache_elem* source, struct cache_elem* dest, rectangle* diff_rect) { int32_t left_x=source->width-1, top_y=source->height-1, right_x=0, bot_y=0; @@ -1181,6 +1198,7 @@ BOOL findDiff(struct cache_elem* source, struct cache_elem* dest, rectangle* dif return TRUE; } +static BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOOL* diff, rectangle* common_rect, int32_t* hshift, int32_t* vshift) { @@ -1249,6 +1267,7 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO } /* use only from send thread */ +static void sendMainImageFromSendThread(uint32_t width, uint32_t height, int32_t dx ,int32_t dy) { uint32_t length = 0; @@ -1325,6 +1344,7 @@ void sendMainImageFromSendThread(uint32_t width, uint32_t height, int32_t dx ,in free(regions[0].compressed_data); } +static void *send_frame_thread (void *threadid) { long tid; @@ -1611,6 +1631,7 @@ void *send_frame_thread (void *threadid) } /* warning! sendqueue_mutex should be locked by thread calling this function! */ +static void clear_send_queue(void) { struct sendqueue_element* current = NULL; @@ -1721,6 +1742,7 @@ void clear_cache_data(uint32_t maxsize) } } +static char* getAgentStateAsString(int state) { switch(state) @@ -2190,6 +2212,7 @@ void terminateServer(int exitStatus) GiveUp(SIGTERM); } +static void processConfigFileSetting(char* key, char* value) { // EPHYR_DBG("process setting %s %s", key, value); @@ -2477,6 +2500,7 @@ unsigned char* image_compress(uint32_t image_width, uint32_t image_height, return png_compress(image_width, image_height, RGBA_buffer, compressed_size); } +static struct cache_elem* add_cache_element(uint32_t crc, int32_t dx, int32_t dy, uint32_t size, uint32_t width, uint32_t height) { struct cache_elem* el=malloc(sizeof(struct cache_elem)); @@ -2570,6 +2594,7 @@ struct cache_elem* add_cache_element(uint32_t crc, int32_t dx, int32_t dy, uint3 * in this case we keeping the most recent elements in the tail of * list for faster search */ +static struct cache_elem* find_cache_element(uint32_t crc) { struct cache_elem* current=remoteVars.last_cache_element; @@ -2602,7 +2627,7 @@ struct cache_elem* find_cache_element(uint32_t crc) return 0; } - +static void initFrameRegions(struct cache_elem* frame) { BOOL haveMultplyRegions=FALSE; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit bc93ad994d50a235672315c06c398844b281f6c9 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 17:08:55 2019 +0200 x2gokdrive*.c: Remove unused variables (or mark them with _X_UNUSED). --- x2gokdrive.c | 10 +--------- x2gokdriveremote.c | 9 +-------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/x2gokdrive.c b/x2gokdrive.c index 4de4779..2be5bfe 100644 --- a/x2gokdrive.c +++ b/x2gokdrive.c @@ -96,8 +96,6 @@ Bool ephyrScreenInitialize(KdScreenInfo *screen) { EphyrScrPriv *scrpriv = screen->driver; - int x = 0, y = 0; - int width = 640, height = 480; CARD32 redMask, greenMask, blueMask; EPHYR_DBG("Init screen"); @@ -683,7 +681,7 @@ void setOutput(ScreenPtr pScreen, RROutputPtr output, RRCrtcPtr crtc, int width, else RROutputSetConnection(output, RR_Disconnected); - RRModePtr mode, newMode = NULL; + RRModePtr mode = NULL; xRRModeInfo modeInfo; RRModePtr *modes; @@ -779,7 +777,6 @@ void addOutput(ScreenPtr pScreen, char* name, int width, int height, int x, int { RROutputPtr output; - int n = 0; /* add new Output */ EPHYR_DBG("CREATE OUTPUT %s",name); @@ -904,7 +901,6 @@ Bool ephyrInitScreen(ScreenPtr pScreen) { KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; EPHYR_LOG("pScreen->myNum:%d\n", pScreen->myNum); pScreen->CreateColormap = ephyrCreateColormap; @@ -1442,10 +1438,6 @@ KdPointerDriver EphyrMouseDriver = { static Status EphyrKeyboardInit(KdKeyboardInfo * ki) { - KeySymsRec keySyms; - CARD8 modmap[MAP_LENGTH]; - XkbControlsRec controls; - ki->driverPrivate = (EphyrKbdPrivate *) calloc(sizeof(EphyrKbdPrivate), 1); diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index f27bf37..8bc4329 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -1275,9 +1275,7 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO static void sendMainImageFromSendThread(uint32_t width, uint32_t height, int32_t dx ,int32_t dy) { - uint32_t length = 0; - char fname[255] = {0}; - char* f = NULL; + _X_UNUSED uint32_t length = 0; struct frame_region regions[9] = {0}; uint32_t isize = 0; @@ -1372,8 +1370,6 @@ void *send_frame_thread (void *threadid) { struct addrinfo hints, *res; int errcode; - char addrstr[100]; - void *ptr; memset (&hints, 0, sizeof (hints)); hints.ai_family = AF_INET; @@ -1567,7 +1563,6 @@ void *send_frame_thread (void *threadid) uint32_t crc = frame->crc; uint32_t width=frame->width; uint32_t height=frame->height; - BOOL show_time=FALSE; /* unlock sendqueue for main thread */ pthread_mutex_unlock(&remoteVars.sendqueue_mutex); @@ -1982,7 +1977,6 @@ clientReadNotify(int fd, int ready, void *data) { uint16_t width=*((uint16_t*)buff+2); uint16_t height=*((uint16_t*)buff+3); - uint8_t primaryInd=*((uint8_t*)buff+8); struct VirtScreen screens[4] = {0}; remoteVars.client_initialized=TRUE; @@ -2118,7 +2112,6 @@ unsigned int checkSocketConnection(OsTimerPtr timer, CARD32 time, void* args) void open_socket(void) { - ssize_t size; const int y = 1; int ret = -1; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 870ba0ebe86b13b8f0c6a2de31adb79f30bccbea Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 16:51:57 2019 +0200 rebase comments --- x2gokdriveremote.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index 1a2d47e..dbbfb64 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -141,7 +141,7 @@ BOOL isCursorSent(uint32_t serialNumber) void addSentCursor(uint32_t serialNumber) { - #warning check memory +// #warning check memory struct sentCursor* curs=malloc(sizeof(struct sentCursor)); curs->next=0; curs->serialNumber=serialNumber; @@ -1204,8 +1204,7 @@ BOOL find_common_regions(struct cache_elem* source, struct cache_elem* dest, BOO return checkEquality(source, dest, 0, *vshift, common_rect); } - -#warning stop here for the moment, let's see later if we'll use it' +// #warning stop here for the moment, let's see later if we'll use it return FALSE; *vshift=0; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 99806b85e259e13f4c34ab03addaf5dd8ad9ebde Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Jul 16 17:01:14 2019 +0200 x2gokdriveremote.c: Attribute ln integer as _X_UNUSED. --- x2gokdriveremote.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index 8bcdbac..f27bf37 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -301,7 +301,8 @@ void remote_sendCursor(CursorPtr cursor) static int32_t send_cursor(struct cursorFrame* cursor) { - int ln, l = 0; + _X_UNUSED int ln = 0; + int l = 0; int sent=0; unsigned char buffer[64] = {0}; @@ -349,7 +350,8 @@ int32_t send_frame(u_int32_t width, uint32_t height, uint32_t x, uint32_t y, uin { uint32_t numofregions=0; - int ln, l = 0; + _X_UNUSED int ln = 0; + int l = 0; uint32_t total=0; int sent = 0; unsigned char buffer[64] = {0}; @@ -431,7 +433,8 @@ int send_deleted_elements(void) unsigned char buffer[56] = {0}; unsigned char* list = NULL; - int ln, l = 0; + _X_UNUSED int ln = 0; + int l = 0; int length, sent=0; unsigned int i = 0; @@ -479,7 +482,8 @@ int send_deleted_cursors(void) { unsigned char buffer[56] = {0}; unsigned char* list = NULL; - int ln, l = 0; + _X_UNUSED int ln = 0; + int l = 0; int length, sent = 0; unsigned int i=0; struct deletedCursor* elem = NULL; @@ -524,7 +528,8 @@ int send_deleted_cursors(void) int send_selection(int sel, char* data, uint32_t length, uint32_t format) { unsigned char buffer[56] = {0}; - int ln, l = 0; + _X_UNUSED int ln = 0; + int l = 0; int sent = 0; *((uint32_t*)buffer)=SELECTION; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git