mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +02:00
Merge pull request #8121 from SamGondelman/miniMirrorFix
Mini mirror/multi-monitor bug fixes
This commit is contained in:
commit
8561581ab2
4 changed files with 9 additions and 13 deletions
|
@ -1579,13 +1579,7 @@ void Application::initializeUi() {
|
||||||
});
|
});
|
||||||
offscreenUi->resume();
|
offscreenUi->resume();
|
||||||
connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect& r){
|
connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect& r){
|
||||||
static qreal oldDevicePixelRatio = 0;
|
resizeGL();
|
||||||
qreal devicePixelRatio = getActiveDisplayPlugin()->devicePixelRatio();
|
|
||||||
if (devicePixelRatio != oldDevicePixelRatio) {
|
|
||||||
oldDevicePixelRatio = devicePixelRatio;
|
|
||||||
qDebug() << "Device pixel ratio changed, triggering GL resize";
|
|
||||||
resizeGL();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// This will set up the input plugins UI
|
// This will set up the input plugins UI
|
||||||
|
@ -1960,7 +1954,8 @@ void Application::resizeGL() {
|
||||||
static qreal lastDevicePixelRatio = 0;
|
static qreal lastDevicePixelRatio = 0;
|
||||||
qreal devicePixelRatio = _window->devicePixelRatio();
|
qreal devicePixelRatio = _window->devicePixelRatio();
|
||||||
if (offscreenUi->size() != fromGlm(uiSize) || devicePixelRatio != lastDevicePixelRatio) {
|
if (offscreenUi->size() != fromGlm(uiSize) || devicePixelRatio != lastDevicePixelRatio) {
|
||||||
offscreenUi->resize(fromGlm(uiSize));
|
qDebug() << "Device pixel ratio changed, triggering resize";
|
||||||
|
offscreenUi->resize(fromGlm(uiSize), true);
|
||||||
_offscreenContext->makeCurrent();
|
_offscreenContext->makeCurrent();
|
||||||
lastDevicePixelRatio = devicePixelRatio;
|
lastDevicePixelRatio = devicePixelRatio;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,8 @@ void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
|
void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
|
||||||
if (!qApp->isHMDMode() && Menu::getInstance()->isOptionChecked(MenuOption::MiniMirror)) {
|
if (!qApp->isHMDMode() && Menu::getInstance()->isOptionChecked(MenuOption::MiniMirror) &&
|
||||||
|
!Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
|
||||||
gpu::Batch& batch = *renderArgs->_batch;
|
gpu::Batch& batch = *renderArgs->_batch;
|
||||||
|
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
|
@ -166,7 +167,7 @@ void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
|
||||||
batch.setViewTransform(Transform());
|
batch.setViewTransform(Transform());
|
||||||
|
|
||||||
float screenRatio = ((float)qApp->getDevicePixelRatio());
|
float screenRatio = ((float)qApp->getDevicePixelRatio());
|
||||||
float renderRatio = ((float)screenRatio * qApp->getRenderResolutionScale());
|
float renderRatio = ((float)qApp->getRenderResolutionScale());
|
||||||
|
|
||||||
auto viewport = qApp->getMirrorViewRect();
|
auto viewport = qApp->getMirrorViewRect();
|
||||||
glm::vec2 bottomLeft(viewport.left(), viewport.top() + viewport.height());
|
glm::vec2 bottomLeft(viewport.left(), viewport.top() + viewport.height());
|
||||||
|
|
|
@ -416,7 +416,7 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
||||||
_updateTimer.start();
|
_updateTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::resize(const QSize& newSize_) {
|
void OffscreenQmlSurface::resize(const QSize& newSize_, bool forceResize) {
|
||||||
|
|
||||||
if (!_renderer || !_renderer->_quickWindow) {
|
if (!_renderer || !_renderer->_quickWindow) {
|
||||||
return;
|
return;
|
||||||
|
@ -435,7 +435,7 @@ void OffscreenQmlSurface::resize(const QSize& newSize_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize currentSize = _renderer->_quickWindow->geometry().size();
|
QSize currentSize = _renderer->_quickWindow->geometry().size();
|
||||||
if (newSize == currentSize) {
|
if (newSize == currentSize && !forceResize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
using MouseTranslator = std::function<QPoint(const QPointF&)>;
|
using MouseTranslator = std::function<QPoint(const QPointF&)>;
|
||||||
|
|
||||||
virtual void create(QOpenGLContext* context);
|
virtual void create(QOpenGLContext* context);
|
||||||
void resize(const QSize& size);
|
void resize(const QSize& size, bool forceResize = false);
|
||||||
QSize size() const;
|
QSize size() const;
|
||||||
Q_INVOKABLE QObject* load(const QUrl& qmlSource, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
Q_INVOKABLE QObject* load(const QUrl& qmlSource, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
|
||||||
Q_INVOKABLE QObject* load(const QString& qmlSourceFile, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {}) {
|
Q_INVOKABLE QObject* load(const QString& qmlSourceFile, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {}) {
|
||||||
|
|
Loading…
Reference in a new issue