mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-16 13:32:10 +02:00
Properly marshal fakeMouseEvent data from script thread to main thread
This commit is contained in:
parent
26b4c904f3
commit
e046ba64dd
3 changed files with 6 additions and 3 deletions
|
@ -2173,8 +2173,9 @@ void Application::maybeToggleMenuVisible(QMouseEvent* event) {
|
|||
}
|
||||
|
||||
/// called by ApplicationCompositor when in HMD mode and we're faking our mouse movement
|
||||
void Application::fakeMouseEvent(QMouseEvent event) {
|
||||
void Application::fakeMouseEvent(int type, int x, int y, uint32_t button, uint32_t buttons, uint32_t modifiers) {
|
||||
_fakedMouseEvent = true;
|
||||
QMouseEvent event(QEvent::MouseMove, QPoint(x, y), (Qt::MouseButton)button, (Qt::MouseButtons)buttons, (Qt::KeyboardModifiers)modifiers);
|
||||
sendEvent(_glWidget, &event);
|
||||
_fakedMouseEvent = false;
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ public slots:
|
|||
|
||||
void runTests();
|
||||
|
||||
void fakeMouseEvent(QMouseEvent event);
|
||||
void fakeMouseEvent(int type, int x, int y, quint32 button, quint32 buttons, quint32 modifiers);
|
||||
|
||||
private slots:
|
||||
void showDesktop();
|
||||
|
|
|
@ -457,7 +457,9 @@ void ApplicationCompositor::setReticlePosition(glm::vec2 position, bool sendFake
|
|||
auto buttons = QApplication::mouseButtons();
|
||||
auto modifiers = QApplication::keyboardModifiers();
|
||||
QMouseEvent event(QEvent::MouseMove, globalPos, button, buttons, modifiers);
|
||||
QMetaObject::invokeMethod(qApp, "fakeMouseEvent", Qt::AutoConnection, Q_ARG(QMouseEvent, event));
|
||||
QMetaObject::invokeMethod(qApp, "fakeMouseEvent", Qt::AutoConnection,
|
||||
Q_ARG(int, (int)QEvent::MouseMove), Q_ARG(int, globalPos.x()), Q_ARG(int, globalPos.y()),
|
||||
Q_ARG(quint32, (quint32)button), Q_ARG(quint32, (quint32)buttons), Q_ARG(quint32, (quint32)modifiers));
|
||||
}
|
||||
} else {
|
||||
// NOTE: This is some debugging code we will leave in while debugging various reticle movement strategies,
|
||||
|
|
Loading…
Reference in a new issue