VIDEO: Act on potential libSDL error return values
This commit is contained in:
parent
88dde792b7
commit
33b88a3e83
1 changed files with 10 additions and 5 deletions
15
sim_video.c
15
sim_video.c
|
@ -1102,10 +1102,13 @@ if (vid_mouse_captured) {
|
||||||
#endif
|
#endif
|
||||||
sim_debug (SIM_VID_DBG_KEY, vid_dev, "vid_key() - Cursor Release\n");
|
sim_debug (SIM_VID_DBG_KEY, vid_dev, "vid_key() - Cursor Release\n");
|
||||||
#if SDL_MAJOR_VERSION == 1
|
#if SDL_MAJOR_VERSION == 1
|
||||||
SDL_WM_GrabInput (SDL_GRAB_OFF); /* relese cursor */
|
if (SDL_WM_GrabInput (SDL_GRAB_OFF) < 0) /* relese cursor */
|
||||||
SDL_ShowCursor (SDL_ENABLE); /* show cursor */
|
sim_printf ("%s: vid_key(): SDL_WM_GrabInput error: %s\n", sim_dname(vid_dev), SDL_GetError());
|
||||||
|
if (SDL_ShowCursor (SDL_ENABLE) < 0) /* show cursor */
|
||||||
|
sim_printf ("%s: vid_key(): SDL_ShowCursor error: %s\n", sim_dname(vid_dev), SDL_GetError());
|
||||||
#else
|
#else
|
||||||
SDL_SetRelativeMouseMode(SDL_FALSE); /* release cursor, show cursor */
|
if (SDL_SetRelativeMouseMode(SDL_FALSE) < 0) /* release cursor, show cursor */
|
||||||
|
sim_printf ("%s: vid_key(): SDL_SetRelativeMouseMode error: %s\n", sim_dname(vid_dev), SDL_GetError());
|
||||||
#endif
|
#endif
|
||||||
vid_mouse_captured = FALSE;
|
vid_mouse_captured = FALSE;
|
||||||
return;
|
return;
|
||||||
|
@ -1244,7 +1247,8 @@ if ((!vid_mouse_captured) && (vid_flags & SIM_VID_INPUTCAPTURED)) {
|
||||||
SDL_PumpEvents ();
|
SDL_PumpEvents ();
|
||||||
while (SDL_PeepEvents (&dummy_event, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK)) {};
|
while (SDL_PeepEvents (&dummy_event, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK)) {};
|
||||||
#else
|
#else
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE); /* lock cursor to window, hide cursor */
|
if (SDL_SetRelativeMouseMode (SDL_TRUE) < 0) /* lock cursor to window, hide cursor */
|
||||||
|
sim_printf ("%s: vid_mouse_button(): SDL_SetRelativeMouseMode error: %s\n", sim_dname(vid_dev), SDL_GetError());
|
||||||
SDL_WarpMouseInWindow (NULL, vid_width/2, vid_height/2);/* back to center */
|
SDL_WarpMouseInWindow (NULL, vid_width/2, vid_height/2);/* back to center */
|
||||||
SDL_PumpEvents ();
|
SDL_PumpEvents ();
|
||||||
while (SDL_PeepEvents (&dummy_event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION)) {};
|
while (SDL_PeepEvents (&dummy_event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION)) {};
|
||||||
|
@ -1301,7 +1305,8 @@ sim_debug (SIM_VID_DBG_VIDEO, vid_dev, "Video Update Event: \n");
|
||||||
if (sim_deb)
|
if (sim_deb)
|
||||||
fflush (sim_deb);
|
fflush (sim_deb);
|
||||||
#if SDL_MAJOR_VERSION == 1
|
#if SDL_MAJOR_VERSION == 1
|
||||||
SDL_BlitSurface (vid_image, NULL, vid_window, &vid_dst);
|
if (SDL_BlitSurface (vid_image, NULL, vid_window, &vid_dst) < 0)
|
||||||
|
sim_printf ("%s: vid_update(): SDL_BlitSurface error: %s\n", sim_dname(vid_dev), SDL_GetError());
|
||||||
SDL_UpdateRects (vid_window, 1, &vid_dst);
|
SDL_UpdateRects (vid_window, 1, &vid_dst);
|
||||||
#else
|
#else
|
||||||
if (SDL_RenderClear (vid_renderer))
|
if (SDL_RenderClear (vid_renderer))
|
||||||
|
|
Loading…
Add table
Reference in a new issue