From 548e8b360abe43bee3169fc21c35b4c2377034b3 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 16 Jul 2022 12:57:35 +0600 Subject: [PATCH] qt: Make renderer widget resizable only once --- src/qt/qt_mainwindow.cpp | 8 +++++--- src/qt/qt_mainwindow.hpp | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 72876c61c..0725d21a4 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -229,7 +229,10 @@ MainWindow::MainWindow(QWidget *parent) : }); connect(this, &MainWindow::resizeContents, this, [this](int w, int h) { - ui->stackedWidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + if (shownonce) { + if (resizableonce == false) ui->stackedWidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + resizableonce = true; + } if (!QApplication::platformName().contains("eglfs") && vid_resize != 1) { w = (w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.)); @@ -558,7 +561,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { if (renderers[i]) { monitor_settings[i].mon_window_w = renderers[i]->geometry().width(); monitor_settings[i].mon_window_h = renderers[i]->geometry().height(); - if (!QApplication::platformName().contains("wayland")) continue; + if (QApplication::platformName().contains("wayland")) continue; monitor_settings[i].mon_window_x = renderers[i]->geometry().x(); monitor_settings[i].mon_window_y = renderers[i]->geometry().y(); } @@ -582,7 +585,6 @@ void MainWindow::initRendererMonitorSlot(int monitor_index) auto& secondaryRenderer = this->renderers[monitor_index]; secondaryRenderer.reset(new RendererStack(nullptr, monitor_index)); if (secondaryRenderer) { - connect(this, &MainWindow::pollMouse, secondaryRenderer.get(), &RendererStack::mousePoll, Qt::DirectConnection); connect(secondaryRenderer.get(), &RendererStack::rendererChanged, this, [this, monitor_index] { this->renderers[monitor_index]->show(); diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index f0fd3ba6a..49300e72b 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -141,6 +141,7 @@ private: /* If main window should send keyboard input */ bool send_keyboard_input = true; bool shownonce = false; + bool resizableonce = false; friend class SpecifyDimensions; friend class ProgSettings;