Commit 3d215714 authored by deuce's avatar deuce
Browse files

Move SDL_GetWindowPosition() into main() thread as well.

parent a389029a
......@@ -1909,7 +1909,6 @@ void main_stub(void *argptr)
int main(int argc, char **argv)
{
struct main_args ma = {argc, argv, -1, 0};
sem_init(&initsdl_sem, 0, 0);
sem_init(&initsdldone_sem, 0, 0);
sem_init(&startsdl_sem, 0, 0);
......
......@@ -84,6 +84,7 @@ enum {
,SDL_USEREVENT_HIDEMOUSE
,SDL_USEREVENT_INIT
,SDL_USEREVENT_QUIT
,SDL_USEREVENT_GETWINPOS
};
const struct sdl_keyvals sdl_keyval[] =
......@@ -246,6 +247,10 @@ static int sdl_user_func_ret(int func, ...)
/* Drain the swamp */
while(1) {
switch(func) {
case SDL_USEREVENT_GETWINPOS:
ev.user.data1 = va_arg(argptr, void *);
ev.user.data2 = va_arg(argptr, void *);
// Fallthrough
case SDL_USEREVENT_SETVIDMODE:
case SDL_USEREVENT_INIT:
case SDL_USEREVENT_QUIT:
......@@ -506,13 +511,11 @@ int sdl_get_window_info(int *width, int *height, int *xpos, int *ypos)
int wx, wy;
if (xpos || ypos) {
sdl.LockMutex(win_mutex);
sdl.GetWindowPosition(win, &wx, &wy);
sdl_user_func_ret(SDL_USEREVENT_GETWINPOS, &wx, &wy);
if(xpos)
*xpos=wx;
if(ypos)
*ypos=wy;
sdl.UnlockMutex(win_mutex);
}
if (width || height) {
......@@ -1030,6 +1033,9 @@ void sdl_video_event_thread(void *data)
sdl_ufunc_retval=0;
sdl.SemPost(sdl_ufunc_ret);
break;
case SDL_USEREVENT_GETWINPOS:
sdl.GetWindowPosition(win, ev.user.data1, ev.user.data2);
sdl.SemPost(sdl_ufunc_ret);
}
break;
}
......
Markdown is supported
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