Skip to content

Commit

Permalink
libvncserver: post SetEncodings hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Volodymyr Samokhatko committed Jun 7, 2023
1 parent eb83123 commit 3257de8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/rfb/rfb.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ enum rfbProtocolExtensionHookType {
RFB_PROTOCOL_EXTENSION_HOOK_CLOSE,
RFB_PROTOCOL_EXTENSION_HOOK_USAGE,
RFB_PROTOCOL_EXTENSION_HOOK_PROCESS_ARGUMENT,
RFB_PROTOCOL_EXTENSION_HOOK_POST_SET_ENCODINGS,
RFB_PROTOCOL_EXTENSION_HOOK_PRE_FBU,
RFB_PROTOCOL_EXTENSION_HOOK_POST_FBU,
};
Expand Down Expand Up @@ -250,6 +251,9 @@ _Static_assert(sizeof(rfbProtocolExtensionHookGeneric) == sizeof(rfbProtocolExte
typedef int (*rfbProtocolExtensionHookProcessArgument)(int argc, char *argv[]);
_Static_assert(sizeof(rfbProtocolExtensionHookGeneric) == sizeof(rfbProtocolExtensionHookProcessArgument), "extension hook size doesn't match");

typedef void (*rfbProtocolExtensionHookPostSetEncodings)(struct _rfbClientRec* client);
_Static_assert(sizeof(rfbProtocolExtensionHookGeneric) == sizeof(rfbProtocolExtensionHookPostSetEncodings), "extension hook size doesn't match");

/** returns TRUE if proceed with the framebuffer update (PostFbu is called in any case). */
typedef rfbBool (*rfbProtocolExtensionHookPreFbu)(struct _rfbClientRec* client, void* data);
_Static_assert(sizeof(rfbProtocolExtensionHookGeneric) == sizeof(rfbProtocolExtensionHookPreFbu), "extension hook size doesn't match");
Expand All @@ -271,6 +275,7 @@ typedef struct _rfbProtocolExtensionElement {
rfbProtocolExtensionHookUsage usage;
rfbProtocolExtensionHookProcessArgument processArgument;

rfbProtocolExtensionHookPostSetEncodings postSetEncodings;
rfbProtocolExtensionHookPreFbu preFbu;
rfbProtocolExtensionHookPostFbu postFbu;
} hook;
Expand Down
12 changes: 12 additions & 0 deletions src/libvncserver/rfbserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2647,6 +2647,18 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
cl->enableCursorPosUpdates = FALSE;
}

rfbProtocolExtension2 *extension2 = rfbGetExtension2Iterator();
for (; extension2; extension2 = extension2->next) {
rfbProtocolExtensionElement* el = extension2->elements;
for (; el && el < extension2->elements + extension2->elementsCount; ++el) {
if (el->type == RFB_PROTOCOL_EXTENSION_HOOK_POST_SET_ENCODINGS) {
el->hook.postSetEncodings(cl);
break;
}
}
}
rfbReleaseExtension2Iterator();

return;
}

Expand Down

0 comments on commit 3257de8

Please sign in to comment.