Merge branch 'petroules-64bit'
This commit is contained in:
commit
c364befde2
|
@ -165,14 +165,17 @@ if (UNIX)
|
||||||
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
|
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
|
||||||
message(STATUS "DARWIN_VERSION=${DARWIN_VERSION}")
|
message(STATUS "DARWIN_VERSION=${DARWIN_VERSION}")
|
||||||
if (DARWIN_VERSION LESS 9)
|
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"
|
set(CMAKE_OSX_ARCHITECTURES "ppc;i386"
|
||||||
CACHE STRING "" FORCE)
|
CACHE STRING "" FORCE)
|
||||||
else()
|
else (DARWIN_VERSION LESS 10)
|
||||||
# 10.5+: 32-bit only -- missing funcs in 64-bit os libs
|
# 10.5: 32-bit Intel only
|
||||||
# such as GetGlobalMouse.
|
|
||||||
set(CMAKE_OSX_ARCHITECTURES "i386"
|
set(CMAKE_OSX_ARCHITECTURES "i386"
|
||||||
CACHE STRING "" FORCE)
|
CACHE STRING "" FORCE)
|
||||||
|
else()
|
||||||
|
# 10.6+: Intel only
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "i386;x86_64"
|
||||||
|
CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1")
|
set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1")
|
||||||
|
|
|
@ -554,7 +554,24 @@ class InternalCommands:
|
||||||
return (major, minor, rev)
|
return (major, minor, rev)
|
||||||
|
|
||||||
def getMacSdkDir(self):
|
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
|
# http://tinyurl.com/cs2rxxb
|
||||||
def fixCmakeEclipseBug(self):
|
def fixCmakeEclipseBug(self):
|
||||||
|
|
|
@ -72,6 +72,9 @@
|
||||||
|
|
||||||
// Added this because it doesn't compile on OS X 10.6 because they are already defined in Carbon
|
// Added this because it doesn't compile on OS X 10.6 because they are already defined in Carbon
|
||||||
#if !defined(__MACTYPES__)
|
#if !defined(__MACTYPES__)
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <CoreServices/CoreServices.h>
|
||||||
|
#else
|
||||||
typedef signed TYPE_OF_SIZE_1 SInt8;
|
typedef signed TYPE_OF_SIZE_1 SInt8;
|
||||||
typedef signed TYPE_OF_SIZE_2 SInt16;
|
typedef signed TYPE_OF_SIZE_2 SInt16;
|
||||||
typedef signed TYPE_OF_SIZE_4 SInt32;
|
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_2 UInt16;
|
||||||
typedef unsigned TYPE_OF_SIZE_4 UInt32;
|
typedef unsigned TYPE_OF_SIZE_4 UInt32;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
//
|
//
|
||||||
// clean up
|
// clean up
|
||||||
//
|
//
|
||||||
|
|
|
@ -296,13 +296,14 @@ COSXScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const
|
||||||
void
|
void
|
||||||
COSXScreen::getCursorPos(SInt32& x, SInt32& y) const
|
COSXScreen::getCursorPos(SInt32& x, SInt32& y) const
|
||||||
{
|
{
|
||||||
Point mouse;
|
CGEventRef event = CGEventCreate(NULL);
|
||||||
GetGlobalMouse(&mouse);
|
CGPoint mouse = CGEventGetLocation(event);
|
||||||
x = mouse.h;
|
x = mouse.x;
|
||||||
y = mouse.v;
|
y = mouse.y;
|
||||||
m_cursorPosValid = true;
|
m_cursorPosValid = true;
|
||||||
m_xCursor = x;
|
m_xCursor = x;
|
||||||
m_yCursor = y;
|
m_yCursor = y;
|
||||||
|
CFRelease(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -700,15 +701,16 @@ COSXScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const
|
||||||
// we can do.
|
// we can do.
|
||||||
|
|
||||||
// get current position
|
// get current position
|
||||||
Point oldPos;
|
CGEventRef event = CGEventCreate(NULL);
|
||||||
GetGlobalMouse(&oldPos);
|
CGPoint oldPos = CGEventGetLocation(event);
|
||||||
|
CFRelease(event);
|
||||||
|
|
||||||
// synthesize event
|
// synthesize event
|
||||||
CGPoint pos;
|
CGPoint pos;
|
||||||
m_xCursor = static_cast<SInt32>(oldPos.h);
|
m_xCursor = static_cast<SInt32>(oldPos.x);
|
||||||
m_yCursor = static_cast<SInt32>(oldPos.v);
|
m_yCursor = static_cast<SInt32>(oldPos.y);
|
||||||
pos.x = oldPos.h + dx;
|
pos.x = oldPos.x + dx;
|
||||||
pos.y = oldPos.v + dy;
|
pos.y = oldPos.y + dy;
|
||||||
postMouseEvent(pos);
|
postMouseEvent(pos);
|
||||||
|
|
||||||
// we now assume we don't know the current cursor position
|
// we now assume we don't know the current cursor position
|
||||||
|
@ -1056,7 +1058,7 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*)
|
||||||
// get scroll amount
|
// get scroll amount
|
||||||
r = GetEventParameter(*carbonEvent,
|
r = GetEventParameter(*carbonEvent,
|
||||||
kSynergyMouseScrollAxisX,
|
kSynergyMouseScrollAxisX,
|
||||||
typeLongInteger,
|
typeSInt32,
|
||||||
NULL,
|
NULL,
|
||||||
sizeof(xScroll),
|
sizeof(xScroll),
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1066,7 +1068,7 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*)
|
||||||
}
|
}
|
||||||
r = GetEventParameter(*carbonEvent,
|
r = GetEventParameter(*carbonEvent,
|
||||||
kSynergyMouseScrollAxisY,
|
kSynergyMouseScrollAxisY,
|
||||||
typeLongInteger,
|
typeSInt32,
|
||||||
NULL,
|
NULL,
|
||||||
sizeof(yScroll),
|
sizeof(yScroll),
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1094,7 +1096,10 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEventClassWindow:
|
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)) {
|
switch (GetEventKind(*carbonEvent)) {
|
||||||
case kEventWindowActivated:
|
case kEventWindowActivated:
|
||||||
LOG((CLOG_DEBUG1 "window activated"));
|
LOG((CLOG_DEBUG1 "window activated"));
|
||||||
|
@ -1518,15 +1523,16 @@ COSXScreen::getScrollSpeedFactor() const
|
||||||
void
|
void
|
||||||
COSXScreen::enableDragTimer(bool enable)
|
COSXScreen::enableDragTimer(bool enable)
|
||||||
{
|
{
|
||||||
UInt32 modifiers;
|
|
||||||
MouseTrackingResult res;
|
|
||||||
|
|
||||||
if (enable && m_dragTimer == NULL) {
|
if (enable && m_dragTimer == NULL) {
|
||||||
m_dragTimer = m_events->newTimer(0.01, NULL);
|
m_dragTimer = m_events->newTimer(0.01, NULL);
|
||||||
m_events->adoptHandler(CEvent::kTimer, m_dragTimer,
|
m_events->adoptHandler(CEvent::kTimer, m_dragTimer,
|
||||||
new TMethodEventJob<COSXScreen>(this,
|
new TMethodEventJob<COSXScreen>(this,
|
||||||
&COSXScreen::handleDrag));
|
&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) {
|
else if (!enable && m_dragTimer != NULL) {
|
||||||
m_events->removeHandler(CEvent::kTimer, m_dragTimer);
|
m_events->removeHandler(CEvent::kTimer, m_dragTimer);
|
||||||
|
@ -1538,15 +1544,14 @@ COSXScreen::enableDragTimer(bool enable)
|
||||||
void
|
void
|
||||||
COSXScreen::handleDrag(const CEvent&, void*)
|
COSXScreen::handleDrag(const CEvent&, void*)
|
||||||
{
|
{
|
||||||
Point p;
|
CGEventRef event = CGEventCreate(NULL);
|
||||||
UInt32 modifiers;
|
CGPoint p = CGEventGetLocation(event);
|
||||||
MouseTrackingResult res;
|
CFRelease(event);
|
||||||
|
|
||||||
TrackMouseLocationWithOptions(NULL, 0, 0, &p, &modifiers, &res);
|
if ((short)p.x != m_dragLastPoint.h || (short)p.y != m_dragLastPoint.v) {
|
||||||
|
m_dragLastPoint.h = (short)p.x;
|
||||||
if (res != kMouseTrackingTimedOut && (p.h != m_dragLastPoint.h || p.v != m_dragLastPoint.v)) {
|
m_dragLastPoint.v = (short)p.y;
|
||||||
m_dragLastPoint = p;
|
onMouseMove((SInt32)p.x, (SInt32)p.y);
|
||||||
onMouseMove((SInt32)p.h, (SInt32)p.v);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ COSXScreenSaver::launchTerminationCallback(
|
||||||
OSStatus result;
|
OSStatus result;
|
||||||
ProcessSerialNumber psn;
|
ProcessSerialNumber psn;
|
||||||
EventParamType actualType;
|
EventParamType actualType;
|
||||||
UInt32 actualSize;
|
ByteCount actualSize;
|
||||||
|
|
||||||
result = GetEventParameter(theEvent, kEventParamProcessID,
|
result = GetEventParameter(theEvent, kEventParamProcessID,
|
||||||
typeProcessSerialNumber, &actualType,
|
typeProcessSerialNumber, &actualType,
|
||||||
|
|
|
@ -302,9 +302,9 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*)
|
||||||
LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str()));
|
LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str()));
|
||||||
|
|
||||||
CString debugArg("--debug");
|
CString debugArg("--debug");
|
||||||
UInt32 debugArgPos = static_cast<UInt32>(command.find(debugArg));
|
size_t debugArgPos = command.find(debugArg);
|
||||||
if (debugArgPos != CString::npos) {
|
if (debugArgPos != CString::npos) {
|
||||||
UInt32 from = debugArgPos + static_cast<UInt32>(debugArg.size()) + 1;
|
UInt32 from = static_cast<UInt32>(debugArgPos) + static_cast<UInt32>(debugArg.size()) + 1;
|
||||||
UInt32 nextSpace = static_cast<UInt32>(command.find(" ", from));
|
UInt32 nextSpace = static_cast<UInt32>(command.find(" ", from));
|
||||||
CString logLevel(command.substr(from, nextSpace - from));
|
CString logLevel(command.substr(from, nextSpace - from));
|
||||||
|
|
||||||
|
|
|
@ -166,21 +166,6 @@ static void sSendMouseCallback(uSynergyContext *context)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Call mouse relative callback after a mouse event
|
|
||||||
**/
|
|
||||||
static void sSendMouseRelativeCallback(uSynergyContext *context, int16_t x, int16_t y)
|
|
||||||
{
|
|
||||||
// Skip if no callback is installed
|
|
||||||
if (context->m_mouseRelativeCallback == 0L)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Send callback
|
|
||||||
context->m_mouseRelativeCallback(context->m_cookie, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Send keyboard callback when a key has been pressed or released
|
@brief Send keyboard callback when a key has been pressed or released
|
||||||
**/
|
**/
|
||||||
|
@ -334,13 +319,6 @@ static void sProcessMessage(uSynergyContext *context, const uint8_t *message)
|
||||||
context->m_mouseY = sNetToNative16(message+10);
|
context->m_mouseY = sNetToNative16(message+10);
|
||||||
sSendMouseCallback(context);
|
sSendMouseCallback(context);
|
||||||
}
|
}
|
||||||
else if (USYNERGY_IS_PACKET("DMRM"))
|
|
||||||
{
|
|
||||||
// Mouse relative. Reply with CNOP
|
|
||||||
// kMsgDMouseRelMove = "DMRM%2i%2i"
|
|
||||||
sSendMouseRelativeCallback(context, sNetToNative16(message+8),
|
|
||||||
sNetToNative16(message+10));
|
|
||||||
}
|
|
||||||
else if (USYNERGY_IS_PACKET("DMWM"))
|
else if (USYNERGY_IS_PACKET("DMWM"))
|
||||||
{
|
{
|
||||||
// Mouse wheel
|
// Mouse wheel
|
||||||
|
@ -459,6 +437,7 @@ static void sProcessMessage(uSynergyContext *context, const uint8_t *message)
|
||||||
// kMsgCScreenSaver = "CSEC%1i"
|
// kMsgCScreenSaver = "CSEC%1i"
|
||||||
// kMsgDKeyRepeat = "DKRP%2i%2i%2i%2i"
|
// kMsgDKeyRepeat = "DKRP%2i%2i%2i%2i"
|
||||||
// kMsgDKeyRepeat1_0 = "DKRP%2i%2i%2i"
|
// kMsgDKeyRepeat1_0 = "DKRP%2i%2i%2i"
|
||||||
|
// kMsgDMouseRelMove = "DMRM%2i%2i"
|
||||||
// kMsgEIncompatible = "EICV%2i%2i"
|
// kMsgEIncompatible = "EICV%2i%2i"
|
||||||
// kMsgEBusy = "EBSY"
|
// kMsgEBusy = "EBSY"
|
||||||
// kMsgEUnknown = "EUNK"
|
// kMsgEUnknown = "EUNK"
|
||||||
|
@ -535,10 +514,6 @@ static void sUpdateContext(uSynergyContext *context)
|
||||||
/* Eat packets */
|
/* Eat packets */
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* If less than 4 bytes left in buffer, we can't even get the next packet length yet */
|
|
||||||
if (context->m_receiveOfs < 4)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Grab packet length and bail out if the packet goes beyond the end of the buffer */
|
/* Grab packet length and bail out if the packet goes beyond the end of the buffer */
|
||||||
packlen = sNetToNative32(context->m_receiveBuffer);
|
packlen = sNetToNative32(context->m_receiveBuffer);
|
||||||
if (packlen+4 > context->m_receiveOfs)
|
if (packlen+4 > context->m_receiveOfs)
|
||||||
|
|
|
@ -255,19 +255,6 @@ typedef void (*uSynergyMouseCallback)(uSynergyCookie cookie, uint16_t x, uint16
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Mouse relative callback
|
|
||||||
|
|
||||||
This callback is called when a mouse relative event happens.
|
|
||||||
|
|
||||||
@param cookie Cookie supplied in the Synergy context
|
|
||||||
@param x Mouse X motion
|
|
||||||
@param y Mouse Y motion
|
|
||||||
**/
|
|
||||||
typedef void (*uSynergyMouseRelativeCallback)(uSynergyCookie cookie, int16_t x, int16_t y);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Key event callback
|
@brief Key event callback
|
||||||
|
|
||||||
|
@ -345,7 +332,6 @@ typedef struct
|
||||||
uSynergyTraceFunc m_traceFunc; /* Function for tracing status (can be NULL) */
|
uSynergyTraceFunc m_traceFunc; /* Function for tracing status (can be NULL) */
|
||||||
uSynergyScreenActiveCallback m_screenActiveCallback; /* Callback for entering and leaving screen */
|
uSynergyScreenActiveCallback m_screenActiveCallback; /* Callback for entering and leaving screen */
|
||||||
uSynergyMouseCallback m_mouseCallback; /* Callback for mouse events */
|
uSynergyMouseCallback m_mouseCallback; /* Callback for mouse events */
|
||||||
uSynergyMouseRelativeCallback m_mouseRelativeCallback; /* Callback for mouse relative events */
|
|
||||||
uSynergyKeyboardCallback m_keyboardCallback; /* Callback for keyboard events */
|
uSynergyKeyboardCallback m_keyboardCallback; /* Callback for keyboard events */
|
||||||
uSynergyJoystickCallback m_joystickCallback; /* Callback for joystick events */
|
uSynergyJoystickCallback m_joystickCallback; /* Callback for joystick events */
|
||||||
uSynergyClipboardCallback m_clipboardCallback; /* Callback for clipboard events */
|
uSynergyClipboardCallback m_clipboardCallback; /* Callback for clipboard events */
|
||||||
|
|
Loading…
Reference in New Issue