From f3306e9e83cd4ddb05328230630198e7c1824383 Mon Sep 17 00:00:00 2001 From: dscho Date: Sun, 9 Dec 2001 21:40:46 +0000 Subject: Makefile cleanup, some special options for OSX --- mac.c | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'mac.c') diff --git a/mac.c b/mac.c index 0f1332b..c91bc61 100644 --- a/mac.c +++ b/mac.c @@ -37,6 +37,10 @@ rfbScreenInfoPtr rfbScreen; +/* some variables to enable special behaviour */ +int startTime = -1, maxSecsToConnect = 0; +Bool disconnectAfterFirstClient = True; + /* Where do I get the "official" list of Mac key codes? Ripped these out of a Mac II emulator called Basilisk II that I found on the net. */ @@ -283,18 +287,45 @@ ScreenInit(int argc, char**argv) static void refreshCallback(CGRectCount count, const CGRect *rectArray, void *ignore) { - int i; + int i; - for (i = 0; i < count; i++) - rfbMarkRectAsModified(rfbScreen, - rectArray[i].origin.x,rectArray[i].origin.y, - rectArray[i].origin.x + rectArray[i].size.width, - rectArray[i].origin.y + rectArray[i].size.height); + if(startTime>0 && time()>startTime+maxSecsToConnect) + exit(0); + + for (i = 0; i < count; i++) + rfbMarkRectAsModified(rfbScreen, + rectArray[i].origin.x,rectArray[i].origin.y, + rectArray[i].origin.x + rectArray[i].size.width, + rectArray[i].origin.y + rectArray[i].size.height); +} + +void clientGone(rfbClientPtr cl) +{ + exit(0); +} + +void newClient(rfbClientPtr cl) +{ + if(startTime>0 && time()>startTime+maxSecsToConnect) + exit(0); + + if(disconnectAfterFirstClient) + cl->clientGoneHook = clientGone; } int main(int argc,char *argv[]) { + for(i=argc-1;i>0;i--) + if(inewClientHook = newClient; + /* enter background event loop */ rfbRunEventLoop(rfbScreen,40,TRUE); -- cgit v1.2.1