qt: port atomic_flag doresize from master
This commit is contained in:
@@ -66,16 +66,17 @@ extern int strnicmp(const char* s1, const char* s2, size_t n);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#define atomic_flag std::atomic_flag
|
#define atomic_flag_t std::atomic_flag
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#else
|
#else
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
|
#define atomic_flag_t atomic_flag
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Global variables residing in the platform module. */
|
/* Global variables residing in the platform module. */
|
||||||
extern int dopause, /* system is paused */
|
extern int dopause, /* system is paused */
|
||||||
mouse_capture; /* mouse is captured in app */
|
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 */
|
extern volatile int is_quit; /* system exit requested */
|
||||||
|
|
||||||
#ifdef MTR_ENABLED
|
#ifdef MTR_ENABLED
|
||||||
|
@@ -80,12 +80,11 @@ main_thread_fn()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If needed, handle a screen resize. */
|
/* 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)
|
if (vid_resize & 2)
|
||||||
plat_resize(fixed_size_x, fixed_size_y);
|
plat_resize(fixed_size_x, fixed_size_y);
|
||||||
else
|
else
|
||||||
plat_resize(scrnsz_x, scrnsz_y);
|
plat_resize(scrnsz_x, scrnsz_y);
|
||||||
doresize = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1067,7 +1067,7 @@ static void update_scaled_checkboxes(Ui::MainWindow* ui, QAction* selected) {
|
|||||||
reset_screen_size();
|
reset_screen_size();
|
||||||
device_force_redraw();
|
device_force_redraw();
|
||||||
video_force_resize_set(1);
|
video_force_resize_set(1);
|
||||||
doresize = 1;
|
atomic_flag_clear(&doresize);
|
||||||
config_save();
|
config_save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user