Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,12 @@ if(WITH_LIBVNCSERVER)
)
endif(WITH_LIBVNCSERVER)

if(WITH_LIBVNCCLIENT)
list(APPEND SIMPLETESTS
client_capstest
)
endif(WITH_LIBVNCCLIENT)


if(WITH_THREADS AND (CMAKE_USE_PTHREADS_INIT OR CMAKE_USE_WIN32_THREADS_INIT) AND WITH_LIBVNCSERVER AND WITH_LIBVNCCLIENT)
set(SIMPLETESTS
Expand Down Expand Up @@ -759,6 +765,9 @@ endif(LIBVNCSERVER_WITH_WEBSOCKETS AND WITH_LIBVNCSERVER)
if(WITH_LIBVNCSERVER)
add_test(NAME cargs COMMAND test_cargstest)
endif(WITH_LIBVNCSERVER)
if(WITH_LIBVNCCLIENT)
add_test(NAME client_caps COMMAND test_client_capstest)
endif(WITH_LIBVNCCLIENT)
if(UNIX)
if(WITH_LIBVNCSERVER)
add_test(NAME includetest_server COMMAND ${TESTS_DIR}/includetest.sh ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_MAKE_PROGRAM} "rfb/rfb.h")
Expand Down
8 changes: 8 additions & 0 deletions src/libvncclient/rfbclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,11 @@ SendExtDesktopSize(rfbClient* client, uint16_t width, uint16_t height)
return TRUE;
}

if (!SupportsClient2Server(client, rfbSetDesktopSize)) {
rfbClientLog("Server does not support SetDesktopSize - not sending dimensions %dx%d\n", width, height);
return TRUE;
}

if (client->screen.width != rfbClientSwap16IfLE(width) || client->screen.height != rfbClientSwap16IfLE(height)) {
rfbClientLog("Sending dimensions %dx%d\n", width, height);
sdm.type = rfbSetDesktopSize;
Expand Down Expand Up @@ -2154,6 +2159,9 @@ HandleRFBServerMessage(rfbClient* client)
}

if (rect.encoding == rfbEncodingExtDesktopSize) {
/* A server that sends ExtendedDesktopSize must understand SetDesktopSize. */
SetClient2Server(client, rfbSetDesktopSize);

/* read encoding data */
int screens;
int loop;
Expand Down
26 changes: 26 additions & 0 deletions test/client_capstest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <rfb/rfbclient.h>

int main(void)
{
rfbClient* client;

client = rfbGetClient(8, 3, 4);
if (!client)
return 1;

client->screen.width = rfbClientSwap16IfLE(640);
client->screen.height = rfbClientSwap16IfLE(480);

if (SupportsClient2Server(client, rfbSetDesktopSize)) {
rfbClientCleanup(client);
return 1;
}

if (!SendExtDesktopSize(client, 800, 600)) {
rfbClientCleanup(client);
return 1;
}

rfbClientCleanup(client);
return 0;
}
Loading