diff src/video/x11/SDL_x11window.c @ 2325:c7bcf84ba1b9

Next version of internationalized input for X11. On my machine (famous last words :-) with a US English keyboard and locale I can compose ` and e and get a text input event with the character รจ. You still get the keypress keyrelease events for the individual keys that go into composing the character.
author Bob Pendleton <bob@pendleton.com>
date Fri, 07 Mar 2008 20:54:11 +0000
parents 3202e4826c57
children 44e49d3fa6cf 64f346a83ed3
line wrap: on
line diff
--- a/src/video/x11/SDL_x11window.c	Fri Mar 07 17:20:37 2008 +0000
+++ b/src/video/x11/SDL_x11window.c	Fri Mar 07 20:54:11 2008 +0000
@@ -455,13 +455,6 @@
         XFree(wmhints);
     }
 
-    XSelectInput(data->display, w,
-                 (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
-                  ExposureMask | ButtonPressMask | ButtonReleaseMask |
-                  PointerMotionMask | KeyPressMask | KeyReleaseMask |
-                  PropertyChangeMask | StructureNotifyMask |
-                  KeymapStateMask));
-
     /* Set the class hints so we can get an icon (AfterStep) */
     classhints = XAllocClassHint();
     if (classhints != NULL) {
@@ -481,9 +474,29 @@
         }
 #endif
         XDestroyWindow(data->display, w);
-        X11_PumpEvents(_this);
         return -1;
     }
+#ifdef X_HAVE_UTF8_STRING
+    {
+        Uint32 fevent = 0;
+        pXGetICValues(((SDL_WindowData *) window->driverdata)->ic,
+                      XNFilterEvents, &fevent, NULL);
+        XSelectInput(data->display, w,
+                     (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
+                      ExposureMask | ButtonPressMask | ButtonReleaseMask |
+                      PointerMotionMask | KeyPressMask | KeyReleaseMask |
+                      PropertyChangeMask | StructureNotifyMask |
+                      KeymapStateMask | fevent));
+    }
+#else
+    XSelectInput(data->display, w,
+                 (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
+                  ExposureMask | ButtonPressMask | ButtonReleaseMask |
+                  PointerMotionMask | KeyPressMask | KeyReleaseMask |
+                  PropertyChangeMask | StructureNotifyMask |
+                  KeymapStateMask));
+#endif
+
     return 0;
 }
 
@@ -680,7 +693,6 @@
 #endif
         if (data->created) {
             XDestroyWindow(display, data->window);
-            X11_PumpEvents(_this);
         }
         SDL_free(data);
     }