Fixes Excel scroll-of-death problem: earlier select-loop failed to call xwin_process_events

when the queue was non-zero but the X11 socket was empty.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@118 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Åstrand 2002-09-12 09:38:31 +00:00
parent 7e7527302c
commit 65ec7634d9

29
xwin.c
View File

@ -517,6 +517,7 @@ toggle_fullscreen()
XFreePixmap(display, pixmap); XFreePixmap(display, pixmap);
} }
/* Process all events in Xlib queue */
static void static void
xwin_process_events() xwin_process_events()
{ {
@ -530,15 +531,6 @@ xwin_process_events()
char str[256]; char str[256];
Status status; 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)) while (XCheckMaskEvent(display, ~0, &xevent))
{ {
if (enable_compose && (XFilterEvent(&xevent, None) == True)) if (enable_compose && (XFilterEvent(&xevent, None) == True))
@ -651,6 +643,15 @@ xwin_process_events()
xevent.xexpose.height, xevent.xexpose.height,
xevent.xexpose.x, xevent.xexpose.y); xevent.xexpose.x, xevent.xexpose.y);
break; 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;
} }
} }
} }
@ -660,11 +661,15 @@ ui_select(int rdp_socket)
{ {
int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1; int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1;
fd_set rfds; fd_set rfds;
XEvent xevent;
FD_ZERO(&rfds); FD_ZERO(&rfds);
while (True) while (True)
{ {
/* Process any events already in queue */
xwin_process_events();
FD_ZERO(&rfds); FD_ZERO(&rfds);
FD_SET(rdp_socket, &rfds); FD_SET(rdp_socket, &rfds);
if (display != NULL) if (display != NULL)
@ -683,7 +688,11 @@ ui_select(int rdp_socket)
} }
if (FD_ISSET(x_socket, &rfds)) 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)) if (FD_ISSET(rdp_socket, &rfds))
return; return;