Fix window resize not always working
Change doresize to atomic_flag to prevent race condition
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <direct.h>
|
||||
#include <wchar.h>
|
||||
#include <io.h>
|
||||
#include <stdatomic.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/config.h>
|
||||
@@ -550,12 +551,11 @@ main_thread(void *param)
|
||||
// Sleep(1);
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1162,7 +1162,7 @@ plat_setfullscreen(int on)
|
||||
video_fullscreen &= 1;
|
||||
video_force_resize_set(1);
|
||||
if (!(on & 1))
|
||||
doresize = 1;
|
||||
atomic_flag_clear(&doresize);
|
||||
|
||||
win_mouse_init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user