47 |
static XIC IC; |
static XIC IC; |
48 |
static XModifierKeymap *mod_map; |
static XModifierKeymap *mod_map; |
49 |
static Cursor current_cursor; |
static Cursor current_cursor; |
50 |
|
static Atom protocol_atom, kill_atom; |
51 |
|
|
52 |
/* endianness */ |
/* endianness */ |
53 |
static BOOL host_be; |
static BOOL host_be; |
437 |
focused = False; |
focused = False; |
438 |
mouse_in_wnd = False; |
mouse_in_wnd = False; |
439 |
|
|
440 |
|
/* handle the WM_DELETE_WINDOW protocol */ |
441 |
|
protocol_atom = XInternAtom(display, "WM_PROTOCOLS", True); |
442 |
|
kill_atom = XInternAtom(display, "WM_DELETE_WINDOW", True); |
443 |
|
XSetWMProtocols(display, wnd, &kill_atom, 1); |
444 |
|
|
445 |
return True; |
return True; |
446 |
} |
} |
447 |
|
|
479 |
} |
} |
480 |
} |
} |
481 |
|
|
482 |
/* Process all events in Xlib queue */ |
/* Process all events in Xlib queue |
483 |
static void |
Returns 0 after user quit, 1 otherwise */ |
484 |
|
static int |
485 |
xwin_process_events(void) |
xwin_process_events(void) |
486 |
{ |
{ |
487 |
XEvent xevent; |
XEvent xevent; |
509 |
|
|
510 |
switch (xevent.type) |
switch (xevent.type) |
511 |
{ |
{ |
512 |
|
case ClientMessage: |
513 |
|
/* the window manager told us to quit */ |
514 |
|
if ((xevent.xclient.message_type == protocol_atom) |
515 |
|
&& (xevent.xclient.data.l[0] == kill_atom)) |
516 |
|
/* Quit */ |
517 |
|
return 0; |
518 |
|
break; |
519 |
|
|
520 |
case KeyPress: |
case KeyPress: |
521 |
if (IC != NULL) |
if (IC != NULL) |
522 |
/* Multi_key compatible version */ |
/* Multi_key compatible version */ |
660 |
|
|
661 |
} |
} |
662 |
} |
} |
663 |
|
/* Keep going */ |
664 |
|
return 1; |
665 |
} |
} |
666 |
|
|
667 |
void |
/* Returns 0 after user quit, 1 otherwise */ |
668 |
|
int |
669 |
ui_select(int rdp_socket) |
ui_select(int rdp_socket) |
670 |
{ |
{ |
671 |
int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1; |
int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1; |
676 |
while (True) |
while (True) |
677 |
{ |
{ |
678 |
/* Process any events already waiting */ |
/* Process any events already waiting */ |
679 |
xwin_process_events(); |
if (!xwin_process_events()) |
680 |
|
/* User quit */ |
681 |
|
return 0; |
682 |
|
|
683 |
FD_ZERO(&rfds); |
FD_ZERO(&rfds); |
684 |
FD_SET(rdp_socket, &rfds); |
FD_SET(rdp_socket, &rfds); |
694 |
} |
} |
695 |
|
|
696 |
if (FD_ISSET(rdp_socket, &rfds)) |
if (FD_ISSET(rdp_socket, &rfds)) |
697 |
return; |
return 1; |
698 |
} |
} |
699 |
} |
} |
700 |
|
|
1126 |
FILL_RECTANGLE(x, y, cx, cy); |
FILL_RECTANGLE(x, y, cx, cy); |
1127 |
} |
} |
1128 |
|
|
1129 |
|
/* warning, this function only draws on wnd or backstore, not both */ |
1130 |
void |
void |
1131 |
ui_draw_glyph(int mixmode, |
ui_draw_glyph(int mixmode, |
1132 |
/* dest */ int x, int y, int cx, int cy, |
/* dest */ int x, int y, int cx, int cy, |
1141 |
XSetStipple(display, gc, (Pixmap) glyph); |
XSetStipple(display, gc, (Pixmap) glyph); |
1142 |
XSetTSOrigin(display, gc, x, y); |
XSetTSOrigin(display, gc, x, y); |
1143 |
|
|
1144 |
FILL_RECTANGLE(x, y, cx, cy); |
if (ownbackstore) |
1145 |
|
XFillRectangle(display, backstore, gc, x, y, cx, cy); |
1146 |
|
else |
1147 |
|
XFillRectangle(display, wnd, gc, x, y, cx, cy); |
1148 |
|
|
1149 |
XSetFillStyle(display, gc, FillSolid); |
XSetFillStyle(display, gc, FillSolid); |
1150 |
} |
} |
1253 |
break; |
break; |
1254 |
} |
} |
1255 |
} |
} |
1256 |
|
if (ownbackstore) |
1257 |
|
{ |
1258 |
|
if (boxcx > 1) |
1259 |
|
XCopyArea(display, backstore, wnd, gc, boxx, |
1260 |
|
boxy, boxcx, boxcy, boxx, boxy); |
1261 |
|
else |
1262 |
|
XCopyArea(display, backstore, wnd, gc, clipx, |
1263 |
|
clipy, clipcx, clipcy, clipx, clipy); |
1264 |
|
} |
1265 |
} |
} |
1266 |
|
|
1267 |
void |
void |