Merge pull request #3167 from realjiangms/shadow_export_default_subsystem
server/shadow: Export API to set built-in subsystem modules for freerdp-shadow-subsystem
This commit is contained in:
commit
92de4cf721
@ -277,7 +277,9 @@ typedef struct _SHADOW_MSG_OUT_AUDIO_OUT_VOLUME SHADOW_MSG_OUT_AUDIO_OUT_VOLUME;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FREERDP_API void shadow_subsystem_set_entry_builtin(const char* name);
|
||||||
FREERDP_API void shadow_subsystem_set_entry(pfnShadowSubsystemEntry pEntry);
|
FREERDP_API void shadow_subsystem_set_entry(pfnShadowSubsystemEntry pEntry);
|
||||||
|
|
||||||
FREERDP_API int shadow_subsystem_pointer_convert_alpha_pointer_data(BYTE* pixels, BOOL premultiplied,
|
FREERDP_API int shadow_subsystem_pointer_convert_alpha_pointer_data(BYTE* pixels, BOOL premultiplied,
|
||||||
UINT32 width, UINT32 height, SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* pointerColor);
|
UINT32 width, UINT32 height, SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* pointerColor);
|
||||||
|
|
||||||
|
@ -97,6 +97,9 @@ set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow")
|
|||||||
set(MODULE_NAME "freerdp-shadow-subsystem")
|
set(MODULE_NAME "freerdp-shadow-subsystem")
|
||||||
set(MODULE_PREFIX "FREERDP_SERVER_SHADOW_SUBSYSTEM")
|
set(MODULE_PREFIX "FREERDP_SERVER_SHADOW_SUBSYSTEM")
|
||||||
|
|
||||||
|
set(${MODULE_PREFIX}_SRCS
|
||||||
|
shadow_subsystem_builtin.c)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(WITH_SHADOW_WIN 1)
|
set(WITH_SHADOW_WIN 1)
|
||||||
elseif(X11_FOUND AND NOT APPLE)
|
elseif(X11_FOUND AND NOT APPLE)
|
||||||
@ -245,15 +248,15 @@ set(${MODULE_PREFIX}_MAC_SRCS
|
|||||||
|
|
||||||
if(WITH_SHADOW_WIN)
|
if(WITH_SHADOW_WIN)
|
||||||
add_definitions(-DWITH_SHADOW_WIN)
|
add_definitions(-DWITH_SHADOW_WIN)
|
||||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_WIN_SRCS})
|
list(APPEND ${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_WIN_SRCS})
|
||||||
list(APPEND ${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_WIN_LIBS})
|
list(APPEND ${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_WIN_LIBS})
|
||||||
elseif(WITH_SHADOW_X11)
|
elseif(WITH_SHADOW_X11)
|
||||||
add_definitions(-DWITH_SHADOW_X11)
|
add_definitions(-DWITH_SHADOW_X11)
|
||||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_X11_SRCS})
|
list(APPEND ${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_X11_SRCS})
|
||||||
list(APPEND ${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_X11_LIBS})
|
list(APPEND ${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_X11_LIBS})
|
||||||
elseif(WITH_SHADOW_MAC)
|
elseif(WITH_SHADOW_MAC)
|
||||||
add_definitions(-DWITH_SHADOW_MAC)
|
add_definitions(-DWITH_SHADOW_MAC)
|
||||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_MAC_SRCS})
|
list(APPEND ${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_MAC_SRCS})
|
||||||
list(APPEND ${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_MAC_LIBS})
|
list(APPEND ${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_MAC_LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -37,18 +37,6 @@ static BOOL g_MessagePump = FALSE;
|
|||||||
|
|
||||||
#include <freerdp/server/shadow.h>
|
#include <freerdp/server/shadow.h>
|
||||||
|
|
||||||
#ifdef WITH_SHADOW_X11
|
|
||||||
extern int X11_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_SHADOW_MAC
|
|
||||||
extern int Mac_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_SHADOW_WIN
|
|
||||||
extern int Win_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
@ -56,17 +44,7 @@ int main(int argc, char** argv)
|
|||||||
DWORD dwExitCode;
|
DWORD dwExitCode;
|
||||||
rdpShadowServer* server;
|
rdpShadowServer* server;
|
||||||
|
|
||||||
#ifdef WITH_SHADOW_X11
|
shadow_subsystem_set_entry_builtin(NULL);
|
||||||
shadow_subsystem_set_entry(X11_ShadowSubsystemEntry);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_SHADOW_MAC
|
|
||||||
shadow_subsystem_set_entry(Mac_ShadowSubsystemEntry);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_SHADOW_WIN
|
|
||||||
shadow_subsystem_set_entry(Win_ShadowSubsystemEntry);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
server = shadow_server_new();
|
server = shadow_server_new();
|
||||||
|
|
||||||
|
96
server/shadow/shadow_subsystem_builtin.c
Normal file
96
server/shadow/shadow_subsystem_builtin.c
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/**
|
||||||
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||||
|
*
|
||||||
|
* Copyright 2016 Jiang Zihao <zihao.jiang@yahoo.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <freerdp/server/shadow.h>
|
||||||
|
|
||||||
|
struct _RDP_SHADOW_SUBSYSTEM
|
||||||
|
{
|
||||||
|
const char* name;
|
||||||
|
pfnShadowSubsystemEntry entry;
|
||||||
|
};
|
||||||
|
typedef struct _RDP_SHADOW_SUBSYSTEM RDP_SHADOW_SUBSYSTEM;
|
||||||
|
|
||||||
|
#ifdef WITH_SHADOW_X11
|
||||||
|
extern int X11_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_SHADOW_MAC
|
||||||
|
extern int Mac_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_SHADOW_WIN
|
||||||
|
extern int Win_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static RDP_SHADOW_SUBSYSTEM g_Subsystems[] =
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef WITH_SHADOW_X11
|
||||||
|
{ "X11", X11_ShadowSubsystemEntry },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_SHADOW_MAC
|
||||||
|
{ "Mac", Mac_ShadowSubsystemEntry },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_SHADOW_WIN
|
||||||
|
{ "Win", Win_ShadowSubsystemEntry },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{ "", NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
static int g_SubsystemCount = (sizeof(g_Subsystems) / sizeof(g_Subsystems[0]));
|
||||||
|
|
||||||
|
static pfnShadowSubsystemEntry shadow_subsystem_load_static_entry(const char* name)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
for (index = 0; index < g_SubsystemCount; index++)
|
||||||
|
{
|
||||||
|
if (g_Subsystems[index].name)
|
||||||
|
return g_Subsystems[index].entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (index = 0; index < g_SubsystemCount; index++)
|
||||||
|
{
|
||||||
|
if (strcmp(name, g_Subsystems[index].name) == 0)
|
||||||
|
return g_Subsystems[index].entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void shadow_subsystem_set_entry_builtin(const char* name)
|
||||||
|
{
|
||||||
|
pfnShadowSubsystemEntry entry;
|
||||||
|
|
||||||
|
entry = shadow_subsystem_load_static_entry(name);
|
||||||
|
|
||||||
|
if (entry)
|
||||||
|
shadow_subsystem_set_entry(entry);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user