From 40f7212b1e248898560dd1589a1613def415419f Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Thu, 12 May 2016 16:37:03 -0700 Subject: [PATCH] Make uses of getReticlePosition consistent with respect to window offset. --- interface/src/Application.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 36a12e7b6a..405e30dd6a 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -864,10 +864,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : if (action == controller::toInt(controller::Action::RETICLE_CLICK)) { auto reticlePos = getApplicationCompositor().getReticlePosition(); - QPoint globalPos(reticlePos.x, reticlePos.y); - - // FIXME - it would be nice if this was self contained in the _compositor or Reticle class - auto localPos = isHMDMode() ? globalPos : _glWidget->mapFromGlobal(globalPos); + QPoint localPos(reticlePos.x, reticlePos.y); // both hmd and desktop already handle this in our coordinates. if (state) { QMouseEvent mousePress(QEvent::MouseButtonPress, localPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); sendEvent(_glWidget, &mousePress); @@ -888,15 +885,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : } else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) { if (!offscreenUi->navigationFocused()) { auto reticlePosition = getApplicationCompositor().getReticlePosition(); - offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); + offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y)); } } else if (action == controller::toInt(controller::Action::CONTEXT_MENU)) { auto reticlePosition = getApplicationCompositor().getReticlePosition(); - offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); + offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y)); } else if (action == controller::toInt(controller::Action::UI_NAV_SELECT)) { if (!offscreenUi->navigationFocused()) { auto reticlePosition = getApplicationCompositor().getReticlePosition(); - offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); + offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y)); } } else if (action == controller::toInt(controller::Action::RETICLE_X)) { auto oldPos = getApplicationCompositor().getReticlePosition(); @@ -2269,7 +2266,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) { if (event->key() == Qt::Key_Alt && _altPressed && hasFocus()) { auto offscreenUi = DependencyManager::get(); auto reticlePosition = getApplicationCompositor().getReticlePosition(); - offscreenUi->toggleMenu(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); + offscreenUi->toggleMenu(QPoint(reticlePosition.x, reticlePosition.y)); } _keysPressed.remove(event->key()); @@ -2738,15 +2735,7 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) { } ivec2 Application::getMouse() const { - auto reticlePosition = getApplicationCompositor().getReticlePosition(); - - // in the HMD, the reticlePosition is the mouse position - if (isHMDMode()) { - return reticlePosition; - } - - // in desktop mode, we need to map from global to widget space - return toGlm(_glWidget->mapFromGlobal(QPoint(reticlePosition.x, reticlePosition.y))); + return getApplicationCompositor().getReticlePosition(); } FaceTracker* Application::getActiveFaceTracker() {