shadow: stub Mac subsystem

This commit is contained in:
Marc-André Moreau 2014-07-15 23:01:56 -04:00
parent 21571eea88
commit 58d83c9c1e
6 changed files with 243 additions and 9 deletions

View File

@ -18,7 +18,7 @@
*/ */
#ifndef __MF_EVENT_H #ifndef __MF_EVENT_H
#define __XMF_EVENT_H #define __MF_EVENT_H
typedef struct mf_event mfEvent; typedef struct mf_event mfEvent;
typedef struct mf_event_queue mfEventQueue; typedef struct mf_event_queue mfEventQueue;

View File

@ -21,6 +21,9 @@
#include "config.h" #include "config.h"
#endif #endif
#include <winpr/crt.h>
#include <winpr/sysinfo.h>
#include <freerdp/server/rdpsnd.h> #include <freerdp/server/rdpsnd.h>
#include "mf_info.h" #include "mf_info.h"
@ -30,8 +33,8 @@ AQRecorderState recorderState;
static const AUDIO_FORMAT supported_audio_formats[] = static const AUDIO_FORMAT supported_audio_formats[] =
{ {
{ WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, NULL }, { WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0, NULL },
{ WAVE_FORMAT_ALAW, 2, 22050, 44100, 2, 8, NULL } { WAVE_FORMAT_ALAW, 2, 22050, 44100, 2, 8, 0, NULL }
}; };
static void mf_peer_rdpsnd_activated(RdpsndServerContext* context) static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
@ -161,7 +164,7 @@ BOOL mf_peer_rdpsnd_init(mfPeerContext* context)
context->rdpsnd->Activated = mf_peer_rdpsnd_activated; context->rdpsnd->Activated = mf_peer_rdpsnd_activated;
context->rdpsnd->Initialize(context->rdpsnd); context->rdpsnd->Initialize(context->rdpsnd, TRUE);
return TRUE; return TRUE;
} }

View File

@ -139,9 +139,24 @@ set(${MODULE_PREFIX}_X11_SRCS
X11/x11_shadow.c X11/x11_shadow.c
X11/x11_shadow.h) X11/x11_shadow.h)
if(X11_FOUND) set(${MODULE_PREFIX}_MAC_SRCS
Mac/mac_shadow.c
Mac/mac_shadow.h)
if(X11_FOUND AND NOT APPLE)
set(WITH_SHADOW_X11 1)
elseif(APPLE AND NOT IOS)
set(WITH_SHADOW_MAC 1)
endif()
if(WITH_SHADOW_X11)
add_definitions(-DWITH_SHADOW_X11)
list(APPEND ${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)
add_definitions(-DWITH_SHADOW_MAC)
list(APPEND ${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_MAC_SRCS})
list(APPEND ${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_MAC_LIBS})
endif() endif()
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})

View File

@ -0,0 +1,163 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
*
* Copyright 2011-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.
*/
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/sysinfo.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/region.h>
#include "../shadow_screen.h"
#include "../shadow_surface.h"
#include "mac_shadow.h"
void mac_shadow_input_synchronize_event(macShadowSubsystem* subsystem, UINT32 flags)
{
}
void mac_shadow_input_keyboard_event(macShadowSubsystem* subsystem, UINT16 flags, UINT16 code)
{
}
void mac_shadow_input_unicode_keyboard_event(macShadowSubsystem* subsystem, UINT16 flags, UINT16 code)
{
}
void mac_shadow_input_mouse_event(macShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y)
{
}
void mac_shadow_input_extended_mouse_event(macShadowSubsystem* subsystem, UINT16 flags, UINT16 x, UINT16 y)
{
}
int mac_shadow_surface_copy(macShadowSubsystem* subsystem)
{
return 1;
}
void* mac_shadow_subsystem_thread(macShadowSubsystem* subsystem)
{
DWORD status;
DWORD nCount;
HANDLE events[32];
HANDLE StopEvent;
StopEvent = subsystem->server->StopEvent;
nCount = 0;
events[nCount++] = StopEvent;
while (1)
{
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
if (WaitForSingleObject(StopEvent, 0) == WAIT_OBJECT_0)
{
break;
}
}
ExitThread(0);
return NULL;
}
int mac_shadow_subsystem_init(macShadowSubsystem* subsystem)
{
return 1;
}
int mac_shadow_subsystem_uninit(macShadowSubsystem* subsystem)
{
if (!subsystem)
return -1;
return 1;
}
int mac_shadow_subsystem_start(macShadowSubsystem* subsystem)
{
HANDLE thread;
if (!subsystem)
return -1;
thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) mac_shadow_subsystem_thread,
(void*) subsystem, 0, NULL);
return 1;
}
int mac_shadow_subsystem_stop(macShadowSubsystem* subsystem)
{
if (!subsystem)
return -1;
return 1;
}
void mac_shadow_subsystem_free(macShadowSubsystem* subsystem)
{
if (!subsystem)
return;
mac_shadow_subsystem_uninit(subsystem);
free(subsystem);
}
macShadowSubsystem* mac_shadow_subsystem_new(rdpShadowServer* server)
{
macShadowSubsystem* subsystem;
subsystem = (macShadowSubsystem*) calloc(1, sizeof(macShadowSubsystem));
if (!subsystem)
return NULL;
subsystem->server = server;
subsystem->Init = (pfnShadowSubsystemInit) mac_shadow_subsystem_init;
subsystem->Uninit = (pfnShadowSubsystemInit) mac_shadow_subsystem_uninit;
subsystem->Start = (pfnShadowSubsystemStart) mac_shadow_subsystem_start;
subsystem->Stop = (pfnShadowSubsystemStop) mac_shadow_subsystem_stop;
subsystem->Free = (pfnShadowSubsystemFree) mac_shadow_subsystem_free;
subsystem->SurfaceCopy = (pfnShadowSurfaceCopy) mac_shadow_surface_copy;
subsystem->SynchronizeEvent = (pfnShadowSynchronizeEvent) mac_shadow_input_synchronize_event;
subsystem->KeyboardEvent = (pfnShadowKeyboardEvent) mac_shadow_input_keyboard_event;
subsystem->UnicodeKeyboardEvent = (pfnShadowUnicodeKeyboardEvent) mac_shadow_input_unicode_keyboard_event;
subsystem->MouseEvent = (pfnShadowMouseEvent) mac_shadow_input_mouse_event;
subsystem->ExtendedMouseEvent = (pfnShadowExtendedMouseEvent) mac_shadow_input_extended_mouse_event;
return subsystem;
}
rdpShadowSubsystem* Mac_ShadowCreateSubsystem(rdpShadowServer* server)
{
return (rdpShadowSubsystem*) mac_shadow_subsystem_new(server);
}

View File

@ -0,0 +1,49 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
*
* Copyright 2011-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_MAC_H
#define FREERDP_SHADOW_SERVER_MAC_H
#include <freerdp/server/shadow.h>
typedef struct mac_shadow_subsystem macShadowSubsystem;
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
#include <winpr/collections.h>
struct mac_shadow_subsystem
{
RDP_SHADOW_SUBSYSTEM_COMMON();
};
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_SHADOW_SERVER_MAC_H */

View File

@ -32,14 +32,14 @@
#include "shadow.h" #include "shadow.h"
#ifdef WITH_X11
#define WITH_SHADOW_X11
#endif
#ifdef WITH_SHADOW_X11 #ifdef WITH_SHADOW_X11
extern rdpShadowSubsystem* X11_ShadowCreateSubsystem(rdpShadowServer* server); extern rdpShadowSubsystem* X11_ShadowCreateSubsystem(rdpShadowServer* server);
#endif #endif
#ifdef WITH_SHADOW_MAC
extern rdpShadowSubsystem* Mac_ShadowCreateSubsystem(rdpShadowServer* server);
#endif
static COMMAND_LINE_ARGUMENT_A shadow_args[] = static COMMAND_LINE_ARGUMENT_A shadow_args[] =
{ {
{ "port", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Server port" }, { "port", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Server port" },
@ -324,6 +324,10 @@ int shadow_server_init(rdpShadowServer* server)
server->CreateSubsystem = X11_ShadowCreateSubsystem; server->CreateSubsystem = X11_ShadowCreateSubsystem;
#endif #endif
#ifdef WITH_SHADOW_MAC
server->CreateSubsystem = Mac_ShadowCreateSubsystem;
#endif
if (server->CreateSubsystem) if (server->CreateSubsystem)
server->subsystem = server->CreateSubsystem(server); server->subsystem = server->CreateSubsystem(server);