winex11.drv: Transmit WM_DEADCHAR messages to applications

Simon Lipp sloonz at gmail.com
Mon Apr 15 07:56:57 CDT 2013


Dead characters (like dead_circumflex) keyboard events are filtered
by input method, and are therefore ignored by Wine. However, some
applications rely on WM_DEADCHAR messages (most notably games for key
bindings configuration) ; so we have to ignore XFilterEvent() result
for dead characters, so applications may receive the WM_DEADCHAR message.
---
 dlls/winex11.drv/event.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 5e5b19e..af0087d 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -389,6 +389,10 @@ static int process_events( Display *display, Bool (*filter)(Display*, XEvent*,XP
         count++;
         if (XFilterEvent( &event, None ))
         {
+            KeySym keysym = 0;
+            XLookupString(&event.xkey, NULL, 0, &keysym, NULL);
+            BOOL is_dead = (keysym >= XK_dead_grave && keysym <=XK_dead_semivoiced_sound);
+
             /*
              * SCIM on linux filters key events strangely. It does not filter the
              * KeyPress events for these keys however it does filter the
@@ -397,13 +401,12 @@ static int process_events( Display *display, Bool (*filter)(Display*, XEvent*,XP
              *
              * We need to let those KeyRelease events be processed so that the
              * keyboard state is correct.
+             *
+             * Moreover, let dead chars be processed or we will never have
+             * WM_DEADCHAR events
              */
-            if (event.type == KeyRelease)
+            if (event.type == KeyRelease || is_dead)
             {
-                KeySym keysym = 0;
-                XKeyEvent *keyevent = &event.xkey;
-
-                XLookupString(keyevent, NULL, 0, &keysym, NULL);
                 if (!(keysym == XK_Shift_L ||
                     keysym == XK_Shift_R ||
                     keysym == XK_Control_L ||
@@ -411,7 +414,8 @@ static int process_events( Display *display, Bool (*filter)(Display*, XEvent*,XP
                     keysym == XK_Alt_R ||
                     keysym == XK_Alt_L ||
                     keysym == XK_Meta_R ||
-                    keysym == XK_Meta_L))
+                    keysym == XK_Meta_L ||
+                    is_dead))
                         continue; /* not a key we care about, ignore it */
             }
             else
-- 
1.8.2.1




More information about the wine-patches mailing list