From d3467568b0a5be4af6858abd1277321d591496f3 Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Fri, 17 Dec 2021 22:23:08 +0200 Subject: [PATCH] qt: port atomic_flag doresize from master --- src/include/86box/plat.h | 5 +++-- src/qt/qt_main.cpp | 3 +-- src/qt/qt_mainwindow.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index fde9bf8d8..8b6f709d2 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -66,16 +66,17 @@ extern int strnicmp(const char* s1, const char* s2, size_t n); #ifdef __cplusplus #include -#define atomic_flag std::atomic_flag +#define atomic_flag_t std::atomic_flag extern "C" { #else #include +#define atomic_flag_t atomic_flag #endif /* Global variables residing in the platform module. */ extern int dopause, /* system is paused */ mouse_capture; /* mouse is captured in app */ -extern atomic_flag doresize; /* screen resize requested */ +extern atomic_flag_t doresize; /* screen resize requested */ extern volatile int is_quit; /* system exit requested */ #ifdef MTR_ENABLED diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 5246dd3c5..f8ffd3720 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -80,12 +80,11 @@ main_thread_fn() } /* If needed, handle a screen resize. */ - if (doresize && !video_fullscreen && !is_quit) { + if (!atomic_flag_test_and_set(&doresize) && !video_fullscreen && !is_quit) { if (vid_resize & 2) plat_resize(fixed_size_x, fixed_size_y); else plat_resize(scrnsz_x, scrnsz_y); - doresize = 0; } } diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 839744eb3..a02ed77d6 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1067,7 +1067,7 @@ static void update_scaled_checkboxes(Ui::MainWindow* ui, QAction* selected) { reset_screen_size(); device_force_redraw(); video_force_resize_set(1); - doresize = 1; + atomic_flag_clear(&doresize); config_save(); }