From 0ce1a8edfe94d98b095d64e534389b15d74a20b9 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 7 Jul 2022 15:09:13 +0600 Subject: [PATCH] Fix compilation for non-Qt builds --- src/unix/unix.c | 5 ++++- src/unix/unix_sdl.c | 4 ++-- src/win/win.c | 7 +++++-- src/win/win_opengl.c | 4 ++-- src/win/win_sdl.c | 4 ++-- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/unix/unix.c b/src/unix/unix.c index 3ab5d46e6..9185fae47 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -563,11 +563,12 @@ main_thread(void *param) SDL_Delay(1); /* If needed, handle a screen resize. */ - if (!atomic_flag_test_and_set(&doresize) && !video_fullscreen && !is_quit) { + if (atomic_load(&doresize_monitors[0]) && !video_fullscreen && !is_quit) { if (vid_resize & 2) plat_resize(fixed_size_x, fixed_size_y); else plat_resize(scrnsz_x, scrnsz_y); + atomic_store(&doresize_monitors[0], 1); } } @@ -1114,6 +1115,7 @@ void monitor_thread(void* param) #endif } +extern int gfxcard_2; int main(int argc, char** argv) { SDL_Event event; @@ -1127,6 +1129,7 @@ int main(int argc, char** argv) return 6; } + gfxcard_2 = 0; eventthread = SDL_ThreadID(); blitmtx = SDL_CreateMutex(); if (!blitmtx) diff --git a/src/unix/unix_sdl.c b/src/unix/unix_sdl.c index 9cd164305..f4adf9581 100644 --- a/src/unix/unix_sdl.c +++ b/src/unix/unix_sdl.c @@ -134,12 +134,12 @@ sdl_blit_shim(int x, int y, int w, int h, int monitor_index) params.y = y; params.w = w; params.h = h; - if (!(!sdl_enabled || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL))) + if (!(!sdl_enabled || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) || (monitor_index >= 1)) video_copy(interpixels, &(buffer32->line[y][x]), h * 2048 * sizeof(uint32_t)); if (screenshots) video_screenshot(interpixels, 0, 0, 2048); blitreq = 1; - video_blit_complete(); + video_blit_complete_monitor(monitor_index); } void ui_window_title_real(); diff --git a/src/win/win.c b/src/win/win.c index ace45f16b..7636d9f36 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -495,6 +495,9 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow) return(1); } + extern int gfxcard_2; + gfxcard_2 = 0; + /* Create console window. */ if (force_debug) { CreateConsole(1); @@ -557,7 +560,7 @@ main_thread(void *param) plat_resize(fixed_size_x, fixed_size_y); else plat_resize(scrnsz_x, scrnsz_y); - atomic_store(&doresize_monitors[0]); + atomic_store(&doresize_monitors[0], 0); } } @@ -1190,7 +1193,7 @@ plat_setfullscreen(int on) video_fullscreen &= 1; video_force_resize_set(1); if (!(on & 1)) - atomic_flag_clear(&doresize); + atomic_store(&doresize_monitors[0], 1); win_mouse_init(); diff --git a/src/win/win_opengl.c b/src/win/win_opengl.c index 02d163293..8b8d39492 100644 --- a/src/win/win_opengl.c +++ b/src/win/win_opengl.c @@ -876,9 +876,9 @@ static void opengl_blit(int x, int y, int w, int h, int monitor_index) int row; if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (thread == NULL) || - atomic_flag_test_and_set(&blit_info[write_pos].in_use)) + atomic_flag_test_and_set(&blit_info[write_pos].in_use) || monitor_index >= 1) { - video_blit_complete(); + video_blit_complete_monitor(monitor_index); return; } diff --git a/src/win/win_sdl.c b/src/win/win_sdl.c index a2a8d5159..8bb0428c9 100644 --- a/src/win/win_sdl.c +++ b/src/win/win_sdl.c @@ -234,8 +234,8 @@ sdl_blit(int x, int y, int w, int h, int monitor_index) SDL_Rect r_src; int ret; - if (!sdl_enabled || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL)) { - video_blit_complete(); + if (!sdl_enabled || (x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (w > 2048) || (h > 2048) || (buffer32 == NULL) || (sdl_render == NULL) || (sdl_tex == NULL) || monitor_index >= 1) { + video_blit_complete_monitor(monitor_index); return; }