diff --git a/include/freerdp/server/shadow.h b/include/freerdp/server/shadow.h index 8f010b54c..23789c672 100644 --- a/include/freerdp/server/shadow.h +++ b/include/freerdp/server/shadow.h @@ -118,6 +118,7 @@ struct rdp_shadow_server MONITOR_DEF virtualScreen; \ HANDLE updateEvent; \ REGION16 invalidRegion; \ + wMessagePipe* MsgPipe; \ SYNCHRONIZATION_BARRIER barrier; \ \ pfnShadowSubsystemInit Init; \ diff --git a/server/shadow/CMakeLists.txt b/server/shadow/CMakeLists.txt index b928a2799..5c25c415c 100644 --- a/server/shadow/CMakeLists.txt +++ b/server/shadow/CMakeLists.txt @@ -151,6 +151,8 @@ set(${MODULE_PREFIX}_SRCS shadow_encomsp.h shadow_remdesk.c shadow_remdesk.h + shadow_subsystem.c + shadow_subsystem.h shadow_server.c shadow.h) diff --git a/server/shadow/Mac/mac_shadow.c b/server/shadow/Mac/mac_shadow.c index 65e8b8bc9..abec9e812 100644 --- a/server/shadow/Mac/mac_shadow.c +++ b/server/shadow/Mac/mac_shadow.c @@ -26,6 +26,8 @@ #include "../shadow_screen.h" #include "../shadow_surface.h" +#include "../shadow_capture.h" +#include "../shadow_subsystem.h" #include "mac_shadow.h" @@ -586,6 +588,8 @@ void mac_shadow_subsystem_free(macShadowSubsystem* subsystem) mac_shadow_subsystem_uninit(subsystem); + shadow_subsystem_common_free((rdpShadowSubsystem*) subsystem); + free(subsystem); } @@ -599,10 +603,7 @@ macShadowSubsystem* mac_shadow_subsystem_new(rdpShadowServer* server) return NULL; subsystem->server = server; - - subsystem->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - - region16_init(&(subsystem->invalidRegion)); + shadow_subsystem_common_new((rdpShadowSubsystem*) subsystem); subsystem->Init = (pfnShadowSubsystemInit) mac_shadow_subsystem_init; subsystem->Uninit = (pfnShadowSubsystemInit) mac_shadow_subsystem_uninit; diff --git a/server/shadow/Win/win_shadow.c b/server/shadow/Win/win_shadow.c index 1615764a4..e5d4b2844 100644 --- a/server/shadow/Win/win_shadow.c +++ b/server/shadow/Win/win_shadow.c @@ -20,13 +20,14 @@ #include #include +#include #include #include -#include #include "../shadow_screen.h" #include "../shadow_surface.h" #include "../shadow_capture.h" +#include "../shadow_subsystem.h" #include "win_shadow.h" @@ -492,9 +493,7 @@ void win_shadow_subsystem_free(winShadowSubsystem* subsystem) win_shadow_subsystem_uninit(subsystem); - region16_uninit(&(subsystem->invalidRegion)); - - CloseHandle(subsystem->updateEvent); + shadow_subsystem_common_free((rdpShadowSubsystem*) subsystem); free(subsystem); } @@ -509,10 +508,7 @@ winShadowSubsystem* win_shadow_subsystem_new(rdpShadowServer* server) return NULL; subsystem->server = server; - - subsystem->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - - region16_init(&(subsystem->invalidRegion)); + shadow_subsystem_common_new((rdpShadowSubsystem*) subsystem); subsystem->Init = (pfnShadowSubsystemInit) win_shadow_subsystem_init; subsystem->Uninit = (pfnShadowSubsystemInit) win_shadow_subsystem_uninit; diff --git a/server/shadow/X11/x11_shadow.c b/server/shadow/X11/x11_shadow.c index eff82b7a8..b3ef07837 100644 --- a/server/shadow/X11/x11_shadow.c +++ b/server/shadow/X11/x11_shadow.c @@ -42,6 +42,7 @@ #include "../shadow_screen.h" #include "../shadow_capture.h" #include "../shadow_surface.h" +#include "../shadow_subsystem.h" #include "x11_shadow.h" @@ -136,7 +137,7 @@ void x11_shadow_input_mouse_event(x11ShadowSubsystem* subsystem, UINT16 flags, U if (flags & PTR_FLAGS_DOWN) down = TRUE; - if (button != 0) + if (button) XTestFakeButtonEvent(subsystem->display, button, down, 0); } @@ -165,6 +166,7 @@ void x11_shadow_input_extended_mouse_event(x11ShadowSubsystem* subsystem, UINT16 } XTestGrabControl(subsystem->display, True); + XTestFakeMotionEvent(subsystem->display, 0, x, y, CurrentTime); if (flags & PTR_XFLAGS_BUTTON1) @@ -175,7 +177,7 @@ void x11_shadow_input_extended_mouse_event(x11ShadowSubsystem* subsystem, UINT16 if (flags & PTR_XFLAGS_DOWN) down = TRUE; - if (button != 0) + if (button) XTestFakeButtonEvent(subsystem->display, button, down, 0); XTestGrabControl(subsystem->display, False); @@ -995,9 +997,7 @@ void x11_shadow_subsystem_free(x11ShadowSubsystem* subsystem) x11_shadow_subsystem_uninit(subsystem); - region16_uninit(&(subsystem->invalidRegion)); - - CloseHandle(subsystem->updateEvent); + shadow_subsystem_common_free((rdpShadowSubsystem*) subsystem); free(subsystem); } @@ -1012,10 +1012,7 @@ x11ShadowSubsystem* x11_shadow_subsystem_new(rdpShadowServer* server) return NULL; subsystem->server = server; - - subsystem->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - - region16_init(&(subsystem->invalidRegion)); + shadow_subsystem_common_new((rdpShadowSubsystem*) subsystem); subsystem->Init = (pfnShadowSubsystemInit) x11_shadow_subsystem_init; subsystem->Uninit = (pfnShadowSubsystemInit) x11_shadow_subsystem_uninit; diff --git a/server/shadow/shadow_client.c b/server/shadow/shadow_client.c index 5002fa76b..6728ee82b 100644 --- a/server/shadow/shadow_client.c +++ b/server/shadow/shadow_client.c @@ -194,6 +194,11 @@ void shadow_client_surface_frame_acknowledge(rdpShadowClient* client, UINT32 fra } } +void shadow_client_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas) +{ + +} + void shadow_client_suppress_output(rdpShadowClient* client, BYTE allow, RECTANGLE_16* area) { @@ -682,6 +687,8 @@ void* shadow_client_thread(rdpShadowClient* client) peer->update->SurfaceFrameAcknowledge = (pSurfaceFrameAcknowledge) shadow_client_surface_frame_acknowledge; + + peer->update->RefreshRect = (pRefreshRect) shadow_client_refresh_rect; peer->update->SuppressOutput = (pSuppressOutput) shadow_client_suppress_output; StopEvent = client->StopEvent; diff --git a/server/shadow/shadow_subsystem.c b/server/shadow/shadow_subsystem.c new file mode 100644 index 000000000..8193755be --- /dev/null +++ b/server/shadow/shadow_subsystem.c @@ -0,0 +1,45 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * + * Copyright 2014 Marc-Andre Moreau + * + * 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 "shadow.h" + +#include "shadow_subsystem.h" + +int shadow_subsystem_common_new(rdpShadowSubsystem* subsystem) +{ + subsystem->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + + subsystem->MsgPipe = MessagePipe_New(); + + region16_init(&(subsystem->invalidRegion)); + + return 1; +} + +void shadow_subsystem_common_free(rdpShadowSubsystem* subsystem) +{ + CloseHandle(subsystem->updateEvent); + + MessagePipe_Free(subsystem->MsgPipe); + + region16_uninit(&(subsystem->invalidRegion)); +} diff --git a/server/shadow/shadow_subsystem.h b/server/shadow/shadow_subsystem.h new file mode 100644 index 000000000..bc8a2413a --- /dev/null +++ b/server/shadow/shadow_subsystem.h @@ -0,0 +1,41 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * + * Copyright 2014 Marc-Andre Moreau + * + * 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. + */ + +#ifndef FREERDP_SHADOW_SERVER_SUBSYSTEM_H +#define FREERDP_SHADOW_SERVER_SUBSYSTEM_H + +#include + +#include +#include + +#include "shadow_subsystem.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int shadow_subsystem_common_new(rdpShadowSubsystem* subsystem); +void shadow_subsystem_common_free(rdpShadowSubsystem* subsystem); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SHADOW_SERVER_SUBSYSTEM_H */ +