mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
Fix offset so that non-full-size window can be located anywhere on screen.
This commit is contained in:
parent
eb0517f3cd
commit
fdf9c0a217
3 changed files with 20 additions and 6 deletions
|
@ -305,6 +305,10 @@ void CompositorHelper::sendFakeMouseEvent() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME remove static Setting::Handle<QRect> windowGeometry("WindowGeometry");
|
||||||
|
|
||||||
|
#include "QWindow.h"
|
||||||
|
#include "QQuickWindow.h"
|
||||||
void CompositorHelper::setReticlePosition(const glm::vec2& position, bool sendFakeEvent) {
|
void CompositorHelper::setReticlePosition(const glm::vec2& position, bool sendFakeEvent) {
|
||||||
if (isHMD()) {
|
if (isHMD()) {
|
||||||
glm::vec2 maxOverlayPosition = _currentDisplayPlugin->getRecommendedUiSize();
|
glm::vec2 maxOverlayPosition = _currentDisplayPlugin->getRecommendedUiSize();
|
||||||
|
@ -322,7 +326,20 @@ void CompositorHelper::setReticlePosition(const glm::vec2& position, bool sendFa
|
||||||
sendFakeMouseEvent();
|
sendFakeMouseEvent();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QCursor::setPos(position.x, position.y);
|
if (!_mainWindow) {
|
||||||
|
auto windows = qApp->topLevelWindows();
|
||||||
|
QWindow* result = nullptr;
|
||||||
|
for (auto window : windows) {
|
||||||
|
QVariant isMainWindow = window->property("MainWindow");
|
||||||
|
if (!qobject_cast<QQuickWindow*>(window)) {
|
||||||
|
result = window;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_mainWindow = result;;
|
||||||
|
}
|
||||||
|
const int MENU_BAR_HEIGHT = 20;
|
||||||
|
QCursor::setPos(position.x + _mainWindow->x(), position.y + _mainWindow->y() + MENU_BAR_HEIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QtCore/QPropertyAnimation>
|
#include <QtCore/QPropertyAnimation>
|
||||||
#include <QtGui/QCursor>
|
#include <QtGui/QCursor>
|
||||||
#include <QtGui/QMouseEvent>
|
#include <QtGui/QMouseEvent>
|
||||||
|
#include <QtGui/QWindow>
|
||||||
|
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
#include <Transform.h>
|
#include <Transform.h>
|
||||||
|
@ -182,6 +183,7 @@ private:
|
||||||
bool _fakeMouseEvent { false };
|
bool _fakeMouseEvent { false };
|
||||||
|
|
||||||
ReticleInterface* _reticleInterface { nullptr };
|
ReticleInterface* _reticleInterface { nullptr };
|
||||||
|
QWindow* _mainWindow { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
// Scripting interface available to control the Reticle
|
// Scripting interface available to control the Reticle
|
||||||
|
|
|
@ -84,11 +84,6 @@ function ignoreMouseActivity() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var setReticlePosition = function (point2d) {
|
var setReticlePosition = function (point2d) {
|
||||||
if (!HMD.active) {
|
|
||||||
// FIX SYSTEM BUG: setPosition is setting relative to screen origin, not the content area of the window.
|
|
||||||
// https://app.asana.com/0/26225263936266/118427643788550
|
|
||||||
point2d = {x: point2d.x, y: point2d.y + 50};
|
|
||||||
}
|
|
||||||
weMovedReticle = true;
|
weMovedReticle = true;
|
||||||
Reticle.setPosition(point2d);
|
Reticle.setPosition(point2d);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue