mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 16:23:16 +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();
|
||||
connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect& r){
|
||||
static qreal oldDevicePixelRatio = 0;
|
||||
qreal devicePixelRatio = getActiveDisplayPlugin()->devicePixelRatio();
|
||||
if (devicePixelRatio != oldDevicePixelRatio) {
|
||||
oldDevicePixelRatio = devicePixelRatio;
|
||||
qDebug() << "Device pixel ratio changed, triggering GL resize";
|
||||
resizeGL();
|
||||
}
|
||||
resizeGL();
|
||||
});
|
||||
|
||||
// This will set up the input plugins UI
|
||||
|
@ -1960,7 +1954,8 @@ void Application::resizeGL() {
|
|||
static qreal lastDevicePixelRatio = 0;
|
||||
qreal devicePixelRatio = _window->devicePixelRatio();
|
||||
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();
|
||||
lastDevicePixelRatio = devicePixelRatio;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,8 @@ void ApplicationOverlay::renderRearViewToFbo(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;
|
||||
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
@ -166,7 +167,7 @@ void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
|
|||
batch.setViewTransform(Transform());
|
||||
|
||||
float screenRatio = ((float)qApp->getDevicePixelRatio());
|
||||
float renderRatio = ((float)screenRatio * qApp->getRenderResolutionScale());
|
||||
float renderRatio = ((float)qApp->getRenderResolutionScale());
|
||||
|
||||
auto viewport = qApp->getMirrorViewRect();
|
||||
glm::vec2 bottomLeft(viewport.left(), viewport.top() + viewport.height());
|
||||
|
|
|
@ -416,7 +416,7 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
|||
_updateTimer.start();
|
||||
}
|
||||
|
||||
void OffscreenQmlSurface::resize(const QSize& newSize_) {
|
||||
void OffscreenQmlSurface::resize(const QSize& newSize_, bool forceResize) {
|
||||
|
||||
if (!_renderer || !_renderer->_quickWindow) {
|
||||
return;
|
||||
|
@ -435,7 +435,7 @@ void OffscreenQmlSurface::resize(const QSize& newSize_) {
|
|||
}
|
||||
|
||||
QSize currentSize = _renderer->_quickWindow->geometry().size();
|
||||
if (newSize == currentSize) {
|
||||
if (newSize == currentSize && !forceResize) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
using MouseTranslator = std::function<QPoint(const QPointF&)>;
|
||||
|
||||
virtual void create(QOpenGLContext* context);
|
||||
void resize(const QSize& size);
|
||||
void resize(const QSize& size, bool forceResize = false);
|
||||
QSize size() const;
|
||||
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*) {}) {
|
||||
|
|
Loading…
Reference in a new issue