From 16f7460c737433f7cc3348af133295115abce76e Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 31 Jul 2022 23:31:59 +0200 Subject: [PATCH] Attempt at some QT fixes. --- src/qt/qt_d3d9renderer.cpp | 2 +- src/qt/qt_mainwindow.cpp | 8 ++++++++ src/qt/qt_rendererstack.cpp | 2 +- src/qt/qt_ui.cpp | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_d3d9renderer.cpp b/src/qt/qt_d3d9renderer.cpp index cb2d0a25a..14357c12d 100644 --- a/src/qt/qt_d3d9renderer.cpp +++ b/src/qt/qt_d3d9renderer.cpp @@ -139,7 +139,7 @@ void D3D9Renderer::resizeEvent(QResizeEvent *event) void D3D9Renderer::blit(int x, int y, int w, int h) { - if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (monitors[m_monitor_index].target_buffer == NULL) || surfaceInUse) { + if (blitDummied || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (monitors[m_monitor_index].target_buffer == NULL) || surfaceInUse) { video_blit_complete_monitor(m_monitor_index); return; } diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index efe1e8682..d4bb122c3 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1594,7 +1594,11 @@ void MainWindow::keyPressEvent(QKeyEvent* event) void MainWindow::blitToWidget(int x, int y, int w, int h, int monitor_index) { if (monitor_index >= 1) { +#ifdef STRICTER_CHECK if (renderers[monitor_index] && renderers[monitor_index]->isVisible()) renderers[monitor_index]->blit(x, y, w, h); +#else + if (renderers[monitor_index]) renderers[monitor_index]->blit(x, y, w, h); +#endif else video_blit_complete_monitor(monitor_index); } else ui->stackedWidget->blit(x, y, w, h); @@ -2053,6 +2057,8 @@ void MainWindow::on_actionShow_non_primary_monitors_triggered() { show_second_monitors ^= 1; + blitDummied = true; + if (show_second_monitors) { for (int monitor_index = 1; monitor_index < MONITORS_NUM; monitor_index++) { auto& secondaryRenderer = renderers[monitor_index]; @@ -2079,5 +2085,7 @@ void MainWindow::on_actionShow_non_primary_monitors_triggered() } } } + + blitDummied = false; } diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index ef415a82c..a5955dbe9 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -435,7 +435,7 @@ RendererStack::blitRenderer(int x, int y, int w, int h) void RendererStack::blitCommon(int x, int y, int w, int h) { - if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (monitors[m_monitor_index].target_buffer == NULL) || imagebufs.empty() || std::get(imagebufs[currentBuf])->test_and_set() || blitDummied) { + if (blitDummied || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (monitors[m_monitor_index].target_buffer == NULL) || imagebufs.empty() || std::get(imagebufs[currentBuf])->test_and_set()) { video_blit_complete_monitor(m_monitor_index); return; } diff --git a/src/qt/qt_ui.cpp b/src/qt/qt_ui.cpp index 7400a4f7a..b7f2cffaf 100644 --- a/src/qt/qt_ui.cpp +++ b/src/qt/qt_ui.cpp @@ -73,6 +73,9 @@ wchar_t* ui_window_title(wchar_t* str) extern "C" void qt_blit(int x, int y, int w, int h, int monitor_index) { + if (blitDummied) + return; + main_window->blitToWidget(x, y, w, h, monitor_index); }