mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
[server,shadow] make rdtk optional
This commit is contained in:
@@ -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 $<INSTALL_INTERFACE:include>)
|
||||
target_link_libraries(${MODULE_NAME} PRIVATE ${LIBS})
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
#include <winpr/assert.h>
|
||||
#include <winpr/cast.h>
|
||||
|
||||
#if defined(WITH_RDTK)
|
||||
#include <rdtk/rdtk.h>
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/synch.h>
|
||||
|
||||
#include <rdtk/rdtk.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user