71 |
static Atom g_protocol_atom, g_kill_atom; |
static Atom g_protocol_atom, g_kill_atom; |
72 |
static BOOL g_focused; |
static BOOL g_focused; |
73 |
static BOOL g_mouse_in_wnd; |
static BOOL g_mouse_in_wnd; |
74 |
/* Indicates the visual is has 15, 16 or 24 depth |
/* Indicates that: |
75 |
and the same color channel masks as its RDP equivalent. */ |
1) visual has 15, 16 or 24 depth and the same color channel masks |
76 |
static BOOL g_compatible_depth; |
as its RDP equivalent (implies X server is LE), |
77 |
|
2) host is LE |
78 |
|
This will trigger an optimization whose real value is questionable. |
79 |
|
*/ |
80 |
|
static BOOL g_compatible_arch; |
81 |
/* Indicates whether RDP's bitmaps and our XImages have the same |
/* Indicates whether RDP's bitmaps and our XImages have the same |
82 |
binary format. If so, we can avoid an expensive translation. |
binary format. If so, we can avoid an expensive translation. |
83 |
If this is True, so is g_compatible_depth. */ |
Note that this can be true when g_compatible_arch is false, |
84 |
|
e.g.: |
85 |
|
|
86 |
|
RDP(LE) <-> host(BE) <-> X-Server(LE) |
87 |
|
|
88 |
|
('host' is the machine running rdesktop; the host simply memcpy's |
89 |
|
so its endianess doesn't matter) |
90 |
|
*/ |
91 |
static BOOL g_no_translate_image = False; |
static BOOL g_no_translate_image = False; |
92 |
|
|
93 |
/* endianness */ |
/* endianness */ |
254 |
#define BSWAP32(x) { x = (((x & 0xff00ff) << 8) | ((x >> 8) & 0xff00ff)); \ |
#define BSWAP32(x) { x = (((x & 0xff00ff) << 8) | ((x >> 8) & 0xff00ff)); \ |
255 |
x = (x << 16) | (x >> 16); } |
x = (x << 16) | (x >> 16); } |
256 |
|
|
257 |
|
/* The following macros output the same octet sequences |
258 |
|
on both BE and LE hosts: */ |
259 |
|
|
260 |
#define BOUT16(o, x) { *(o++) = x >> 8; *(o++) = x; } |
#define BOUT16(o, x) { *(o++) = x >> 8; *(o++) = x; } |
261 |
#define BOUT24(o, x) { *(o++) = x >> 16; *(o++) = x >> 8; *(o++) = x; } |
#define BOUT24(o, x) { *(o++) = x >> 16; *(o++) = x >> 8; *(o++) = x; } |
262 |
#define BOUT32(o, x) { *(o++) = x >> 24; *(o++) = x >> 16; *(o++) = x >> 8; *(o++) = x; } |
#define BOUT32(o, x) { *(o++) = x >> 24; *(o++) = x >> 16; *(o++) = x >> 8; *(o++) = x; } |
336 |
{ |
{ |
337 |
uint16 value; |
uint16 value; |
338 |
|
|
339 |
if (g_compatible_depth) |
if (g_compatible_arch) |
340 |
{ |
{ |
341 |
/* *INDENT-OFF* */ |
/* *INDENT-OFF* */ |
342 |
REPEAT2 |
REPEAT2 |
370 |
{ |
{ |
371 |
uint32 value; |
uint32 value; |
372 |
|
|
373 |
if (g_compatible_depth) |
if (g_compatible_arch) |
374 |
{ |
{ |
375 |
while (out < end) |
while (out < end) |
376 |
{ |
{ |
393 |
{ |
{ |
394 |
uint32 value; |
uint32 value; |
395 |
|
|
396 |
if (g_compatible_depth) |
if (g_compatible_arch) |
397 |
{ |
{ |
398 |
/* *INDENT-OFF* */ |
/* *INDENT-OFF* */ |
399 |
REPEAT4 |
REPEAT4 |
465 |
uint16 pixel; |
uint16 pixel; |
466 |
PixelColour pc; |
PixelColour pc; |
467 |
|
|
468 |
if (g_compatible_depth) |
if (g_compatible_arch) |
469 |
{ |
{ |
470 |
/* *INDENT-OFF* */ |
/* *INDENT-OFF* */ |
471 |
REPEAT3 |
REPEAT3 |
515 |
uint32 value; |
uint32 value; |
516 |
PixelColour pc; |
PixelColour pc; |
517 |
|
|
518 |
if (g_compatible_depth) |
if (g_compatible_arch) |
519 |
{ |
{ |
520 |
/* *INDENT-OFF* */ |
/* *INDENT-OFF* */ |
521 |
REPEAT4 |
REPEAT4 |
623 |
uint16 pixel; |
uint16 pixel; |
624 |
PixelColour pc; |
PixelColour pc; |
625 |
|
|
626 |
if (g_compatible_depth) |
if (g_compatible_arch) |
627 |
{ |
{ |
628 |
/* *INDENT-OFF* */ |
/* *INDENT-OFF* */ |
629 |
REPEAT3 |
REPEAT3 |
693 |
uint32 value; |
uint32 value; |
694 |
PixelColour pc; |
PixelColour pc; |
695 |
|
|
696 |
if (g_compatible_depth) |
if (g_compatible_arch) |
697 |
{ |
{ |
698 |
/* *INDENT-OFF* */ |
/* *INDENT-OFF* */ |
699 |
REPEAT4 |
REPEAT4 |
822 |
uint32 value; |
uint32 value; |
823 |
PixelColour pc; |
PixelColour pc; |
824 |
|
|
825 |
if (g_compatible_depth) |
if (g_compatible_arch) |
826 |
{ |
{ |
827 |
/* *INDENT-OFF* */ |
/* *INDENT-OFF* */ |
828 |
#ifdef NEED_ALIGN |
#ifdef NEED_ALIGN |
1035 |
vmatches = XGetVisualInfo(g_display, VisualClassMask, &template, &visuals_count); |
vmatches = XGetVisualInfo(g_display, VisualClassMask, &template, &visuals_count); |
1036 |
g_visual = NULL; |
g_visual = NULL; |
1037 |
g_no_translate_image = False; |
g_no_translate_image = False; |
1038 |
g_compatible_depth = False; |
g_compatible_arch = False; |
1039 |
if (vmatches != NULL) |
if (vmatches != NULL) |
1040 |
{ |
{ |
1041 |
for (i = 0; i < visuals_count; ++i) |
for (i = 0; i < visuals_count; ++i) |
1062 |
{ |
{ |
1063 |
g_visual = visual_info->visual; |
g_visual = visual_info->visual; |
1064 |
g_depth = visual_info->depth; |
g_depth = visual_info->depth; |
1065 |
g_compatible_depth = True; |
g_compatible_arch = !g_host_be; |
1066 |
g_no_translate_image = (visual_info->depth == g_server_depth); |
g_no_translate_image = (visual_info->depth == g_server_depth); |
1067 |
if (g_no_translate_image) |
if (g_no_translate_image) |
1068 |
/* We found the best visual */ |
/* We found the best visual */ |
1070 |
} |
} |
1071 |
else |
else |
1072 |
{ |
{ |
1073 |
g_compatible_depth = False; |
g_compatible_arch = False; |
1074 |
} |
} |
1075 |
|
|
1076 |
if (visual_info->depth > 24) |
if (visual_info->depth > 24) |