From 9291f23461116b47c3ecd14b56f1d379b0122e22 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 25 Dec 2021 15:28:48 +0600 Subject: [PATCH] * Fix black screen on Wayland when setting resizable options * Fix incorrect fixed size at startup when status bar is disabled * Fix incorrect fixed size when it is set from Specify Dimensions --- src/qt/qt_mainwindow.cpp | 11 ++++++++--- src/qt/qt_specifydimensions.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index cdd5a581b..49394a06b 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -316,7 +316,7 @@ void MainWindow::showEvent(QShowEvent *event) { setGeometry(window_x, window_y, window_w, window_h + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height())); } if (vid_resize == 2) { - setFixedSize(fixed_size_x, fixed_size_y + this->menuBar()->height() + this->statusBar()->height()); + setFixedSize(fixed_size_x, fixed_size_y + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height())); scrnsz_x = fixed_size_x; scrnsz_y = fixed_size_y; } @@ -913,10 +913,14 @@ void MainWindow::on_actionFullscreen_triggered() { if (video_fullscreen > 0) { showNormal(); ui->menubar->show(); - ui->statusbar->show(); + if (!hide_status_bar) ui->statusbar->show(); video_fullscreen = 0; - setGeometry(geometry()); + if (vid_resize != 1) { + if (vid_resize == 2) setFixedSize(fixed_size_x, fixed_size_y + menuBar()->height() + (!hide_status_bar ? statusBar()->height() : 0)); + emit resizeContents(scrnsz_x, scrnsz_y); + } } else { + setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); ui->menubar->hide(); ui->statusbar->hide(); showFullScreen(); @@ -1064,6 +1068,7 @@ void MainWindow::on_actionResizable_window_triggered(bool checked) { setWindowFlag(Qt::MSWindowsFixedSizeDialogHint); } show(); + ui->stackedWidget->switchRenderer((RendererStack::Renderer)vid_api); ui->menuWindow_scale_factor->setEnabled(! checked); emit resizeContents(scrnsz_x, scrnsz_y); diff --git a/src/qt/qt_specifydimensions.cpp b/src/qt/qt_specifydimensions.cpp index 85da6212b..ca4aa5706 100644 --- a/src/qt/qt_specifydimensions.cpp +++ b/src/qt/qt_specifydimensions.cpp @@ -45,14 +45,17 @@ void SpecifyDimensions::on_SpecifyDimensions_accepted() window_remember = 0; fixed_size_x = ui->spinBoxWidth->value(); fixed_size_y = ui->spinBoxHeight->value(); - main_window->setFixedSize(ui->spinBoxWidth->value(), ui->spinBoxHeight->value() + (hide_status_bar ? main_window->statusBar()->height() : 0) + main_window->menuBar()->height()); + main_window->setFixedSize(ui->spinBoxWidth->value(), ui->spinBoxHeight->value() + (!hide_status_bar ? main_window->statusBar()->height() : 0) + main_window->menuBar()->height()); emit main_window->updateMenuResizeOptions(); main_window->show(); + main_window->ui->stackedWidget->switchRenderer((RendererStack::Renderer)vid_api); } else { - if (vid_resize != 1) main_window->ui->actionResizable_window->trigger(); + main_window->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + main_window->ui->actionResizable_window->setChecked(false); vid_resize = 0; + main_window->ui->actionResizable_window->trigger(); window_remember = 1; window_w = ui->spinBoxWidth->value(); window_h = ui->spinBoxHeight->value();