updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / rdesktop-raw / xwin.c.diff
blobfd316a03d9a1e3066baad1f39610da0aa0a42f5a
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
4 @@ -27,6 +27,8 @@
5 #include <strings.h>
6 #include "rdesktop.h"
7 #include "xproto.h"
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
13 @@ -45,6 +47,7 @@
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;
19 Display *g_display;
20 Time g_last_gesturetime;
21 @@ -129,6 +132,7 @@
22 so its endianess doesn't matter)
24 static RD_BOOL g_no_translate_image = False;
25 +static RD_BOOL g_modeswitch_down = False;
27 /* endianness */
28 static RD_BOOL g_host_be;
29 @@ -1956,6 +1960,7 @@
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 @@
38 continue;
41 + if( g_raw_keyboard && ((xevent.type == KeyPress) || (xevent.type == KeyRelease))) {
42 + g_last_gesturetime = xevent.xkey.time;
43 + vk_handle_key( (XKeyEvent*)&xevent);
44 + continue;
45 + }
47 switch (xevent.type)
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,
60 get_ksname(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,
71 get_ksname(keysym)));