517 |
XFreePixmap(display, pixmap); |
XFreePixmap(display, pixmap); |
518 |
} |
} |
519 |
|
|
520 |
|
/* Process all events in Xlib queue */ |
521 |
static void |
static void |
522 |
xwin_process_events() |
xwin_process_events() |
523 |
{ |
{ |
531 |
char str[256]; |
char str[256]; |
532 |
Status status; |
Status status; |
533 |
|
|
|
/* 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); |
|
|
} |
|
|
|
|
534 |
while (XCheckMaskEvent(display, ~0, &xevent)) |
while (XCheckMaskEvent(display, ~0, &xevent)) |
535 |
{ |
{ |
536 |
if (enable_compose && (XFilterEvent(&xevent, None) == True)) |
if (enable_compose && (XFilterEvent(&xevent, None) == True)) |
643 |
xevent.xexpose.height, |
xevent.xexpose.height, |
644 |
xevent.xexpose.x, xevent.xexpose.y); |
xevent.xexpose.x, xevent.xexpose.y); |
645 |
break; |
break; |
646 |
|
|
647 |
|
case MappingNotify: |
648 |
|
/* Refresh keyboard mapping if it has changed. This is important for |
649 |
|
Xvnc, since it allocates keycodes dynamically */ |
650 |
|
if (xevent.xmapping.request == MappingKeyboard |
651 |
|
|| xevent.xmapping.request == MappingModifier) |
652 |
|
XRefreshKeyboardMapping(&xevent.xmapping); |
653 |
|
break; |
654 |
|
|
655 |
} |
} |
656 |
} |
} |
657 |
} |
} |
661 |
{ |
{ |
662 |
int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1; |
int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1; |
663 |
fd_set rfds; |
fd_set rfds; |
664 |
|
XEvent xevent; |
665 |
|
|
666 |
FD_ZERO(&rfds); |
FD_ZERO(&rfds); |
667 |
|
|
668 |
while (True) |
while (True) |
669 |
{ |
{ |
670 |
|
/* Process any events already in queue */ |
671 |
|
xwin_process_events(); |
672 |
|
|
673 |
FD_ZERO(&rfds); |
FD_ZERO(&rfds); |
674 |
FD_SET(rdp_socket, &rfds); |
FD_SET(rdp_socket, &rfds); |
675 |
if (display != NULL) |
if (display != NULL) |
688 |
} |
} |
689 |
|
|
690 |
if (FD_ISSET(x_socket, &rfds)) |
if (FD_ISSET(x_socket, &rfds)) |
691 |
xwin_process_events(); |
{ |
692 |
|
/* Move new events from socket to queue */ |
693 |
|
XPeekEvent(display, &xevent); |
694 |
|
continue; |
695 |
|
} |
696 |
|
|
697 |
if (FD_ISSET(rdp_socket, &rfds)) |
if (FD_ISSET(rdp_socket, &rfds)) |
698 |
return; |
return; |