mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 19:30:41 +02:00
Mouse pointer fix fix.
This commit is contained in:
parent
600b05fcc9
commit
bdba05785e
2 changed files with 8 additions and 9 deletions
|
@ -1082,7 +1082,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
|
||||||
|
|
||||||
void Application::mouseMoveEvent(QMouseEvent* event) {
|
void Application::mouseMoveEvent(QMouseEvent* event) {
|
||||||
_lastMouseMove = usecTimestampNow();
|
_lastMouseMove = usecTimestampNow();
|
||||||
if (_mouseHidden) {
|
if (_mouseHidden && !isFullscreenOculus()) {
|
||||||
getGLWidget()->setCursor(Qt::ArrowCursor);
|
getGLWidget()->setCursor(Qt::ArrowCursor);
|
||||||
_mouseHidden = false;
|
_mouseHidden = false;
|
||||||
_seenMouseMove = true;
|
_seenMouseMove = true;
|
||||||
|
@ -1658,6 +1658,10 @@ void Application::findAxisAlignment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::isFullscreenOculus() const {
|
||||||
|
return OculusManager::isConnected() && _window->windowState().testFlag(Qt::WindowFullScreen);
|
||||||
|
}
|
||||||
|
|
||||||
void Application::nudgeVoxels() {
|
void Application::nudgeVoxels() {
|
||||||
VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
||||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && selectedNode) {
|
if (!Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && selectedNode) {
|
||||||
|
@ -2390,20 +2394,13 @@ void Application::updateCursor(float deltaTime) {
|
||||||
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||||
PerformanceWarning warn(showWarnings, "Application::updateCursor()");
|
PerformanceWarning warn(showWarnings, "Application::updateCursor()");
|
||||||
|
|
||||||
// in fullscreen Oculus mode, always hide cursor
|
|
||||||
if (OculusManager::isConnected() && _window->windowState().testFlag(Qt::WindowFullScreen)) {
|
|
||||||
getGLWidget()->setCursor(Qt::BlankCursor);
|
|
||||||
_mouseHidden = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// watch mouse position, if it hasn't moved, hide the cursor
|
// watch mouse position, if it hasn't moved, hide the cursor
|
||||||
bool underMouse = _glWidget->underMouse();
|
bool underMouse = _glWidget->underMouse();
|
||||||
if (!_mouseHidden) {
|
if (!_mouseHidden) {
|
||||||
uint64_t now = usecTimestampNow();
|
uint64_t now = usecTimestampNow();
|
||||||
int elapsed = now - _lastMouseMove;
|
int elapsed = now - _lastMouseMove;
|
||||||
const int HIDE_CURSOR_TIMEOUT = 1 * 1000 * 1000; // 1 second
|
const int HIDE_CURSOR_TIMEOUT = 1 * 1000 * 1000; // 1 second
|
||||||
if (elapsed > HIDE_CURSOR_TIMEOUT && (underMouse || !_seenMouseMove)) {
|
if ((elapsed > HIDE_CURSOR_TIMEOUT && (underMouse || !_seenMouseMove)) || isFullscreenOculus()) {
|
||||||
getGLWidget()->setCursor(Qt::BlankCursor);
|
getGLWidget()->setCursor(Qt::BlankCursor);
|
||||||
_mouseHidden = true;
|
_mouseHidden = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,6 +295,8 @@ private:
|
||||||
|
|
||||||
void displayRearMirrorTools();
|
void displayRearMirrorTools();
|
||||||
|
|
||||||
|
bool isFullscreenOculus() const;
|
||||||
|
|
||||||
QMainWindow* _window;
|
QMainWindow* _window;
|
||||||
QGLWidget* _glWidget;
|
QGLWidget* _glWidget;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue