Fix crash on X servers without UTF-8 support.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 31 Oct 2011 23:37:57 -0400
changeset 6045 b8e995dab018
parent 6044 35448a5ea044
child 6046 3b33b82cdbac
Fix crash on X servers without UTF-8 support.
src/video/x11/SDL_x11window.c
--- a/src/video/x11/SDL_x11window.c	Mon Oct 31 05:56:58 2011 -0400
+++ b/src/video/x11/SDL_x11window.c	Mon Oct 31 23:37:57 2011 -0400
@@ -265,6 +265,7 @@
     Atom _NET_WM_WINDOW_TYPE_NORMAL;
     int wmstate_count;
     Atom wmstate_atoms[3];
+    Uint32 fevent = 0;
 
 #if SDL_VIDEO_DRIVER_X11_XINERAMA
 /* FIXME
@@ -554,28 +555,19 @@
     }
 
 #ifdef X_HAVE_UTF8_STRING
-    {
-        Uint32 fevent = 0;
+    if (SDL_X11_HAVE_UTF8) {
         pXGetICValues(((SDL_WindowData *) window->driverdata)->ic,
                       XNFilterEvents, &fevent, NULL);
-        XSelectInput(display, w,
-                     (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
-                      ExposureMask | ButtonPressMask | ButtonReleaseMask |
-                      PointerMotionMask | KeyPressMask | KeyReleaseMask |
-                      PropertyChangeMask | StructureNotifyMask |
-                      KeymapStateMask | fevent));
-    }
-#else
-    {
-        XSelectInput(display, w,
-                     (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
-                      ExposureMask | ButtonPressMask | ButtonReleaseMask |
-                      PointerMotionMask | KeyPressMask | KeyReleaseMask |
-                      PropertyChangeMask | StructureNotifyMask |
-                      KeymapStateMask));
     }
 #endif
 
+    XSelectInput(display, w,
+                 (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
+                 ExposureMask | ButtonPressMask | ButtonReleaseMask |
+                 PointerMotionMask | KeyPressMask | KeyReleaseMask |
+                 PropertyChangeMask | StructureNotifyMask |
+                 KeymapStateMask | fevent));
+
     XFlush(display);
 
     return 0;