1 diff -u rdesktop-1.5.0.orig/xwin.c rdesktop-1.5.0/xwin.c
2 --- rdesktop-1.5.0.orig/xwin.c 2006-08-07 19:45:44.000000000 +0800
3 +++ rdesktop-1.5.0/xwin.c 2006-10-10 09:59:02.000000000 +0800
8 +#include "X11/XKBlib.h"
9 +#include "X11/keysym.h"
11 /* We can't include Xproto.h because of conflicting defines for BOOL */
12 #define X_ConfigureWindow 12
14 As of RDP 5.1, it may be 8, 15, 16 or 24. */
15 extern int g_server_depth;
16 extern int g_win_button_size;
17 +extern RD_BOOL g_raw_keyboard;
20 Time g_last_gesturetime;
22 so its endianess doesn't matter)
24 static RD_BOOL g_no_translate_image = False;
25 +static RD_BOOL g_modeswitch_down = False;
28 static RD_BOOL g_host_be;
33 +extern void vk_handle_key( XKeyEvent *xkey);
35 /* Process events in Xlib queue
36 Returns 0 after user quit, 1 otherwise */
37 @@ -1980,6 +1985,12 @@
41 + if( g_raw_keyboard && ((xevent.type == KeyPress) || (xevent.type == KeyRelease))) {
42 + g_last_gesturetime = xevent.xkey.time;
43 + vk_handle_key( (XKeyEvent*)&xevent);
49 case VisibilityNotify:
50 @@ -2018,6 +2029,10 @@
51 XLookupString((XKeyEvent *) & xevent,
52 str, sizeof(str), &keysym, NULL);
55 + // Mode_switch during XGrabKeyboard fix: Ungrab Keyboard during Mode_switch
56 + if ( keysym == XK_Mode_switch ) g_modeswitch_down = True;
57 + if ( g_focused && g_modeswitch_down ) XUngrabKeyboard(g_display, CurrentTime);
59 DEBUG_KBD(("KeyPress for keysym (0x%lx, %s)\n", keysym,
61 @@ -2034,6 +2049,10 @@
62 g_last_gesturetime = xevent.xkey.time;
63 XLookupString((XKeyEvent *) & xevent, str,
64 sizeof(str), &keysym, NULL);
65 + // Mode_switch during XGrabKeyboard fix: Regrab Keyboard after Mode_switch
66 + if ( keysym == XK_Mode_switch ) g_modeswitch_down = False;
67 + if ( g_focused && !g_modeswitch_down ) XGrabKeyboard(g_display, g_wnd, True, GrabModeAsync, GrabModeAsync, CurrentTime);
70 DEBUG_KBD(("\nKeyRelease for keysym (0x%lx, %s)\n", keysym,