diff --git a/macmouseover.hh b/macmouseover.hh index 116a5a6f..0f528bc5 100644 --- a/macmouseover.hh +++ b/macmouseover.hh @@ -31,6 +31,8 @@ public: /// Called from event loop callback void mouseMoved(); + + static bool isAXAPIEnabled(); signals: diff --git a/macmouseover.mm b/macmouseover.mm index c5940b3c..890dbe7b 100644 --- a/macmouseover.mm +++ b/macmouseover.mm @@ -1,8 +1,9 @@ -#include "macmouseover.hh" +include "macmouseover.hh" #include #include #include #include +#include const int mouseOverInterval = 300; @@ -91,7 +92,7 @@ void MacMouseOver::mouseMoved() void MacMouseOver::enableMouseOver() { mouseTimer.stop(); - if( !AXAPIEnabled() ) + if( !isAXAPIEnabled() ) return; if( !tapRef ) tapRef = CGEventTapCreate( kCGAnnotatedSessionEventTap, kCGHeadInsertEventTap, @@ -318,3 +319,11 @@ void MacMouseOver::handleRetrievedString( QString & wordSeq, int wordSeqPos ) emit instance().hovered( word, false ); } + +bool MacMouseOver::isAXAPIEnabled() +{ + if( NSFoundationVersionNumber >= 1000 ) // MacOS 10.9+ + return AXIsProcessTrusted(); + + return AXAPIEnabled(); +} diff --git a/mainwindow.cc b/mainwindow.cc index eecae895..c5d1ab57 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -32,6 +32,7 @@ #ifdef Q_OS_MAC #include "lionsupport.h" +#include "macmouseover.hh" #endif #ifdef Q_OS_WIN32 @@ -758,7 +759,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): updateStatusLine(); #ifdef Q_OS_MACX - if( cfg.preferences.startWithScanPopupOn && !AXAPIEnabled() ) + if( cfg.preferences.startWithScanPopupOn && !MacMouseOver::isAXAPIEnabled() ) mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, QPixmap( ":/icons/error.png" ) ); #endif @@ -2768,7 +2769,7 @@ void MainWindow::scanEnableToggled( bool on ) { scanPopup->enableScanning(); #ifdef Q_OS_MACX - if( !AXAPIEnabled() ) + if( !MacMouseOver::isAXAPIEnabled() ) mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, QPixmap( ":/icons/error.png" ) ); #endif