Fixed compiler warning (gcc w/ -Wall) for unused variable, and checked for SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Sun, 08 Jul 2007 01:35:50 +0000
branchSDL-1.2
changeset 4014 a6264945ac52
parent 4013 5804139bdf0b
child 4015 7e878cc4250a
Fixed compiler warning (gcc w/ -Wall) for unused variable, and checked for error return code too.
src/video/x11/SDL_x11video.c
--- a/src/video/x11/SDL_x11video.c	Sat Jul 07 19:22:27 2007 +0000
+++ b/src/video/x11/SDL_x11video.c	Sun Jul 08 01:35:50 2007 +0000
@@ -538,8 +538,17 @@
 				   whenever we re-create an IC.  */
 				unsigned long mask = 0;
 				char *ret = pXGetICValues(SDL_IC, XNFilterEvents, &mask, NULL);
-				XSelectInput(SDL_Display, WMwindow, app_event_mask | mask);
-				XSetICFocus(SDL_IC);
+				if (ret != NULL) {
+					XUnsetICFocus(SDL_IC);
+					XDestroyIC(SDL_IC);
+					SDL_IC = NULL;
+					SDL_SetError("no input context could be created");
+					XCloseIM(SDL_IM);
+					SDL_IM = NULL;
+				} else {
+					XSelectInput(SDL_Display, WMwindow, app_event_mask | mask);
+					XSetICFocus(SDL_IC);
+				}
 			}
 		}
 	}