Merge branch 'master' of github.com:mrthebunny/FreeRDP

This commit is contained in:
Marc-André Moreau 2013-07-15 17:14:20 -04:00
commit fe62e8c69b
15 changed files with 197 additions and 274 deletions

View File

@ -106,15 +106,15 @@ if (${BUILD_SHARED_LIBS})
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}>"
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_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}"
"@executable_path/../Frameworks/${MODULE_OUTPUT_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>"
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_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}")
"@executable_path/../Frameworks/${MODULE_OUTPUT_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>"
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/${MODULE_NAME}")
endforeach()
# Call install_name_tool to reassign the library install names in dependent libraries
@ -123,8 +123,8 @@ if (${BUILD_SHARED_LIBS})
# 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}>"
"@executable_path/../Frameworks/${MODULE_OUTPUT_NAME}.framework/Contents/$<TARGET_FILE_NAME:${LIB}>"
"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/Contents/$<TARGET_FILE_NAME:${DEST}>"
COMMENT Setting install name for ${LIB} in module ${DEST})
endforeach()
endforeach()
@ -145,7 +145,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_OUTPUT_NAME}.framework/Versions/${MACOSX_BUNDLE_SHORT_VERSION_STRING}/Resources)
# Compile the .xib files using the 'ibtool' program with the destination being the app package
foreach(xib ${${MODULE_NAME}_XIBS})
@ -153,7 +153,7 @@ 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_OUTPUT_NAME}.framework/Versions/${MACOSX_BUNDLE_SHORT_VERSION_STRING}/Resources/${XIB_WE}.nib ${xib}
COMMENT "Compiling ${xib}")
endforeach()
endif()
@ -162,13 +162,13 @@ endif()
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/
COMMAND ditto ${HEADER} ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_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
COMMAND ditto ${CMAKE_SOURCE_DIR}/include/freerdp ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_OUTPUT_NAME}.framework/Headers/freerdp
COMMENT Copying FreeRDP header files to ${MODULE_NAME})
add_subdirectory(cli)

View File

@ -79,6 +79,8 @@
int kdrmeta;
int kdcapslock;
BOOL initialized;
@public
NSPasteboard* pasteboard_rd; /* for reading from clipboard */
NSPasteboard* pasteboard_wr; /* for writing to clipboard */
@ -107,3 +109,8 @@
#define PTR_FLAGS_BUTTON2 0x2000
#define PTR_FLAGS_BUTTON3 0x4000
#define WheelRotationMask 0x01FF
BOOL mac_pre_connect(freerdp* instance);
BOOL mac_post_connect(freerdp* instance);
BOOL mac_authenticate(freerdp* instance, char** username, char** password, char** domain);
int mac_receive_channel_data(freerdp* instance, int chan_id, BYTE* data, int size, int flags, int total_size);

View File

@ -75,9 +75,6 @@ void mf_Pointer_Set(rdpContext* context, rdpPointer* pointer);
void mf_Pointer_SetNull(rdpContext* context);
void mf_Pointer_SetDefault(rdpContext* context);
// int rdp_connect(void);
BOOL mac_pre_connect(freerdp* instance);
BOOL mac_post_connect(freerdp* instance);
BOOL mac_authenticate(freerdp* instance, char** username, char** password, char** domain);
void mac_set_bounds(rdpContext* context, rdpBounds* bounds);
void mac_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap);
void mac_begin_paint(rdpContext* context);
@ -129,28 +126,19 @@ struct rgba_data
rdpSettings* settings;
EmbedWindowEventArgs e;
[self initializeView];
context = rdp_context;
mfc = (mfContext*) rdp_context;
instance = context->instance;
settings = context->settings;
mfc->view = self;
EventArgsInit(&e, "mfreerdp");
e.embed = TRUE;
e.handle = (void*) self;
PubSub_OnEmbedWindow(context->pubSub, context, &e);
context->instance->PreConnect = mac_pre_connect;
context->instance->PostConnect = mac_post_connect;
context->instance->ReceiveChannelData = mac_receive_channel_data;
context->instance->Authenticate = mac_authenticate;
// TODO
// instance->Authenticate = mf_authenticate;
// instance->VerifyCertificate = mf_verify_certificate;
// instance->LogonErrorInfo = mf_logon_error_info;
status = freerdp_connect(context->instance);
status = freerdp_connect(context->instance);
if (!status)
{
@ -185,7 +173,7 @@ struct rgba_data
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
self = [super initWithFrame:frame];
if (self)
{
@ -201,24 +189,34 @@ struct rgba_data
//TODO - Expose this code as a public method, because awakeFromNib
// won't be called if the view is created dynamically
- (void) awakeFromNib
- (void) viewDidLoad
{
// store our window dimensions
width = [self frame].size.width;
height = [self frame].size.height;
titleBarHeight = 22;
[self initializeView];
}
[[self window] becomeFirstResponder];
[[self window] setAcceptsMouseMovedEvents:YES];
- (void) initializeView
{
if (!initialized)
{
// store our window dimensions
width = [self frame].size.width;
height = [self frame].size.height;
titleBarHeight = 22;
cursors = [[NSMutableArray alloc] initWithCapacity:10];
[[self window] becomeFirstResponder];
[[self window] setAcceptsMouseMovedEvents:YES];
// setup a mouse tracking area
NSTrackingArea * trackingArea = [[NSTrackingArea alloc] initWithRect:[self visibleRect] options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingCursorUpdate | NSTrackingEnabledDuringMouseDrag | NSTrackingActiveWhenFirstResponder owner:self userInfo:nil];
cursors = [[NSMutableArray alloc] initWithCapacity:10];
[self addTrackingArea:trackingArea];
// setup a mouse tracking area
NSTrackingArea * trackingArea = [[NSTrackingArea alloc] initWithRect:[self visibleRect] options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingCursorUpdate | NSTrackingEnabledDuringMouseDrag | NSTrackingActiveWhenFirstResponder owner:self userInfo:nil];
mouseInClientArea = YES;
[self addTrackingArea:trackingArea];
mouseInClientArea = YES;
initialized = YES;
}
}
/** *********************************************************************
@ -619,11 +617,6 @@ struct rgba_data
if (run_loop_src_channels != 0)
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), run_loop_src_channels, kCFRunLoopDefaultMode);
freerdp_client_stop(self->context);
freerdp_client_context_free(self->context);
}
/** *********************************************************************
@ -782,7 +775,16 @@ struct rgba_data
outerRect.size.height = h + heightDiff;
[[self window] setMaxSize:outerRect.size];
[[self window] setMinSize:outerRect.size];
[[self window] setFrame:outerRect display:YES];
@try
{
[[self window] setFrame:outerRect display:YES];
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
@finally {
}
// set client area to specified dimensions
innerRect.size.width = w;
@ -868,8 +870,7 @@ BOOL mac_pre_connect(freerdp* instance)
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
[view setViewSize :instance->settings->DesktopWidth :instance->settings->DesktopHeight];
[view setViewSize :instance->settings->DesktopWidth :instance->settings->DesktopHeight];
freerdp_channels_pre_connect(instance->context->channels, instance);
return TRUE;
@ -888,13 +889,7 @@ BOOL mac_pre_connect(freerdp* instance)
BOOL mac_post_connect(freerdp* instance)
{
int index;
int fds[32];
UINT32 flags;
int rd_count = 0;
int wr_count = 0;
void* rd_fds[32];
void* wr_fds[32];
rdpPointer rdp_pointer;
mfContext *mfc = (mfContext*) instance->context;
@ -928,9 +923,6 @@ BOOL mac_post_connect(freerdp* instance)
view->pasteboard_changecount = (int) [view->pasteboard_rd changeCount];
view->pasteboard_timer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:mfc->view selector:@selector(onPasteboardTimerFired:) userInfo:nil repeats:YES];
/* we want to be notified when window resizes */
[[NSNotificationCenter defaultCenter] addObserver:mfc->view selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:nil];
return TRUE;
}
@ -1152,10 +1144,10 @@ void mac_end_paint(rdpContext* context)
for (i = 0; i < gdi->primary->hdc->hwnd->ninvalid; i++)
{
drawRect.origin.x = gdi->primary->hdc->hwnd->cinvalid[i].x;
drawRect.origin.y = gdi->primary->hdc->hwnd->cinvalid[i].y;
drawRect.size.width = gdi->primary->hdc->hwnd->cinvalid[i].w;
drawRect.size.height = gdi->primary->hdc->hwnd->cinvalid[i].h;
drawRect.origin.x = gdi->primary->hdc->hwnd->cinvalid[i].x - 1;
drawRect.origin.y = gdi->primary->hdc->hwnd->cinvalid[i].y - 1;
drawRect.size.width = gdi->primary->hdc->hwnd->cinvalid[i].w + 1;
drawRect.size.height = gdi->primary->hdc->hwnd->cinvalid[i].h + 1;
windows_to_apple_cords(mfc->view, &drawRect);
[view setNeedsDisplayInRect:drawRect];
}

View File

@ -7,8 +7,8 @@
//
#import <Cocoa/Cocoa.h>
#import <MacFreeRDP-library/MRDPView.h>
#import <MacFreeRDP-library/mfreerdp.h>
#import <MacFreeRDP/MRDPView.h>
#import <MacFreeRDP/mfreerdp.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
{
@ -20,6 +20,5 @@
@property (assign) IBOutlet NSWindow *window;
@property (assign) rdpContext *context;
@property (assign) IBOutlet MRDPView *mrdpView;
@end

View File

@ -7,8 +7,12 @@
//
#import "AppDelegate.h"
#import "MacFreeRDP-library/mfreerdp.h"
#import "MacFreeRDP-library/mf_client.h"
#import "MacFreeRDP/mfreerdp.h"
#import "MacFreeRDP/mf_client.h"
static AppDelegate* _singleDelegate = nil;
void AppDelegate_EmbedWindowEventHandler(rdpContext* context, EmbedWindowEventArgs* e);
@implementation AppDelegate
@ -19,7 +23,6 @@
@synthesize window = window;
@synthesize mrdpView = mrdpView;
@synthesize context = context;
@ -28,6 +31,7 @@
int status;
mfContext* mfc;
_singleDelegate = self;
[self CreateContext];
status = [self ParseCommandLineArguments];
@ -41,6 +45,7 @@
}
else
{
PubSub_Subscribe(context->pubSub, "EmbedWindow", (pEventHandler) AppDelegate_EmbedWindowEventHandler);
freerdp_client_start(context);
}
}
@ -48,6 +53,7 @@
- (void) applicationWillTerminate:(NSNotification*)notification
{
[mrdpView releaseResources];
_singleDelegate = nil;
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
@ -103,4 +109,19 @@
context = nil;
}
@end
void AppDelegate_EmbedWindowEventHandler(rdpContext* context, EmbedWindowEventArgs* e)
{
if (_singleDelegate)
{
mfContext* mfc = (mfContext*) context;
_singleDelegate->mrdpView = mfc->view;
if (_singleDelegate->window)
{
[[_singleDelegate->window contentView] addSubview:mfc->view];
}
}
}

View File

@ -2,18 +2,16 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">12D78</string>
<string key="IBDocument.SystemVersion">12E55</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.37</string>
<string key="IBDocument.AppKitVersion">1187.39</string>
<string key="IBDocument.HIToolboxVersion">626.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">3084</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBNSLayoutConstraint</string>
<string>NSCustomObject</string>
<string>NSCustomView</string>
<string>NSMenu</string>
<string>NSMenuItem</string>
<string>NSView</string>
@ -257,24 +255,12 @@
<object class="NSView" key="NSWindowView" id="439893737">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSCustomView" id="467991374">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
<string key="NSFrameSize">{1024, 768}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSClassName">MRDPView</string>
</object>
</array>
<array class="NSMutableArray" key="NSSubviews"/>
<string key="NSFrameSize">{1024, 768}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="467991374"/>
<reference key="NSNextKeyView"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{1024, 790}</string>
<string key="NSMaxSize">{1024, 790}</string>
<int key="NSWindowCollectionBehavior">128</int>
@ -369,14 +355,6 @@
</object>
<int key="connectionID">493</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">mrdpView</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="467991374"/>
</object>
<int key="connectionID">569</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
@ -551,73 +529,7 @@
<object class="IBObjectRecord">
<int key="objectID">372</int>
<reference key="object" ref="439893737"/>
<array class="NSMutableArray" key="children">
<reference ref="467991374"/>
<object class="IBNSLayoutConstraint" id="334327932">
<reference key="firstItem" ref="467991374"/>
<int key="firstAttribute">6</int>
<int key="relation">0</int>
<reference key="secondItem" ref="439893737"/>
<int key="secondAttribute">6</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="439893737"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="890641817">
<reference key="firstItem" ref="467991374"/>
<int key="firstAttribute">5</int>
<int key="relation">0</int>
<reference key="secondItem" ref="439893737"/>
<int key="secondAttribute">5</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="439893737"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="437142032">
<reference key="firstItem" ref="467991374"/>
<int key="firstAttribute">4</int>
<int key="relation">0</int>
<reference key="secondItem" ref="439893737"/>
<int key="secondAttribute">4</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="439893737"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="934352021">
<reference key="firstItem" ref="467991374"/>
<int key="firstAttribute">3</int>
<int key="relation">0</int>
<reference key="secondItem" ref="439893737"/>
<int key="secondAttribute">3</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="439893737"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
</array>
<array class="NSMutableArray" key="children"/>
<reference key="parent" ref="972006081"/>
</object>
<object class="IBObjectRecord">
@ -657,31 +569,6 @@
<reference key="object" ref="976324537"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">551</int>
<reference key="object" ref="467991374"/>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">561</int>
<reference key="object" ref="334327932"/>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">562</int>
<reference key="object" ref="890641817"/>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">563</int>
<reference key="object" ref="437142032"/>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">564</int>
<reference key="object" ref="934352021"/>
<reference key="parent" ref="439893737"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@ -706,12 +593,6 @@
<string key="371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="371.IBWindowTemplateEditedContentRect">{{380, 496}, {480, 360}}</string>
<integer value="1" key="371.NSWindowTemplate.visibleAtLaunch"/>
<array class="NSMutableArray" key="372.IBNSViewMetadataConstraints">
<reference ref="334327932"/>
<reference ref="890641817"/>
<reference ref="437142032"/>
<reference ref="934352021"/>
</array>
<string key="372.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="375.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="420.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -720,13 +601,7 @@
<string key="492.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="494.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="551.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="551.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="56.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="561.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="562.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="563.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="564.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="57.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="58.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="83.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -738,48 +613,7 @@
<nil key="sourceID"/>
<int key="maxID">570</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">AppDelegate</string>
<string key="superclassName">NSObject</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="mrdpView">MRDPView</string>
<string key="window">NSWindow</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="mrdpView">
<string key="name">mrdpView</string>
<string key="candidateClassName">MRDPView</string>
</object>
<object class="IBToOneOutletInfo" key="window">
<string key="name">window</string>
<string key="candidateClassName">NSWindow</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/AppDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MRDPView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MRDPView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSLayoutConstraint</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/NSLayoutConstraint.h</string>
</object>
</object>
</array>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">

View File

@ -25,6 +25,7 @@
#include <freerdp/constants.h>
#include <freerdp/utils/signal.h>
#include <freerdp/client/cmdline.h>
#import "MRDPView.h"
/**
* Client Interface
@ -46,6 +47,13 @@ int mfreerdp_client_start(rdpContext* context)
MRDPView* view;
mfContext* mfc = (mfContext*) context;
if (mfc->view == NULL)
{
// view not specified beforehand. Create view dynamically
mfc->view = [[MRDPView alloc] initWithFrame : NSMakeRect(0, 0, context->settings->DesktopWidth, context->settings->DesktopHeight)];
mfc->view_ownership = TRUE;
}
view = (MRDPView*) mfc->view;
[view rdpStart:context];
@ -60,20 +68,34 @@ int mfreerdp_client_stop(rdpContext* context)
{
wMessageQueue* queue;
queue = freerdp_get_message_queue(context->instance, FREERDP_UPDATE_MESSAGE_QUEUE);
MessageQueue_PostQuit(queue, 0);
if (queue)
{
MessageQueue_PostQuit(queue, 0);
}
}
if (context->settings->AsyncInput)
{
wMessageQueue* queue;
queue = freerdp_get_message_queue(context->instance, FREERDP_INPUT_MESSAGE_QUEUE);
MessageQueue_PostQuit(queue, 0);
}
if (queue)
{
MessageQueue_PostQuit(queue, 0);
}
}
else
{
mfc->disconnect = TRUE;
}
if (mfc->view_ownership)
{
MRDPView* view = (MRDPView*) mfc->view;
[view releaseResources];
[view release];
mfc->view = nil;
}
return 0;
}
@ -84,7 +106,12 @@ int mfreerdp_client_new(freerdp* instance, rdpContext* context)
mfc = (mfContext*) instance->context;
context->channels = freerdp_channels_new();
context->instance->PreConnect = mac_pre_connect;
context->instance->PostConnect = mac_post_connect;
context->instance->ReceiveChannelData = mac_receive_channel_data;
context->instance->Authenticate = mac_authenticate;
context->channels = freerdp_channels_new();
settings = instance->settings;

View File

@ -28,6 +28,7 @@ struct mf_context
DEFINE_RDP_CLIENT_COMMON();
void* view;
BOOL view_ownership; // TRUE indicates that the window was created and should be freed by the API.
int width;
int height;

View File

@ -112,16 +112,13 @@ int freerdp_client_parse_command_line(rdpContext* context, int argc, char** argv
if (settings->ConnectionFile)
{
rdpFile* file = freerdp_client_rdp_file_new();
freerdp_client_parse_rdp_file(file, settings->ConnectionFile);
freerdp_client_populate_settings_from_rdp_file(file, settings);
freerdp_client_rdp_file_free(file);
return freerdp_client_parse_connection_file(context, settings->ConnectionFile);
}
return status;
}
int freerdp_client_parse_connection_file(rdpContext* context, char* filename)
int freerdp_client_parse_connection_file(rdpContext* context, const char* filename)
{
rdpFile* file;
@ -136,11 +133,35 @@ int freerdp_client_parse_connection_file(rdpContext* context, char* filename)
int freerdp_client_parse_connection_file_buffer(rdpContext* context, BYTE* buffer, size_t size)
{
rdpFile* file;
int status = -1;
file = freerdp_client_rdp_file_new();
freerdp_client_parse_rdp_file_buffer(file, buffer, size);
freerdp_client_populate_settings_from_rdp_file(file, context->settings);
if (freerdp_client_parse_rdp_file_buffer(file, buffer, size)
&& freerdp_client_populate_settings_from_rdp_file(file, context->settings))
{
status = 0;
}
freerdp_client_rdp_file_free(file);
return 0;
return status;
}
int freerdp_client_write_connection_file(rdpContext* context, const char* filename, BOOL unicode)
{
rdpFile* file;
int status = -1;
file = freerdp_client_rdp_file_new();
if (freerdp_client_populate_rdp_file_from_settings(file, context->settings))
{
if (freerdp_client_write_rdp_file(file, filename, unicode))
{
status = 0;
}
}
freerdp_client_rdp_file_free(file);
return status;
}

View File

@ -439,7 +439,7 @@ BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, BYTE* buffer, size_t si
return freerdp_client_parse_rdp_file_buffer_ascii(file, buffer, size);
}
BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name)
BOOL freerdp_client_parse_rdp_file(rdpFile* file, const char* name)
{
BYTE* buffer;
FILE* fp = NULL;
@ -480,7 +480,8 @@ BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name)
return freerdp_client_parse_rdp_file_buffer(file, buffer, file_size);
}
#define SETTING_MODIFIED(_settings, _field) (_settings->settings_modified[FreeRDP_##_field])
#define WRITE_ALL_SETTINGS TRUE
#define SETTING_MODIFIED(_settings, _field) (WRITE_ALL_SETTINGS || _settings->settings_modified[FreeRDP_##_field])
#define SETTING_MODIFIED_SET(_target, _settings, _field) if SETTING_MODIFIED(_settings, _field) _target = _settings->_field
BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, rdpSettings* settings)
@ -529,9 +530,9 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, rdpSettings*
}
BOOL freerdp_client_write_rdp_file(rdpFile* file, char* name, BOOL unicode)
BOOL freerdp_client_write_rdp_file(rdpFile* file, const char* name, BOOL unicode)
{
BOOL success = FALSE;
int rc = 0;
char* buffer;
int len, len2;
FILE* fp = NULL;
@ -559,22 +560,22 @@ BOOL freerdp_client_write_rdp_file(rdpFile* file, char* name, BOOL unicode)
fwrite(BOM_UTF16_LE, sizeof(BYTE), 2, fp);
fwrite(unicodestr, 2, len, fp);
free(unicodestr);
free(unicodestr);
}
else
{
fwrite(buffer, 1, len, fp);
}
fflush(fp);
fclose(fp);
rc = fflush(fp);
rc = fclose(fp);
}
}
if (buffer != NULL)
free(buffer);
return success;
return (rc == 0);
}
#define WRITE_RDP_FILE_DECLARE(_file, _buffer, _size) \

View File

@ -84,8 +84,9 @@ FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context);
FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context);
FREERDP_API int freerdp_client_parse_command_line(rdpContext* context, int argc, char** argv);
FREERDP_API int freerdp_client_parse_connection_file(rdpContext* context, char* filename);
FREERDP_API int freerdp_client_parse_connection_file(rdpContext* context, const char* filename);
FREERDP_API int freerdp_client_parse_connection_file_buffer(rdpContext* context, BYTE* buffer, size_t size);
FREERDP_API int freerdp_client_write_connection_file(rdpContext* context, const char* filename, BOOL unicode);
#ifdef __cplusplus
}

View File

@ -137,12 +137,12 @@ typedef struct rdp_file rdpFile;
extern "C" {
#endif
FREERDP_API BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name);
FREERDP_API BOOL freerdp_client_parse_rdp_file(rdpFile* file, const char* name);
FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, BYTE* buffer, size_t size);
FREERDP_API BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* settings);
FREERDP_API BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, rdpSettings* settings);
FREERDP_API BOOL freerdp_client_write_rdp_file(rdpFile* file, char* name, BOOL unicode);
FREERDP_API BOOL freerdp_client_write_rdp_file(rdpFile* file, const char* name, BOOL unicode);
FREERDP_API size_t freerdp_client_write_rdp_file_buffer(rdpFile* file, char* buffer, size_t size);
FREERDP_API rdpFile* freerdp_client_rdp_file_new(void);

View File

@ -77,15 +77,19 @@ BOOL rdp_client_connect(rdpRdp* rdp)
if (settings->GatewayEnabled)
{
char* user;
char* user;
char* domain;
char* cookie;
int user_length;
int user_length = 0;
int domain_length;
int cookie_length;
user = settings->Username;
user_length = strlen(settings->Username);
if (settings->Username)
{
user = settings->Username;
user_length = strlen(settings->Username);
}
if (settings->Domain)
domain = settings->Domain;
@ -100,8 +104,11 @@ BOOL rdp_client_connect(rdpRdp* rdp)
CopyMemory(cookie, domain, domain_length);
CharUpperBuffA(cookie, domain_length);
cookie[domain_length] = '\\';
CopyMemory(&cookie[domain_length + 1], user, user_length);
cookie[cookie_length] = '\0';
if (settings->Username)
CopyMemory(&cookie[domain_length + 1], user, user_length);
cookie[cookie_length] = '\0';
nego_set_cookie(rdp->nego, cookie);
free(cookie);

View File

@ -1369,6 +1369,10 @@ BOOL tsg_disconnect(rdpTsg* tsg)
* | |
*/
if (tsg == NULL)
return FALSE;
tsg->rpc->client->SynchronousReceive = TRUE;
/* if we are already in state pending (i.e. if a server initiated disconnect was issued)
@ -1392,7 +1396,12 @@ BOOL tsg_disconnect(rdpTsg* tsg)
int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length)
{
int CopyLength;
rdpRpc* rpc = tsg->rpc;
rdpRpc* rpc;
if (tsg == NULL)
return -1;
rpc = tsg->rpc;
if (tsg->PendingPdu)
{

View File

@ -210,6 +210,9 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE* lpHandles, BOOL bWaitAl
return WAIT_FAILED;
}
if (fd == -1)
return WAIT_FAILED;
FD_SET(fd, &fds);
if (fd > maxfd)