Skip to content
Snippets Groups Projects
Commit cb7184e9 authored by deuce's avatar deuce
Browse files

bugfix: VIDEOMODE cannot be a blocking call.

parent 0d034032
No related branches found
No related tags found
No related merge requests found
...@@ -61,6 +61,7 @@ int sdl_ufunc_retval; ...@@ -61,6 +61,7 @@ int sdl_ufunc_retval;
int fullscreen=0; int fullscreen=0;
SDL_sem *sdl_init_complete;
int sdl_init_good=0; int sdl_init_good=0;
SDL_mutex *sdl_keylock; SDL_mutex *sdl_keylock;
SDL_sem *sdl_key_pending; SDL_sem *sdl_key_pending;
...@@ -261,6 +262,7 @@ void sdl_user_func(int func, ...) ...@@ -261,6 +262,7 @@ void sdl_user_func(int func, ...)
} }
while(sdl.PeepEvents(&ev, 1, SDL_ADDEVENT, 0xffffffff)!=1); while(sdl.PeepEvents(&ev, 1, SDL_ADDEVENT, 0xffffffff)!=1);
break; break;
case SDL_USEREVENT_SETVIDMODE:
case SDL_USEREVENT_COPY: case SDL_USEREVENT_COPY:
case SDL_USEREVENT_PASTE: case SDL_USEREVENT_PASTE:
case SDL_USEREVENT_SHOWMOUSE: case SDL_USEREVENT_SHOWMOUSE:
...@@ -289,7 +291,6 @@ int sdl_user_func_ret(int func, ...) ...@@ -289,7 +291,6 @@ int sdl_user_func_ret(int func, ...)
ev.user.code=func; ev.user.code=func;
va_start(argptr, func); va_start(argptr, func);
switch(func) { switch(func) {
case SDL_USEREVENT_SETVIDMODE:
case SDL_USEREVENT_INIT: case SDL_USEREVENT_INIT:
case SDL_USEREVENT_QUIT: case SDL_USEREVENT_QUIT:
while(sdl.PeepEvents(&ev, 1, SDL_ADDEVENT, 0xffffffff)!=1); while(sdl.PeepEvents(&ev, 1, SDL_ADDEVENT, 0xffffffff)!=1);
...@@ -452,7 +453,7 @@ int sdl_init_mode(int mode) ...@@ -452,7 +453,7 @@ int sdl_init_mode(int mode)
if(vstat.scaling < 1) if(vstat.scaling < 1)
vstat.scaling = 1; vstat.scaling = 1;
sdl_user_func_ret(SDL_USEREVENT_SETVIDMODE); sdl_user_func(SDL_USEREVENT_SETVIDMODE);
return(0); return(0);
} }
...@@ -617,7 +618,7 @@ void sdl_add_key(unsigned int keyval) ...@@ -617,7 +618,7 @@ void sdl_add_key(unsigned int keyval)
if(keyval==0xa600) { if(keyval==0xa600) {
fullscreen=!fullscreen; fullscreen=!fullscreen;
cio_api.mode=fullscreen?CIOLIB_MODE_SDL_FULLSCREEN:CIOLIB_MODE_SDL; cio_api.mode=fullscreen?CIOLIB_MODE_SDL_FULLSCREEN:CIOLIB_MODE_SDL;
sdl_user_func_ret(SDL_USEREVENT_SETVIDMODE); sdl_user_func(SDL_USEREVENT_SETVIDMODE);
return; return;
} }
if(keyval <= 0xffff) { if(keyval <= 0xffff) {
...@@ -1306,8 +1307,6 @@ int sdl_video_event_thread(void *data) ...@@ -1306,8 +1307,6 @@ int sdl_video_event_thread(void *data)
} }
else else
pthread_mutex_unlock(&vstatlock); pthread_mutex_unlock(&vstatlock);
sdl_ufunc_retval=0;
sdl.SemPost(sdl_ufunc_ret);
break; break;
case SDL_USEREVENT_HIDEMOUSE: case SDL_USEREVENT_HIDEMOUSE:
sdl.ShowCursor(SDL_DISABLE); sdl.ShowCursor(SDL_DISABLE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment