mirror of
https://github.com/overte-org/overte.git
synced 2025-04-18 21:57:10 +02:00
don't capture mouse when other windows or menus are active
This commit is contained in:
parent
5281f89d0d
commit
1403f8908f
2 changed files with 18 additions and 1 deletions
|
@ -5921,6 +5921,22 @@ void Application::cameraModeChanged() {
|
|||
cameraMenuChanged();
|
||||
}
|
||||
|
||||
bool Application::shouldCaptureMouse() const {
|
||||
if (!_captureMouse) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_glWidget->isActiveWindow()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ui::Menu::isSomeSubmenuShown()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Application::captureMouseChanged(bool captureMouse) {
|
||||
_captureMouse = captureMouse;
|
||||
if (_captureMouse) {
|
||||
|
@ -6281,7 +6297,7 @@ void Application::update(float deltaTime) {
|
|||
PROFILE_ASYNC_END(app, "Scene Loading", "");
|
||||
}
|
||||
|
||||
if (_captureMouse) {
|
||||
if (shouldCaptureMouse()) {
|
||||
QPoint point = _glWidget->mapToGlobal(_glWidget->geometry().center());
|
||||
if (QCursor::pos() != point) {
|
||||
_mouseCaptureTarget = point;
|
||||
|
|
|
@ -603,6 +603,7 @@ private:
|
|||
|
||||
void maybeToggleMenuVisible(QMouseEvent* event) const;
|
||||
void toggleTabletUI(bool shouldOpen = false) const;
|
||||
bool shouldCaptureMouse() const;
|
||||
|
||||
void userKickConfirmation(const QUuid& nodeID);
|
||||
|
||||
|
|
Loading…
Reference in a new issue