diff --git a/server/shadow/CMakeLists.txt b/server/shadow/CMakeLists.txt index 758d6d2cd..d069ada87 100644 --- a/server/shadow/CMakeLists.txt +++ b/server/shadow/CMakeLists.txt @@ -54,28 +54,24 @@ set(SRCS shadow.h ) -if(NOT FREERDP_UNIFIED_BUILD) - find_package(rdtk 0 REQUIRED) - include_directories(SYSTEM ${RDTK_INCLUDE_DIR}) -else() - if(NOT WITH_RDTK) - message(FATAL_ERROR "-DWITH_RDTK=ON is required for unified FreeRDP build with shadow server") +if(WITH_RDTK) + if(NOT FREERDP_UNIFIED_BUILD) + find_package(rdtk 0 REQUIRED) + include_directories(SYSTEM ${RDTK_INCLUDE_DIR}) + else() + include_directories(${PROJECT_SOURCE_DIR}/rdtk/include) + include_directories(${PROJECT_BINARY_DIR}/rdtk/include) endif() - include_directories(${PROJECT_SOURCE_DIR}/rdtk/include) - include_directories(${PROJECT_BINARY_DIR}/rdtk/include) endif() addtargetwithresourcefile(${MODULE_NAME} "FALSE" "${FREERDP_VERSION}" SRCS) -list( - APPEND - LIBS - freerdp - freerdp-server - winpr - winpr-tools - rdtk -) +if(WITH_RDTK) + target_compile_definitions(${MODULE_NAME} PRIVATE WITH_RDTK) + list(APPEND LIBS rdtk) +endif() + +list(APPEND LIBS freerdp freerdp-server winpr winpr-tools) target_include_directories(${MODULE_NAME} INTERFACE $) target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS}) diff --git a/server/shadow/shadow_lobby.c b/server/shadow/shadow_lobby.c index 568930a27..36e3a973d 100644 --- a/server/shadow/shadow_lobby.c +++ b/server/shadow/shadow_lobby.c @@ -21,7 +21,9 @@ #include #include +#if defined(WITH_RDTK) #include +#endif #include "shadow.h" @@ -30,9 +32,6 @@ BOOL shadow_client_init_lobby(rdpShadowServer* server) { BOOL rc = FALSE; - int width = 0; - int height = 0; - rdtkSurface* surface = NULL; RECTANGLE_16 invalidRect = { 0 }; WINPR_ASSERT(server); @@ -41,16 +40,18 @@ BOOL shadow_client_init_lobby(rdpShadowServer* server) if (!lobby) return FALSE; +#if defined(WITH_RDTK) rdtkEngine* engine = rdtk_engine_new(); if (!engine) return FALSE; EnterCriticalSection(&lobby->lock); - surface = + rdtkSurface* surface = rdtk_surface_new(engine, lobby->data, WINPR_ASSERTING_INT_CAST(uint16_t, lobby->width), WINPR_ASSERTING_INT_CAST(uint16_t, lobby->height), lobby->scanline); if (!surface) goto fail; +#endif invalidRect.left = 0; invalidRect.top = 0; @@ -65,12 +66,14 @@ BOOL shadow_client_init_lobby(rdpShadowServer* server) goto fail; } - width = invalidRect.right - invalidRect.left; - height = invalidRect.bottom - invalidRect.top; +#if defined(WITH_RDTK) + const int width = invalidRect.right - invalidRect.left; + const int height = invalidRect.bottom - invalidRect.top; WINPR_ASSERT(width <= UINT16_MAX); WINPR_ASSERT(width >= 0); WINPR_ASSERT(height <= UINT16_MAX); WINPR_ASSERT(height >= 0); + if (rdtk_surface_fill(surface, invalidRect.left, invalidRect.top, (UINT16)width, (UINT16)height, 0x3BB9FF) < 0) goto fail; @@ -80,14 +83,19 @@ BOOL shadow_client_init_lobby(rdpShadowServer* server) goto fail; // rdtk_button_draw(surface, 16, 64, 128, 32, NULL, "button"); // rdtk_text_field_draw(surface, 16, 128, 128, 32, NULL, "text field"); +#endif if (!region16_union_rect(&(lobby->invalidRegion), &(lobby->invalidRegion), &invalidRect)) goto fail; rc = TRUE; fail: + +#if defined(WITH_RDTK) rdtk_surface_free(surface); - LeaveCriticalSection(&lobby->lock); rdtk_engine_free(engine); +#endif + + LeaveCriticalSection(&lobby->lock); return rc; } diff --git a/server/shadow/shadow_lobby.h b/server/shadow/shadow_lobby.h index 37ad9cf69..917ad34dc 100644 --- a/server/shadow/shadow_lobby.h +++ b/server/shadow/shadow_lobby.h @@ -24,8 +24,6 @@ #include #include -#include - #ifdef __cplusplus extern "C" {