diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index becfd8f9e..fb426ec8d 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -79,8 +79,13 @@ MainWindow::MainWindow(QWidget *parent) : connect(this, &MainWindow::resizeContents, this, [this](int w, int h) { if (!QApplication::platformName().contains("eglfs")) { + int modifiedHeight = h + menuBar()->height() + statusBar()->height(); ui->stackedWidget->resize(w, h); - resize(w, h + menuBar()->height() + statusBar()->height()); + if (vid_resize == 0) { + setFixedSize(w, modifiedHeight); + } else { + resize(w, modifiedHeight); + } } }); @@ -98,6 +103,7 @@ MainWindow::MainWindow(QWidget *parent) : ui->actionKeyboard_requires_capture->setChecked(kbd_req_capture); ui->actionRight_CTRL_is_left_ALT->setChecked(rctrl_is_lalt); + ui->actionResizable_window->setChecked(vid_resize > 0); setFocusPolicy(Qt::StrongFocus); ui->gles->setFocusPolicy(Qt::NoFocus); @@ -738,6 +744,7 @@ bool MainWindow::eventFilter(QObject* receiver, QEvent* event) return true; } } + return QMainWindow::eventFilter(receiver, event); } @@ -811,3 +818,14 @@ void MainWindow::focusOutEvent(QFocusEvent* event) { this->releaseKeyboard(); } + +void MainWindow::on_actionResizable_window_triggered(bool checked) { + if (checked) { + vid_resize = 1; + setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + } else { + vid_resize = 0; + } + emit resizeContents(scrnsz_x, scrnsz_y); +} + diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 6c56cfd6a..dde4e0fb7 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -56,6 +56,7 @@ private slots: void on_actionHardware_Renderer_OpenGL_ES_triggered(); void on_actionHardware_Renderer_OpenGL_triggered(); void on_actionSoftware_Renderer_triggered(); + void on_actionResizable_window_triggered(bool checked); void refreshMediaMenu(); void showMessage_(const QString& header, const QString& message); diff --git a/src/qt/qt_ui.cpp b/src/qt/qt_ui.cpp index cb9646660..4af7423cc 100644 --- a/src/qt/qt_ui.cpp +++ b/src/qt/qt_ui.cpp @@ -7,10 +7,6 @@ #include "qt_mainwindow.hpp" -std::atomic_int resize_pending = 0; -std::atomic_int resize_w = 0; -std::atomic_int resize_h = 0; - MainWindow* main_window = nullptr; extern "C" { @@ -46,10 +42,6 @@ void mouse_poll() { } void plat_resize(int w, int h) { - resize_w = w; - resize_h = h; - resize_pending = 1; - main_window->resizeContents(w, h); }