shadow: add common subsystem code

This commit is contained in:
Marc-André Moreau 2014-09-17 22:58:57 -04:00
parent e84e7928e3
commit 48d15998e7
8 changed files with 111 additions and 21 deletions

View File

@ -118,6 +118,7 @@ struct rdp_shadow_server
MONITOR_DEF virtualScreen; \
HANDLE updateEvent; \
REGION16 invalidRegion; \
wMessagePipe* MsgPipe; \
SYNCHRONIZATION_BARRIER barrier; \
\
pfnShadowSubsystemInit Init; \

View File

@ -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)

View File

@ -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;

View File

@ -20,13 +20,14 @@
#include <winpr/synch.h>
#include <winpr/sysinfo.h>
#include <freerdp/log.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/region.h>
#include <freerdp/log.h>
#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;

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1,45 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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 "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));
}

View File

@ -0,0 +1,41 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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.
*/
#ifndef FREERDP_SHADOW_SERVER_SUBSYSTEM_H
#define FREERDP_SHADOW_SERVER_SUBSYSTEM_H
#include <freerdp/server/shadow.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#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 */