possible fix for mavericks
This commit is contained in:
parent
50e97e23f0
commit
3d963bfbe7
|
@ -156,7 +156,7 @@ if (UNIX)
|
|||
CACHE STRING "" FORCE)
|
||||
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_IOKit IOKit)
|
||||
|
|
|
@ -71,7 +71,7 @@ HEADERS += src/MainWindow.h \
|
|||
RESOURCES += res/Synergy.qrc
|
||||
RC_FILE = res/win/Synergy.rc
|
||||
macx {
|
||||
QMAKE_INFO_PLIST = res/mac/Synergy.plist
|
||||
QMAKE_INFO_PLIST = res/mac/Info.plist
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
|
||||
TARGET = Synergy
|
||||
QSYNERGY_ICON.files = res/mac/Synergy.icns
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
<string>Synergy.icns</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>0.9.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Synergy</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>synergy</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -28,6 +28,10 @@
|
|||
#include <QtGui>
|
||||
#include <QSettings>
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
class QThreadImpl : public QThread
|
||||
{
|
||||
public:
|
||||
|
@ -39,6 +43,10 @@ public:
|
|||
|
||||
int waitForTray();
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
bool checkMacAssistiveDevices();
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QCoreApplication::setOrganizationName("Synergy");
|
||||
|
@ -47,8 +55,17 @@ int main(int argc, char* argv[])
|
|||
|
||||
QSynergyApplication app(argc, argv);
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
if (!checkMacAssistiveDevices())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!waitForTray())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
|
@ -98,3 +115,33 @@ int waitForTray()
|
|||
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
|
||||
|
|
|
@ -108,9 +108,21 @@ COSXScreen::COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCur
|
|||
m_screensaver = new COSXScreenSaver(m_events, getEventTarget());
|
||||
m_keyState = new COSXKeyState(m_events);
|
||||
|
||||
// TODO: http://stackoverflow.com/questions/2950124/enable-access-for-assistive-device-programmatically
|
||||
if (m_isPrimary && !AXAPIEnabled())
|
||||
throw XArch("system setting not enabled: \"Enable access for assistive devices\"");
|
||||
// only needed when running as a server.
|
||||
if (m_isPrimary) {
|
||||
|
||||
#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
|
||||
#if defined(MAC_OS_X_VERSION_10_5)
|
||||
|
|
|
@ -615,7 +615,7 @@ void
|
|||
CConfig::read(CConfigReadContext& context)
|
||||
{
|
||||
CConfig tmp(m_events);
|
||||
while (context) {
|
||||
while (context.getStream()) {
|
||||
tmp.readSection(context);
|
||||
}
|
||||
*this = tmp;
|
||||
|
@ -1924,11 +1924,6 @@ CConfigReadContext::getLineNumber() const
|
|||
return m_line;
|
||||
}
|
||||
|
||||
CConfigReadContext::operator void*() const
|
||||
{
|
||||
return m_stream;
|
||||
}
|
||||
|
||||
bool
|
||||
CConfigReadContext::operator!() const
|
||||
{
|
||||
|
|
|
@ -491,7 +491,6 @@ public:
|
|||
bool readLine(CString&);
|
||||
UInt32 getLineNumber() const;
|
||||
|
||||
operator void*() const;
|
||||
bool operator!() const;
|
||||
|
||||
OptionValue parseBoolean(const CString&) const;
|
||||
|
@ -513,6 +512,7 @@ public:
|
|||
IPlatformScreen::CButtonInfo*
|
||||
parseMouse(const CString& mouse) const;
|
||||
KeyModifierMask parseModifier(const CString& modifiers) const;
|
||||
std::istream& getStream() const { return m_stream; };
|
||||
|
||||
private:
|
||||
// not implemented
|
||||
|
|
Loading…
Reference in New Issue