66 |
static int g_move_x_offset = 0; |
static int g_move_x_offset = 0; |
67 |
static int g_move_y_offset = 0; |
static int g_move_y_offset = 0; |
68 |
|
|
69 |
|
#ifdef WITH_RDPSND |
70 |
|
extern int g_dsp_fd; |
71 |
|
extern BOOL g_dsp_busy; |
72 |
|
#endif |
73 |
|
|
74 |
/* MWM decorations */ |
/* MWM decorations */ |
75 |
#define MWM_HINTS_DECORATIONS (1L << 1) |
#define MWM_HINTS_DECORATIONS (1L << 1) |
76 |
#define PROP_MOTIF_WM_HINTS_ELEMENTS 5 |
#define PROP_MOTIF_WM_HINTS_ELEMENTS 5 |
206 |
static uint32 |
static uint32 |
207 |
make_colour24(PixelColour pc) |
make_colour24(PixelColour pc) |
208 |
{ |
{ |
209 |
return (pc.red << 16) | (pc.green << 8) | pc.blue; |
if (g_xserver_be) |
210 |
|
{ |
211 |
|
return pc.red | (pc.green << 8) | (pc.blue << 16); |
212 |
|
} |
213 |
|
else |
214 |
|
{ |
215 |
|
return (pc.red << 16) | (pc.green << 8) | pc.blue; |
216 |
|
} |
217 |
} |
} |
218 |
|
|
219 |
static uint32 |
static uint32 |
220 |
make_colour32(PixelColour pc) |
make_colour32(PixelColour pc) |
221 |
{ |
{ |
222 |
return (pc.red << 16) | (pc.green << 8) | pc.blue; |
if (g_xserver_be) |
223 |
|
{ |
224 |
|
return pc.red | (pc.green << 8) | (pc.blue << 16); |
225 |
|
} |
226 |
|
else |
227 |
|
{ |
228 |
|
return (pc.red << 16) | (pc.green << 8) | pc.blue; |
229 |
|
} |
230 |
} |
} |
231 |
|
|
232 |
#define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); } |
#define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); } |
363 |
static void |
static void |
364 |
translate15to32(uint16 * data, uint32 * out, uint32 * end) |
translate15to32(uint16 * data, uint32 * out, uint32 * end) |
365 |
{ |
{ |
366 |
|
uint16 pixel; |
367 |
|
|
368 |
while (out < end) |
while (out < end) |
369 |
*(out++) = make_colour32(split_colour15(*(data++))); |
{ |
370 |
|
if (g_host_be) |
371 |
|
{ |
372 |
|
pixel = *(data++); |
373 |
|
pixel = (pixel & 0xff) << 8 | (pixel & 0xff00) >> 8; |
374 |
|
*(out++) = make_colour32(split_colour15(pixel)); |
375 |
|
} |
376 |
|
else |
377 |
|
{ |
378 |
|
*(out++) = make_colour32(split_colour15(*(data++))); |
379 |
|
} |
380 |
|
} |
381 |
} |
} |
382 |
|
|
383 |
static void |
static void |
405 |
static void |
static void |
406 |
translate16to32(uint16 * data, uint32 * out, uint32 * end) |
translate16to32(uint16 * data, uint32 * out, uint32 * end) |
407 |
{ |
{ |
408 |
|
uint16 pixel; |
409 |
|
|
410 |
while (out < end) |
while (out < end) |
411 |
*(out++) = make_colour32(split_colour16(*(data++))); |
{ |
412 |
|
if (g_host_be) |
413 |
|
{ |
414 |
|
pixel = *(data++); |
415 |
|
pixel = (pixel & 0xff) << 8 | (pixel & 0xff00) >> 8; |
416 |
|
*(out++) = make_colour32(split_colour16(pixel)); |
417 |
|
} |
418 |
|
else |
419 |
|
{ |
420 |
|
*(out++) = make_colour32(split_colour16(*(data++))); |
421 |
|
} |
422 |
|
} |
423 |
} |
} |
424 |
|
|
425 |
static void |
static void |
450 |
uint32 pixel = 0; |
uint32 pixel = 0; |
451 |
while (out < end) |
while (out < end) |
452 |
{ |
{ |
453 |
pixel = *(data++); |
if (g_host_be) |
454 |
pixel |= *(data++) << 8; |
{ |
455 |
pixel |= *(data++) << 16; |
pixel = *(data++) << 16; |
456 |
|
pixel |= *(data++) << 8; |
457 |
|
pixel |= *(data++); |
458 |
|
} |
459 |
|
else |
460 |
|
{ |
461 |
|
pixel = *(data++); |
462 |
|
pixel |= *(data++) << 8; |
463 |
|
pixel |= *(data++) << 16; |
464 |
|
} |
465 |
*(out++) = pixel; |
*(out++) = pixel; |
466 |
} |
} |
467 |
} |
} |
887 |
if (tr.scancode == 0) |
if (tr.scancode == 0) |
888 |
break; |
break; |
889 |
|
|
890 |
save_remote_modifiers(); |
save_remote_modifiers(tr.scancode); |
891 |
ensure_remote_modifiers(ev_time, tr); |
ensure_remote_modifiers(ev_time, tr); |
892 |
rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode); |
rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode); |
893 |
restore_remote_modifiers(); |
restore_remote_modifiers(ev_time, tr.scancode); |
894 |
|
|
895 |
break; |
break; |
896 |
|
|
1083 |
ui_select(int rdp_socket) |
ui_select(int rdp_socket) |
1084 |
{ |
{ |
1085 |
int n = (rdp_socket > g_x_socket) ? rdp_socket + 1 : g_x_socket + 1; |
int n = (rdp_socket > g_x_socket) ? rdp_socket + 1 : g_x_socket + 1; |
1086 |
fd_set rfds; |
fd_set rfds, wfds; |
|
|
|
|
FD_ZERO(&rfds); |
|
1087 |
|
|
1088 |
while (True) |
while (True) |
1089 |
{ |
{ |
1093 |
return 0; |
return 0; |
1094 |
|
|
1095 |
FD_ZERO(&rfds); |
FD_ZERO(&rfds); |
1096 |
|
FD_ZERO(&wfds); |
1097 |
FD_SET(rdp_socket, &rfds); |
FD_SET(rdp_socket, &rfds); |
1098 |
FD_SET(g_x_socket, &rfds); |
FD_SET(g_x_socket, &rfds); |
1099 |
|
|
1100 |
switch (select(n, &rfds, NULL, NULL, NULL)) |
#ifdef WITH_RDPSND |
1101 |
|
/* FIXME: there should be an API for registering fds */ |
1102 |
|
if (g_dsp_busy) |
1103 |
|
{ |
1104 |
|
FD_SET(g_dsp_fd, &wfds); |
1105 |
|
n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n; |
1106 |
|
} |
1107 |
|
#endif |
1108 |
|
|
1109 |
|
switch (select(n, &rfds, &wfds, NULL, NULL)) |
1110 |
{ |
{ |
1111 |
case -1: |
case -1: |
1112 |
error("select: %s\n", strerror(errno)); |
error("select: %s\n", strerror(errno)); |
1117 |
|
|
1118 |
if (FD_ISSET(rdp_socket, &rfds)) |
if (FD_ISSET(rdp_socket, &rfds)) |
1119 |
return 1; |
return 1; |
1120 |
|
|
1121 |
|
#ifdef WITH_RDPSND |
1122 |
|
if (g_dsp_busy && FD_ISSET(g_dsp_fd, &wfds)) |
1123 |
|
wave_out_play(); |
1124 |
|
#endif |
1125 |
} |
} |
1126 |
} |
} |
1127 |
|
|