--- sourceforge.net/trunk/rdesktop/xwin.c 2002/09/11 11:11:27 116 +++ sourceforge.net/trunk/rdesktop/xwin.c 2002/09/12 09:38:31 119 @@ -247,7 +247,7 @@ } } -static BOOL +BOOL get_key_state(int keysym) { int keysymMask = 0, modifierpos, key; @@ -517,6 +517,7 @@ XFreePixmap(display, pixmap); } +/* Process all events in Xlib queue */ static void xwin_process_events() { @@ -530,15 +531,6 @@ char str[256]; Status status; - /* Refresh keyboard mapping if it has changed. This is important for - Xvnc, since it allocates keycodes dynamically */ - if (XCheckTypedEvent(display, MappingNotify, &xevent)) - { - if (xevent.xmapping.request == MappingKeyboard - || xevent.xmapping.request == MappingModifier) - XRefreshKeyboardMapping(&xevent.xmapping); - } - while (XCheckMaskEvent(display, ~0, &xevent)) { if (enable_compose && (XFilterEvent(&xevent, None) == True)) @@ -574,18 +566,12 @@ str, sizeof(str), &keysym, NULL); } - if (keysym == XK_Break) /* toggle full screen */ - { - if (get_key_state(XK_Alt_L) || get_key_state(XK_Alt_R)) - { - toggle_fullscreen(); - break; - } - } - ksname = get_ksname(keysym); DEBUG_KBD(("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname)); + if (handle_special_keys(keysym, ev_time, True)) + break; + tr = xkeymap_translate_key(keysym, xevent.xkey.keycode, xevent.xkey.state); @@ -604,6 +590,9 @@ DEBUG_KBD(("\nKeyRelease for (keysym 0x%lx, %s)\n", keysym, ksname)); + if (handle_special_keys(keysym, ev_time, False)) + break; + tr = xkeymap_translate_key(keysym, xevent.xkey.keycode, xevent.xkey.state); @@ -654,6 +643,15 @@ xevent.xexpose.height, xevent.xexpose.x, xevent.xexpose.y); break; + + case MappingNotify: + /* Refresh keyboard mapping if it has changed. This is important for + Xvnc, since it allocates keycodes dynamically */ + if (xevent.xmapping.request == MappingKeyboard + || xevent.xmapping.request == MappingModifier) + XRefreshKeyboardMapping(&xevent.xmapping); + break; + } } } @@ -663,11 +661,15 @@ { int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1; fd_set rfds; + XEvent xevent; FD_ZERO(&rfds); while (True) { + /* Process any events already in queue */ + xwin_process_events(); + FD_ZERO(&rfds); FD_SET(rdp_socket, &rfds); if (display != NULL) @@ -686,7 +688,11 @@ } if (FD_ISSET(x_socket, &rfds)) - xwin_process_events(); + { + /* Move new events from socket to queue */ + XPeekEvent(display, &xevent); + continue; + } if (FD_ISSET(rdp_socket, &rfds)) return;