mirror of
https://github.com/debauchee/barrier.git
synced 2026-07-06 03:46:29 +08:00
possible fix for mavericks
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user