Showing the changes to interface/src/Application.cpp (1 of 50 files). Show all
Unified · Split
| @@ -135,9 +135,6 @@ using namespace std; · 134 unmodified lines | |||
| 135 | static unsigned STARFIELD_NUM_STARS = 50000; | 135 | static unsigned STARFIELD_NUM_STARS = 50000; |
| 136 | static unsigned STARFIELD_SEED = 1; | 136 | static unsigned STARFIELD_SEED = 1; |
| 137 | 137 | ||
| 138 | static const int BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH = 6; // farther dragged clicks are ignored | ||
| 139 | |||
| 140 | |||
| 141 | const qint64 MAXIMUM_CACHE_SIZE = 10737418240; // 10GB | 138 | const qint64 MAXIMUM_CACHE_SIZE = 10737418240; // 10GB |
| 142 | 139 | ||
| 143 | static QTimer* idleTimer = NULL; | 140 | static QTimer* idleTimer = NULL; |
| @@ -225,6 +222,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 81 unmodified lines | |||
| 225 | _scaleMirror(1.0f), | 222 | _scaleMirror(1.0f), |
| 226 | _rotateMirror(0.0f), | 223 | _rotateMirror(0.0f), |
| 227 | _raiseMirror(0.0f), | 224 | _raiseMirror(0.0f), |
| 225 | _cursorVisible(true), | ||
| 228 | _lastMouseMove(usecTimestampNow()), | 226 | _lastMouseMove(usecTimestampNow()), |
| 229 | _lastMouseMoveWasSimulated(false), | 227 | _lastMouseMoveWasSimulated(false), |
| 230 | _touchAvgX(0.0f), | 228 | _touchAvgX(0.0f), |
| @@ -1480,6 +1478,8 @@ void Application::setEnableVRMode(bool enableVRMode) { · 1249 unmodified lines | |||
| 1480 | 1478 | ||
| 1481 | auto glCanvas = DependencyManager::get<GLCanvas>(); | 1479 | auto glCanvas = DependencyManager::get<GLCanvas>(); |
| 1482 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); | 1480 | resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); |
| 1481 | |||
| 1482 | updateCursorVisibility(); | ||
| 1483 | } | 1483 | } |
| 1484 | 1484 | ||
| 1485 | void Application::setLowVelocityFilter(bool lowVelocityFilter) { | 1485 | void Application::setLowVelocityFilter(bool lowVelocityFilter) { |
| @@ -1947,35 +1947,22 @@ void Application::updateCursor(float deltaTime) { · 461 unmodified lines | |||
| 1947 | 1947 | ||
| 1948 | static QPoint lastMousePos = QPoint(); | 1948 | static QPoint lastMousePos = QPoint(); |
| 1949 | _lastMouseMove = (lastMousePos == QCursor::pos()) ? _lastMouseMove : usecTimestampNow(); | 1949 | _lastMouseMove = (lastMousePos == QCursor::pos()) ? _lastMouseMove : usecTimestampNow(); |
| 1950 | bool hideMouse = false; | ||
| 1951 | bool underMouse = QGuiApplication::topLevelAt(QCursor::pos()) == | ||
| 1952 | Application::getInstance()->getWindow()->windowHandle(); | ||
| 1953 | |||
| 1954 | static const int HIDE_CURSOR_TIMEOUT = 3 * USECS_PER_SECOND; // 3 second | ||
| 1955 | int elapsed = usecTimestampNow() - _lastMouseMove; | ||
| 1956 | if ((elapsed > HIDE_CURSOR_TIMEOUT) || | ||
| 1957 | (OculusManager::isConnected() && Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode))) { | ||
| 1958 | hideMouse = underMouse; | ||
| 1959 | } | ||
| 1960 | |||
| 1961 | setCursorVisible(!hideMouse); | ||
| 1962 | lastMousePos = QCursor::pos(); | 1950 | lastMousePos = QCursor::pos(); |
| 1963 | } | 1951 | } |
| 1964 | 1952 | ||
| 1965 | void Application::setCursorVisible(bool visible) { | 1953 | void Application::updateCursorVisibility() { |
| 1966 | if (visible) { | 1954 | if (!_cursorVisible || Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) { |
| 1967 | if (overrideCursor() != NULL) { | 1955 | DependencyManager::get<GLCanvas>()->setCursor(Qt::BlankCursor); |
| 1968 | restoreOverrideCursor(); | ||
| 1969 | } | ||
| 1970 | } else { | 1956 | } else { |
| 1971 | if (overrideCursor() != NULL) { | 1957 | DependencyManager::get<GLCanvas>()->unsetCursor(); |
| 1972 | changeOverrideCursor(Qt::BlankCursor); | ||
| 1973 | } else { | ||
| 1974 | setOverrideCursor(Qt::BlankCursor); | ||
| 1975 | } | ||
| 1976 | } | 1958 | } |
| 1977 | } | 1959 | } |
| 1978 | 1960 | ||
| 1961 | void Application::setCursorVisible(bool visible) { | ||
| 1962 | _cursorVisible = visible; | ||
| 1963 | updateCursorVisibility(); | ||
| 1964 | } | ||
| 1965 | |||
| 1979 | void Application::update(float deltaTime) { | 1966 | void Application::update(float deltaTime) { |
| 1980 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); | 1967 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 1981 | PerformanceWarning warn(showWarnings, "Application::update()"); | 1968 | PerformanceWarning warn(showWarnings, "Application::update()"); |