From 7dd2db25ec8eb62741b671d9ff929ad069ef92cb Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 15 Oct 2014 19:00:30 -0700 Subject: [PATCH 1/7] Add support for building with 64-bit architectures on OS X. This patch brings full 64-bit compatibility to Synergy on OS X by replacing all obsolete 32-bit only Carbon functions with modern equivalents. All functions introduced have been available since 10.4 so this won't affect the minimum deployment target. Specifically: Creating an empty CGEvent and getting its location is behaviourally identical to GetGlobalMouse, and yes, both are in flipped coordinates. This was tested with a multi-monitor configuration as well. TrackMouseLocationWithOptions is behaviourally identical to GetGlobalMouse in these cases because the timeout was 0 and none of the other out params were used, except for the MouseTrackingResult in one call was checked against kMouseTrackingTimedOut. Since the timeout was 0 and not kEventDurationForever, that value never could have been returned anyway. Instead of attempting to define SIntXX and UIntXX manually, MacTypes.h is included on OS X. These types were wrong in 64-bit mode because of this, causing type redefinition errors. --- CMakeLists.txt | 9 +++-- src/lib/common/basic_types.h | 4 +++ src/lib/platform/OSXScreen.cpp | 55 ++++++++++++++++------------- src/lib/platform/OSXScreenSaver.cpp | 2 +- src/lib/synergy/DaemonApp.cpp | 4 +-- 5 files changed, 41 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dca34f3..4501e81b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,13 +165,12 @@ if (UNIX) string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) message(STATUS "DARWIN_VERSION=${DARWIN_VERSION}") if (DARWIN_VERSION LESS 9) - # 10.4: universal (32-bit intel and power pc) - set(CMAKE_OSX_ARCHITECTURES "ppc;i386" + # 10.4: Universal (32-bit and 64-bit Intel and PowerPC) + set(CMAKE_OSX_ARCHITECTURES "ppc;ppc64;i386:x86_64" CACHE STRING "" FORCE) else() - # 10.5+: 32-bit only -- missing funcs in 64-bit os libs - # such as GetGlobalMouse. - set(CMAKE_OSX_ARCHITECTURES "i386" + # 10.5+: Intel only + set(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "" FORCE) endif() diff --git a/src/lib/common/basic_types.h b/src/lib/common/basic_types.h index 7f20cb5a..b2aa999d 100644 --- a/src/lib/common/basic_types.h +++ b/src/lib/common/basic_types.h @@ -72,6 +72,9 @@ // Added this because it doesn't compile on OS X 10.6 because they are already defined in Carbon #if !defined(__MACTYPES__) +#if defined(__APPLE__) +#include +#else typedef signed TYPE_OF_SIZE_1 SInt8; typedef signed TYPE_OF_SIZE_2 SInt16; typedef signed TYPE_OF_SIZE_4 SInt32; @@ -79,6 +82,7 @@ typedef unsigned TYPE_OF_SIZE_1 UInt8; typedef unsigned TYPE_OF_SIZE_2 UInt16; typedef unsigned TYPE_OF_SIZE_4 UInt32; #endif +#endif // // clean up // diff --git a/src/lib/platform/OSXScreen.cpp b/src/lib/platform/OSXScreen.cpp index cf58aaa2..b576d469 100644 --- a/src/lib/platform/OSXScreen.cpp +++ b/src/lib/platform/OSXScreen.cpp @@ -292,13 +292,14 @@ COSXScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const void COSXScreen::getCursorPos(SInt32& x, SInt32& y) const { - Point mouse; - GetGlobalMouse(&mouse); - x = mouse.h; - y = mouse.v; + CGEventRef event = CGEventCreate(NULL); + CGPoint mouse = CGEventGetLocation(event); + x = mouse.x; + y = mouse.y; m_cursorPosValid = true; m_xCursor = x; m_yCursor = y; + CFRelease(event); } void @@ -696,15 +697,16 @@ COSXScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const // we can do. // get current position - Point oldPos; - GetGlobalMouse(&oldPos); + CGEventRef event = CGEventCreate(NULL); + CGPoint oldPos = CGEventGetLocation(event); + CFRelease(event); // synthesize event CGPoint pos; - m_xCursor = static_cast(oldPos.h); - m_yCursor = static_cast(oldPos.v); - pos.x = oldPos.h + dx; - pos.y = oldPos.v + dy; + m_xCursor = static_cast(oldPos.x); + m_yCursor = static_cast(oldPos.y); + pos.x = oldPos.x + dx; + pos.y = oldPos.y + dy; postMouseEvent(pos); // we now assume we don't know the current cursor position @@ -1052,7 +1054,7 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*) // get scroll amount r = GetEventParameter(*carbonEvent, kSynergyMouseScrollAxisX, - typeLongInteger, + typeSInt32, NULL, sizeof(xScroll), NULL, @@ -1062,7 +1064,7 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*) } r = GetEventParameter(*carbonEvent, kSynergyMouseScrollAxisY, - typeLongInteger, + typeSInt32, NULL, sizeof(yScroll), NULL, @@ -1090,7 +1092,10 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*) break; case kEventClassWindow: - SendEventToWindow(*carbonEvent, m_userInputWindow); + // 2nd param was formerly GetWindowEventTarget(m_userInputWindow) which is 32-bit only, + // however as m_userInputWindow is never initialized to anything we can take advantage of + // the fact that GetWindowEventTarget(NULL) == NULL + SendEventToEventTarget(*carbonEvent, NULL); switch (GetEventKind(*carbonEvent)) { case kEventWindowActivated: LOG((CLOG_DEBUG1 "window activated")); @@ -1514,15 +1519,16 @@ COSXScreen::getScrollSpeedFactor() const void COSXScreen::enableDragTimer(bool enable) { - UInt32 modifiers; - MouseTrackingResult res; - if (enable && m_dragTimer == NULL) { m_dragTimer = m_events->newTimer(0.01, NULL); m_events->adoptHandler(CEvent::kTimer, m_dragTimer, new TMethodEventJob(this, &COSXScreen::handleDrag)); - TrackMouseLocationWithOptions(NULL, 0, 0, &m_dragLastPoint, &modifiers, &res); + CGEventRef event = CGEventCreate(NULL); + CGPoint mouse = CGEventGetLocation(event); + m_dragLastPoint.h = (short)mouse.x; + m_dragLastPoint.v = (short)mouse.y; + CFRelease(event); } else if (!enable && m_dragTimer != NULL) { m_events->removeHandler(CEvent::kTimer, m_dragTimer); @@ -1534,15 +1540,14 @@ COSXScreen::enableDragTimer(bool enable) void COSXScreen::handleDrag(const CEvent&, void*) { - Point p; - UInt32 modifiers; - MouseTrackingResult res; + CGEventRef event = CGEventCreate(NULL); + CGPoint p = CGEventGetLocation(event); + CFRelease(event); - TrackMouseLocationWithOptions(NULL, 0, 0, &p, &modifiers, &res); - - if (res != kMouseTrackingTimedOut && (p.h != m_dragLastPoint.h || p.v != m_dragLastPoint.v)) { - m_dragLastPoint = p; - onMouseMove((SInt32)p.h, (SInt32)p.v); + if ((short)p.x != m_dragLastPoint.h || (short)p.y != m_dragLastPoint.v) { + m_dragLastPoint.h = (short)p.x; + m_dragLastPoint.v = (short)p.y; + onMouseMove((SInt32)p.x, (SInt32)p.y); } } diff --git a/src/lib/platform/OSXScreenSaver.cpp b/src/lib/platform/OSXScreenSaver.cpp index 8ae9dc5c..c393077f 100644 --- a/src/lib/platform/OSXScreenSaver.cpp +++ b/src/lib/platform/OSXScreenSaver.cpp @@ -142,7 +142,7 @@ COSXScreenSaver::launchTerminationCallback( OSStatus result; ProcessSerialNumber psn; EventParamType actualType; - UInt32 actualSize; + ByteCount actualSize; result = GetEventParameter(theEvent, kEventParamProcessID, typeProcessSerialNumber, &actualType, diff --git a/src/lib/synergy/DaemonApp.cpp b/src/lib/synergy/DaemonApp.cpp index e8e8007b..aa03ee32 100644 --- a/src/lib/synergy/DaemonApp.cpp +++ b/src/lib/synergy/DaemonApp.cpp @@ -302,9 +302,9 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*) LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str())); CString debugArg("--debug"); - UInt32 debugArgPos = static_cast(command.find(debugArg)); + size_t debugArgPos = command.find(debugArg); if (debugArgPos != CString::npos) { - UInt32 from = debugArgPos + static_cast(debugArg.size()) + 1; + UInt32 from = static_cast(debugArgPos) + static_cast(debugArg.size()) + 1; UInt32 nextSpace = static_cast(command.find(" ", from)); CString logLevel(command.substr(from, nextSpace - from)); From b644b1253d3fbe06d21908ddd3180c8fd6b7034e Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 15 Oct 2014 18:56:37 -0700 Subject: [PATCH 2/7] Fix SDK detection to work with modern versions of Xcode. This finds the the OS X SDK directory by using xcrun and known fallbacks; users shouldn't be symlinking /Developer. --- ext/toolchain/commands1.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index ef492f2b..a60aae2e 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -554,7 +554,24 @@ class InternalCommands: return (major, minor, rev) def getMacSdkDir(self): - return "/Developer/SDKs/MacOSX" + self.macSdk + ".sdk" + sdkName = "macosx" + self.macSdk + + # Ideally we'll use xcrun (which is influenced by $DEVELOPER_DIR), then try a couple + # fallbacks to known paths if xcrun is not available + status, sdkPath = commands.getstatusoutput("xcrun --show-sdk-path --sdk " + sdkName) + if status == 0 and sdkPath: + return sdkPath + + developerDir = os.getenv("DEVELOPER_DIR") + if not developerDir: + developerDir = "/Applications/Xcode.app/Contents/Developer" + + sdkDirName = sdkName.replace("macosx", "MacOSX") + sdkPath = developerDir + "/Platforms/MacOSX.platform/Developer/SDKs/" + sdkDirName + ".sdk" + if os.path.exists(sdkPath): + return sdkPath + + return "/Developer/SDKs/" + sdkDirName + ".sdk" # http://tinyurl.com/cs2rxxb def fixCmakeEclipseBug(self): From f3218ff53c67eca6bd20b5bf1cfc070b2e5a33ca Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Wed, 22 Oct 2014 13:55:39 +0100 Subject: [PATCH 3/7] added branch name to package names now that buildbot builds branches, it'll be handy to see that branch name in the package name. --- ext/toolchain/commands1.py | 40 ++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index c21662f0..48a868f5 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -963,17 +963,32 @@ class InternalCommands: def getGitRevision(self): if sys.version_info < (2, 4): raise Exception("Python 2.4 or greater required.") - else: - p = subprocess.Popen( - ["git", "log", "--pretty=format:%h", "-n", "1"], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - stdout, stderr = p.communicate() - - if p.returncode != 0: - raise Exception('Could not get revision - git info failed with code: ' + str(p.returncode)) - return stdout + p = subprocess.Popen( + ["git", "log", "--pretty=format:%h", "-n", "1"], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + stdout, stderr = p.communicate() + + if p.returncode != 0: + raise Exception('Could not get revision, git error: ' + str(p.returncode)) + + return stdout.strip() + + def getGitBranchName(self): + if sys.version_info < (2, 4): + raise Exception("Python 2.4 or greater required.") + + p = subprocess.Popen( + ["git", "rev-parse", "--abbrev-ref", "HEAD"], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + stdout, stderr = p.communicate() + + if p.returncode != 0: + raise Exception('Could not get branch name, git error: ' + str(p.returncode)) + + return stdout.strip() def find_revision_svn(self): if sys.version_info < (2, 4): @@ -1439,9 +1454,10 @@ class InternalCommands: def dist_name_rev(self, type): # find the version number (we're puting the rev in after this) pattern = '(.*\d+\.\d+\.\d+)(.*)' - replace = '\g<1>-' + self.find_revision() + '\g<2>' + replace = "\g<1>-%s@%s\g<2>" % ( + self.getGitBranchName(), self.getGitRevision()) return re.sub(pattern, replace, self.dist_name(type)) - + def dist_usage(self): print ('Usage: %s package [package-type]\n' '\n' From 7abcf133173189a648133aeccb5a97ed1953db36 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Wed, 22 Oct 2014 14:06:15 +0100 Subject: [PATCH 4/7] fixed "hm dist src" command to support branches also allowed non-unix platforms to run src --- ext/toolchain/commands1.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 48a868f5..086a1915 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -1036,10 +1036,7 @@ class InternalCommands: moveExt = '' if type == 'src': - if sys.platform in ['linux2', 'darwin']: - self.distSrc() - else: - package_unsupported = True + self.distSrc() elif type == 'rpm': if sys.platform == 'linux2': @@ -1223,11 +1220,15 @@ class InternalCommands: print "Removing existing export..." shutil.rmtree(exportPath) - print 'Exporting repository to: ' + exportPath os.mkdir(exportPath) - err = os.system('git archive master | tar -x -C ' + exportPath) + + cmd = "git archive %s | tar -x -C %s" % ( + self.getGitBranchName(), exportPath) + + print 'Exporting repository to: ' + exportPath + err = os.system(cmd) if err != 0: - raise Exception('Repository export failed: ' + str(err)) + raise Exception('Repository export failed: ' + str(err)) packagePath = '../' + self.getGenerator().binDir + '/' + name + '.tar.gz' From c09d2ad91e024a3b88aaf485f6662d7741b9f6bb Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Wed, 22 Oct 2014 14:56:57 +0100 Subject: [PATCH 5/7] changed @ to - in package name --- ext/toolchain/commands1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 086a1915..5374bcd2 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -1455,7 +1455,7 @@ class InternalCommands: def dist_name_rev(self, type): # find the version number (we're puting the rev in after this) pattern = '(.*\d+\.\d+\.\d+)(.*)' - replace = "\g<1>-%s@%s\g<2>" % ( + replace = "\g<1>-%s-%s\g<2>" % ( self.getGitBranchName(), self.getGitRevision()) return re.sub(pattern, replace, self.dist_name(type)) From e3d57af4fdc692cd1e5bed194db7676cfea02d01 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 15 Oct 2014 19:00:30 -0700 Subject: [PATCH 6/7] Add support for building with 64-bit architectures on OS X. This patch brings full 64-bit compatibility to Synergy on OS X by replacing all obsolete 32-bit only Carbon functions with modern equivalents. All functions introduced have been available since 10.4 so this won't affect the minimum deployment target. Specifically: Creating an empty CGEvent and getting its location is behaviourally identical to GetGlobalMouse, and yes, both are in flipped coordinates. This was tested with a multi-monitor configuration as well. TrackMouseLocationWithOptions is behaviourally identical to GetGlobalMouse in these cases because the timeout was 0 and none of the other out params were used, except for the MouseTrackingResult in one call was checked against kMouseTrackingTimedOut. Since the timeout was 0 and not kEventDurationForever, that value never could have been returned anyway. Instead of attempting to define SIntXX and UIntXX manually, MacTypes.h is included on OS X. These types were wrong in 64-bit mode because of this, causing type redefinition errors. --- CMakeLists.txt | 11 +++--- src/lib/common/basic_types.h | 4 +++ src/lib/platform/OSXScreen.cpp | 55 ++++++++++++++++------------- src/lib/platform/OSXScreenSaver.cpp | 2 +- src/lib/synergy/DaemonApp.cpp | 4 +-- 5 files changed, 44 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dca34f3..7c0eaaf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,14 +165,17 @@ if (UNIX) string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) message(STATUS "DARWIN_VERSION=${DARWIN_VERSION}") if (DARWIN_VERSION LESS 9) - # 10.4: universal (32-bit intel and power pc) + # 10.4: Universal (32-bit Intel and PowerPC) set(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "" FORCE) - else() - # 10.5+: 32-bit only -- missing funcs in 64-bit os libs - # such as GetGlobalMouse. + else (DARWIN_VERSION LESS 10) + # 10.5: 32-bit Intel only set(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "" FORCE) + else() + # 10.6+: Intel only + set(CMAKE_OSX_ARCHITECTURES "i386;x86_64" + CACHE STRING "" FORCE) endif() set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1") diff --git a/src/lib/common/basic_types.h b/src/lib/common/basic_types.h index 7f20cb5a..b2aa999d 100644 --- a/src/lib/common/basic_types.h +++ b/src/lib/common/basic_types.h @@ -72,6 +72,9 @@ // Added this because it doesn't compile on OS X 10.6 because they are already defined in Carbon #if !defined(__MACTYPES__) +#if defined(__APPLE__) +#include +#else typedef signed TYPE_OF_SIZE_1 SInt8; typedef signed TYPE_OF_SIZE_2 SInt16; typedef signed TYPE_OF_SIZE_4 SInt32; @@ -79,6 +82,7 @@ typedef unsigned TYPE_OF_SIZE_1 UInt8; typedef unsigned TYPE_OF_SIZE_2 UInt16; typedef unsigned TYPE_OF_SIZE_4 UInt32; #endif +#endif // // clean up // diff --git a/src/lib/platform/OSXScreen.cpp b/src/lib/platform/OSXScreen.cpp index 47e5af8e..fd2ceea9 100644 --- a/src/lib/platform/OSXScreen.cpp +++ b/src/lib/platform/OSXScreen.cpp @@ -296,13 +296,14 @@ COSXScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const void COSXScreen::getCursorPos(SInt32& x, SInt32& y) const { - Point mouse; - GetGlobalMouse(&mouse); - x = mouse.h; - y = mouse.v; + CGEventRef event = CGEventCreate(NULL); + CGPoint mouse = CGEventGetLocation(event); + x = mouse.x; + y = mouse.y; m_cursorPosValid = true; m_xCursor = x; m_yCursor = y; + CFRelease(event); } void @@ -700,15 +701,16 @@ COSXScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const // we can do. // get current position - Point oldPos; - GetGlobalMouse(&oldPos); + CGEventRef event = CGEventCreate(NULL); + CGPoint oldPos = CGEventGetLocation(event); + CFRelease(event); // synthesize event CGPoint pos; - m_xCursor = static_cast(oldPos.h); - m_yCursor = static_cast(oldPos.v); - pos.x = oldPos.h + dx; - pos.y = oldPos.v + dy; + m_xCursor = static_cast(oldPos.x); + m_yCursor = static_cast(oldPos.y); + pos.x = oldPos.x + dx; + pos.y = oldPos.y + dy; postMouseEvent(pos); // we now assume we don't know the current cursor position @@ -1056,7 +1058,7 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*) // get scroll amount r = GetEventParameter(*carbonEvent, kSynergyMouseScrollAxisX, - typeLongInteger, + typeSInt32, NULL, sizeof(xScroll), NULL, @@ -1066,7 +1068,7 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*) } r = GetEventParameter(*carbonEvent, kSynergyMouseScrollAxisY, - typeLongInteger, + typeSInt32, NULL, sizeof(yScroll), NULL, @@ -1094,7 +1096,10 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*) break; case kEventClassWindow: - SendEventToWindow(*carbonEvent, m_userInputWindow); + // 2nd param was formerly GetWindowEventTarget(m_userInputWindow) which is 32-bit only, + // however as m_userInputWindow is never initialized to anything we can take advantage of + // the fact that GetWindowEventTarget(NULL) == NULL + SendEventToEventTarget(*carbonEvent, NULL); switch (GetEventKind(*carbonEvent)) { case kEventWindowActivated: LOG((CLOG_DEBUG1 "window activated")); @@ -1518,15 +1523,16 @@ COSXScreen::getScrollSpeedFactor() const void COSXScreen::enableDragTimer(bool enable) { - UInt32 modifiers; - MouseTrackingResult res; - if (enable && m_dragTimer == NULL) { m_dragTimer = m_events->newTimer(0.01, NULL); m_events->adoptHandler(CEvent::kTimer, m_dragTimer, new TMethodEventJob(this, &COSXScreen::handleDrag)); - TrackMouseLocationWithOptions(NULL, 0, 0, &m_dragLastPoint, &modifiers, &res); + CGEventRef event = CGEventCreate(NULL); + CGPoint mouse = CGEventGetLocation(event); + m_dragLastPoint.h = (short)mouse.x; + m_dragLastPoint.v = (short)mouse.y; + CFRelease(event); } else if (!enable && m_dragTimer != NULL) { m_events->removeHandler(CEvent::kTimer, m_dragTimer); @@ -1538,15 +1544,14 @@ COSXScreen::enableDragTimer(bool enable) void COSXScreen::handleDrag(const CEvent&, void*) { - Point p; - UInt32 modifiers; - MouseTrackingResult res; + CGEventRef event = CGEventCreate(NULL); + CGPoint p = CGEventGetLocation(event); + CFRelease(event); - TrackMouseLocationWithOptions(NULL, 0, 0, &p, &modifiers, &res); - - if (res != kMouseTrackingTimedOut && (p.h != m_dragLastPoint.h || p.v != m_dragLastPoint.v)) { - m_dragLastPoint = p; - onMouseMove((SInt32)p.h, (SInt32)p.v); + if ((short)p.x != m_dragLastPoint.h || (short)p.y != m_dragLastPoint.v) { + m_dragLastPoint.h = (short)p.x; + m_dragLastPoint.v = (short)p.y; + onMouseMove((SInt32)p.x, (SInt32)p.y); } } diff --git a/src/lib/platform/OSXScreenSaver.cpp b/src/lib/platform/OSXScreenSaver.cpp index 8ae9dc5c..c393077f 100644 --- a/src/lib/platform/OSXScreenSaver.cpp +++ b/src/lib/platform/OSXScreenSaver.cpp @@ -142,7 +142,7 @@ COSXScreenSaver::launchTerminationCallback( OSStatus result; ProcessSerialNumber psn; EventParamType actualType; - UInt32 actualSize; + ByteCount actualSize; result = GetEventParameter(theEvent, kEventParamProcessID, typeProcessSerialNumber, &actualType, diff --git a/src/lib/synergy/DaemonApp.cpp b/src/lib/synergy/DaemonApp.cpp index e8e8007b..aa03ee32 100644 --- a/src/lib/synergy/DaemonApp.cpp +++ b/src/lib/synergy/DaemonApp.cpp @@ -302,9 +302,9 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*) LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str())); CString debugArg("--debug"); - UInt32 debugArgPos = static_cast(command.find(debugArg)); + size_t debugArgPos = command.find(debugArg); if (debugArgPos != CString::npos) { - UInt32 from = debugArgPos + static_cast(debugArg.size()) + 1; + UInt32 from = static_cast(debugArgPos) + static_cast(debugArg.size()) + 1; UInt32 nextSpace = static_cast(command.find(" ", from)); CString logLevel(command.substr(from, nextSpace - from)); From 67f17a0fda6e08554c88a8784d1782fc8040fac1 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 15 Oct 2014 18:56:37 -0700 Subject: [PATCH 7/7] Fix SDK detection to work with modern versions of Xcode. This finds the the OS X SDK directory by using xcrun and known fallbacks; users shouldn't be symlinking /Developer. --- ext/toolchain/commands1.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 1eee3a41..5374bcd2 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -554,7 +554,24 @@ class InternalCommands: return (major, minor, rev) def getMacSdkDir(self): - return "/Developer/SDKs/MacOSX" + self.macSdk + ".sdk" + sdkName = "macosx" + self.macSdk + + # Ideally we'll use xcrun (which is influenced by $DEVELOPER_DIR), then try a couple + # fallbacks to known paths if xcrun is not available + status, sdkPath = commands.getstatusoutput("xcrun --show-sdk-path --sdk " + sdkName) + if status == 0 and sdkPath: + return sdkPath + + developerDir = os.getenv("DEVELOPER_DIR") + if not developerDir: + developerDir = "/Applications/Xcode.app/Contents/Developer" + + sdkDirName = sdkName.replace("macosx", "MacOSX") + sdkPath = developerDir + "/Platforms/MacOSX.platform/Developer/SDKs/" + sdkDirName + ".sdk" + if os.path.exists(sdkPath): + return sdkPath + + return "/Developer/SDKs/" + sdkDirName + ".sdk" # http://tinyurl.com/cs2rxxb def fixCmakeEclipseBug(self):