Implement a DisplayFinishedHook for libvncserver.

If set, this hook gets called just before
rfbSendFrameBufferUpdate() returns.

Signed-off-by: Christian Beier <dontmind@freeshell.org>
pull/1/head
Christian Beier 15 years ago committed by Johannes Schindelin
parent a29e42e515
commit 09f7c684a2

@ -894,6 +894,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen->setTranslateFunction = rfbSetTranslateFunction; screen->setTranslateFunction = rfbSetTranslateFunction;
screen->newClientHook = rfbDefaultNewClientHook; screen->newClientHook = rfbDefaultNewClientHook;
screen->displayHook = NULL; screen->displayHook = NULL;
screen->displayFinishedHook = NULL;
screen->getKeyboardLedStateHook = NULL; screen->getKeyboardLedStateHook = NULL;
/* initialize client list and iterator mutex */ /* initialize client list and iterator mutex */

@ -2446,9 +2446,14 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
fu->nRects = Swap16IfLE(1); fu->nRects = Swap16IfLE(1);
cl->ublen = sz_rfbFramebufferUpdateMsg; cl->ublen = sz_rfbFramebufferUpdateMsg;
if (!rfbSendNewFBSize(cl, cl->scaledScreen->width, cl->scaledScreen->height)) { if (!rfbSendNewFBSize(cl, cl->scaledScreen->width, cl->scaledScreen->height)) {
if(cl->screen->displayFinishedHook)
cl->screen->displayFinishedHook(cl, FALSE);
return FALSE; return FALSE;
} }
return rfbSendUpdateBuf(cl); result = rfbSendUpdateBuf(cl);
if(cl->screen->displayFinishedHook)
cl->screen->displayFinishedHook(cl, result);
return result;
} }
/* /*
@ -2564,6 +2569,8 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
!sendSupportedMessages && !sendSupportedEncodings && !sendServerIdentity) { !sendSupportedMessages && !sendSupportedEncodings && !sendServerIdentity) {
sraRgnDestroy(updateRegion); sraRgnDestroy(updateRegion);
UNLOCK(cl->updateMutex); UNLOCK(cl->updateMutex);
if(cl->screen->displayFinishedHook)
cl->screen->displayFinishedHook(cl, TRUE);
return TRUE; return TRUE;
} }
@ -2841,6 +2848,9 @@ updateFailed:
sraRgnReleaseIterator(i); sraRgnReleaseIterator(i);
sraRgnDestroy(updateRegion); sraRgnDestroy(updateRegion);
sraRgnDestroy(updateCopyRegion); sraRgnDestroy(updateCopyRegion);
if(cl->screen->displayFinishedHook)
cl->screen->displayFinishedHook(cl, result);
return result; return result;
} }

@ -136,6 +136,7 @@ typedef rfbBool (*rfbSetTranslateFunctionProcPtr)(struct _rfbClientRec* cl);
typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len); typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len);
typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl); typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl);
typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl); typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl);
typedef void (*rfbDisplayFinishedHookPtr)(struct _rfbClientRec* cl, int result);
/* support the capability to view the caps/num/scroll states of the X server */ /* support the capability to view the caps/num/scroll states of the X server */
typedef int (*rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo* screen); typedef int (*rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo* screen);
/* If x==1 and y==1 then set the whole display /* If x==1 and y==1 then set the whole display
@ -352,6 +353,9 @@ typedef struct _rfbScreenInfo
/* command line authorization of file transfers */ /* command line authorization of file transfers */
rfbBool permitFileTransfer; rfbBool permitFileTransfer;
/* displayFinishedHook is called just after a frame buffer update */
rfbDisplayFinishedHookPtr displayFinishedHook;
} rfbScreenInfo, *rfbScreenInfoPtr; } rfbScreenInfo, *rfbScreenInfoPtr;

Loading…
Cancel
Save