diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 784b5c2f..8e01e4ee 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -788,12 +788,6 @@ class InternalCommands: shutil.copy(targetDir + "/synergys", bundleBinDir) shutil.copy(targetDir + "/syntool", bundleBinDir) - if self.macSdk == "10.9": - launchServicesDir = dir + "/Synergy.app/Contents/Library/LaunchServices/" - if not os.path.exists(launchServicesDir): - os.makedirs(launchServicesDir) - shutil.copy(targetDir + "/synmacph", launchServicesDir) - if self.enableMakeGui: self.loadConfig() diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 7d826227..4f8fcabb 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -100,9 +100,7 @@ HEADERS += src/MainWindow.h \ src/CoreInterface.h RESOURCES += res/Synergy.qrc RC_FILE = res/win/Synergy.rc -macx { - HEADERS += src/AXDatabaseCleaner.h - OBJECTIVE_SOURCES += src/AXDatabaseCleaner.mm +macx { QMAKE_INFO_PLIST = res/mac/Info.plist TARGET = Synergy QSYNERGY_ICON.files = res/mac/Synergy.icns diff --git a/src/gui/res/mac/Info.plist b/src/gui/res/mac/Info.plist index 992df616..c2e4eac7 100644 --- a/src/gui/res/mac/Info.plist +++ b/src/gui/res/mac/Info.plist @@ -17,9 +17,5 @@ CFBundleIdentifier synergy SMPrivilegedExecutables - - synmacph - anchor apple generic and identifier "synmacph" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = SP58PFWX5L) - diff --git a/src/gui/src/AXDatabaseCleaner.h b/src/gui/src/AXDatabaseCleaner.h deleted file mode 100644 index dc41f31b..00000000 --- a/src/gui/src/AXDatabaseCleaner.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2014 Synergy Si Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include - -// HACK: ideally this file should not be included in project, -// if it is below marvericks, but it seems that .pro can't -// specify mac version -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 - -class AXDatabaseCleaner { -public: - AXDatabaseCleaner(); - ~AXDatabaseCleaner(); - - bool loadPrivilegeHelper(); - bool xpcConnect(); - bool privilegeCommand(const char* command); - -private: - class Private; - Private* m_private; - bool m_waitForResponse; -}; - -#endif diff --git a/src/gui/src/AXDatabaseCleaner.mm b/src/gui/src/AXDatabaseCleaner.mm deleted file mode 100644 index 96435b1e..00000000 --- a/src/gui/src/AXDatabaseCleaner.mm +++ /dev/null @@ -1,166 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2014 Synergy Si Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#import "AXDatabaseCleaner.h" - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 - -#import -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 -#import -#endif -#import -#import -#import - -const NSString* const label = @"synmacph"; - -class AXDatabaseCleaner::Private { -public: - NSAutoreleasePool* autoReleasePool; - AuthorizationRef authRef; - xpc_connection_t xpcConnection; -}; - -AXDatabaseCleaner::AXDatabaseCleaner() -{ - m_private = new Private; - m_private->autoReleasePool = [[NSAutoreleasePool alloc] init]; - - m_waitForResponse = false; -} - -AXDatabaseCleaner::~AXDatabaseCleaner() -{ - [m_private->autoReleasePool release]; - delete m_private; -} - -bool AXDatabaseCleaner::loadPrivilegeHelper() -{ -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 // mavericks - - OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &m_private->authRef); - if (status != errAuthorizationSuccess) { - assert(NO); - m_private->authRef = NULL; - } - - AuthorizationItem authItem = {kSMRightBlessPrivilegedHelper, 0, NULL, 0}; - AuthorizationRights authRights = {1, &authItem}; - AuthorizationFlags flags = kAuthorizationFlagDefaults - | kAuthorizationFlagInteractionAllowed - | kAuthorizationFlagPreAuthorize - | kAuthorizationFlagExtendRights; - - BOOL result = NO; - NSError* error = nil; - - status = AuthorizationCopyRights(m_private->authRef, &authRights, kAuthorizationEmptyEnvironment, flags, NULL); - if (status != errAuthorizationSuccess) { - error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; - } - else { - CFErrorRef cfError; - result = (BOOL)SMJobBless(kSMDomainSystemLaunchd, (CFStringRef)label, m_private->authRef, &cfError); - - if (!result) { - error = CFBridgingRelease(cfError); - } - } - - if (!result) { - assert(error != nil); - NSLog(@"bless error: domain= %@ / code= %d", [error domain], (int) [error code]); - return false; - } - - return true; -} - -bool AXDatabaseCleaner::xpcConnect() -{ - const char *cStr = [label cStringUsingEncoding:NSASCIIStringEncoding]; - m_private->xpcConnection = xpc_connection_create_mach_service( - cStr, - NULL, - XPC_CONNECTION_MACH_SERVICE_PRIVILEGED); - - if (!m_private->xpcConnection) { - NSLog(@"failed to create xpc connection"); - return false; - } - - xpc_connection_set_event_handler(m_private->xpcConnection, ^(xpc_object_t event) { - xpc_type_t type = xpc_get_type(event); - - if (type == XPC_TYPE_ERROR) { - if (event == XPC_ERROR_CONNECTION_INTERRUPTED) { - NSLog(@"xpc connection interupted"); - - } - else if (event == XPC_ERROR_CONNECTION_INVALID) { - NSLog(@"xpc connection invalid, releasing"); - xpc_release(m_private->xpcConnection); - } - else { - NSLog(@"unexpected xpc connection error"); - } - } - else { - NSLog(@"unexpected xpc connection event"); - } - }); - - xpc_connection_resume(m_private->xpcConnection); - - return true; -} - -bool AXDatabaseCleaner::privilegeCommand(const char* command) -{ - xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0); - xpc_dictionary_set_string(message, "request", command); - m_waitForResponse = true; - - xpc_connection_send_message_with_reply( - m_private->xpcConnection, - message, - dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), - ^(xpc_object_t event) { - const char* response = xpc_dictionary_get_string(event, "reply"); - NSLog(@"reply from helper tool: %s", response); - m_waitForResponse = false; - }); - - QTime time = QTime::currentTime(); - time.start(); - - while (m_waitForResponse) { - sleep(1); - if (time.elapsed() > 10000) { - QMessageBox::critical(NULL, "Synergy", - QObject::tr("No response from helper tool.Restart Synergy may solve this problem.")); - return false; - } - } -#endif - - return true; -} - -#endif diff --git a/src/gui/src/main.cpp b/src/gui/src/main.cpp index 2e3df613..4bdff3ec 100644 --- a/src/gui/src/main.cpp +++ b/src/gui/src/main.cpp @@ -32,10 +32,6 @@ #if defined(Q_OS_MAC) #include -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 -#include "AXDatabaseCleaner.h" -#endif - #endif class QThreadImpl : public QThread