summaryrefslogtreecommitdiffstats
path: root/client_examples
diff options
context:
space:
mode:
authordscho <dscho>2008-05-13 00:02:52 +0000
committerdscho <dscho>2008-05-13 00:02:52 +0000
commitb069f1dc015e4d84a5690d4e5fe2e1578e79702b (patch)
tree401ac05b69710d285521a830e4a017fefdf10ced /client_examples
parentd538e4e28148c967d00310f3eca1a648916b771e (diff)
downloadlibtdevnc-b069f1dc015e4d84a5690d4e5fe2e1578e79702b.tar.gz
libtdevnc-b069f1dc015e4d84a5690d4e5fe2e1578e79702b.zip
SDLvncviewer: add -viewonly
Just like its siblings from other projects, SDLvncviewer now supports viewonly connections. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'client_examples')
-rw-r--r--client_examples/SDLvncviewer.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/client_examples/SDLvncviewer.c b/client_examples/SDLvncviewer.c
index 8a006fd..e73edb1 100644
--- a/client_examples/SDLvncviewer.c
+++ b/client_examples/SDLvncviewer.c
@@ -221,13 +221,23 @@ log_to_file(const char *format, ...)
int main(int argc,char** argv) {
rfbClient* cl;
- int i,buttonMask=0;
+ int i, j, buttonMask = 0, viewOnly = 0;
SDL_Event e;
#ifdef LOG_TO_FILE
rfbClientLog=rfbClientErr=log_to_file;
#endif
+ for (i = 1, j = 1; i < argc; i++)
+ if (!strcmp(argv[1], "-viewonly"))
+ viewOnly = 1;
+ else {
+ if (i != j)
+ argv[j] = argv[i];
+ j++;
+ }
+ argc = j;
+
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
SDL_EnableUNICODE(1);
@@ -252,6 +262,8 @@ int main(int argc,char** argv) {
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEMOTION: {
int x,y;
+ if (viewOnly)
+ break;
int state=SDL_GetMouseState(&x,&y);
int i;
for(buttonMask=0,i=0;buttonMapping[i].sdl;i++)
@@ -261,6 +273,8 @@ int main(int argc,char** argv) {
}
break;
case SDL_KEYUP: case SDL_KEYDOWN:
+ if (viewOnly)
+ break;
SendKeyEvent(cl,SDL_key2rfbKeySym(&e.key),(e.type==SDL_KEYDOWN)?TRUE:FALSE);
break;
case SDL_QUIT: