* 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
This commit is contained in:
Cacodemon345
2021-12-25 15:28:48 +06:00
parent 2c4fe15539
commit 9291f23461
2 changed files with 13 additions and 5 deletions

View File

@@ -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);

View File

@@ -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();