From ee124f580df3beca04d0b2b44e03009bb0a43a48 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 5 Dec 2014 17:02:49 -0800 Subject: [PATCH] removed _mouse{X,Y} --- interface/src/Application.cpp | 17 +---------------- interface/src/Application.h | 6 ++---- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 0ecb99fbcc..41e925fd9d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -165,8 +165,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : _scaleMirror(1.0f), _rotateMirror(0.0f), _raiseMirror(0.0f), - _mouseX(0), - _mouseY(0), _lastMouseMove(usecTimestampNow()), _lastMouseMoveWasSimulated(false), _mouseHidden(false), @@ -1282,9 +1280,6 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { _mouseHidden = false; _seenMouseMove = true; } - - _mouseX = event->x(); - _mouseY = event->y(); } void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { @@ -1302,8 +1297,6 @@ void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { if (activeWindow() == _window) { if (event->button() == Qt::LeftButton) { - _mouseX = event->x(); - _mouseY = event->y(); _mouseDragStartedX = getTrueMouseX(); _mouseDragStartedY = getTrueMouseY(); _mousePressed = true; @@ -1346,8 +1339,6 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { if (activeWindow() == _window) { if (event->button() == Qt::LeftButton) { - _mouseX = event->x(); - _mouseY = event->y(); _mousePressed = false; if (Menu::getInstance()->isOptionChecked(MenuOption::Stats) && mouseOnScreen()) { @@ -1940,9 +1931,6 @@ void Application::init() { _voxelShader.init(); _pointShader.init(); - _mouseX = _glWidget->width() / 2; - _mouseY = _glWidget->height() / 2; - // TODO: move _myAvatar out of Application. Move relevant code to MyAvataar or AvatarManager _avatarManager.init(); _myCamera.setMode(CAMERA_MODE_FIRST_PERSON); @@ -3557,9 +3545,6 @@ void Application::deleteVoxelAt(const VoxelDetail& voxel) { } void Application::resetSensors() { - _mouseX = _glWidget->width() / 2; - _mouseY = _glWidget->height() / 2; - _faceshift.reset(); _visage.reset(); _dde.reset(); @@ -3572,7 +3557,7 @@ void Application::resetSensors() { QScreen* currentScreen = _window->windowHandle()->screen(); QWindow* mainWindow = _window->windowHandle(); QPoint windowCenter = mainWindow->geometry().center(); - QCursor::setPos(currentScreen, windowCenter); + _glWidget->cursor().setPos(currentScreen, windowCenter); _myAvatar->reset(); diff --git a/interface/src/Application.h b/interface/src/Application.h index 8fb0cb090d..58dec1da1f 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -217,8 +217,8 @@ public: bool mouseOnScreen() const; int getMouseX() const; int getMouseY() const; - int getTrueMouseX() const { return _mouseX; } - int getTrueMouseY() const { return _mouseY; } + int getTrueMouseX() const { return _glWidget->mapFromGlobal(QCursor::pos()).x(); } + int getTrueMouseY() const { return _glWidget->mapFromGlobal(QCursor::pos()).y(); } int getMouseDragStartedX() const; int getMouseDragStartedY() const; int getTrueMouseDragStartedX() const { return _mouseDragStartedX; } @@ -563,8 +563,6 @@ private: Environment _environment; - int _mouseX; - int _mouseY; int _mouseDragStartedX; int _mouseDragStartedY; quint64 _lastMouseMove;