mirror of
https://github.com/overte-org/overte.git
synced 2025-08-16 22:57:14 +02:00
slight rework of handleRealMouseMoveEvent
This commit is contained in:
parent
843039f741
commit
adcadedc65
3 changed files with 20 additions and 16 deletions
|
@ -2203,11 +2203,9 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
|
|||
// if this is a real mouse event, and we're in HMD mode, then we should use it to move the
|
||||
// compositor reticle
|
||||
if (!_fakedMouseEvent) {
|
||||
if (isHMDMode()) {
|
||||
_compositor.handleRealMouseMoveEvent();
|
||||
// handleRealMouseMoveEvent() will return true, if we shouldn't process the event further
|
||||
if (_compositor.handleRealMouseMoveEvent()) {
|
||||
return; // bail
|
||||
} else {
|
||||
_compositor.trackRealMouseMoveEvent(); // FIXME - super janky
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -319,20 +319,26 @@ void ApplicationCompositor::handleLeaveEvent() {
|
|||
}
|
||||
}
|
||||
|
||||
void ApplicationCompositor::trackRealMouseMoveEvent() {
|
||||
_lastKnownRealMouse = QCursor::pos();
|
||||
}
|
||||
bool ApplicationCompositor::handleRealMouseMoveEvent(bool sendFakeEvent) {
|
||||
|
||||
void ApplicationCompositor::handleRealMouseMoveEvent(bool sendFakeEvent) {
|
||||
// If the mouse move came from a capture mouse related move, we completely ignore it.
|
||||
if (_ignoreMouseMove) {
|
||||
_ignoreMouseMove = false;
|
||||
return;
|
||||
return true; // swallow the event
|
||||
}
|
||||
auto newPosition = QCursor::pos();
|
||||
auto changeInRealMouse = newPosition - _lastKnownRealMouse;
|
||||
auto newReticlePosition = _reticlePositionInHMD + toGlm(changeInRealMouse);
|
||||
_lastKnownRealMouse = newPosition;
|
||||
setReticlePosition(newReticlePosition, sendFakeEvent);
|
||||
|
||||
// If we're in HMD mode
|
||||
if (qApp->isHMDMode()) {
|
||||
auto newPosition = QCursor::pos();
|
||||
auto changeInRealMouse = newPosition - _lastKnownRealMouse;
|
||||
auto newReticlePosition = _reticlePositionInHMD + toGlm(changeInRealMouse);
|
||||
_lastKnownRealMouse = newPosition;
|
||||
setReticlePosition(newReticlePosition, sendFakeEvent);
|
||||
return true; // swallow the event
|
||||
} else {
|
||||
_lastKnownRealMouse = QCursor::pos();
|
||||
}
|
||||
return false; // let the caller know to process the event
|
||||
}
|
||||
|
||||
glm::vec2 ApplicationCompositor::getReticlePosition() {
|
||||
|
|
|
@ -98,8 +98,8 @@ public:
|
|||
|
||||
ReticleInterface* getReticleInterface() { return _reticleInterface; }
|
||||
|
||||
void handleRealMouseMoveEvent(bool sendFakeEvent = true);
|
||||
void trackRealMouseMoveEvent();
|
||||
/// return value - true means the caller should not process the event further
|
||||
bool handleRealMouseMoveEvent(bool sendFakeEvent = true);
|
||||
void handleLeaveEvent();
|
||||
QPointF getMouseEventPosition(QMouseEvent* event);
|
||||
|
||||
|
|
Loading…
Reference in a new issue