server/shadow: Completely decouple subsystem implementations and shadow framework...
authorzihao.jiang <zihao.jiang@yahoo.com>
Sun, 28 Jun 2015 08:20:49 +0000 (16:20 +0800)
committerzihao.jiang <zihao.jiang@yahoo.com>
Thu, 31 Dec 2015 19:13:52 +0000 (03:13 +0800)
It will be completely possible to implement subsystem with only include/freerdp/server/shadow.h and libfreerdp-shadow.

Details as following:
1. Exported surface structure as subsystem implementations deeply depend on it to send image update
2. Export capture APIs. They are actually indepent APIs to help compare and calculate image difference.
3. Introduce API to trigger client frame update. Conceal details in subsystem->updateEvent
4. Pass client to client callbacks. Subsystem implementation may need to know 'which client' send the interaction event as well as the authentication request.
Add this support in callback definition before anyone really use shadow framework APIs to implement a custom subsystem.
Also added callback for client capability exchange
5. Remove X11_ShadowSubsystem Mac_ShadowSubsystem Win_ShadowSubsystem from libfreerdp-shadow.
Discard FREERDP_API mark on ShadowSubsystemEntry functions and make them be compiled together with shadow.c in CMakeLists.txt.
This is required from PR #2751.
Now subsystem implementations and shadow.c could be regarded as an example for shadow framework.

include/freerdp/server/shadow.h
server/shadow/CMakeLists.txt
server/shadow/Mac/mac_shadow.c
server/shadow/Win/win_shadow.c
server/shadow/X11/x11_shadow.c
server/shadow/shadow_audin.c
server/shadow/shadow_capture.h
server/shadow/shadow_client.c
server/shadow/shadow_input.c
server/shadow/shadow_subsystem.c
server/shadow/shadow_surface.h

index 72cc814..5e8c71b 100644 (file)
@@ -64,18 +64,19 @@ typedef int (*pfnShadowSubsystemStop)(rdpShadowSubsystem* subsystem);
 
 typedef int (*pfnShadowEnumMonitors)(MONITOR_DEF* monitors, int maxMonitors);
 
-typedef int (*pfnShadowAuthenticate)(rdpShadowSubsystem* subsystem,
+typedef int (*pfnShadowAuthenticate)(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
                const char* user, const char* domain, const char* password);
 typedef BOOL (*pfnShadowClientConnect)(rdpShadowSubsystem* subsystem, rdpShadowClient* client);
 typedef void (*pfnShadowClientDisconnect)(rdpShadowSubsystem* subsystem, rdpShadowClient* client);
+typedef BOOL (*pfnShadowClientCapabilities)(rdpShadowSubsystem* subsystem, rdpShadowClient* client);
 
-typedef int (*pfnShadowSynchronizeEvent)(rdpShadowSubsystem* subsystem, UINT32 flags);
-typedef int (*pfnShadowKeyboardEvent)(rdpShadowSubsystem* subsystem, UINT16 flags, UINT16 code);
-typedef int (*pfnShadowUnicodeKeyboardEvent)(rdpShadowSubsystem* subsystem, UINT16 flags, UINT16 code);
-typedef int (*pfnShadowMouseEvent)(rdpShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y);
-typedef int (*pfnShadowExtendedMouseEvent)(rdpShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y);
+typedef int (*pfnShadowSynchronizeEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, UINT32 flags);
+typedef int (*pfnShadowKeyboardEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 code);
+typedef int (*pfnShadowUnicodeKeyboardEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 code);
+typedef int (*pfnShadowMouseEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y);
+typedef int (*pfnShadowExtendedMouseEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y);
 
-typedef void (*pfnShadowChannelAudinServerReceiveSamples)(rdpShadowSubsystem* subsystem, const void* buf, int nframes);
+typedef void (*pfnShadowChannelAudinServerReceiveSamples)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, const void* buf, int nframes);
 
 struct rdp_shadow_client
 {
@@ -130,6 +131,21 @@ struct rdp_shadow_server
        freerdp_listener* listener;
 };
 
+struct rdp_shadow_surface
+{
+       rdpShadowServer* server;
+
+       int x;
+       int y;
+       int width;
+       int height;
+       int scanline;
+       BYTE* data;
+
+       CRITICAL_SECTION lock;
+       REGION16 invalidRegion;
+};
+
 struct _RDP_SHADOW_ENTRY_POINTS
 {
        pfnShadowSubsystemNew New;
@@ -174,6 +190,7 @@ struct _RDP_SHADOW_ENTRY_POINTS
        pfnShadowAuthenticate Authenticate; \
        pfnShadowClientConnect ClientConnect; \
        pfnShadowClientDisconnect ClientDisconnect; \
+       pfnShadowClientCapabilities ClientCapabilities; \
        \
        rdpShadowServer* server
 
@@ -278,6 +295,11 @@ FREERDP_API int shadow_enum_monitors(MONITOR_DEF* monitors, int maxMonitors);
 FREERDP_API rdpShadowServer* shadow_server_new();
 FREERDP_API void shadow_server_free(rdpShadowServer* server);
 
+FREERDP_API int shadow_capture_align_clip_rect(RECTANGLE_16* rect, RECTANGLE_16* clip);
+FREERDP_API int shadow_capture_compare(BYTE* pData1, int nStep1, int nWidth, int nHeight, BYTE* pData2, int nStep2, RECTANGLE_16* rect);
+
+FREERDP_API void shadow_subsystem_frame_update(rdpShadowSubsystem* subsystem);
+
 FREERDP_API BOOL shadow_client_post_msg(rdpShadowClient* client, void* context, UINT32 type, SHADOW_MSG_OUT* msg, void* lParam);
 FREERDP_API int shadow_client_boardcast_msg(rdpShadowServer* server, void* context, UINT32 type, SHADOW_MSG_OUT* msg, void* lParam);
 FREERDP_API int shadow_client_boardcast_quit(rdpShadowServer* server, int nExitCode);
index d51371f..ce5ac7f 100644 (file)
 set(MODULE_NAME "freerdp-shadow")
 set(MODULE_PREFIX "FREERDP_SERVER_SHADOW")
 
+include_directories(${OPENSSL_INCLUDE_DIR})
+
+set(${MODULE_PREFIX}_SRCS
+       shadow_client.c
+       shadow_client.h
+       shadow_lobby.c
+       shadow_lobby.h
+       shadow_input.c
+       shadow_input.h
+       shadow_screen.c
+       shadow_screen.h
+       shadow_surface.c
+       shadow_surface.h
+       shadow_encoder.c
+       shadow_encoder.h
+       shadow_capture.c
+       shadow_capture.h
+       shadow_channels.c
+       shadow_channels.h
+       shadow_encomsp.c
+       shadow_encomsp.h
+       shadow_remdesk.c
+       shadow_remdesk.h
+       shadow_rdpsnd.c
+       shadow_rdpsnd.h
+       shadow_audin.c
+       shadow_audin.h
+       shadow_subsystem.c
+       shadow_subsystem.h
+       shadow_mcevent.c
+       shadow_mcevent.h
+       shadow_server.c
+       shadow.h)
+
+# On windows create dll version information.
+# Vendor, product and year are already set in top level CMakeLists.txt
+if (WIN32)
+  set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR})
+  set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR})
+  set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION})
+  set (RC_VERSION_PATCH 0)
+  set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" )
+
+  configure_file(
+    ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in
+    ${CMAKE_CURRENT_BINARY_DIR}/version.rc
+    @ONLY)
+
+  set ( ${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
+endif()
+
+add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
+
+list(APPEND ${MODULE_PREFIX}_LIBS freerdp)
+list(APPEND ${MODULE_PREFIX}_LIBS freerdp-server)
+list(APPEND ${MODULE_PREFIX}_LIBS freerdp-client)
+
+list(APPEND ${MODULE_PREFIX}_LIBS winpr)
+list(APPEND ${MODULE_PREFIX}_LIBS winpr-makecert-tool)
+
+list(APPEND ${MODULE_PREFIX}_LIBS rdtk)
+
+target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
+
+if (WITH_LIBRARY_VERSIONING)
+         set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION})
+endif()
+
+install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT server)
+
+if (WITH_DEBUG_SYMBOLS AND MSVC)
+       install(FILES ${CMAKE_BINARY_DIR}/${MODULE_NAME}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols)
+endif()
+
+set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow")
+
+# command-line executable
+
+set(MODULE_NAME "freerdp-shadow-cli")
+set(MODULE_PREFIX "FREERDP_SERVER_SHADOW_CLI")
+
 if(WIN32)
        set(WITH_SHADOW_WIN 1)
 elseif(X11_FOUND AND NOT APPLE)
@@ -146,39 +227,8 @@ if(WITH_SHADOW_MAC)
        list(APPEND ${MODULE_PREFIX}_MAC_LIBS ${IOKIT} ${IOSURFACE} ${CARBON})
 endif()
 
-include_directories(${OPENSSL_INCLUDE_DIR})
-
 set(${MODULE_PREFIX}_SRCS
-       shadow_client.c
-       shadow_client.h
-       shadow_lobby.c
-       shadow_lobby.h
-       shadow_input.c
-       shadow_input.h
-       shadow_screen.c
-       shadow_screen.h
-       shadow_surface.c
-       shadow_surface.h
-       shadow_encoder.c
-       shadow_encoder.h
-       shadow_capture.c
-       shadow_capture.h
-       shadow_channels.c
-       shadow_channels.h
-       shadow_encomsp.c
-       shadow_encomsp.h
-       shadow_remdesk.c
-       shadow_remdesk.h
-       shadow_rdpsnd.c
-       shadow_rdpsnd.h
-       shadow_audin.c
-       shadow_audin.h
-       shadow_subsystem.c
-       shadow_subsystem.h
-       shadow_mcevent.c
-       shadow_mcevent.h
-       shadow_server.c
-       shadow.h)
+       shadow.c)
 
 set(${MODULE_PREFIX}_WIN_SRCS
        Win/win_rdp.c
@@ -214,56 +264,6 @@ endif()
 
 list(APPEND ${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_AUTH_LIBS})
 
-# On windows create dll version information.
-# Vendor, product and year are already set in top level CMakeLists.txt
-if (WIN32)
-  set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR})
-  set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR})
-  set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION})
-  set (RC_VERSION_PATCH 0)
-  set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" )
-
-  configure_file(
-    ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in
-    ${CMAKE_CURRENT_BINARY_DIR}/version.rc
-    @ONLY)
-
-  set ( ${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
-endif()
-
-add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
-
-list(APPEND ${MODULE_PREFIX}_LIBS freerdp)
-list(APPEND ${MODULE_PREFIX}_LIBS freerdp-server)
-list(APPEND ${MODULE_PREFIX}_LIBS freerdp-client)
-
-list(APPEND ${MODULE_PREFIX}_LIBS winpr)
-list(APPEND ${MODULE_PREFIX}_LIBS winpr-makecert-tool)
-
-list(APPEND ${MODULE_PREFIX}_LIBS rdtk)
-
-target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
-
-if (WITH_LIBRARY_VERSIONING)
-         set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION})
-endif()
-
-install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT server)
-
-if (WITH_DEBUG_SYMBOLS AND MSVC)
-       install(FILES ${CMAKE_BINARY_DIR}/${MODULE_NAME}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols)
-endif()
-
-set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow")
-
-# command-line executable
-
-set(MODULE_NAME "freerdp-shadow-cli")
-set(MODULE_PREFIX "FREERDP_SERVER_SHADOW_CLI")
-
-set(${MODULE_PREFIX}_SRCS
-       shadow.c)
-
        # On windows create dll version information.
 # Vendor, product and year are already set in top level CMakeLists.txt
 if (WIN32)
index 1c6bfe4..2fd5f96 100644 (file)
 #include <freerdp/codec/region.h>
 #include <freerdp/log.h>
 
-#include "../shadow_screen.h"
-#include "../shadow_client.h"
-#include "../shadow_surface.h"
-#include "../shadow_capture.h"
-#include "../shadow_subsystem.h"
-#include "../shadow_mcevent.h"
-
 #include "mac_shadow.h"
 
 #define TAG SERVER_TAG("shadow.mac")
 
 static macShadowSubsystem* g_Subsystem = NULL;
 
-void mac_shadow_input_synchronize_event(macShadowSubsystem* subsystem, UINT32 flags)
+void mac_shadow_input_synchronize_event(macShadowSubsystem* subsystem, rdpShadowClient* client, UINT32 flags)
 {
 
 }
 
-void mac_shadow_input_keyboard_event(macShadowSubsystem* subsystem, UINT16 flags, UINT16 code)
+void mac_shadow_input_keyboard_event(macShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 code)
 {
        DWORD vkcode;
        DWORD keycode;
@@ -87,12 +80,12 @@ void mac_shadow_input_keyboard_event(macShadowSubsystem* subsystem, UINT16 flags
        CFRelease(source);
 }
 
-void mac_shadow_input_unicode_keyboard_event(macShadowSubsystem* subsystem, UINT16 flags, UINT16 code)
+void mac_shadow_input_unicode_keyboard_event(macShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 code)
 {
 
 }
 
-void mac_shadow_input_mouse_event(macShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y)
+void mac_shadow_input_mouse_event(macShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
 {
        UINT32 scrollX = 0;
        UINT32 scrollY = 0;
@@ -196,7 +189,7 @@ void mac_shadow_input_mouse_event(macShadowSubsystem* subsystem, UINT16 flags, U
        }
 }
 
-void mac_shadow_input_extended_mouse_event(macShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y)
+void mac_shadow_input_extended_mouse_event(macShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
 {
 
 }
@@ -366,7 +359,7 @@ void (^mac_capture_stream_handler)(CGDisplayStreamFrameStatus, uint64_t, IOSurfa
                        
                count = ArrayList_Count(server->clients);
                        
-               shadow_multiclient_publish_and_wait(subsystem->updateEvent);
+               shadow_subsystem_frame_update((rdpShadowSubsystem *)subsystem);
                
                if (count == 1)
                {
@@ -667,7 +660,7 @@ macShadowSubsystem* mac_shadow_subsystem_new()
        return subsystem;
 }
 
-FREERDP_API int Mac_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
+int Mac_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
 {
        pEntryPoints->New = (pfnShadowSubsystemNew) mac_shadow_subsystem_new;
        pEntryPoints->Free = (pfnShadowSubsystemFree) mac_shadow_subsystem_free;
index 0a05cb1..d1dbc58 100644 (file)
 #include <freerdp/codec/color.h>
 #include <freerdp/codec/region.h>
 
-#include "../shadow_screen.h"
-#include "../shadow_surface.h"
-#include "../shadow_capture.h"
-#include "../shadow_subsystem.h"
-#include "../shadow_mcevent.h"
-
 #include "win_shadow.h"
 
 #define TAG SERVER_TAG("shadow.win")
 
-void win_shadow_input_synchronize_event(winShadowSubsystem* subsystem, UINT32 flags)
+void win_shadow_input_synchronize_event(winShadowSubsystem* subsystem, rdpShadowClient* client, UINT32 flags)
 {
 
 }
 
-void win_shadow_input_keyboard_event(winShadowSubsystem* subsystem, UINT16 flags, UINT16 code)
+void win_shadow_input_keyboard_event(winShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 code)
 {
        INPUT event;
 
@@ -59,7 +53,7 @@ void win_shadow_input_keyboard_event(winShadowSubsystem* subsystem, UINT16 flags
        SendInput(1, &event, sizeof(INPUT));
 }
 
-void win_shadow_input_unicode_keyboard_event(winShadowSubsystem* subsystem, UINT16 flags, UINT16 code)
+void win_shadow_input_unicode_keyboard_event(winShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 code)
 {
        INPUT event;
 
@@ -76,7 +70,7 @@ void win_shadow_input_unicode_keyboard_event(winShadowSubsystem* subsystem, UINT
        SendInput(1, &event, sizeof(INPUT));
 }
 
-void win_shadow_input_mouse_event(winShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y)
+void win_shadow_input_mouse_event(winShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
 {
        INPUT event;
        float width;
@@ -143,7 +137,7 @@ void win_shadow_input_mouse_event(winShadowSubsystem* subsystem, UINT16 flags, U
        }
 }
 
-void win_shadow_input_extended_mouse_event(winShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y)
+void win_shadow_input_extended_mouse_event(winShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
 {
        INPUT event;
        float width;
@@ -187,20 +181,20 @@ void win_shadow_input_extended_mouse_event(winShadowSubsystem* subsystem, UINT16
 int win_shadow_invalidate_region(winShadowSubsystem* subsystem, int x, int y, int width, int height)
 {
        rdpShadowServer* server;
-       rdpShadowScreen* screen;
+       rdpShadowSurface* surface;
        RECTANGLE_16 invalidRect;
 
        server = subsystem->server;
-       screen = server->screen;
+       surface = server->surface;
 
        invalidRect.left = x;
        invalidRect.top = y;
        invalidRect.right = x + width;
        invalidRect.bottom = y + height;
 
-       EnterCriticalSection(&(screen->lock));
-       region16_union_rect(&(screen->invalidRegion), &(screen->invalidRegion), &invalidRect);
-       LeaveCriticalSection(&(screen->lock));
+       EnterCriticalSection(&(surface->lock));
+       region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion), &invalidRect);
+       LeaveCriticalSection(&(surface->lock));
 
        return 1;
 }
@@ -288,7 +282,7 @@ int win_shadow_surface_copy(winShadowSubsystem* subsystem)
 
        count = ArrayList_Count(server->clients);
 
-       shadow_multiclient_publish_and_wait(subsystem->updateEvent);
+       shadow_subsystem_frame_update((rdpShadowSubsystem *)subsystem);
 
        ArrayList_Unlock(server->clients);
 
@@ -525,7 +519,7 @@ winShadowSubsystem* win_shadow_subsystem_new()
        return subsystem;
 }
 
-FREERDP_API int Win_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
+int Win_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
 {
        pEntryPoints->New = (pfnShadowSubsystemNew) win_shadow_subsystem_new;
        pEntryPoints->Free = (pfnShadowSubsystemFree) win_shadow_subsystem_free;
index 98af9f8..9a16662 100644 (file)
 #include <freerdp/codec/color.h>
 #include <freerdp/codec/region.h>
 
-#include "../shadow_screen.h"
-#include "../shadow_client.h"
-#include "../shadow_capture.h"
-#include "../shadow_surface.h"
-#include "../shadow_subsystem.h"
-#include "../shadow_mcevent.h"
-
 #include "x11_shadow.h"
 
 #define TAG SERVER_TAG("shadow.x11")
@@ -161,7 +154,7 @@ int x11_shadow_pam_get_service_name(SHADOW_PAM_AUTH_INFO* info)
        return 1;
 }
 
-int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem, const char* user, const char* domain, const char* password)
+int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem, rdpShadowClient* client, const char* user, const char* domain, const char* password)
 {
        int pam_status;
        SHADOW_PAM_AUTH_INFO* info;
@@ -215,12 +208,12 @@ int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem, const char* user,
 
 #endif
 
-void x11_shadow_input_synchronize_event(x11ShadowSubsystem* subsystem, UINT32 flags)
+void x11_shadow_input_synchronize_event(x11ShadowSubsystem* subsystem, rdpShadowClient* client, UINT32 flags)
 {
 
 }
 
-void x11_shadow_input_keyboard_event(x11ShadowSubsystem* subsystem, UINT16 flags, UINT16 code)
+void x11_shadow_input_keyboard_event(x11ShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 code)
 {
 #ifdef WITH_XTEST
        DWORD vkcode;
@@ -256,12 +249,12 @@ void x11_shadow_input_keyboard_event(x11ShadowSubsystem* subsystem, UINT16 flags
 #endif
 }
 
-void x11_shadow_input_unicode_keyboard_event(x11ShadowSubsystem* subsystem, UINT16 flags, UINT16 code)
+void x11_shadow_input_unicode_keyboard_event(x11ShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 code)
 {
 
 }
 
-void x11_shadow_input_mouse_event(x11ShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y)
+void x11_shadow_input_mouse_event(x11ShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
 {
 #ifdef WITH_XTEST
        int button = 0;
@@ -314,7 +307,7 @@ void x11_shadow_input_mouse_event(x11ShadowSubsystem* subsystem, UINT16 flags, U
 #endif
 }
 
-void x11_shadow_input_extended_mouse_event(x11ShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y)
+void x11_shadow_input_extended_mouse_event(x11ShadowSubsystem* subsystem, rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
 {
 #ifdef WITH_XTEST
        int button = 0;
@@ -793,7 +786,7 @@ int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
 
                count = ArrayList_Count(server->clients);
 
-               shadow_multiclient_publish_and_wait(subsystem->updateEvent);
+               shadow_subsystem_frame_update((rdpShadowSubsystem *)subsystem);
 
                if (count == 1)
                {
@@ -1444,7 +1437,7 @@ void x11_shadow_subsystem_free(x11ShadowSubsystem* subsystem)
        free(subsystem);
 }
 
-FREERDP_API int X11_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
+int X11_ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
 {
        pEntryPoints->New = (pfnShadowSubsystemNew) x11_shadow_subsystem_new;
        pEntryPoints->Free = (pfnShadowSubsystemFree) x11_shadow_subsystem_free;
index 6e35f3f..c655c82 100644 (file)
@@ -93,7 +93,7 @@ static UINT AudinServerReceiveSamples(audin_server_context* context, const void*
                return CHANNEL_RC_OK;
 
        if (subsystem->AudinServerReceiveSamples)
-               subsystem->AudinServerReceiveSamples(subsystem, buf, nframes);
+               subsystem->AudinServerReceiveSamples(subsystem, client, buf, nframes);
        return CHANNEL_RC_OK;
 }
 
index 3ce3cdd..f5e7404 100644 (file)
@@ -38,9 +38,6 @@ struct rdp_shadow_capture
 extern "C" {
 #endif
 
-int shadow_capture_align_clip_rect(RECTANGLE_16* rect, RECTANGLE_16* clip);
-int shadow_capture_compare(BYTE* pData1, int nStep1, int nWidth, int nHeight, BYTE* pData2, int nStep2, RECTANGLE_16* rect);
-
 rdpShadowCapture* shadow_capture_new(rdpShadowServer* server);
 void shadow_capture_free(rdpShadowCapture* capture);
 
index 32e54d1..6c5d80b 100644 (file)
@@ -179,6 +179,16 @@ void shadow_client_message_free(wMessage* message)
 
 BOOL shadow_client_capabilities(freerdp_peer* peer)
 {
+       rdpShadowSubsystem* subsystem;
+       rdpShadowClient* client;
+
+       client = (rdpShadowClient*) peer->context;
+       subsystem = client->server->subsystem;
+
+       if (subsystem->ClientCapabilities)
+       {
+               return subsystem->ClientCapabilities(subsystem, client);
+       }
        return TRUE;
 }
 
@@ -243,7 +253,7 @@ BOOL shadow_client_post_connect(freerdp_peer* peer)
        {
                if (subsystem->Authenticate)
                {
-                       authStatus = subsystem->Authenticate(subsystem,
+                       authStatus = subsystem->Authenticate(subsystem, client,
                                        settings->Username, settings->Domain, settings->Password);
                }
        }
index e128789..7f97b29 100644 (file)
@@ -32,7 +32,7 @@ BOOL shadow_input_synchronize_event(rdpInput* input, UINT32 flags)
 
        if (subsystem->SynchronizeEvent)
        {
-               subsystem->SynchronizeEvent(subsystem, flags);
+               subsystem->SynchronizeEvent(subsystem, client, flags);
        }
        return TRUE;
 }
@@ -47,7 +47,7 @@ BOOL shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
        
        if (subsystem->KeyboardEvent)
        {
-               subsystem->KeyboardEvent(subsystem, flags, code);
+               subsystem->KeyboardEvent(subsystem, client, flags, code);
        }
        return TRUE;
 }
@@ -62,7 +62,7 @@ BOOL shadow_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 c
 
        if (subsystem->UnicodeKeyboardEvent)
        {
-               subsystem->UnicodeKeyboardEvent(subsystem, flags, code);
+               subsystem->UnicodeKeyboardEvent(subsystem, client, flags, code);
        }
        return TRUE;
 }
@@ -98,7 +98,7 @@ BOOL shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
 
        if (subsystem->MouseEvent)
        {
-               subsystem->MouseEvent(subsystem, flags, x, y);
+               subsystem->MouseEvent(subsystem, client, flags, x, y);
        }
        return TRUE;
 }
@@ -122,7 +122,7 @@ BOOL shadow_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x,
 
        if (subsystem->ExtendedMouseEvent)
        {
-               subsystem->ExtendedMouseEvent(subsystem, flags, x, y);
+               subsystem->ExtendedMouseEvent(subsystem, client, flags, x, y);
        }
        return TRUE;
 }
index 80a6fde..0cbb46f 100644 (file)
@@ -271,3 +271,8 @@ int shadow_subsystem_pointer_convert_alpha_pointer_data(BYTE* pixels, BOOL premu
 
        return 1;
 }
+
+void shadow_subsystem_frame_update(rdpShadowSubsystem* subsystem)
+{
+       shadow_multiclient_publish_and_wait(subsystem->updateEvent);
+}
index eeae822..2eefe5e 100644 (file)
 #include <winpr/crt.h>
 #include <winpr/synch.h>
 
-struct rdp_shadow_surface
-{
-       rdpShadowServer* server;
-
-       int x;
-       int y;
-       int width;
-       int height;
-       int scanline;
-       BYTE* data;
-
-       CRITICAL_SECTION lock;
-       REGION16 invalidRegion;
-};
-
 #ifdef __cplusplus
 extern "C" {
 #endif