Static buid for Mac OS X, mf_interface, WITH_VERBOSE option

mf_interface is still in progress
This commit is contained in:
Benoît LeBlanc 2013-06-11 14:56:43 -04:00
parent e9edd489df
commit 42f7c7f6b2
13 changed files with 826 additions and 43 deletions

2
.gitignore vendored Normal file → Executable file
View File

@ -93,3 +93,5 @@ default.log
*.cbp
*.txt.user
*.autosave

11
CMakeLists.txt Normal file → Executable file
View File

@ -80,7 +80,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
if(NOT DEFINED BUILD_SHARED_LIBS)
if(ANDROID OR IOS)
if(ANDROID OR IOS OR APPLE)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
@ -194,6 +194,7 @@ check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(sys/modem.h HAVE_SYS_MODEM_H)
check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
check_include_files(sys/strtio.h HAVE_SYS_STRTIO_H)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
else()
set(HAVE_FCNTL_H 1)
set(HAVE_UNISTD_H 1)
@ -226,6 +227,14 @@ if(APPLE)
if(WITH_CLANG)
set(CMAKE_C_COMPILER "clang")
endif()
if (WITH_VERBOSE)
# Support for automatic reference counting requires non-fragile abi.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -v")
# Tell the compiler where to look for the FreeRDP framework
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v")
endif()
endif()
# Android

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string></string>
<key>CFBundleIconFile</key>
<string>FreeRDP</string>
<key>CFBundleIdentifier</key>
<string>FreeRDP.Mac</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string></string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 __MyCompanyName__. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

87
client/Mac/CMakeLists.txt Normal file → Executable file
View File

@ -1,4 +1,3 @@
project(MacFreeRDP-library)
# add directory for App
@ -29,6 +28,14 @@ set(${MODULE_NAME}_RESOURCES "en.lproj/InfoPlist.strings")
# OS X Interface Builder files
file(GLOB ${MODULE_NAME}_XIBS *.xib)
# source files
file(GLOB ${MODULE_NAME}_SRC *.c *.m)
# header files
file(GLOB ${MODULE_NAME}_HEADERS *.h)
message(WARNING "public headers:" ${${MODULE_NAME}_HEADERS})
# Include XIB file in Xcode resources.
if("${CMAKE_GENERATOR}" MATCHES "Xcode")
message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}")
@ -37,10 +44,7 @@ endif("${CMAKE_GENERATOR}" MATCHES "Xcode")
add_library(${MODULE_NAME}
SHARED
MRDPView.h
MRDPView.m
MRDPCursor.m
PasswordDialog.m
${${MODULE_NAME}_SRC}
${${MODULE_NAME}_RESOURCES})
# configures the framework to always be looked for in the application bundle in the Frameworks sub-folder.
@ -63,7 +67,6 @@ set_target_properties(${MODULE_NAME} PROPERTIES
FRAMEWORK_VERSION 1.1.0
MACOSX_FRAMEWORK_SHORT_VERSION_STRING 1.1.0
MACOSX_FRAMEWORK_BUNDLE_VERSION 1.1.0
PUBLIC_HEADER "MRDPView.h"
INSTALL_NAME_DIR "@executable_path/../../Frameworks"
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
BUILD_WITH_INSTALL_RPATH 1)
@ -95,37 +98,35 @@ endforeach()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Mac")
# Add a post-build event to copy the dependent libraries in the framework bundle
# Call install_name_tool to reassign the library install name
foreach(LIB ${DEPENDENCIES})
# message("adding post-build dependency: ${LIB}")
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:${LIB}>"
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>"
COMMENT "Copying ${LIB} to output directory"
COMMAND install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>" "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>" "${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/${MODULE_NAME}"
COMMENT Setting install name for ${LIB}
COMMAND "${CMAKE_COMMAND}" -E echo install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>" "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>" "${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/${MODULE_NAME}"
)
endforeach()
if (${BUILD_SHARED_LIBS})
# Add a post-build event to copy the dependent libraries in the framework bundle
# Call install_name_tool to reassign the library install name
foreach(LIB ${DEPENDENCIES})
# message("adding post-build dependency: ${LIB}")
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:${LIB}>"
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>"
COMMENT "Copying ${LIB} to output directory"
COMMAND install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>" "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>" "${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/${MODULE_NAME}"
COMMENT Setting install name for ${LIB}
COMMAND "${CMAKE_COMMAND}" -E echo install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>" "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>" "${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/${MODULE_NAME}"
)
endforeach()
# Call install_name_tool to reassign the library install names in dependent libraries
foreach(DEST ${DEPENDENCIES})
foreach(LIB ${DEPENDENCIES})
# message("adding post-build dependency: ${LIB}")
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
COMMAND install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>" "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>" "${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${DEST}>"
COMMENT Setting install name for ${LIB} in module ${DEST}
)
# Call install_name_tool to reassign the library install names in dependent libraries
foreach(DEST ${DEPENDENCIES})
foreach(LIB ${DEPENDENCIES})
# message("adding post-build dependency: ${LIB}")
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
COMMAND install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>" "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>" "${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${DEST}>"
COMMENT Setting install name for ${LIB} in module ${DEST}
)
# COMMAND "${CMAKE_COMMAND}" -E echo install_name_tool -change "$<TARGET_SONAME_FILE:${LIB}>" #"@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>" #"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Contents/$<TARGET_FILE_NAME:${DEST}>"
# )
endforeach()
endforeach()
endforeach()
endforeach()
endif()
# Add post-build NIB file generation in unix makefiles. XCode handles this implicitly.
if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")
@ -153,4 +154,22 @@ if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")
COMMENT "Compiling ${xib}")
endforeach()
# Copy the public header files into the framework
foreach(HEADER ${${MODULE_NAME}_HEADERS})
# message("adding post-build dependency: ${LIB}")
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
COMMAND ditto ${HEADER} ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Headers/
COMMENT Copying public header files to ${MODULE_NAME}
)
endforeach()
# Copy the FreeRDP header files into the framework
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
COMMAND ditto ${CMAKE_SOURCE_DIR}/include/freerdp ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Headers/freerdp
COMMENT Copying FreeRDP header files to ${MODULE_NAME}
)
endif()

6
client/Mac/MRDPView.h Normal file → Executable file
View File

@ -19,6 +19,8 @@
#import <Cocoa/Cocoa.h>
#ifdef HAVE_RAIL
#import "MRDPWindow.h"
#endif
@ -36,10 +38,10 @@
#import "freerdp/rail/rail.h"
#import "freerdp/rail.h"
#import "freerdp/utils/rail.h"
#import "mf_interface.h"
*/
@interface MRDPView : NSView
{
CFRunLoopSourceRef run_loop_src;

View File

@ -18,7 +18,7 @@ set(MACOSX_BUNDLE_LONG_VERSION_STRING "MacFreeRDP Client Version 1.1.0")
set(MACOSX_BUNDLE_BUNDLE_NAME "MacFreeRDP")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING 1.1.0)
set(MACOSX_BUNDLE_BUNDLE_VERSION 1.1.0)
set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2012. All Rights Reserved.")
set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013. All Rights Reserved.")
set(MACOSX_BUNDLE_NSMAIN_NIB_FILE "MainMenu")
set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "NSApplication")
@ -60,10 +60,10 @@ set_target_properties(${MODULE_NAME} PROPERTIES RESOURCE "${${MODULE_NAME}_RESOU
# set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
# Support for automatic reference counting requires non-fragile abi.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -v -fobjc-nonfragile-abi")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-nonfragile-abi")
# Tell the compiler where to look for the FreeRDP framework
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v -F../")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -F../")
# Tell XCode where to look for the MacFreeRDP-library framework
set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS
@ -112,7 +112,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")
# Make sure the 'Resources' Directory is correctly created before we build
add_custom_command (TARGET ${MODULE_NAME} PRE_BUILD
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.app/Contents/Resources)
COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/\${CONFIGURATION}/${MODULE_NAME}.app/Contents/Resources)
# Compile the .xib files using the 'ibtool' program with the destination being the app package
foreach(xib ${${MODULE_NAME}_XIBS})
@ -120,8 +120,8 @@ if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")
add_custom_command (TARGET ${MODULE_NAME} POST_BUILD
COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
--compile ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.app/Contents/Resources/${XIB_WE}.nib ${xib}
--compile ${CMAKE_CURRENT_BINARY_DIR}/\${CONFIGURATION}/${MODULE_NAME}.app/Contents/Resources/${XIB_WE}.nib ${xib}
COMMENT "Compiling ${xib}")
endforeach()
endif("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")
endif("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")

32
client/Mac/mf_event.c Executable file
View File

@ -0,0 +1,32 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Event Handling
*
* Copyright 2009-2011 Jay Sorg
* Copyright 2010-2011 Vic Lee
* Copyright 2010-2011 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 <stdio.h>
#include <freerdp/freerdp.h>
#include "mf_interface.h"
#include "mf_event.h"

31
client/Mac/mf_event.h Executable file
View File

@ -0,0 +1,31 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Event Handling
*
* Copyright 2009-2011 Jay Sorg
* Copyright 2010-2011 Vic Lee
* Copyright 2010-2011 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 __WF_EVENT_H
#define __WF_EVENT_H
#ifdef WITH_DEBUG_KBD
#define DEBUG_KBD(fmt, ...) DEBUG_CLASS(KBD, fmt, ## __VA_ARGS__)
#else
#define DEBUG_KBD(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#endif
#endif /* __WF_EVENT_H */

318
client/Mac/mf_interface.c Executable file
View File

@ -0,0 +1,318 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* X11 Client Interface
*
* Copyright 2013 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 "mfreerdp.h"
#include <freerdp/utils/signal.h>
#include <freerdp/client/cmdline.h>
/**
* Client Interface
*/
int freerdp_client_global_init()
{
// setlocale(LC_ALL, "");
freerdp_handle_signals();
freerdp_channels_global_init();
return 0;
}
int freerdp_client_global_uninit()
{
freerdp_channels_global_uninit();
return 0;
}
int freerdp_client_start(void* cfi)
{
mfInfo* mfi = (mfInfo*) cfi;
rdpSettings* settings = mfi->instance->settings;
if (!settings->ServerHostname)
{
fprintf(stderr, "error: server hostname was not specified with /v:<server>[:port]\n");
return -1;
}
//mfi->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) mf_thread, (void*) mfi->instance, 0, NULL);
return 0;
}
int freerdp_client_stop(void* cfi)
{
mfInfo* mfi = (mfInfo*) cfi;
// if (mfi->instance->settings->AsyncInput)
// {
// wMessageQueue* queue;
// queue = freerdp_get_message_queue(mfi->instance, FREERDP_INPUT_MESSAGE_QUEUE);
// MessageQueue_PostQuit(queue, 0);
// }
// else
// {
// mfi->disconnect = TRUE;
// }
return 0;
}
void* freerdp_client_get_instance(void* cfi)
{
mfInfo* mfi = (mfInfo*) cfi;
return mfi->instance;
}
HANDLE freerdp_client_get_thread(void* cfi)
{
mfInfo* mfi = (mfInfo*) cfi;
return mfi->thread;
}
void* freerdp_client_get_interface(void* cfi)
{
mfInfo* mfi = (mfInfo*) cfi;
return mfi->client;
}
cfInfo* freerdp_client_new(int argc, char** argv)
{
int index;
int status;
mfInfo* mfi;
rdpFile* file;
freerdp* instance;
rdpSettings* settings;
instance = freerdp_new();
// instance->PreConnect = mf_pre_connect;
// instance->PostConnect = mf_post_connect;
// instance->Authenticate = mf_authenticate;
// instance->VerifyCertificate = mf_verify_certificate;
// instance->LogonErrorInfo = mf_logon_error_info;
// instance->ReceiveChannelData = mf_receive_channel_data;
instance->context_size = sizeof(mfContext);
instance->ContextNew = (pContextNew) mf_context_new;
instance->ContextFree = (pContextFree) mf_context_free;
freerdp_context_new(instance);
instance->context->argc = argc;
instance->context->argv = (char**) malloc(sizeof(char*) * argc);
for (index = 0; index < argc; index++)
instance->context->argv[index] = _strdup(argv[index]);
mfi = (mfInfo*) malloc(sizeof(mfInfo));
ZeroMemory(mfi, sizeof(mfInfo));
((mfContext*) instance->context)->mfi = mfi;
mfi->instance = instance;
settings = instance->settings;
mfi->client = instance->context->client;
status = freerdp_client_parse_command_line_arguments(instance->context->argc,
instance->context->argv, settings);
if (status < 0)
{
freerdp_context_free(mfi->instance);
freerdp_free(mfi->instance);
free(mfi);
return NULL;
}
if (settings->ConnectionFile)
{
file = freerdp_client_rdp_file_new();
fprintf(stderr, "Using connection file: %s\n", settings->ConnectionFile);
freerdp_client_parse_rdp_file(file, settings->ConnectionFile);
freerdp_client_populate_settings_from_rdp_file(file, settings);
}
settings->OsMajorType = OSMAJORTYPE_UNIX;
settings->OsMinorType = OSMINORTYPE_NATIVE_XSERVER;
settings->OrderSupport[NEG_DSTBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_PATBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE;
settings->OrderSupport[NEG_OPAQUE_RECT_INDEX] = TRUE;
settings->OrderSupport[NEG_DRAWNINEGRID_INDEX] = FALSE;
settings->OrderSupport[NEG_MULTIDSTBLT_INDEX] = FALSE;
settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = FALSE;
settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = FALSE;
settings->OrderSupport[NEG_MULTIOPAQUERECT_INDEX] = TRUE;
settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX] = FALSE;
settings->OrderSupport[NEG_LINETO_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYLINE_INDEX] = TRUE;
settings->OrderSupport[NEG_MEMBLT_INDEX] = settings->BitmapCacheEnabled;
settings->OrderSupport[NEG_MEM3BLT_INDEX] = (settings->SoftwareGdi) ? TRUE : FALSE;
settings->OrderSupport[NEG_MEMBLT_V2_INDEX] = settings->BitmapCacheEnabled;
settings->OrderSupport[NEG_MEM3BLT_V2_INDEX] = FALSE;
settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = FALSE;
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = (settings->SoftwareGdi) ? FALSE : TRUE;
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = (settings->SoftwareGdi) ? FALSE : TRUE;
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
// if (settings->ListMonitors)
// {
// mf_list_monitors(mfi);
// }
return mfi;
}
void freerdp_client_free(void* cfi)
{
mfInfo* mfi = (mfInfo*) cfi;
if (mfi)
{
int index;
rdpContext* context;
// mf_window_free(mfi);
// free(mfi->bmp_codec_none);
// XCloseDisplay(mfi->display);
// context = (rdpContext*) mfi->context;
for (index = 0; index < context->argc; index++)
free(context->argv[index]);
free(context->argv);
freerdp_context_free(mfi->instance);
freerdp_free(mfi->instance);
free(mfi);
}
}
BOOL freerdp_client_get_param_bool(void* cfi, int id)
{
mfInfo* mfi = (mfInfo*) cfi;
rdpSettings* settings = mfi->instance->settings;
return freerdp_get_param_bool(settings, id);
}
int freerdp_client_set_param_bool(void* cfi, int id, BOOL param)
{
mfInfo* mfi = (mfInfo*) cfi;
rdpSettings* settings = mfi->instance->settings;
return freerdp_set_param_bool(settings, id, param);
}
UINT32 freerdp_client_get_param_uint32(void* cfi, int id)
{
mfInfo* mfi = (mfInfo*) cfi;
rdpSettings* settings = mfi->instance->settings;
return freerdp_get_param_uint32(settings, id);
}
int freerdp_client_set_param_uint32(void* cfi, int id, UINT32 param)
{
mfInfo* mfi = (mfInfo*) cfi;
rdpSettings* settings = mfi->instance->settings;
return freerdp_set_param_uint32(settings, id, param);
}
UINT64 freerdp_client_get_param_uint64(void* cfi, int id)
{
mfInfo* mfi = (mfInfo*) cfi;
rdpSettings* settings = mfi->instance->settings;
return freerdp_get_param_uint64(settings, id);
}
int freerdp_client_set_param_uint64(void* cfi, int id, UINT64 param)
{
mfInfo* mfi = (mfInfo*) cfi;
rdpSettings* settings = mfi->instance->settings;
return freerdp_set_param_uint64(settings, id, param);
}
char* freerdp_client_get_param_string(void* cfi, int id)
{
mfInfo* mfi = (mfInfo*) cfi;
rdpSettings* settings = mfi->instance->settings;
return freerdp_get_param_string(settings, id);
}
int freerdp_client_set_param_string(void* cfi, int id, char* param)
{
mfInfo* mfi = (mfInfo*) cfi;
rdpSettings* settings = mfi->instance->settings;
return freerdp_set_param_string(settings, id, param);
}
void freerdp_client_mouse_event(void* cfi, DWORD flags, int x, int y)
{
int width, height;
mfInfo* mfi = (mfInfo*) cfi;
rdpInput* input = mfi->instance->input;
rdpSettings* settings = mfi->instance->settings;
width = settings->DesktopWidth;
height = settings->DesktopHeight;
if (x < 0)
x = 0;
if (x >= width)
x = width - 1;
if (y < 0)
y = 0;
if (y >= height)
y = height - 1;
input->MouseEvent(input, flags, x, y);
}

82
client/Mac/mf_interface.h Executable file
View File

@ -0,0 +1,82 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Windows Client
*
* Copyright 2009-2011 Jay Sorg
* Copyright 2010-2011 Vic Lee
* Copyright 2010-2011 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 __MF_INTERFACE_H
#define __MF_INTERFACE_H
#ifdef __cplusplus
extern "C" {
#endif
#include "mfreerdp.h"
#include <freerdp/api.h>
// Callback type codes. Move elsewhere?
#define CALLBACK_TYPE_PARAM_CHANGE 0x01
#define CALLBACK_TYPE_CONNECTED 0x02
#define CALLBACK_TYPE_DISCONNECTED 0x03
// Public API functions
FREERDP_API int freerdp_client_global_init();
FREERDP_API int freerdp_client_global_uninit();
FREERDP_API int freerdp_client_start(void* cfi); // mfInfo
FREERDP_API int freerdp_client_stop(void* cfi); // mfInfo
FREERDP_API void* freerdp_client_get_thread(void* cfi); // HANDLE, mfInfo
FREERDP_API void* freerdp_client_get_instance(void* cfi); // freerdp, mfInfo
FREERDP_API void* freerdp_client_get_interface(void* cfi); // rdpClient, mfInfo
FREERDP_API int freerdp_client_focus_in(void* cfi); // mfInfo
FREERDP_API int freerdp_client_focus_out(void* cfi); // mfInfo
FREERDP_API int freerdp_client_set_window_size(void* cfi, int width, int height);
FREERDP_API cfInfo* freerdp_client_new(int argc, char** argv); // cfInfo*
FREERDP_API void freerdp_client_free(cfInfo* cfi); // mfInfo*
FREERDP_API int freerdp_client_set_client_callback_function(void* cfi, void* callbackFunc);
FREERDP_API void* freerdp_client_get_settings(void* cfi); // rdpSettings*, mfInfo*
FREERDP_API int freerdp_client_load_settings_from_rdp_file(void* cfi, char* filename); // mfInfo*
FREERDP_API int freerdp_client_save_settings_to_rdp_file(void* cfi, char* filename); // mfInfo*
FREERDP_API BOOL freerdp_client_get_param_bool(void* cfi, int id);
FREERDP_API int freerdp_client_set_param_bool(void* cfi, int id, BOOL param);
FREERDP_API UINT32 freerdp_client_get_param_uint32(void* cfi, int id);
FREERDP_API int freerdp_client_set_param_uint32(void* cfi, int id, UINT32 param);
FREERDP_API UINT64 freerdp_client_get_param_uint64(void* cfi, int id);
FREERDP_API int freerdp_client_set_param_uint64(void* cfi, int id, UINT64 param);
FREERDP_API char* freerdp_client_get_param_string(void* cfi, int id);
FREERDP_API int freerdp_client_set_param_string(void* cfi, int id, char* param);
FREERDP_API void freerdp_client_mouse_event(void* cfi, DWORD flags, int x, int y);
#ifdef __cplusplus
}
#endif
#endif

109
client/Mac/mfreerdp.c Normal file
View File

@ -0,0 +1,109 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* X11 Client Interface
*
* Copyright 2013 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 <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <unistd.h>
#include <string.h>
#include <termios.h>
#include <pthread.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/select.h>
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>
#include <freerdp/codec/nsc.h>
#include <freerdp/codec/rfx.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/bitmap.h>
#include <freerdp/utils/event.h>
#include <freerdp/utils/signal.h>
#include <freerdp/utils/passphrase.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/client/channels.h>
#include <freerdp/rail.h>
#include <freerdp/client/file.h>
#include <freerdp/client/cmdline.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/file.h>
#include "mf_interface.h"
#include "mfreerdp.h"
static long xv_port = 0;
static const size_t password_size = 512;
mfInfo* mf_mfi_new()
{
mfInfo* mfi;
mfi = (mfInfo*) malloc(sizeof(mfInfo));
ZeroMemory(mfi, sizeof(mfInfo));
return mfi;
}
void mf_mfi_free(mfInfo* mfi)
{
free(mfi);
}
void mf_context_new(freerdp* instance, rdpContext* context)
{
mfInfo* mfi;
context->channels = freerdp_channels_new();
mfi = mf_mfi_new();
((mfContext*) context)->mfi = mfi;
mfi->instance = instance;
// Register callbacks
instance->context->client->OnParamChange = mf_on_param_change;
}
void mf_context_free(freerdp* instance, rdpContext* context)
{
if (context->cache)
cache_free(context->cache);
freerdp_channels_free(context->channels);
mf_mfi_free(((mfContext*) context)->mfi);
((mfContext*) context)->mfi = NULL;
}
void mf_on_param_change(freerdp* instance, int id)
{
}

144
client/Mac/mfreerdp.h Normal file
View File

@ -0,0 +1,144 @@
#ifndef MFREERDP_H
#define MFREERDP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <winpr/windows.h>
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
#include <freerdp/gdi/gdi.h>
#include <freerdp/gdi/dc.h>
#include <freerdp/gdi/region.h>
#include <freerdp/cache/cache.h>
#include <freerdp/codec/color.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/channels.h>
#include <freerdp/codec/rfx.h>
#include <freerdp/codec/nsc.h>
#include <freerdp/client/file.h>
#include "mf_event.h"
#ifdef __cplusplus
}
#endif
// System menu constants
#define SYSCOMMAND_ID_SMARTSIZING 1000
typedef struct mf_info mfInfo;
struct mf_context
{
rdpContext _p;
mfInfo* mfi;
};
typedef struct mf_context mfContext;
typedef void (CALLBACK * callbackFunc)(mfInfo* mfi, int callback_type, DWORD param1, DWORD param2);
struct mf_info
{
rdpClient* client;
int width;
int height;
int offset_x;
int offset_y;
int fs_toggle;
int fullscreen;
int percentscreen;
char window_title[64];
int client_x;
int client_y;
int client_width;
int client_height;
HANDLE thread;
HANDLE keyboardThread;
HGDI_DC hdc;
UINT16 srcBpp;
UINT16 dstBpp;
freerdp* instance;
DWORD mainThreadId;
DWORD keyboardThreadId;
RFX_CONTEXT* rfx_context;
NSC_CONTEXT* nsc_context;
BOOL sw_gdi;
callbackFunc client_callback_func;
rdpFile* connectionRdpFile;
// Keep track of window size and position, disable when in fullscreen mode.
BOOL disablewindowtracking;
// These variables are required for horizontal scrolling.
BOOL updating_scrollbars;
BOOL xScrollVisible;
int xMinScroll; // minimum horizontal scroll value
int xCurrentScroll; // current horizontal scroll value
int xMaxScroll; // maximum horizontal scroll value
// These variables are required for vertical scrolling.
BOOL yScrollVisible;
int yMinScroll; // minimum vertical scroll value
int yCurrentScroll; // current vertical scroll value
int yMaxScroll; // maximum vertical scroll value
};
/**
* Client Interface
*/
#define cfInfo mfInfo
void mf_on_param_change(freerdp* instance, int id);
//FREERDP_API int freerdp_client_global_init();
//FREERDP_API int freerdp_client_global_uninit();
//FREERDP_API int freerdp_client_start(mfInfo* cfi);
//FREERDP_API int freerdp_client_stop(mfInfo* cfi);
//FREERDP_API HANDLE freerdp_client_get_thread(mfInfo* cfi);
//FREERDP_API freerdp* freerdp_client_get_instance(mfInfo* cfi);
//FREERDP_API rdpClient* freerdp_client_get_interface(mfInfo* cfi);
//FREERDP_API int freerdp_client_focus_in(mfInfo* cfi);
//FREERDP_API int freerdp_client_focus_out(mfInfo* cfi);
//FREERDP_API int freerdp_client_set_window_size(mfInfo* cfi, int width, int height);
//FREERDP_API cfInfo* freerdp_client_new(int argc, char** argv);
//FREERDP_API void freerdp_client_free(mfInfo* cfi);
//FREERDP_API int freerdp_client_set_client_callback_function(mfInfo* cfi, callbackFunc callbackFunc);
//FREERDP_API rdpSettings* freerdp_client_get_settings(mfInfo* wfi);
//FREERDP_API int freerdp_client_load_settings_from_rdp_file(mfInfo* cfi, char* filename);
//FREERDP_API int freerdp_client_save_settings_to_rdp_file(mfInfo* cfi, char* filename);
mfInfo* mf_mfi_new();
void mf_mfi_free(mfInfo* mfi);
void mf_context_new(freerdp* instance, rdpContext* context);
void mf_context_free(freerdp* instance, rdpContext* context);
void mf_on_param_change(freerdp* instance, int id);
#endif // MFREERDP_H

1
config.h.in Normal file → Executable file
View File

@ -27,6 +27,7 @@
#cmakedefine HAVE_INTTYPES_H
#cmakedefine HAVE_SYS_MODEM_H
#cmakedefine HAVE_SYS_FILIO_H
#cmakedefine HAVE_SYS_SELECT_H
#cmakedefine HAVE_SYS_STRTIO_H
#cmakedefine HAVE_EVENTFD_H
#cmakedefine HAVE_TM_GMTOFF