possible fix for mavericks

This commit is contained in:
Nick Bolton 2014-01-24 17:53:03 +00:00
parent 50e97e23f0
commit 3d963bfbe7
7 changed files with 68 additions and 14 deletions

View File

@ -156,7 +156,7 @@ if (UNIX)
CACHE STRING "" FORCE) CACHE STRING "" FORCE)
endif() endif()
set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1")
find_library(lib_ScreenSaver ScreenSaver) find_library(lib_ScreenSaver ScreenSaver)
find_library(lib_IOKit IOKit) find_library(lib_IOKit IOKit)

View File

@ -71,7 +71,7 @@ HEADERS += src/MainWindow.h \
RESOURCES += res/Synergy.qrc RESOURCES += res/Synergy.qrc
RC_FILE = res/win/Synergy.rc RC_FILE = res/win/Synergy.rc
macx { macx {
QMAKE_INFO_PLIST = res/mac/Synergy.plist QMAKE_INFO_PLIST = res/mac/Info.plist
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
TARGET = Synergy TARGET = Synergy
QSYNERGY_ICON.files = res/mac/Synergy.icns QSYNERGY_ICON.files = res/mac/Synergy.icns

View File

@ -6,11 +6,11 @@
<string>Synergy.icns</string> <string>Synergy.icns</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>0.9.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>Synergy</string> <string>Synergy</string>
<key>CFBundleIdentifier</key>
<string>synergy</string>
</dict> </dict>
</plist> </plist>

View File

@ -28,6 +28,10 @@
#include <QtGui> #include <QtGui>
#include <QSettings> #include <QSettings>
#if defined(Q_OS_MAC)
#include <Carbon/Carbon.h>
#endif
class QThreadImpl : public QThread class QThreadImpl : public QThread
{ {
public: public:
@ -39,6 +43,10 @@ public:
int waitForTray(); int waitForTray();
#if defined(Q_OS_MAC)
bool checkMacAssistiveDevices();
#endif
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
QCoreApplication::setOrganizationName("Synergy"); QCoreApplication::setOrganizationName("Synergy");
@ -47,8 +55,17 @@ int main(int argc, char* argv[])
QSynergyApplication app(argc, argv); QSynergyApplication app(argc, argv);
#if defined(Q_OS_MAC)
if (!checkMacAssistiveDevices())
{
return 1;
}
#endif
if (!waitForTray()) if (!waitForTray())
{
return -1; return -1;
}
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
QApplication::setQuitOnLastWindowClosed(false); QApplication::setQuitOnLastWindowClosed(false);
@ -98,3 +115,33 @@ int waitForTray()
return true; return true;
} }
#if defined(Q_OS_MAC)
bool checkMacAssistiveDevices()
{
#if defined(MAC_OS_X_VERSION_10_9) // mavericks
// new in mavericks, applications are trusted individually
// with use of the accessibility api. this call will show a
// prompt which can show the security/privacy/accessibility
// tab, with a list of allowed applications. synergy should
// show up there automatically, but will be unchecked.
const void* keys[] = { kAXTrustedCheckOptionPrompt };
const void* values[] = { kCFBooleanTrue };
CFDictionaryRef options = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL);
bool result = AXIsProcessTrustedWithOptions(options);
CFRelease(options);
return result;
#else
// now deprecated in mavericks.
bool result = AXAPIEnabled();
QMessageBox::information(NULL, "Synergy", "Please enable access to assistive devices (System Preferences), then re-open Synergy.");
return result;
#endif
}
#endif

View File

@ -108,9 +108,21 @@ COSXScreen::COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCur
m_screensaver = new COSXScreenSaver(m_events, getEventTarget()); m_screensaver = new COSXScreenSaver(m_events, getEventTarget());
m_keyState = new COSXKeyState(m_events); m_keyState = new COSXKeyState(m_events);
// TODO: http://stackoverflow.com/questions/2950124/enable-access-for-assistive-device-programmatically // only needed when running as a server.
if (m_isPrimary && !AXAPIEnabled()) if (m_isPrimary) {
throw XArch("system setting not enabled: \"Enable access for assistive devices\"");
#if defined(MAC_OS_X_VERSION_10_9)
// we can't pass options to show the dialog, this must be done by the gui.
//if (!AXIsProcessTrusted()) {
// throw XArch("assistive devices does not trust this process, allow it in system settings.");
//}
#else
// now deprecated in mavericks.
if (!AXAPIEnabled()) {
throw XArch("assistive devices is not enabled, enable it in system settings.");
}
#endif
}
// install display manager notification handler // install display manager notification handler
#if defined(MAC_OS_X_VERSION_10_5) #if defined(MAC_OS_X_VERSION_10_5)

View File

@ -615,7 +615,7 @@ void
CConfig::read(CConfigReadContext& context) CConfig::read(CConfigReadContext& context)
{ {
CConfig tmp(m_events); CConfig tmp(m_events);
while (context) { while (context.getStream()) {
tmp.readSection(context); tmp.readSection(context);
} }
*this = tmp; *this = tmp;
@ -1924,11 +1924,6 @@ CConfigReadContext::getLineNumber() const
return m_line; return m_line;
} }
CConfigReadContext::operator void*() const
{
return m_stream;
}
bool bool
CConfigReadContext::operator!() const CConfigReadContext::operator!() const
{ {

View File

@ -491,7 +491,6 @@ public:
bool readLine(CString&); bool readLine(CString&);
UInt32 getLineNumber() const; UInt32 getLineNumber() const;
operator void*() const;
bool operator!() const; bool operator!() const;
OptionValue parseBoolean(const CString&) const; OptionValue parseBoolean(const CString&) const;
@ -513,6 +512,7 @@ public:
IPlatformScreen::CButtonInfo* IPlatformScreen::CButtonInfo*
parseMouse(const CString& mouse) const; parseMouse(const CString& mouse) const;
KeyModifierMask parseModifier(const CString& modifiers) const; KeyModifierMask parseModifier(const CString& modifiers) const;
std::istream& getStream() const { return m_stream; };
private: private:
// not implemented // not implemented