summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordscho <dscho>2001-12-21 15:27:10 +0000
committerdscho <dscho>2001-12-21 15:27:10 +0000
commit1d514588737cc744b74848464343cfa2056866ae (patch)
tree7bd5c653c93efd3c34a15f63e222c311898d2c4a
parentcddeb0d9d261d0a7f6e987c69d6123f5aedeebbe (diff)
downloadlibtdevnc-1d514588737cc744b74848464343cfa2056866ae.tar.gz
libtdevnc-1d514588737cc744b74848464343cfa2056866ae.zip
shared mode added
-rw-r--r--mac.c17
-rw-r--r--x11vnc.c22
2 files changed, 32 insertions, 7 deletions
diff --git a/mac.c b/mac.c
index 94ef5d2..ff37f01 100644
--- a/mac.c
+++ b/mac.c
@@ -266,6 +266,8 @@ PtrAddEvent(buttonMask, x, y, cl)
(buttonMask & (1 << 7)) ? TRUE : FALSE);
}
+Bool viewOnly = FALSE, sharedMode = FALSE;
+
void
ScreenInit(int argc, char**argv)
{
@@ -278,8 +280,15 @@ ScreenInit(int argc, char**argv)
rfbScreen->paddedWidthInBytes = CGDisplayBytesPerRow(kCGDirectMainDisplay);
rfbScreen->frameBuffer =
(char *)CGDisplayBaseAddress(kCGDirectMainDisplay);
- rfbScreen->ptrAddEvent = PtrAddEvent;
- rfbScreen->kbdAddEvent = KbdAddEvent;
+
+ if(!viewOnly) {
+ rfbScreen->ptrAddEvent = PtrAddEvent;
+ rfbScreen->kbdAddEvent = KbdAddEvent;
+ }
+ if(sharedMode) {
+ rfbScreen->rfbAlwaysShared = TRUE;
+ }
+
rfbInitServer(rfbScreen);
}
@@ -321,6 +330,10 @@ int main(int argc,char *argv[])
startTime = time(0);
} else if(strcmp(argv[i],"-runforever")==0) {
disconnectAfterFirstClient = FALSE;
+ } else if(strcmp(argv[i],"-viewonly")==0) {
+ viewOnly=TRUE;
+ } else if(strcmp(argv[i],"-shared")==0) {
+ sharedMode=TRUE;
}
ScreenInit(argc,argv);
diff --git a/x11vnc.c b/x11vnc.c
index 70b4ca8..3c067f1 100644
--- a/x11vnc.c
+++ b/x11vnc.c
@@ -16,8 +16,10 @@
Display *dpy = 0;
int window;
int c=0,blockLength = 32;
-int tileX=0,tileY=0,tileWidth=32,tileHeight=32*2,dontTile=True;
+int tileX=0,tileY=0,tileWidth=32,tileHeight=32*2,dontTile=TRUE;
Bool gotInput = FALSE;
+Bool viewOnly = FALSE;
+Bool sharedMode = FALSE;
Bool disconnectAfterFirstClient = TRUE;
@@ -129,7 +131,7 @@ int oldButtonMask = 0;
void mouse(int buttonMask,int x,int y,rfbClientPtr cl)
{
int i=0;
- //fprintf(stderr,"/");
+
XTestFakeMotionEvent(dpy,0,x,y,CurrentTime );
while(i<5) {
if ((oldButtonMask&(1<<i))!=(buttonMask&(1<<i)))
@@ -299,7 +301,11 @@ int main(int argc,char** argv)
} else if(strcmp(argv[i],"-runforever")==0) {
disconnectAfterFirstClient = FALSE;
} else if(strcmp(argv[i],"-tile")==0) {
- dontTile=False;
+ dontTile=FALSE;
+ } else if(strcmp(argv[i],"-viewonly")==0) {
+ viewOnly=TRUE;
+ } else if(strcmp(argv[i],"-shared")==0) {
+ sharedMode=TRUE;
}
updateCounter = dontTile?20:1;
@@ -380,8 +386,14 @@ int main(int argc,char** argv)
screen->frameBuffer = backupImage;
screen->cursor = 0;
screen->newClientHook = newClient;
- screen->kbdAddEvent = keyboard;
- screen->ptrAddEvent = mouse;
+
+ if(!viewOnly) {
+ screen->kbdAddEvent = keyboard;
+ screen->ptrAddEvent = mouse;
+ }
+ if(sharedMode) {
+ screen->rfbAlwaysShared = TRUE;
+ }
screen->rfbDeferUpdateTime = 1;
updateCounter /= screen->rfbDeferUpdateTime;