From 12a46784dd7d9b98c81ba2ab5d163e7ec89b25ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Fri, 31 May 2013 12:48:40 -0400 Subject: [PATCH] mfreerdp: integrate benoit's refactored mac client --- CMakeLists.txt | 2 +- client/Mac/.gitignore | 1 + client/Mac/AppDelegate.h | 29 - client/Mac/AppDelegate.m | 38 - client/Mac/CMakeLists.txt | 231 +- client/Mac/Info.plist | 16 +- client/Mac/MRDPRailView.h | 76 - client/Mac/MRDPRailView.m | 930 ------ client/Mac/MRDPRailWindow.h | 24 - client/Mac/MRDPRailWindow.m | 29 - client/Mac/MRDPView.h | 121 +- client/Mac/MRDPView.m | 278 +- client/Mac/MRDPWindow.h | 33 - client/Mac/MRDPWindow.m | 28 - client/Mac/PasswordDialog.h | 10 +- client/Mac/README.txt | 140 - client/Mac/cli/AppDelegate.h | 22 + client/Mac/cli/AppDelegate.m | 32 + client/Mac/cli/CMakeLists.txt | 127 + client/Mac/{ => cli}/FreeRDP.icns | Bin client/Mac/cli/Info.plist | 34 + client/Mac/cli/MacClient2-Info.plist | 32 + client/Mac/cli/MacClient2-Prefix.pch | 7 + client/Mac/{ => cli}/MainMenu.xib | 20 +- client/Mac/cli/en.lproj/Credits.rtf | 29 + client/Mac/cli/en.lproj/InfoPlist.strings | 2 + client/Mac/cli/en.lproj/MainMenu.xib | 3299 +++++++++++++++++++++ client/Mac/cli/main.m | 16 + client/Mac/en.lproj/InfoPlist.strings | 2 + client/Mac/main.m | 4 +- 30 files changed, 4042 insertions(+), 1570 deletions(-) delete mode 100644 client/Mac/AppDelegate.h delete mode 100644 client/Mac/AppDelegate.m delete mode 100644 client/Mac/MRDPRailView.h delete mode 100644 client/Mac/MRDPRailView.m delete mode 100644 client/Mac/MRDPRailWindow.h delete mode 100644 client/Mac/MRDPRailWindow.m delete mode 100644 client/Mac/MRDPWindow.h delete mode 100644 client/Mac/MRDPWindow.m delete mode 100644 client/Mac/README.txt create mode 100644 client/Mac/cli/AppDelegate.h create mode 100644 client/Mac/cli/AppDelegate.m create mode 100644 client/Mac/cli/CMakeLists.txt rename client/Mac/{ => cli}/FreeRDP.icns (100%) create mode 100644 client/Mac/cli/Info.plist create mode 100644 client/Mac/cli/MacClient2-Info.plist create mode 100644 client/Mac/cli/MacClient2-Prefix.pch rename client/Mac/{ => cli}/MainMenu.xib (98%) create mode 100644 client/Mac/cli/en.lproj/Credits.rtf create mode 100644 client/Mac/cli/en.lproj/InfoPlist.strings create mode 100644 client/Mac/cli/en.lproj/MainMenu.xib create mode 100644 client/Mac/cli/main.m create mode 100644 client/Mac/en.lproj/InfoPlist.strings diff --git a/CMakeLists.txt b/CMakeLists.txt index 3576f7a4b..7ee793a52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -312,8 +312,8 @@ if(APPLE) set(DIRECTFB_FEATURE_TYPE "DISABLED") set(FFMPEG_FEATURE_TYPE "OPTIONAL") set(GSTREAMER_FEATURE_TYPE "OPTIONAL") + set(X11_FEATURE_TYPE "DISABLED") if(IOS) - set(X11_FEATURE_TYPE "DISABLED") set(ALSA_FEATURE_TYPE "DISABLED") set(PULSE_FEATURE_TYPE "DISABLED") set(CUPS_FEATURE_TYPE "DISABLED") diff --git a/client/Mac/.gitignore b/client/Mac/.gitignore index 600769254..334032120 100644 --- a/client/Mac/.gitignore +++ b/client/Mac/.gitignore @@ -1,2 +1,3 @@ *.app +*.framework diff --git a/client/Mac/AppDelegate.h b/client/Mac/AppDelegate.h deleted file mode 100644 index a050c8d6c..000000000 --- a/client/Mac/AppDelegate.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * MacFreeRDP - * - * Copyright 2012 Thomas Goddard - * - * 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. - */ - -#import -#import "MRDPView.h" - -@interface AppDelegate : NSObject - -@property (assign) IBOutlet MRDPView *mrdpView; -@property (assign) IBOutlet NSWindow *window; - -int rdp_connect(void); -@end diff --git a/client/Mac/AppDelegate.m b/client/Mac/AppDelegate.m deleted file mode 100644 index 029d055d1..000000000 --- a/client/Mac/AppDelegate.m +++ /dev/null @@ -1,38 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * MacFreeRDP - * - * Copyright 2012 Thomas Goddard - * - * 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. - */ - -#import "AppDelegate.h" - -@implementation AppDelegate - -@synthesize window = _window; - -@synthesize mrdpView; - -- (void)applicationDidFinishLaunching:(NSNotification*)aNotification -{ - rdp_connect(); -} - -- (void) applicationWillTerminate:(NSNotification*)notification -{ - //[mrdpView releaseResources]; -} - -@end diff --git a/client/Mac/CMakeLists.txt b/client/Mac/CMakeLists.txt index 80b03ca62..5b77814a5 100644 --- a/client/Mac/CMakeLists.txt +++ b/client/Mac/CMakeLists.txt @@ -1,75 +1,57 @@ -project(MacFreeRDP) +project(MacFreeRDP-library) -set(MODULE_NAME "MacFreeRDP") -set(MODULE_PREFIX "FREERDP_CLIENT_MAC") +# add directory for App +add_subdirectory(cli) -set(FRAMEWORK_HEADERS_PATH /System/Library/Frameworks/Cocoa.framework/Versions/A/Headers/) -include_directories(${FRAMEWORK_HEADERS_PATH} /System/Library/Frameworks) - -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mmacosx-version-min=10.4") -set(GUI_TYPE MACOSX_BUNDLE) +set(MODULE_NAME "MacFreeRDP-library") +set(MODULE_PREFIX "FREERDP_CLIENT_MAC-LIB") +# Import libraries find_library(FOUNDATION_LIBRARY Foundation) find_library(COCOA_LIBRARY Cocoa) find_library(APPKIT_LIBRARY AppKit) -set(MACOSX_BUNDLE_INFO_STRING "MacFreeRDP") -set(MACOSX_BUNDLE_ICON_FILE "FreeRDP.icns") +set(MACOSX_BUNDLE_INFO_STRING "MacFreeRDP-library") set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.freerdp.mac") -set(MACOSX_BUNDLE_BUNDLE_IDENTIFIER "FreeRDP.Mac") -set(MACOSX_BUNDLE_LONG_VERSION_STRING "MacFreeRDP Version 1.0.1") -set(MACOSX_BUNDLE_BUNDLE_NAME "MacFreeRDP") -set(MACOSX_BUNDLE_SHORT_VERSION_STRING 1.0.1) -set(MACOSX_BUNDLE_BUNDLE_VERSION 1.0.1) -set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2012. All Rights Reserved.") - -set(MACOSX_BUNDLE_NSMAIN_NIB_FILE "MainMenu") -set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "NSApplication") +set(MACOSX_BUNDLE_BUNDLE_IDENTIFIER "FreeRDP-library.Mac") +set(MACOSX_BUNDLE_LONG_VERSION_STRING "MacFreeRDP library Version 1.1") +set(MACOSX_BUNDLE_BUNDLE_NAME "MacFreeRDP-library") +set(MACOSX_BUNDLE_SHORT_VERSION_STRING 1.1.0) +set(MACOSX_BUNDLE_BUNDLE_VERSION 1.1.0) +set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2013. All Rights Reserved.") mark_as_advanced(COCOA_LIBRARY FOUNDATION_LIBRARY APPKIT_LIBRARY) set(EXTRA_LIBS ${COCOA_LIBRARY} ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY}) -set(APP_TYPE MACOSX_BUNDLE) -set(${MODULE_NAME}_XIBS - MainMenu.xib - PasswordDialog.xib) +set(${MODULE_NAME}_RESOURCES "en.lproj/InfoPlist.strings") -set(${MODULE_NAME}_RESOURCES - ${${MODULE_NAME}_XIBS} - ${MACOSX_BUNDLE_ICON_FILE}) +# OS X Interface Builder files +file(GLOB ${MODULE_NAME}_XIBS *.xib) -set(${MODULE_NAME}_HEADERS - AppDelegate.h - MRDPCursor.h - MRDPRailView.h - MRDPRailWindow.h +# Include XIB file in Xcode resources. +if("${CMAKE_GENERATOR}" MATCHES "Xcode") + message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}") + set(${MODULE_NAME}_RESOURCES ${${MODULE_NAME}_RESOURCES} ${${MODULE_NAME}_XIBS}) +endif("${CMAKE_GENERATOR}" MATCHES "Xcode") + + +add_library(${MODULE_NAME} + SHARED MRDPView.h - MRDPWindow.h - PasswordDialog.h) - -set(${MODULE_NAME}_SOURCES - main.m - AppDelegate.m - MRDPCursor.m - MRDPRailView.m - MRDPRailWindow.m MRDPView.m - MRDPWindow.m - PasswordDialog.m) - -add_executable(${MODULE_NAME} - ${APP_TYPE} - ${${MODULE_NAME}_HEADERS} - ${${MODULE_NAME}_SOURCES} + MRDPCursor.m + PasswordDialog.m ${${MODULE_NAME}_RESOURCES}) -# This is necessary for the xib file part below -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) - -# This allows for automatic xib to nib ibitool -set_target_properties(${MODULE_NAME} PROPERTIES RESOURCE "${${MODULE_NAME}_RESOURCES}") - +# configures the framework to always be looked for in the application bundle in the Frameworks sub-folder. +SET_TARGET_PROPERTIES( ${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_INSTALL_PATH @executable_path/../Frameworks/ ) + + set_target_properties( ${MODULE_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH} + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH} +) + # Automatic ref counting # temporary turn off for x86_64 build issue # set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES) @@ -77,14 +59,90 @@ set_target_properties(${MODULE_NAME} PROPERTIES RESOURCE "${${MODULE_NAME}_RESOU # Support for automatic reference counting requires non-fragile abi. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-nonfragile-abi") +# XCode project architecture to native architecture of build machine +# ----------------------------------------------------------------------------------------------------- +# Issue: Had some issues with FreeRDP project building only 64 bit and +# MacFreeRDP attempting to link to both 32 and 64 for dual target. +# In the future the FreeRDP Xcode project should be pulled in for a couple of reasons: +# 1) better step-into debugging 2) automatic dependency compilation and multi-arch compilation + linkage +# If you know the solutions for 1 and 2, please add below. set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_ARCHS "$(NATIVE_ARCH_ACTUAL)") # Set the info plist to the custom instance -set_target_properties(${MODULE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) +# MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist -set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${EXTRA_LIBS}) +set(MODULE_VERSION, 1.1.0) -set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client) +set_target_properties(${MODULE_NAME} PROPERTIES + FRAMEWORK TRUE + MACOSX_FRAMEWORK_IDENTIFIER com.awakecoding.${MODULE_NAME} + 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 +) + +set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${EXTRA_LIBS} freerdp-client) + +# Set a list of the dependent targets used by the application. There should be a way to get this list automatically +# from cmake, but for now I put it down manually. I got the references by calling +# otool -L MacFreeRDP-client + +set(DEPENDENCIES + winpr-asn1 + winpr-heap + winpr-sspi + winpr-bcrypt + winpr-input + winpr-sspicli + winpr-credentials + winpr-interlocked + winpr-synch + winpr-credui + winpr-io + winpr-sysinfo + winpr-crt + winpr-library + winpr-thread + winpr-crypto + winpr-timezone + winpr-dsparse + winpr-path + winpr-utils + winpr-environment + winpr-pipe + winpr-winhttp + winpr-error + winpr-pool + winpr-winsock + winpr-file + winpr-registry + winpr-handle + winpr-rpc + freerdp-utils + freerdp-gdi + freerdp-rail + freerdp-cache + freerdp-codec + freerdp-primitives + freerdp-core + freerdp-crypto + freerdp-client + freerdp-locale + freerdp-common + ) + + +## Modify the install name path of the dependent libraries so that they can be located by the bundling app. +# foreach(LIB ${DEPENDENCIES}) +# set_target_properties(${LIB} PROPERTIES +# INSTALL_NAME_DIR "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents" +# BUILD_WITH_INSTALL_RPATH 1 +# ) +# endforeach() set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD} MODULE freerdp @@ -94,6 +152,67 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHI MODULE winpr MODULES winpr-input winpr-crt winpr-utils) +set_target_properties(${MODULE_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "") target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) 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 + "$" + "${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Contents/$" + COMMENT "Copying ${LIB} to output directory" + COMMAND install_name_tool -change "$" "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$" "${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 "$" "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$" "${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 "$" "@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$" "${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Contents/$" + COMMENT Setting install name for ${LIB} in module ${DEST} +) + +# COMMAND "${CMAKE_COMMAND}" -E echo install_name_tool -change "$" #"@executable_path/../Frameworks/${MODULE_NAME}.framework/Contents/$" #"${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.framework/Contents/$" +# ) + +endforeach() +endforeach() + + +# Add post-build NIB file generation in unix makefiles. XCode handles this implicitly. +if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") + message(STATUS "Adding post-build NIB file generation event for ${MODULE_NAME}") + + # Make sure we can find the 'ibtool' program. If we can NOT find it we + # skip generation of this project + find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin") + if (${IBTOOL} STREQUAL "IBTOOL-NOTFOUND") + message(SEND_ERROR "ibtool can not be found and is needed to compile the .xib files. It should have been installed with + the Apple developer tools. The default system paths were searched in addition to ${OSX_DEVELOPER_ROOT}/usr/bin") + endif() + + # 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) + + # Compile the .xib files using the 'ibtool' program with the destination being the app package + foreach(xib ${${MODULE_NAME}_XIBS}) + get_filename_component(XIB_WE ${xib} NAME_WE) + + 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} + COMMENT "Compiling ${xib}") + endforeach() + +endif("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") \ No newline at end of file diff --git a/client/Mac/Info.plist b/client/Mac/Info.plist index 253612c6e..2b552b421 100644 --- a/client/Mac/Info.plist +++ b/client/Mac/Info.plist @@ -3,11 +3,9 @@ CFBundleDevelopmentRegion - en - CFBundleExecutable - + English CFBundleIconFile - FreeRDP + CFBundleIdentifier FreeRDP.Mac CFBundleInfoDictionaryVersion @@ -15,20 +13,14 @@ CFBundleName CFBundlePackageType - APPL + FMWK CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 - LSMinimumSystemVersion - - NSHumanReadableCopyright - Copyright © 2012 FreeRDP Open Source Project. - NSMainNibFile - MainMenu NSPrincipalClass - NSApplication + diff --git a/client/Mac/MRDPRailView.h b/client/Mac/MRDPRailView.h deleted file mode 100644 index 84d4c55ee..000000000 --- a/client/Mac/MRDPRailView.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * MacFreeRDP - * - * Copyright 2012 Thomas Goddard - * - * 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. - */ - -#import - -#import "freerdp/gdi/gdi.h" -#import "freerdp/rail/rail.h" - -#import "MRDPRailWindow.h" - -@interface MRDPRailView : NSView -{ - freerdp* rdp_instance; - rdpContext* context; - NSBitmapImageRep* bmiRep; - NSPoint savedDragLocation; - char* pixelData; - BOOL mouseInClientArea; - BOOL titleBarClicked; - BOOL gestureEventInProgress; - int width; - int height; - int savedWindowId; - int scrollWheelCount; - - int kdlshift; - int kdrshift; - int kdlctrl; - int kdrctrl; - int kdlalt; - int kdralt; - int kdlmeta; - int kdrmeta; - int kdcapslock; - -@public - BOOL isMoveSizeInProgress; - BOOL saveInitialDragLoc; - BOOL skipMoveWindowOnce; - int localMoveType; -} - -@property (assign) MRDPRailWindow* mrdpRailWindow; -@property (assign) int windowIndex; -@property (assign) BOOL activateWindow; - -- (void) windowDidMove:(NSNotification*) notification; -- (void) updateDisplay; -- (void) setRdpInstance:(freerdp*) instance width:(int) w andHeight:(int) h windowID:(int) windowID; -- (void) setupBmiRep:(int) width :(int) height; -- (void) releaseResources; - -void mac_rail_MoveWindow(rdpRail* rail, rdpWindow* window); -void apple_to_windowMove(NSRect* r, RAIL_WINDOW_MOVE_ORDER* windowMove); -void mac_send_rail_client_event(rdpChannels* channels, UINT16 event_type, void* param); -void windows_to_apple_cords(NSRect* r); -void rail_MoveWindow(rdpRail* rail, rdpWindow* window); -void mac_rail_send_activate(int window_id); - -@end diff --git a/client/Mac/MRDPRailView.m b/client/Mac/MRDPRailView.m deleted file mode 100644 index b23c9c3e4..000000000 --- a/client/Mac/MRDPRailView.m +++ /dev/null @@ -1,930 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * MacFreeRDP - * - * Copyright 2012 Thomas Goddard - * - * 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 "MRDPRailView.h" - -#define USE_RAIL_CVT - -@implementation MRDPRailView - -@synthesize mrdpRailWindow, windowIndex, activateWindow; - -MRDPRailView* g_mrdpRailView; - -- (void) updateDisplay -{ - BOOL moveWindow = NO; - NSRect srcRectOuter; - NSRect destRectOuter; - - rdpGdi* gdi; - - if ((context == 0) || (context->gdi == 0)) - return; - - if (context->gdi->primary->hdc->hwnd->invalid->null) - return; - - if (context->gdi->drawing != context->gdi->primary) - return; - - gdi = context->gdi; - - srcRectOuter = NSMakeRect(0, 0, self->width, self->height); - destRectOuter = [[self window] frame]; - - // cannot be bigger than our current screen size - NSRect screenSize = [[NSScreen mainScreen] frame]; - - if (destRectOuter.size.width > screenSize.size.width) - { - destRectOuter.size.width = screenSize.size.width; - moveWindow = YES; - } - - if (destRectOuter.size.height > screenSize.size.height) - { - destRectOuter.size.height = screenSize.size.height; - moveWindow = YES; - } - - if (destRectOuter.origin.x + destRectOuter.size.width > width) - destRectOuter.size.width = width - destRectOuter.origin.x; - - [self setupBmiRep:destRectOuter.size.width :destRectOuter.size.height]; - - if (moveWindow) - { - moveWindow = NO; - RAIL_WINDOW_MOVE_ORDER newWndLoc; - apple_to_windowMove(&destRectOuter, &newWndLoc); - newWndLoc.windowId = savedWindowId; - //skipMoveWindowOnce = TRUE; - //mac_send_rail_client_event(g_mrdpRailView->rdp_instance->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &newWndLoc); - } - - destRectOuter.origin.y = height - destRectOuter.origin.y - destRectOuter.size.height; - rail_convert_color_space(pixelData, (char *) gdi->primary_buffer, - &destRectOuter, self->width, self->height); - - if (moveWindow) - [self setNeedsDisplayInRect:destRectOuter]; - else - [self setNeedsDisplayInRect:[self frame]]; - - gdi->primary->hdc->hwnd->ninvalid = 0; -} - -/** ********************************************************************* - * called when our view needs to be redrawn - ***********************************************************************/ - -- (void) drawRect:(NSRect)dirtyRect -{ - [bmiRep drawInRect:dirtyRect fromRect:dirtyRect operation:NSCompositeCopy fraction:1.0 respectFlipped:NO hints:nil]; - - if (pixelData) - { - free(pixelData); - pixelData = NULL; - } - - bmiRep = nil; -} - -/** ********************************************************************* - * become first responder so we can get keyboard and mouse events - ***********************************************************************/ - -- (BOOL)acceptsFirstResponder -{ - return YES; -} - -- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent -{ - return NO; -} - -/** ********************************************************************* - * called when a mouse move event occurs - * - * ideally we want to be called when the mouse moves over NSView client area, - * but in reality we get called any time the mouse moves anywhere on the screen; - * we could use NSTrackingArea class to handle this but this class is available - * on Mac OS X v10.5 and higher; since we want to be compatible with older - * versions, we do this manually. - * - * TODO: here is how it can be done using legacy methods - * http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/MouseTrackingEvents/MouseTrackingEvents.html#//apple_ref/doc/uid/10000060i-CH11-SW1 - ***********************************************************************/ - -- (void) mouseMoved:(NSEvent *)event -{ - [super mouseMoved:event]; - - NSRect winFrame = [[self window] frame]; - NSPoint loc = [event locationInWindow]; - - int x = (int) (winFrame.origin.x + loc.x); - int y = (int) (winFrame.origin.y + loc.y); - - y = height - y; - - /* send mouse motion event to RDP server */ - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_MOVE, x, y); -} - -/** ********************************************************************* - * called when left mouse button is pressed down - ***********************************************************************/ - -- (void)mouseDown:(NSEvent *) event -{ - [super mouseDown:event]; - - NSRect winFrame = [[self window] frame]; - NSPoint loc = [event locationInWindow]; - int x = (int) (winFrame.origin.x + loc.x); - int y = (int) (winFrame.origin.y + loc.y); - int yPos = (int) (winFrame.size.height - loc.y); - - y = height - y; - - if ((yPos >= 4) && (yPos <= 20)) - titleBarClicked = YES; - else - titleBarClicked = NO; - - savedDragLocation.x = loc.x; - savedDragLocation.y = loc.y; - - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1, x, y); -} - -/** ********************************************************************* - * called when left mouse button is released - ***********************************************************************/ - -- (void) mouseUp:(NSEvent *) event -{ - [super mouseUp:event]; - - NSRect winFrame = [[self window] frame]; - NSPoint loc = [event locationInWindow]; - int x = (int) (winFrame.origin.x + loc.x); - int y = (int) (winFrame.origin.y + loc.y); - y = height - y; - - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_BUTTON1, x, y); - titleBarClicked = NO; -} - -/** ********************************************************************* - * called when right mouse button is pressed down - ***********************************************************************/ - -- (void) rightMouseDown:(NSEvent *)event -{ - [super rightMouseDown:event]; - - NSRect winFrame = [[self window] frame]; - NSPoint loc = [event locationInWindow]; - int x = (int) (winFrame.origin.x + loc.x); - int y = (int) (winFrame.origin.y + loc.y); - y = height - y; - - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON2, x, y); -} - -/** ********************************************************************* - * called when right mouse button is released - ***********************************************************************/ - -- (void) rightMouseUp:(NSEvent *)event -{ - [super rightMouseUp:event]; - - NSRect winFrame = [[self window] frame]; - NSPoint loc = [event locationInWindow]; - int x = (int) (winFrame.origin.x + loc.x); - int y = (int) (winFrame.origin.y + loc.y); - y = height - y; - - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_BUTTON2, x, y); -} - -/** ********************************************************************* - * called when middle mouse button is pressed - ***********************************************************************/ - -- (void) otherMouseDown:(NSEvent *)event -{ - [super otherMouseDown:event]; - - NSRect winFrame = [[self window] frame]; - NSPoint loc = [event locationInWindow]; - int x = (int) (winFrame.origin.x + loc.x); - int y = (int) (winFrame.origin.y + loc.y); - y = height - y; - - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON3, x, y); -} - -/** ********************************************************************* - * called when middle mouse button is released - ***********************************************************************/ - -- (void) otherMouseUp:(NSEvent *)event -{ - [super otherMouseUp:event]; - - NSRect winFrame = [[self window] frame]; - NSPoint loc = [event locationInWindow]; - int x = (int) (winFrame.origin.x + loc.x); - int y = (int) (winFrame.origin.y + loc.y); - y = height - y; - - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_BUTTON3, x, y); -} - -- (void) scrollWheel:(NSEvent *)event -{ - uint16 flags; - - [super scrollWheel:event]; - - // we get more two finger trackpad scroll events - // than scrollWheel events, so we drop some - - if (gestureEventInProgress) - { - scrollWheelCount++; - - if (scrollWheelCount % 8 != 0) - return; - } - - if ([event scrollingDeltaY] < 0) - { - flags = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088; - } - else - { - flags = PTR_FLAGS_WHEEL | 0x78; - } - - rdp_instance->input->MouseEvent(rdp_instance->input, flags, 0, 0); -} - -/** ********************************************************************* - * called when mouse is moved with left button pressed - * note: invocation order is: mouseDown, mouseDragged, mouseUp - ***********************************************************************/ -- (void) mouseDragged:(NSEvent *)event -{ - [super mouseDragged:event]; - - NSRect winFrame = [[self window] frame]; - NSPoint loc = [event locationInWindow]; - int x = (int) loc.x; - int y = (int) loc.y; - - if (titleBarClicked) - { - // window is being dragged to a new location - int newX = x - savedDragLocation.x; - int newY = y - savedDragLocation.y; - - if ((newX == 0) && (newY == 0)) - return; - - winFrame.origin.x += newX; - winFrame.origin.y += newY; - - [[self window] setFrame:winFrame display:YES]; - return; - } - - if (localMoveType == RAIL_WMSZ_LEFT) - { - // left border resize taking place - int diff = (int) (loc.x - savedDragLocation.x); - - if (diff == 0) - return; - - if (diff < 0) - { - diff = abs(diff); - winFrame.origin.x -= diff; - winFrame.size.width += diff; - } - else - { - winFrame.origin.x += diff; - winFrame.size.width -= diff; - } - - [[self window] setFrame:winFrame display:YES]; - return; - } - - if (localMoveType == RAIL_WMSZ_RIGHT) - { - // right border resize taking place - int diff = (int) (loc.x - savedDragLocation.x); - - if (diff == 0) - return; - - savedDragLocation.x = loc.x; - savedDragLocation.y = loc.y; - - winFrame.size.width += diff; - [[self window] setFrame:winFrame display:YES]; - - return; - } - - if (localMoveType == RAIL_WMSZ_TOP) - { - // top border resize taking place - int diff = (int) (loc.y - savedDragLocation.y); - - if (diff == 0) - return; - - savedDragLocation.x = loc.x; - savedDragLocation.y = loc.y; - - winFrame.size.height += diff; - [[self window] setFrame:winFrame display:YES]; - - return; - } - - if (localMoveType == RAIL_WMSZ_BOTTOM) - { - // bottom border resize taking place - int diff = (int) (loc.y - savedDragLocation.y); - - if (diff == 0) - return; - - if (diff < 0) - { - diff = abs(diff); - winFrame.origin.y -= diff; - winFrame.size.height += diff; - } - else - { - winFrame.origin.y += diff; - winFrame.size.height -= diff; - } - - [[self window] setFrame:winFrame display:YES]; - return; - } - - if (localMoveType == RAIL_WMSZ_TOPLEFT) - { - // top left border resize taking place - int diff = (int) (loc.x - savedDragLocation.x); - - if (diff != 0) - { - if (diff < 0) - { - diff = abs(diff); - winFrame.origin.x -= diff; - winFrame.size.width += diff; - } - else - { - winFrame.origin.x += diff; - winFrame.size.width -= diff; - } - } - - diff = (int) (loc.y - savedDragLocation.y); - - if (diff != 0) - { - savedDragLocation.y = loc.y; - winFrame.size.height += diff; - } - - [[self window] setFrame:winFrame display:YES]; - return; - } - - if (localMoveType == RAIL_WMSZ_TOPRIGHT) - { - // top right border resize taking place - int diff = (int) (loc.x - savedDragLocation.x); - - if (diff != 0) - winFrame.size.width += diff; - - diff = (int) (loc.y - savedDragLocation.y); - - if (diff != 0) - winFrame.size.height += diff; - - savedDragLocation.x = loc.x; - savedDragLocation.y = loc.y; - - [[self window] setFrame:winFrame display:YES]; - return; - } - - if (localMoveType == RAIL_WMSZ_BOTTOMLEFT) - { - // bottom left border resize taking place - int diff = (int) (loc.x - savedDragLocation.x); - - if (diff != 0) - { - if (diff < 0) - { - diff = abs(diff); - winFrame.origin.x -= diff; - winFrame.size.width += diff; - } - else - { - winFrame.origin.x += diff; - winFrame.size.width -= diff; - } - } - - diff = (int) (loc.y - savedDragLocation.y); - - if (diff != 0) - { - if (diff < 0) - { - diff = abs(diff); - winFrame.origin.y -= diff; - winFrame.size.height += diff; - } - else - { - winFrame.origin.y += diff; - winFrame.size.height -= diff; - } - } - - [[self window] setFrame:winFrame display:YES]; - return; - } - - if (localMoveType == RAIL_WMSZ_BOTTOMRIGHT) - { - // bottom right border resize taking place - int diff = (int) (loc.x - savedDragLocation.x); - - if (diff != 0) - { - savedDragLocation.x = loc.x; - //savedDragLocation.y = loc.y; - winFrame.size.width += diff; - } - - diff = (int) (loc.y - savedDragLocation.y); - - if (diff != 0) - { - if (diff < 0) - { - diff = abs(diff); - winFrame.origin.y -= diff; - winFrame.size.height += diff; - } - else - { - winFrame.origin.y += diff; - winFrame.size.height -= diff; - } - } - - [[self window] setFrame:winFrame display:YES]; - return; - } - - x = (int) (winFrame.origin.x + loc.x); - y = (int) (winFrame.origin.y + loc.y); - y = height - y; - - // send mouse motion event to RDP server - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_MOVE, x, y); -} - -/** ********************************************************************* - * called when a key is pressed - ***********************************************************************/ - -- (void) keyDown:(NSEvent *) event -{ - int key; - USHORT extended; - DWORD vkcode; - DWORD scancode; - - key = [event keyCode] + 8; - - vkcode = GetVirtualKeyCodeFromKeycode(key, KEYCODE_TYPE_APPLE); - scancode = GetVirtualScanCodeFromVirtualKeyCode(vkcode, 4); - extended = (scancode & KBDEXT) ? KBDEXT : 0; - - rdp_instance->input->KeyboardEvent(rdp_instance->input, extended | KBD_FLAGS_DOWN, scancode & 0xFF); -} - -/** ********************************************************************* - * called when a key is released - ***********************************************************************/ - -- (void) keyUp:(NSEvent *) event -{ - int key; - USHORT extended; - DWORD vkcode; - DWORD scancode; - - key = [event keyCode] + 8; - - vkcode = GetVirtualKeyCodeFromKeycode(key, KEYCODE_TYPE_APPLE); - scancode = GetVirtualScanCodeFromVirtualKeyCode(vkcode, 4); - extended = (scancode & KBDEXT) ? TRUE : FALSE; - - rdp_instance->input->KeyboardEvent(rdp_instance->input, extended | KBD_FLAGS_RELEASE, scancode & 0xFF); -} - -/** ********************************************************************* - * called when shift, control, alt and meta keys are pressed/released - ***********************************************************************/ - -- (void) flagsChanged:(NSEvent *) event -{ - NSUInteger mf = [event modifierFlags]; - - // caps lock - if (mf == 0x10100) { - printf("TODO: caps lock is on\n"); - kdcapslock = 1; - } - if (kdcapslock && (mf == 0x100)) { - kdcapslock = 0; - printf("TODO: caps lock is off\n"); - } - // left shift - if ((kdlshift == 0) && ((mf & 2) != 0)) { - // left shift went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_DOWN, 0x2a); - kdlshift = 1; - } - if ((kdlshift != 0) && ((mf & 2) == 0)) { - // left shift went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x2a); - kdlshift = 0; - } - - // right shift - if ((kdrshift == 0) && ((mf & 4) != 0)) { - // right shift went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_DOWN, 0x36); - kdrshift = 1; - } - if ((kdrshift != 0) && ((mf & 4) == 0)) { - // right shift went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x36); - kdrshift = 0; - } - - // left ctrl - if ((kdlctrl == 0) && ((mf & 1) != 0)) { - // left ctrl went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_DOWN, 0x1d); - kdlctrl = 1; - } - if ((kdlctrl != 0) && ((mf & 1) == 0)) { - // left ctrl went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x1d); - kdlctrl = 0; - } - - // right ctrl - if ((kdrctrl == 0) && ((mf & 0x2000) != 0)) { - // right ctrl went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_DOWN, 0x1d); - kdrctrl = 1; - } - if ((kdrctrl != 0) && ((mf & 0x2000) == 0)) { - // right ctrl went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x1d); - kdrctrl = 0; - } - - // left alt - if ((kdlalt == 0) && ((mf & 0x20) != 0)) { - // left alt went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_DOWN, 0x38); - kdlalt = 1; - } - if ((kdlalt != 0) && ((mf & 0x20) == 0)) { - // left alt went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x38); - kdlalt = 0; - } - - // right alt - if ((kdralt == 0) && ((mf & 0x40) != 0)) { - // right alt went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_DOWN, 0x38); - kdralt = 1; - } - if ((kdralt != 0) && ((mf & 0x40) == 0)) { - // right alt went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x38); - kdralt = 0; - } - - // left meta - if ((kdlmeta == 0) && ((mf & 0x08) != 0)) { - // left meta went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_DOWN, 0x5b); - kdlmeta = 1; - } - if ((kdlmeta != 0) && ((mf & 0x08) == 0)) { - // left meta went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x5b); - kdlmeta = 0; - } - - // right meta - if ((kdrmeta == 0) && ((mf & 0x10) != 0)) { - // right meta went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_DOWN, 0x5c); - kdrmeta = 1; - } - if ((kdrmeta != 0) && ((mf & 0x10) == 0)) { - // right meta went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x5c); - kdrmeta = 0; - } -} - -- (void) setRdpInstance:(freerdp *) instance width:(int) w andHeight:(int) h windowID:(int) windowID -{ - rdp_instance = instance; - context = instance->context; - width = w; - height = h; - savedWindowId = windowID; - - NSRect tr = NSMakeRect(0, 0, - [[NSScreen mainScreen] frame].size.width, - [[NSScreen mainScreen] frame].size.height); - - NSTrackingArea * trackingArea = [[NSTrackingArea alloc] initWithRect:tr options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingCursorUpdate | NSTrackingEnabledDuringMouseDrag | NSTrackingActiveAlways owner:self userInfo:nil]; - - [self addTrackingArea:trackingArea]; - - g_mrdpRailView = self; - - [self becomeFirstResponder]; - [self setAcceptsTouchEvents:YES]; - - // we want to be notified when window resizes.... - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:nil]; - - // ...moves - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:nil]; - - // ...and becomes the key window - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil]; -} - -- (void) setupBmiRep:(int) frameWidth :(int) frameHeight -{ - struct rgba_data - { - char red; - char green; - char blue; - char alpha; - }; - - if (pixelData) - free(pixelData); - - pixelData = (char *) malloc(frameWidth * frameHeight * sizeof(struct rgba_data)); - bmiRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **) &pixelData - pixelsWide:frameWidth - pixelsHigh:frameHeight - bitsPerSample:8 - samplesPerPixel:sizeof(struct rgba_data) - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bitmapFormat:0 - bytesPerRow:frameWidth * sizeof(struct rgba_data) - bitsPerPixel:0]; -} -- (void) beginGestureWithEvent:(NSEvent *)event -{ - gestureEventInProgress = YES; -} - -- (void) endGestureWithEvent:(NSEvent *)event -{ - gestureEventInProgress = NO; -} - -/** - * called when a bordered window changes size - */ - -- (void) windowDidResize:(NSNotification *) notification -{ - // if we are not the source of this notification, just return - if ([notification object] != [self mrdpRailWindow]) - return; - - // let RDP server know that window has moved - RAIL_WINDOW_MOVE_ORDER windowMove; - NSRect r = [[self window] frame]; - - int diffInHeight = [[self window] frame].size.height - [self frame].size.height; - r.size.height -= diffInHeight; - - apple_to_windowMove(&r, &windowMove); - windowMove.windowId = self->savedWindowId; - mac_send_rail_client_event(self->context->channels, RailChannel_ClientWindowMove, &windowMove); -} - -/** - * called when user moves a bordered window - */ - -- (void) windowDidMove:(NSNotification *) notification -{ - // if we are not the source of this notification, just return - if ([notification object] != [self mrdpRailWindow]) - return; - - // let RDP server know that window has moved - RAIL_WINDOW_MOVE_ORDER windowMove; - NSRect r = [[self window] frame]; - - int diffInHeight = [[self window] frame].size.height - [self frame].size.height; - r.size.height -= diffInHeight; - - apple_to_windowMove(&r, &windowMove); - windowMove.windowId = self->savedWindowId; - mac_send_rail_client_event(self->context->channels, RailChannel_ClientWindowMove, &windowMove); -} - -/** - * called when a NSWindow becomes the key window - */ - -- (void) windowDidBecomeKey:(NSNotification *) notification -{ - // if we are not the source of this notification, just return - if ([notification object] != [self mrdpRailWindow]) - return; - - if (![self activateWindow]) - return; - - [[self window] setAcceptsMouseMovedEvents: YES]; - - //if ([self activateWindow]) - mac_rail_send_activate(savedWindowId); - - // set_current_window(windowIndex); // ? code mis-merge? -} - -- (void) releaseResources -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -void rail_cvt_from_rect(char* dest, char* src, NSRect destRect, int destWidth, int destHeight, NSRect srcRect) -{ -} - -/** ********************************************************************* - * color space conversion used specifically in RAIL - ***********************************************************************/ -void rail_convert_color_space(char* destBuf, char* srcBuf, NSRect* destRect, int width, int height) -{ - int i; - int j; - int numRows; - int srcX; - int srcY; - int destX; - int destY; - int pixelsPerRow; - int pixel; - int pixel1; - int pixel2; - int * src32; - int * dest32; - - int destWidth = destRect->size.width; - int destHeight = destRect->size.height; - - if ((!destBuf) || (!srcBuf)) - return; - - numRows = (destRect->origin.y + destHeight > height) ? height - destRect->origin.y : destHeight; - pixelsPerRow = destWidth; - - srcX = destRect->origin.x; - srcY = destRect->origin.y; - destX = 0; - destY = 0; - - for (i = 0; i < numRows; i++) - { - src32 = (int *) (srcBuf + ((srcY + i) * width + srcX) * 4); - dest32 = (int *) (destBuf + ((destY + i) * destWidth + destX) * 4); - - for (j = 0; j < pixelsPerRow; j++) - { - pixel = *src32; - pixel1 = (pixel & 0x00ff0000) >> 16; - pixel2 = (pixel & 0x000000ff) << 16; - pixel = (pixel & 0xff00ff00) | pixel1 | pixel2; - - *dest32 = pixel; - - src32++; - dest32++; - } - } - - destRect->origin.y = destHeight - destRect->origin.y - destRect->size.height; - return; -} - -/** - * let RDP server know that window has moved - */ - -void rail_MoveWindow(rdpRail * rail, rdpWindow * window) -{ - if (g_mrdpRailView->isMoveSizeInProgress) - return; - - if (g_mrdpRailView->skipMoveWindowOnce) - { - g_mrdpRailView->skipMoveWindowOnce = NO; - return; - } - - // this rect is based on Windows co-ordinates... - NSRect r; - r.origin.x = window->windowOffsetX; - r.origin.y = window->windowOffsetY; - r.size.width = window->windowWidth; - r.size.height = window->windowHeight; - - windows_to_apple_cords(&r); - [[g_mrdpRailView window] setFrame:r display:YES]; -} - - -void mac_rail_send_activate(int window_id) -{ - RAIL_ACTIVATE_ORDER activate; - - activate.windowId = window_id; - activate.enabled = 1; - - mac_send_rail_client_event(g_mrdpRailView->context->channels, RailChannel_ClientActivate, &activate); -} - -@end - diff --git a/client/Mac/MRDPRailWindow.h b/client/Mac/MRDPRailWindow.h deleted file mode 100644 index 52f1c045a..000000000 --- a/client/Mac/MRDPRailWindow.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * MacFreeRDP - * - * Copyright 2012 Thomas Goddard - * - * 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. - */ - -#import - -@interface MRDPRailWindow : NSWindow - -@end diff --git a/client/Mac/MRDPRailWindow.m b/client/Mac/MRDPRailWindow.m deleted file mode 100644 index f714d610e..000000000 --- a/client/Mac/MRDPRailWindow.m +++ /dev/null @@ -1,29 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * MacFreeRDP - * - * Copyright 2012 Thomas Goddard - * - * 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. - */ - -#import "MRDPRailWindow.h" - -@implementation MRDPRailWindow - -- (BOOL) canBecomeKeyWindow -{ - return YES; -} - -@end diff --git a/client/Mac/MRDPView.h b/client/Mac/MRDPView.h index c15b35641..96b6f2bd0 100644 --- a/client/Mac/MRDPView.h +++ b/client/Mac/MRDPView.h @@ -19,8 +19,12 @@ #import +#ifdef HAVE_RAIL #import "MRDPWindow.h" -#import "freerdp/freerdp.h" +#endif + +/* + #import "freerdp/freerdp.h" #import "freerdp/types.h" #import "freerdp/channels/channels.h" #import "freerdp/gdi/gdi.h" @@ -32,6 +36,9 @@ #import "freerdp/rail/rail.h" #import "freerdp/rail.h" #import "freerdp/utils/rail.h" +*/ + + @interface MRDPView : NSView { @@ -43,17 +50,20 @@ NSTimer* pasteboard_timer; NSRect prevWinPosition; int titleBarHeight; - freerdp* rdp_instance; - rdpContext* rdp_context; + void* rdp_instance; + void* rdp_context; CGContextRef bitmap_context; char* pixel_data; int width; int height; int argc; char** argv; - - /* RemoteApp */ + +#ifdef HAVE_RAIL + // RemoteApp MRDPWindow* currentWindow; +#endif + NSPoint savedDragLocation; BOOL mouseInClientArea; BOOL isRemoteApp; @@ -62,7 +72,7 @@ BOOL skipResizeOnce; BOOL saveInitialDragLoc; BOOL skipMoveWindowOnce; - + /* store state info for some keys */ int kdlshift; int kdrshift; @@ -76,16 +86,17 @@ @public NSWindow* ourMainWindow; - NSPasteboard* pasteboard_rd; - NSPasteboard* pasteboard_wr; + NSPasteboard* pasteboard_rd; /* for reading from clipboard */ + NSPasteboard* pasteboard_wr; /* for writing to clipboard */ int pasteboard_changecount; int pasteboard_format; int is_connected; } +- (int) rdpConnect; - (void) rdpConnectError; - (void) rdpRemoteAppError; -- (void) saveStateInfo :(freerdp *) instance :(rdpContext *) context; +- (void) saveStateInfo :(void *) instance :(void *) context; - (void) onPasteboardTimerFired :(NSTimer *) timer; - (void) releaseResources; - (void) setViewSize : (int) width : (int) height; @@ -95,87 +106,11 @@ @end /* Pointer Flags */ -#define PTR_FLAGS_WHEEL 0x0200 -#define PTR_FLAGS_WHEEL_NEGATIVE 0x0100 -#define PTR_FLAGS_MOVE 0x0800 -#define PTR_FLAGS_DOWN 0x8000 -#define PTR_FLAGS_BUTTON1 0x1000 -#define PTR_FLAGS_BUTTON2 0x2000 -#define PTR_FLAGS_BUTTON3 0x4000 -#define WheelRotationMask 0x01FF - -void mf_Pointer_New(rdpContext* context, rdpPointer* pointer); -void mf_Pointer_Free(rdpContext* context, rdpPointer* pointer); -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_context_new(freerdp* instance, rdpContext* context); -void mac_context_free(freerdp* instance, rdpContext* context); -void mac_set_bounds(rdpContext* context, rdpBounds* bounds); -void mac_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap); -void mac_begin_paint(rdpContext* context); -void mac_end_paint(rdpContext* context); -void mac_save_state_info(freerdp* instance, rdpContext* context); -void skt_activity_cb(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void* data, void* info); -void channel_activity_cb(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void* data, void* info); -int register_fds(int* fds, int count, void* instance); -int invoke_draw_rect(rdpContext* context); -int process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data); -int receive_channel_data(freerdp* instance, int chan_id, BYTE* data, int size, int flags, int total_size); -void process_cliprdr_event(freerdp* instance, wMessage* event); -void cliprdr_process_cb_format_list_event(freerdp* instance, RDP_CB_FORMAT_LIST_EVENT* event); -void cliprdr_send_data_request(freerdp* instance, UINT32 format); -void cliprdr_process_cb_monitor_ready_event(freerdp* inst); -void cliprdr_process_cb_data_response_event(freerdp* instance, RDP_CB_DATA_RESPONSE_EVENT* event); -void cliprdr_process_text(freerdp* instance, BYTE* data, int len); -void cliprdr_send_supported_format_list(freerdp* instance); -int register_channel_fds(int* fds, int count, void* instance); - -void mac_process_rail_event(freerdp* instance, wMessage* event); -void mac_rail_register_callbacks(freerdp* instance, rdpRail* rail); -void mac_rail_CreateWindow(rdpRail* rail, rdpWindow* window); -void mac_rail_MoveWindow(rdpRail* rail, rdpWindow* window); -void mac_rail_ShowWindow(rdpRail* rail, rdpWindow* window, BYTE state); -void mac_rail_SetWindowText(rdpRail* rail, rdpWindow* window); -void mac_rail_SetWindowIcon(rdpRail* rail, rdpWindow* window, rdpIcon* icon); -void mac_rail_SetWindowRects(rdpRail* rail, rdpWindow* window); -void mac_rail_SetWindowVisibilityRects(rdpRail* rail, rdpWindow* window); -void mac_rail_DestroyWindow(rdpRail* rail, rdpWindow* window); -void mac_process_rail_get_sysparams_event(rdpChannels* channels, wMessage* event); -void mac_send_rail_client_event(rdpChannels* channels, UINT16 event_type, void* param); -void mac_on_free_rail_client_event(wMessage* event); -void mac_process_rail_server_sysparam_event(rdpChannels* channels, wMessage* event); -void mac_process_rail_exec_result_event(rdpChannels* channels, wMessage* event); -void mac_rail_enable_remoteapp_mode(void); -void mac_process_rail_server_minmaxinfo_event(rdpChannels* channels, wMessage* event); -void mac_process_rail_server_localmovesize_event(freerdp* instance, wMessage* event); -void apple_center_window(NSRect* r); -void apple_to_windowMove(NSRect* r, RAIL_WINDOW_MOVE_ORDER* windowMove); - -struct mac_context -{ - rdpContext _p; -}; - -struct cursor -{ - rdpPointer* pointer; - BYTE* cursor_data; - void* bmiRep; /* NSBitmapImageRep */ - void* nsCursor; /* NSCursor */ - void* nsImage; /* NSImage */ -}; - -struct rgba_data -{ - char red; - char green; - char blue; - char alpha; -}; - +#define PTR_FLAGS_WHEEL 0x0200 +#define PTR_FLAGS_WHEEL_NEGATIVE 0x0100 +#define PTR_FLAGS_MOVE 0x0800 +#define PTR_FLAGS_DOWN 0x8000 +#define PTR_FLAGS_BUTTON1 0x1000 +#define PTR_FLAGS_BUTTON2 0x2000 +#define PTR_FLAGS_BUTTON3 0x4000 +#define WheelRotationMask 0x01FF diff --git a/client/Mac/MRDPView.m b/client/Mac/MRDPView.m index db30f5830..8548f01dd 100644 --- a/client/Mac/MRDPView.m +++ b/client/Mac/MRDPView.m @@ -51,9 +51,113 @@ #include +#import "freerdp/freerdp.h" +#import "freerdp/types.h" +#import "freerdp/channels/channels.h" +#import "freerdp/gdi/gdi.h" +#import "freerdp/graphics.h" +#import "freerdp/utils/event.h" +#import "freerdp/client/cliprdr.h" +#import "freerdp/client/file.h" +#import "freerdp/client/cmdline.h" +#import "freerdp/rail/rail.h" +#import "freerdp/rail.h" +#import "freerdp/utils/rail.h" + +#ifdef HAVE_RAIL +#import "MRDPWindow.h" +#endif + // RAIL_TODO DELETE WHEN DONE TESTING #define MRDP_DRAW_INDIVIDUAL_RECTS + + +/****************************************** + Forward declarations + ******************************************/ + + +void mf_Pointer_New(rdpContext* context, rdpPointer* pointer); +void mf_Pointer_Free(rdpContext* context, rdpPointer* pointer); +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_context_new(freerdp* instance, rdpContext* context); +void mac_context_free(freerdp* instance, rdpContext* context); +void mac_set_bounds(rdpContext* context, rdpBounds* bounds); +void mac_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap); +void mac_begin_paint(rdpContext* context); +void mac_end_paint(rdpContext* context); +void mac_save_state_info(freerdp* instance, rdpContext* context); +void skt_activity_cb(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void* data, void* info); +void channel_activity_cb(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void* data, void* info); +int register_fds(int* fds, int count, void* instance); +int invoke_draw_rect(rdpContext* context); +int process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data); +int receive_channel_data(freerdp* instance, int chan_id, BYTE* data, int size, int flags, int total_size); +void process_cliprdr_event(freerdp* instance, wMessage* event); +void cliprdr_process_cb_format_list_event(freerdp* instance, RDP_CB_FORMAT_LIST_EVENT* event); +void cliprdr_send_data_request(freerdp* instance, UINT32 format); +void cliprdr_process_cb_monitor_ready_event(freerdp* inst); +void cliprdr_process_cb_data_response_event(freerdp* instance, RDP_CB_DATA_RESPONSE_EVENT* event); +void cliprdr_process_text(freerdp* instance, BYTE* data, int len); +void cliprdr_send_supported_format_list(freerdp* instance); +int register_channel_fds(int* fds, int count, void* instance); + +void mac_process_rail_event(freerdp* instance, wMessage* event); +void mac_rail_register_callbacks(freerdp* instance, rdpRail* rail); +void mac_rail_CreateWindow(rdpRail* rail, rdpWindow* window); +void mac_rail_MoveWindow(rdpRail* rail, rdpWindow* window); +void mac_rail_ShowWindow(rdpRail* rail, rdpWindow* window, BYTE state); +void mac_rail_SetWindowText(rdpRail* rail, rdpWindow* window); +void mac_rail_SetWindowIcon(rdpRail* rail, rdpWindow* window, rdpIcon* icon); +void mac_rail_SetWindowRects(rdpRail* rail, rdpWindow* window); +void mac_rail_SetWindowVisibilityRects(rdpRail* rail, rdpWindow* window); +void mac_rail_DestroyWindow(rdpRail* rail, rdpWindow* window); +void mac_process_rail_get_sysparams_event(rdpChannels* channels, wMessage* event); +void mac_send_rail_client_event(rdpChannels* channels, UINT16 event_type, void* param); +void mac_on_free_rail_client_event(wMessage* event); +void mac_process_rail_server_sysparam_event(rdpChannels* channels, wMessage* event); +void mac_process_rail_exec_result_event(rdpChannels* channels, wMessage* event); +void mac_rail_enable_remoteapp_mode(void); +void mac_process_rail_server_minmaxinfo_event(rdpChannels* channels, wMessage* event); +void mac_process_rail_server_localmovesize_event(freerdp* instance, wMessage* event); +void apple_center_window(NSRect* r); +void apple_to_windowMove(NSRect* r, RAIL_WINDOW_MOVE_ORDER * windowMove); + +struct mac_context +{ + // *must* have this - do not delete + rdpContext _p; +}; + +struct cursor +{ + rdpPointer* pointer; + BYTE* cursor_data; + void* bmiRep; /* NSBitmapImageRep */ + void* nsCursor; /* NSCursor */ + void* nsImage; /* NSImage */ +}; + +struct rgba_data +{ + char red; + char green; + char blue; + char alpha; +}; + + + + + + @implementation MRDPView MRDPView *g_mrdpview; @@ -71,6 +175,41 @@ const char* error_code_names[] = "RAIL_EXEC_E_SESSION_LOCKED" }; +//int rdp_connect() +- (int) rdpConnect +{ + int status; + freerdp* instance; + + freerdp_channels_global_init(); + + instance = freerdp_new(); + instance->PreConnect = mac_pre_connect; + instance->PostConnect = mac_post_connect; + instance->context_size = sizeof(struct mac_context); + instance->ContextNew = mac_context_new; + instance->ContextFree = mac_context_free; + instance->ReceiveChannelData = receive_channel_data; + instance->Authenticate = mac_authenticate; + freerdp_context_new(instance); + + status = freerdp_connect(instance); + + if (status) + { + freerdp_check_fds(instance); + [g_mrdpview setIs_connected:1]; + return 0; + } + + [g_mrdpview setIs_connected:0]; + [g_mrdpview rdpConnectError]; + + return -1; +} + + + /************************************************************************ methods we override ************************************************************************/ @@ -108,16 +247,19 @@ const char* error_code_names[] = [[self window] setAcceptsMouseMovedEvents:YES]; cursors = [[NSMutableArray alloc] initWithCapacity:10]; - + +#ifdef HAVE_RAIL firstCreateWindow = TRUE; skipResizeOnce = YES; windows = [[NSMutableArray alloc] initWithCapacity:10]; - + +#endif + // setup a mouse tracking area NSTrackingArea * trackingArea = [[NSTrackingArea alloc] initWithRect:[self visibleRect] options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingCursorUpdate | NSTrackingEnabledDuringMouseDrag | NSTrackingActiveWhenFirstResponder owner:self userInfo:nil]; //[self addTrackingArea:trackingArea]; - + // windows in RemoteApp (RAIL) mode cannot have title bars NSArray * args = [[NSProcessInfo processInfo] arguments]; for (NSString * str in args) @@ -132,6 +274,7 @@ const char* error_code_names[] = [self addTrackingArea:trackingArea]; mouseInClientArea = YES; + } /** ********************************************************************* @@ -170,7 +313,7 @@ const char* error_code_names[] = y = height - y; // send mouse motion event to RDP server - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_MOVE, x, y); + ((freerdp*)rdp_instance)->input->MouseEvent(((freerdp*)rdp_instance)->input, PTR_FLAGS_MOVE, x, y); } /** ********************************************************************* @@ -190,7 +333,7 @@ const char* error_code_names[] = y = height - y; - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1, x, y); + ((freerdp*)rdp_instance)->input->MouseEvent(((freerdp*)rdp_instance)->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1, x, y); } /** ********************************************************************* @@ -210,7 +353,7 @@ const char* error_code_names[] = y = height - y; - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_BUTTON1, x, y); + ((freerdp*)rdp_instance)->input->MouseEvent(((freerdp*)rdp_instance)->input, PTR_FLAGS_BUTTON1, x, y); } /** ********************************************************************* @@ -230,7 +373,7 @@ const char* error_code_names[] = y = height - y; - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON2, x, y); + ((freerdp*)rdp_instance)->input->MouseEvent(((freerdp*)rdp_instance)->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON2, x, y); } /** ********************************************************************* @@ -250,7 +393,7 @@ const char* error_code_names[] = y = height - y; - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_BUTTON2, x, y); + ((freerdp*)rdp_instance)->input->MouseEvent(((freerdp*)rdp_instance)->input, PTR_FLAGS_BUTTON2, x, y); } /** ********************************************************************* @@ -270,7 +413,7 @@ const char* error_code_names[] = y = height - y; - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON3, x, y); + ((freerdp*)rdp_instance)->input->MouseEvent(((freerdp*)rdp_instance)->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON3, x, y); } /** ********************************************************************* @@ -290,7 +433,7 @@ const char* error_code_names[] = y = height - y; - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_BUTTON3, x, y); + ((freerdp*)rdp_instance)->input->MouseEvent(((freerdp*)rdp_instance)->input, PTR_FLAGS_BUTTON3, x, y); } - (void) scrollWheel:(NSEvent *)event @@ -318,7 +461,7 @@ const char* error_code_names[] = x += (int) [event deltaX]; y += (int) [event deltaY]; - rdp_instance->input->MouseEvent(rdp_instance->input, flags, x, y); + ((freerdp*)rdp_instance)->input->MouseEvent(((freerdp*)rdp_instance)->input, flags, x, y); } /** ********************************************************************* @@ -337,6 +480,7 @@ const char* error_code_names[] = int x = (int) loc.x; int y = (int) loc.y; +#ifdef HAVE_RAIL // RAIL_TODO delete this if not reqd if ((isRemoteApp) && (isMoveSizeInProgress)) { @@ -356,11 +500,12 @@ const char* error_code_names[] = r.origin.y += newY; [[g_mrdpview window] setFrame:r display:YES]; } - +#endif + y = height - y; // send mouse motion event to RDP server - rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_MOVE, x, y); + ((freerdp*)rdp_instance)->input->MouseEvent(((freerdp*)rdp_instance)->input, PTR_FLAGS_MOVE, x, y); } /** ********************************************************************* @@ -383,7 +528,7 @@ const char* error_code_names[] = scancode = GetVirtualScanCodeFromVirtualKeyCode(vkcode, 4); extended = (scancode & KBDEXT) ? KBDEXT : 0; - rdp_instance->input->KeyboardEvent(rdp_instance->input, extended | KBD_FLAGS_DOWN, scancode & 0xFF); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, extended | KBD_FLAGS_DOWN, scancode & 0xFF); } /** ********************************************************************* @@ -406,7 +551,7 @@ const char* error_code_names[] = scancode = GetVirtualScanCodeFromVirtualKeyCode(vkcode, 4); extended = (scancode & KBDEXT) ? KBDEXT : 0; - rdp_instance->input->KeyboardEvent(rdp_instance->input, extended | KBD_FLAGS_RELEASE, scancode & 0xFF); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, extended | KBD_FLAGS_RELEASE, scancode & 0xFF); } /** ********************************************************************* @@ -432,96 +577,96 @@ const char* error_code_names[] = // left shift if ((kdlshift == 0) && ((mf & 2) != 0)) { // left shift went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_DOWN, 0x2a); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, KBD_FLAGS_DOWN, 0x2a); kdlshift = 1; } if ((kdlshift != 0) && ((mf & 2) == 0)) { // left shift went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x2a); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, KBD_FLAGS_RELEASE, 0x2a); kdlshift = 0; } // right shift if ((kdrshift == 0) && ((mf & 4) != 0)) { // right shift went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_DOWN, 0x36); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, KBD_FLAGS_DOWN, 0x36); kdrshift = 1; } if ((kdrshift != 0) && ((mf & 4) == 0)) { // right shift went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x36); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, KBD_FLAGS_RELEASE, 0x36); kdrshift = 0; } // left ctrl if ((kdlctrl == 0) && ((mf & 1) != 0)) { // left ctrl went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_DOWN, 0x1d); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, KBD_FLAGS_DOWN, 0x1d); kdlctrl = 1; } if ((kdlctrl != 0) && ((mf & 1) == 0)) { // left ctrl went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x1d); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, KBD_FLAGS_RELEASE, 0x1d); kdlctrl = 0; } // right ctrl if ((kdrctrl == 0) && ((mf & 0x2000) != 0)) { // right ctrl went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_DOWN, 0x1d); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, 1 | KBD_FLAGS_DOWN, 0x1d); kdrctrl = 1; } if ((kdrctrl != 0) && ((mf & 0x2000) == 0)) { // right ctrl went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x1d); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, 1 | KBD_FLAGS_RELEASE, 0x1d); kdrctrl = 0; } // left alt if ((kdlalt == 0) && ((mf & 0x20) != 0)) { // left alt went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_DOWN, 0x38); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, KBD_FLAGS_DOWN, 0x38); kdlalt = 1; } if ((kdlalt != 0) && ((mf & 0x20) == 0)) { // left alt went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x38); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, KBD_FLAGS_RELEASE, 0x38); kdlalt = 0; } // right alt if ((kdralt == 0) && ((mf & 0x40) != 0)) { // right alt went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_DOWN, 0x38); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, 1 | KBD_FLAGS_DOWN, 0x38); kdralt = 1; } if ((kdralt != 0) && ((mf & 0x40) == 0)) { // right alt went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x38); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, 1 | KBD_FLAGS_RELEASE, 0x38); kdralt = 0; } // left meta if ((kdlmeta == 0) && ((mf & 0x08) != 0)) { // left meta went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_DOWN, 0x5b); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, 1 | KBD_FLAGS_DOWN, 0x5b); kdlmeta = 1; } if ((kdlmeta != 0) && ((mf & 0x08) == 0)) { // left meta went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x5b); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, 1 | KBD_FLAGS_RELEASE, 0x5b); kdlmeta = 0; } // right meta if ((kdrmeta == 0) && ((mf & 0x10) != 0)) { // right meta went down - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_DOWN, 0x5c); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, 1 | KBD_FLAGS_DOWN, 0x5c); kdrmeta = 1; } if ((kdrmeta != 0) && ((mf & 0x10) == 0)) { // right meta went up - rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x5c); + ((freerdp*)rdp_instance)->input->KeyboardEvent(((freerdp*)rdp_instance)->input, 1 | KBD_FLAGS_RELEASE, 0x5c); kdrmeta = 0; } } @@ -536,12 +681,14 @@ const char* error_code_names[] = free(argv[i]); } +#ifdef HAVE_RAIL for (MRDPWindow * w in windows) { [w setWindow:nil]; [w setView:nil]; } - +#endif + if (!is_connected) return; @@ -566,9 +713,11 @@ const char* error_code_names[] = if (!rdp_context) return; +#ifdef HAVE_RAIL if (g_mrdpview->isRemoteApp && g_mrdpview->currentWindow) return; - +#endif + if(g_mrdpview->bitmap_context) { CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; @@ -595,7 +744,7 @@ const char* error_code_names[] = * save state info for use by other methods later on ***********************************************************************/ -- (void) saveStateInfo:(freerdp *) instance :(rdpContext *) context +- (void) saveStateInfo:(void *) instance :(void *) context { rdp_instance = instance; rdp_context = context; @@ -755,9 +904,11 @@ const char* error_code_names[] = [[g_mrdpview window] orderOut:g_mrdpview]; } +#ifdef HAVE_RAIL // RAIL_TODO is this func required - (void) windowDidResize:(NSNotification*) notification { + RAIL_WINDOW_MOVE_ORDER windowMove; printf("RAIL_TODO: MRDPView: windowDidResize() - not yet implemented\n"); @@ -786,8 +937,9 @@ const char* error_code_names[] = printf("----- LK_TODO: MRDPView:windowDidResize windowID=%d left=%d top=%d right=%d bottom=x%d width=%f height=%f\n", [currentWindow windowID], windowMove.left, windowMove.top, windowMove.right, windowMove.bottom, r.size.width, r.size.height); - //mac_send_rail_client_event(g_mrdpview->rdp_instance->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove); + //mac_send_rail_client_event(g_mrdpview->((freerdp*)rdp_instance)->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove); } +#endif /************************************************************************ * * @@ -801,37 +953,6 @@ const char* error_code_names[] = * @return 0 on success, -1 on failure ***********************************************************************/ -int rdp_connect() -{ - int status; - freerdp* instance; - - freerdp_channels_global_init(); - - instance = freerdp_new(); - instance->PreConnect = mac_pre_connect; - instance->PostConnect = mac_post_connect; - instance->context_size = sizeof(struct mac_context); - instance->ContextNew = mac_context_new; - instance->ContextFree = mac_context_free; - instance->ReceiveChannelData = receive_channel_data; - instance->Authenticate = mac_authenticate; - freerdp_context_new(instance); - - status = freerdp_connect(instance); - - if (status) - { - freerdp_check_fds(instance); - [g_mrdpview setIs_connected:1]; - return 0; - } - - [g_mrdpview setIs_connected:0]; - [g_mrdpview rdpConnectError]; - - return -1; -} /** ********************************************************************* * a callback given to freerdp_connect() to process the pre-connect operations. @@ -1038,12 +1159,14 @@ BOOL mac_post_connect(freerdp* instance) register_channel_fds(fds, rd_count, instance); freerdp_channels_post_connect(instance->context->channels, instance); - + +#ifdef HAVE_RAIL /* setup RemoteApp */ instance->context->rail = rail_new(instance->settings); rail_register_update_callbacks(instance->context->rail, instance->update); mac_rail_register_callbacks(instance, instance->context->rail); - +#endif + /* setup pasteboard (aka clipboard) for copy operations (write only) */ g_mrdpview->pasteboard_wr = [NSPasteboard generalPasteboard]; @@ -1281,14 +1404,16 @@ void mac_end_paint(rdpContext* context) if (context->gdi->drawing != context->gdi->primary) return; - gdi = g_mrdpview->rdp_context->gdi; + gdi = ((rdpContext*)g_mrdpview->rdp_context)->gdi; +#ifdef HAVE_RAIL if (g_mrdpview->isRemoteApp && g_mrdpview->currentWindow) { [[g_mrdpview->currentWindow view] updateDisplay]; return; } - +#endif + for (i = 0; i < gdi->primary->hdc->hwnd->ninvalid; i++) { drawRect.origin.x = gdi->primary->hdc->hwnd->cinvalid[i].x; @@ -1333,10 +1458,11 @@ void channel_activity_cb(CFSocketRef s, CFSocketCallBackType callbackType, { switch (GetMessageClass(event->id)) { +#ifdef HAVE_RAIL case RailChannel_Class: mac_process_rail_event(instance, event); break; - +#endif case CliprdrChannel_Class: process_cliprdr_event(instance, event); break; @@ -1617,6 +1743,9 @@ void cliprdr_send_supported_format_list(freerdp* instance) freerdp_channels_send_event(instance->context->channels, (wMessage*) event); } + +#ifdef HAVE_RAIL + /**************************************************************************************** * * * * @@ -1715,7 +1844,7 @@ void mac_rail_CreateWindow(rdpRail* rail, rdpWindow* window) RAIL_WINDOW_MOVE_ORDER windowMove; apple_to_windowMove(&winFrame, &windowMove); windowMove.windowId = window->windowId; - mac_send_rail_client_event(g_mrdpview->rdp_instance->context->channels, RailChannel_ClientWindowMove, &windowMove); + mac_send_rail_client_event(((freerdp*)g_mrdpview->rdp_instance)->context->channels, RailChannel_ClientWindowMove, &windowMove); } /* create MRDPRailView and add to above window */ @@ -2031,6 +2160,8 @@ void mac_rail_enable_remoteapp_mode() g_mrdpview->isRemoteApp = TRUE; } +#endif + /** * given a rect with 0,0 at the bottom left (apple cords) * convert it to a rect with 0,0 at the top left (windows cords) @@ -2057,6 +2188,7 @@ void apple_center_window(NSRect* r) r->origin.y = (g_mrdpview->height - r->size.height) / 2; } +#ifdef HAVE_RAIL void apple_to_windowMove(NSRect* r, RAIL_WINDOW_MOVE_ORDER* windowMove) { windowMove->left = (UINT16) r->origin.x; // x-cord of top left corner @@ -2064,5 +2196,7 @@ void apple_to_windowMove(NSRect* r, RAIL_WINDOW_MOVE_ORDER* windowMove) windowMove->right = (UINT16) (windowMove->left + r->size.width); // x-cord of bottom right corner windowMove->bottom = (UINT16) (windowMove->top + r->size.height); // y-cord of bottom right corner } +#endif + @end diff --git a/client/Mac/MRDPWindow.h b/client/Mac/MRDPWindow.h deleted file mode 100644 index 0e7e26b97..000000000 --- a/client/Mac/MRDPWindow.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * MacFreeRDP - * - * Copyright 2012 Thomas Goddard - * - * 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. - */ - -#import -#import "MRDPRailView.h" -#import "MRDPRailWindow.h" - -@interface MRDPWindow : NSObject -{ -} - -@property (assign) int windowID; -@property (retain) MRDPRailWindow* window; -@property (retain) MRDPRailView* view; - -@end - diff --git a/client/Mac/MRDPWindow.m b/client/Mac/MRDPWindow.m deleted file mode 100644 index e5e5e402f..000000000 --- a/client/Mac/MRDPWindow.m +++ /dev/null @@ -1,28 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * MacFreeRDP - * - * Copyright 2012 Thomas Goddard - * - * 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 "MRDPWindow.h" - -@implementation MRDPWindow - -@synthesize windowID; -@synthesize window; -@synthesize view; - -@end diff --git a/client/Mac/PasswordDialog.h b/client/Mac/PasswordDialog.h index d95783ab2..3e22de7dd 100644 --- a/client/Mac/PasswordDialog.h +++ b/client/Mac/PasswordDialog.h @@ -20,7 +20,15 @@ #import @interface PasswordDialog : NSWindowController - +{ +@public + NSTextField* usernameText; + NSTextField* passwordText; + NSTextField* messageLabel; + NSString* serverHostname; + NSString* username; + NSString* password; +} @property (retain) IBOutlet NSTextField* usernameText; @property (retain) IBOutlet NSTextField* passwordText; @property (retain) IBOutlet NSTextField* messageLabel; diff --git a/client/Mac/README.txt b/client/Mac/README.txt deleted file mode 100644 index 39fe93f73..000000000 --- a/client/Mac/README.txt +++ /dev/null @@ -1,140 +0,0 @@ - -------------------------------------------------------------------------- - Building FreeRDP on Mac OS X -------------------------------------------------------------------------- - -Platform: Lion with Xcode 4.3.2 - ------------------- - installing cmake ------------------- - -first install macports by googling for it, the run the following command -sudo port install cmake - ----------------- - installing gcc ----------------- -Click on Xcode->Preferences->Downloads -Click on Components -Click on Install Command line tools - -You will be prompted for your Apple Developer userid and password - ----------------------------------------- - download FreeRDP source code using git ----------------------------------------- - -mkdir ~/projects/A8 -cd ~/projects/A8 -git clone git://github.com/FreeRDP/FreeRDP.git - ------------------- - building FreeRDP ------------------- - -cd ~projects/A8/FreeRDP -cmake -DWITH_MACAUDIO=ON -DCMAKE_INSTALL_PREFIX="" -make -make install - ------------------------- - creating Xcode project ------------------------- - -Start xcode -Select 'Create a new xcode project' -In 'Choose a template for your new project', click on Mac OS X -> application -Click on 'Cocoa Application' -Click on next -I used the following: -Product Name: Mac -Company Identifier: com.freerdp -Check 'Automatic Reference Counting' -Create the project in your directory of choice - -------------------------------- - Adding files to your projects -------------------------------- - -Add the following files to your project: - -cd ~/projects/A8/FreeRDP/client/Mac/MRDPCursor.h -cd ~/projects/A8/FreeRDP/client/Mac/MRDPCursor.m -cd ~/projects/A8/FreeRDP/client/Mac/MRDPView.h -cd ~/projects/A8/FreeRDP/client/Mac/MRDPView.m - -This is what your AppDelegate.h file should like like - -#import -#import "MRDPView.h" - -@interface AppDelegate : NSObject - -@property (assign) IBOutlet NSWindow *window; -@property (assign) IBOutlet MRDPView *mrdpView; - -int rdp_connect(); - -@end - -This is what your AppDelegate.m file should like like - -#import "AppDelegate.h" - -@implementation AppDelegate - -@synthesize window = _window; -@synthesize mrdpView; - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification -{ - rdp_connect(); -} - -- (void) applicationWillTerminate:(NSNotification *)notification -{ - [mrdpView releaseResources]; -} - -@end - ----------------------------------- - Modifying your MainMenu.xib file ----------------------------------- - -In your project select MainMenu.xib and drag a NSView object into the main window -Name the class MRDPView -In Interface Builder, select the Application Delegate and tie the mrdpview outlet to the NSView -Set the default size of the main window to 1024x768. This is FreeRDP's default resolution - ----------------------------- - Configuring build settings ----------------------------- - -In Project Navigator, click on Mac -Click on Targets -> Mac -Click on Build Phases -Click on 'Link Binary With Libraries' and click on the + button, then click on the 'Add Other' button to add the following dynamic libraries -~/projects/A8/FreeRDP/libfreerdp-core/libfreerdp-core.dylib -~/projects/A8/FreeRDP/libfreerdp-channels/libfreerdp-channels.dylilb -~/projects/A8/FreeRDP/libfreerdp-utils/libfreerdp-utils.dylib -~/projects/A8/FreeRDP/libfreerdp-codec/libfreerdp-codec.dylib -~/projects/A8/FreeRDP/libfreerdp-cache/libfreerdp-cache.dylib -~/projects/A8/FreeRDP/libfreerdp-gdi/libfreerdp-gdi.dylib - -Click on 'Build Settings' -In 'Search Paths -> Library Search Paths' set the following - Header Search Path Debug: ~/projects/A8/FreeRDP/include - Header Search Path Release: ~/projects/A8/FreeRDP/include - -TODO: in build settings, set strip build product to yes when done debugging - ---------------------------- - To deploy the application ---------------------------- - -in xcode, click on Product->Archive -Click on Distribute button -Select Export As -> application - diff --git a/client/Mac/cli/AppDelegate.h b/client/Mac/cli/AppDelegate.h new file mode 100644 index 000000000..b24cbeeab --- /dev/null +++ b/client/Mac/cli/AppDelegate.h @@ -0,0 +1,22 @@ +// +// AppDelegate.h +// MacClient2 +// +// Created by Benoît et Kathy on 2013-05-08. +// +// + +#import +#import + +@interface AppDelegate : NSObject +{ +@public + NSWindow* window; + MRDPView* mrdpView; +} + +@property (assign) IBOutlet NSWindow *window; +@property (assign) IBOutlet MRDPView *mrdpView; + +@end diff --git a/client/Mac/cli/AppDelegate.m b/client/Mac/cli/AppDelegate.m new file mode 100644 index 000000000..8fca18cb7 --- /dev/null +++ b/client/Mac/cli/AppDelegate.m @@ -0,0 +1,32 @@ +// +// AppDelegate.m +// MacClient2 +// +// Created by Benoît et Kathy on 2013-05-08. +// +// + +#import "AppDelegate.h" + +@implementation AppDelegate + +- (void)dealloc +{ + [super dealloc]; +} + +@synthesize window = window; + +@synthesize mrdpView = mrdpView; + +- (void)applicationDidFinishLaunching:(NSNotification*)aNotification +{ + [mrdpView rdpConnect]; +} + +- (void) applicationWillTerminate:(NSNotification*)notification +{ + [mrdpView releaseResources]; +} + +@end diff --git a/client/Mac/cli/CMakeLists.txt b/client/Mac/cli/CMakeLists.txt new file mode 100644 index 000000000..789bd5cde --- /dev/null +++ b/client/Mac/cli/CMakeLists.txt @@ -0,0 +1,127 @@ +project(MacFreeRDP-client) + +set(MODULE_NAME "MacFreeRDP-client") +set(MODULE_PREFIX "FREERDP_CLIENT_MAC_CLIENT") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mmacosx-version-min=10.4") + +# Import libraries +find_library(FOUNDATION_LIBRARY Foundation) +find_library(COCOA_LIBRARY Cocoa) +find_library(APPKIT_LIBRARY AppKit) +find_library(FREERDP_LIBRARY NAMES MacFreeRDP-library PATHS ${CMAKE_CURRENT_BINARY_DIR}/../${CONFIGURATION}) + +set(MACOSX_BUNDLE_INFO_STRING "MacFreeRDP-client") +set(MACOSX_BUNDLE_ICON_FILE "FreeRDP.icns") +set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.freerdp.mac") +set(MACOSX_BUNDLE_BUNDLE_IDENTIFIER "FreeRDP-client.Mac") +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_NSMAIN_NIB_FILE "MainMenu") +set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "NSApplication") + +mark_as_advanced(COCOA_LIBRARY FOUNDATION_LIBRARY APPKIT_LIBRARY) +set(APP_TYPE MACOSX_BUNDLE) + +# OS X Interface Builder files +file(GLOB ${MODULE_NAME}_XIBS *.xib) + +set(${MODULE_NAME}_RESOURCES ${MACOSX_BUNDLE_ICON_FILE}) + +# Include XIB file in Xcode resources. +if("${CMAKE_GENERATOR}" MATCHES "Xcode") + message(STATUS "Adding Xcode XIB resources for ${MODULE_NAME}") + set(${MODULE_NAME}_RESOURCES ${${MODULE_NAME}_RESOURCES} ${${MODULE_NAME}_XIBS}) +endif("${CMAKE_GENERATOR}" MATCHES "Xcode") + +# Headers +file(GLOB ${MODULE_NAME}_HEADERS *.h) + +# Source +file(GLOB ${MODULE_NAME}_SOURCES *.m) + +add_executable(${MODULE_NAME} + ${APP_TYPE} + ${${MODULE_NAME}_HEADERS} + ${${MODULE_NAME}_SOURCES} + ${${MODULE_NAME}_RESOURCES}) + +# This is necessary for the xib file part below +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) + +# This allows for automatic xib to nib ibitool +set_target_properties(${MODULE_NAME} PROPERTIES RESOURCE "${${MODULE_NAME}_RESOURCES}") + +# Automatic ref counting +# temporary turn off for x86_64 build issue +# 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") + +# Tell the compiler where to look for the FreeRDP framework +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v -F../") + +# Tell XCode where to look for the MacFreeRDP-library framework +set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS + "${XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS} ${CMAKE_CURRENT_BINARY_DIR}/../$(CONFIGURATION)") + + +# XCode project architecture to native architecture of build machine +# ----------------------------------------------------------------------------------------------------- +# Issue: Had some issues with FreeRDP project building only 64 bit and +# MacFreeRDP attempting to link to both 32 and 64 for dual target. +# In the future the FreeRDP Xcode project should be pulled in for a couple of reasons: +# 1) better step-into debugging 2) automatic dependency compilation and multi-arch compilation + linkage +# If you know the solutions for 1 and 2, please add below. +set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_ARCHS "$(NATIVE_ARCH_ACTUAL)") + +# Set the info plist to the custom instance +set_target_properties(${MODULE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) + +# Disable transitive linking +# ${FREERDP_LIBRARY} +target_link_libraries(${MODULE_NAME} ${COCOA_LIBRARY} ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY} MacFreeRDP-library) + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Mac") + +# Embed the FreeRDP framework into the app bundle +add_custom_command(TARGET ${MODULE_NAME} POST_BUILD + COMMAND mkdir ARGS -p ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.app/Contents/Frameworks + COMMAND ditto ${CMAKE_CURRENT_BINARY_DIR}/../$(CONFIGURATION)/MacFreeRDP-library.framework ${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.app/Contents/Frameworks/MacFreeRDP-library.framework + COMMAND install_name_tool -change "@executable_path/../../Frameworks/MacFreeRDP-library.framework/Versions/1.1.0/MacFreeRDP-library" "@executable_path/../Frameworks/MacFreeRDP-library.framework/Versions/Current/MacFreeRDP-library" "${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)/${MODULE_NAME}.app/Contents/MacOS/${MODULE_NAME}" + COMMENT Setting install name for MacFreeRDP-library + + ) + + +# Add post-build NIB file generation in unix makefiles. XCode handles this implicitly. +if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") + message(STATUS "Adding post-build NIB file generation event for ${MODULE_NAME}") + + # Make sure we can find the 'ibtool' program. If we can NOT find it we + # skip generation of this project + find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin") + if (${IBTOOL} STREQUAL "IBTOOL-NOTFOUND") + message(SEND_ERROR "ibtool can not be found and is needed to compile the .xib files. It should have been installed with + the Apple developer tools. The default system paths were searched in addition to ${OSX_DEVELOPER_ROOT}/usr/bin") + endif() + + # 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) + + # Compile the .xib files using the 'ibtool' program with the destination being the app package + foreach(xib ${${MODULE_NAME}_XIBS}) + get_filename_component(XIB_WE ${xib} NAME_WE) + + 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} + COMMENT "Compiling ${xib}") + endforeach() + +endif("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") \ No newline at end of file diff --git a/client/Mac/FreeRDP.icns b/client/Mac/cli/FreeRDP.icns similarity index 100% rename from client/Mac/FreeRDP.icns rename to client/Mac/cli/FreeRDP.icns diff --git a/client/Mac/cli/Info.plist b/client/Mac/cli/Info.plist new file mode 100644 index 000000000..cb6976502 --- /dev/null +++ b/client/Mac/cli/Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + + CFBundleIconFile + FreeRDP + CFBundleIdentifier + FreeRDP.Mac + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + + NSHumanReadableCopyright + Copyright © 2012 __MyCompanyName__. All rights reserved. + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/client/Mac/cli/MacClient2-Info.plist b/client/Mac/cli/MacClient2-Info.plist new file mode 100644 index 000000000..6efd7bddc --- /dev/null +++ b/client/Mac/cli/MacClient2-Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + awakecoding.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/client/Mac/cli/MacClient2-Prefix.pch b/client/Mac/cli/MacClient2-Prefix.pch new file mode 100644 index 000000000..f81d50593 --- /dev/null +++ b/client/Mac/cli/MacClient2-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'MacClient2' target in the 'MacClient2' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/client/Mac/MainMenu.xib b/client/Mac/cli/MainMenu.xib similarity index 98% rename from client/Mac/MainMenu.xib rename to client/Mac/cli/MainMenu.xib index e535cbe12..90e992462 100755 --- a/client/Mac/MainMenu.xib +++ b/client/Mac/cli/MainMenu.xib @@ -2,10 +2,10 @@ 1070 - 12C60 + 12D78 3084 - 1187.34 - 625.00 + 1187.37 + 626.00 com.apple.InterfaceBuilder.CocoaPlugin 3084 @@ -375,7 +375,7 @@ - 565 + 569 @@ -383,7 +383,7 @@ - 567 + 570 @@ -736,7 +736,7 @@ - 568 + 570 @@ -770,6 +770,14 @@ ./Classes/MRDPView.h + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + 0 diff --git a/client/Mac/cli/en.lproj/Credits.rtf b/client/Mac/cli/en.lproj/Credits.rtf new file mode 100644 index 000000000..46576ef21 --- /dev/null +++ b/client/Mac/cli/en.lproj/Credits.rtf @@ -0,0 +1,29 @@ +{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} +{\colortbl;\red255\green255\blue255;} +\paperw9840\paperh8400 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural + +\f0\b\fs24 \cf0 Engineering: +\b0 \ + Some people\ +\ + +\b Human Interface Design: +\b0 \ + Some other people\ +\ + +\b Testing: +\b0 \ + Hopefully not nobody\ +\ + +\b Documentation: +\b0 \ + Whoever\ +\ + +\b With special thanks to: +\b0 \ + Mom\ +} diff --git a/client/Mac/cli/en.lproj/InfoPlist.strings b/client/Mac/cli/en.lproj/InfoPlist.strings new file mode 100644 index 000000000..477b28ff8 --- /dev/null +++ b/client/Mac/cli/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/client/Mac/cli/en.lproj/MainMenu.xib b/client/Mac/cli/en.lproj/MainMenu.xib new file mode 100644 index 000000000..dd4e1905e --- /dev/null +++ b/client/Mac/cli/en.lproj/MainMenu.xib @@ -0,0 +1,3299 @@ + + + + 1080 + 12D78 + 3084 + 1187.37 + 626.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 3084 + + + IBNSLayoutConstraint + NSCustomObject + NSCustomView + NSMenu + NSMenuItem + NSView + NSWindowTemplate + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + + + MacClient2 + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + MacClient2 + + + + About MacClient2 + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide MacClient2 + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit MacClient2 + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save… + s + 1048576 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find and Replace… + f + 1572864 + 2147483647 + + + 12 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + + + Show Spelling and Grammar + : + 1048576 + 2147483647 + + + + + + Check Document Now + ; + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + Correct Spelling Automatically + + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + + + Show Substitutions + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Dashes + + 2147483647 + + + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + Text Replacement + + 2147483647 + + + + + + + + + Transformations + + 2147483647 + + + submenuAction: + + Transformations + + + + Make Upper Case + + 2147483647 + + + + + + Make Lower Case + + 2147483647 + + + + + + Capitalize + + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + + + Font + + 2147483647 + + + submenuAction: + + Font + + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligatures + + 2147483647 + + + submenuAction: + + Ligatures + + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Writing Direction + + 2147483647 + + + submenuAction: + + Writing Direction + + + + YES + Paragraph + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + YES + Selection + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + + + MacClient2 Help + ? + 1048576 + 2147483647 + + + + + _NSHelpMenu + + + + _NSMainMenu + + + 15 + 2 + {{335, 390}, {480, 360}} + 1954021376 + MacClient2 + NSWindow + + + + + 256 + + + + 268 + {480, 360} + + _NS:9 + MRDPView + + + {480, 360} + + + + {{0, 0}, {1440, 878}} + {10000000000000, 10000000000000} + YES + + + AppDelegate + + + NSFontManager + + + + + + + terminate: + + + + 449 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + delegate + + + + 495 + + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + saveDocument: + + + + 362 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + toggleAutomaticSpellingCorrection: + + + + 456 + + + + orderFrontSubstitutionsPanel: + + + + 458 + + + + toggleAutomaticDashSubstitution: + + + + 461 + + + + toggleAutomaticTextReplacement: + + + + 463 + + + + uppercaseWord: + + + + 464 + + + + capitalizeWord: + + + + 467 + + + + lowercaseWord: + + + + 468 + + + + pasteAsPlainText: + + + + 486 + + + + performFindPanelAction: + + + + 487 + + + + performFindPanelAction: + + + + 488 + + + + performFindPanelAction: + + + + 489 + + + + showHelp: + + + + 493 + + + + alignCenter: + + + + 518 + + + + pasteRuler: + + + + 519 + + + + toggleRuler: + + + + 520 + + + + alignRight: + + + + 521 + + + + copyRuler: + + + + 522 + + + + alignJustified: + + + + 523 + + + + alignLeft: + + + + 524 + + + + makeBaseWritingDirectionNatural: + + + + 525 + + + + makeBaseWritingDirectionLeftToRight: + + + + 526 + + + + makeBaseWritingDirectionRightToLeft: + + + + 527 + + + + makeTextWritingDirectionNatural: + + + + 528 + + + + makeTextWritingDirectionLeftToRight: + + + + 529 + + + + makeTextWritingDirectionRightToLeft: + + + + 530 + + + + performFindPanelAction: + + + + 535 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + mrdpView + + + + 549 + + + + window + + + + 550 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + + + + + + + + + + + + 19 + + + + + + + + 56 + + + + + + + + 217 + + + + + + + + 83 + + + + + + + + 81 + + + + + + + + + + + + + + + + + 75 + + + + + 78 + + + + + 72 + + + + + 82 + + + + + 124 + + + + + + + + 77 + + + + + 73 + + + + + 79 + + + + + 112 + + + + + 74 + + + + + 125 + + + + + + + + 126 + + + + + 205 + + + + + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + + + + + + 216 + + + + + + + + 200 + + + + + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 57 + + + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + + + 144 + + + + + 129 + + + + + 143 + + + + + 236 + + + + + 131 + + + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + + + + + + 296 + + + + + + + + + 297 + + + + + 298 + + + + + 211 + + + + + + + + 212 + + + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + + + + + + 349 + + + + + + + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + + + + + + 372 + + + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 4 + 0 + + 4 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + 3 + 0 + + 3 + 1 + + 0.0 + + 1000 + + 8 + 29 + 3 + + + + + + + 375 + + + + + + + + 376 + + + + + + + + + 377 + + + + + + + + 388 + + + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + + + + + + 398 + + + + + + + + 399 + + + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + + + + + + 451 + + + + + + + + + + 452 + + + + + 453 + + + + + 454 + + + + + 457 + + + + + 459 + + + + + 460 + + + + + 462 + + + + + 465 + + + + + 466 + + + + + 485 + + + + + 490 + + + + + + + + 491 + + + + + + + + 492 + + + + + 494 + + + + + 496 + + + + + + + + 497 + + + + + + + + + + + + + + + + + 498 + + + + + 499 + + + + + 500 + + + + + 501 + + + + + 502 + + + + + 503 + + + + + + + + 504 + + + + + 505 + + + + + 506 + + + + + 507 + + + + + 508 + + + + + + + + + + + + + + + + 509 + + + + + 510 + + + + + 511 + + + + + 512 + + + + + 513 + + + + + 514 + + + + + 515 + + + + + 516 + + + + + 517 + + + + + 534 + + + + + 536 + + + + + 542 + + + + + 544 + + + + + 545 + + + + + 546 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{380, 496}, {480, 360}} + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 550 + + + 0 + IBCocoaFramework + YES + 3 + + {11, 11} + {10, 3} + + YES + + diff --git a/client/Mac/cli/main.m b/client/Mac/cli/main.m new file mode 100644 index 000000000..b1ed1e5f4 --- /dev/null +++ b/client/Mac/cli/main.m @@ -0,0 +1,16 @@ +// +// main.m +// MacClient2 +// +// Created by Benoît et Kathy on 2013-05-08. +// +// + +#import +#import + +int main(int argc, char *argv[]) +{ + [MRDPView class]; + return NSApplicationMain(argc, (const char **)argv); +} diff --git a/client/Mac/en.lproj/InfoPlist.strings b/client/Mac/en.lproj/InfoPlist.strings new file mode 100644 index 000000000..477b28ff8 --- /dev/null +++ b/client/Mac/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/client/Mac/main.m b/client/Mac/main.m index 5726f5c03..4cba6cfc1 100644 --- a/client/Mac/main.m +++ b/client/Mac/main.m @@ -19,7 +19,7 @@ #import -int main(int argc, char* argv[]) +int main(int argc, char *argv[]) { - return NSApplicationMain(argc, (const char**) argv); + return NSApplicationMain(argc, (const char **)argv); }