Commit 2fa70069 authored by Deucе's avatar Deucе 👌🏾
Browse files

Now that SDL_USEREVENT_SETVIDMODE takes a size, we can clean up

sdl_setwinsize() and eliminate another race.
parent e9aa2a80
Pipeline #3497 passed with stage
in 5 minutes and 22 seconds
......@@ -454,8 +454,9 @@ int sdl_init(int mode)
return(-1);
}
void sdl_setwinsize_locked(int w, int h)
static void internal_setwinsize(int w, int h)
{
pthread_mutex_lock(&vstatlock);
if (w > 16384)
w = 16384;
if (h > 16384)
......@@ -467,13 +468,13 @@ void sdl_setwinsize_locked(int w, int h)
cvstat.winwidth = vstat.winwidth = w;
cvstat.winheight = vstat.winheight = h;
internal_scaling = window_can_scale_internally(cvstat.winwidth, cvstat.winheight);
setup_surfaces_locked();
pthread_mutex_unlock(&vstatlock);
}
void sdl_setwinsize(int w, int h)
{
pthread_mutex_lock(&vstatlock);
sdl_setwinsize_locked(w, h);
pthread_mutex_unlock(&vstatlock);
sdl_user_func_ret(SDL_USEREVENT_SETVIDMODE, w, h);
}
void sdl_setwinposition(int x, int y)
......@@ -1039,10 +1040,7 @@ void sdl_video_event_thread(void *data)
break;
}
pthread_mutex_unlock(&sdl_mode_mutex);
pthread_mutex_lock(&vstatlock);
sdl_setwinsize_locked(ev.window.data1, ev.window.data2);
setup_surfaces_locked();
pthread_mutex_unlock(&vstatlock);
internal_setwinsize(ev.window.data1, ev.window.data2);
break;
case SDL_WINDOWEVENT_EXPOSED:
bitmap_drv_request_pixels();
......@@ -1198,10 +1196,7 @@ void sdl_video_event_thread(void *data)
sdl_mode = false;
pthread_mutex_unlock(&sdl_mode_mutex);
pthread_mutex_lock(&vstatlock);
sdl_setwinsize(ev.user.data1 - NULL, ev.user.data2 - NULL);
setup_surfaces_locked();
pthread_mutex_unlock(&vstatlock);
internal_setwinsize(ev.user.data1 - NULL, ev.user.data2 - NULL);
sdl_ufunc_retval=0;
sem_post(&sdl_ufunc_ret);
break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment