File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 8
8
9
9
#include < cmath>
10
10
11
+ #ifdef Q_OS_MAC
12
+ #include < ApplicationServices/ApplicationServices.h>
13
+ #endif
14
+
15
+ void CheckIfProcessTrusted () {
16
+ #ifdef Q_OS_MAC
17
+ CFStringRef keys[] = { kAXTrustedCheckOptionPrompt };
18
+ CFTypeRef values[] = { kCFBooleanTrue };
19
+ CFDictionaryRef options = CFDictionaryCreate (NULL ,
20
+ (const void **)&keys,
21
+ (const void **)&values,
22
+ sizeof (keys) / sizeof (keys[0 ]),
23
+ &kCFTypeDictionaryKeyCallBacks ,
24
+ &kCFTypeDictionaryValueCallBacks );
25
+ if (!AXIsProcessTrustedWithOptions (options)) {
26
+ throw std::runtime_error (" not a trusted trusted accessibility client" );
27
+ }
28
+ CFRelease (options);
29
+ #endif
30
+ }
31
+
11
32
Camera::Camera (QObjectPointer parent)
12
33
: QObject(parent)
13
34
{
35
+ CheckIfProcessTrusted ();
14
36
m_timer = startTimer (25 );
15
37
}
16
38
@@ -159,7 +181,7 @@ void Camera::mouseMoveEvent(QMouseEvent *event)
159
181
160
182
const auto size = m_window->geometry ().size ();
161
183
const auto center = QPointF (size.width () / 2.0 , size.height () / 2.0 );
162
- const auto delta = event->localPos () - center;
184
+ const auto delta = event->position () - center;
163
185
const auto deltax = delta.x () * m_sensitivity;
164
186
const auto deltay = delta.y () * m_sensitivity;
165
187
m_yaw += deltax;
You can’t perform that action at this time.
0 commit comments