207 |
} |
} |
208 |
|
|
209 |
#define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); } |
#define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); } |
210 |
#define BSWAP24(x) { x = (((x & 0xff) << 16) | (x >> 16) | ((x >> 8) & 0xff00)); } |
#define BSWAP24(x) { x = (((x & 0xff) << 16) | (x >> 16) | (x & 0xff00)); } |
211 |
#define BSWAP32(x) { x = (((x & 0xff00ff) << 8) | ((x >> 8) & 0xff00ff)); \ |
#define BSWAP32(x) { x = (((x & 0xff00ff) << 8) | ((x >> 8) & 0xff00ff)); \ |
212 |
x = (x << 16) | (x >> 16); } |
x = (x << 16) | (x >> 16); } |
213 |
|
|
245 |
while (out < end) |
while (out < end) |
246 |
{ |
{ |
247 |
value = (uint16) g_colmap[*(data++)]; |
value = (uint16) g_colmap[*(data++)]; |
248 |
|
|
249 |
if (g_xserver_be) |
if (g_xserver_be) |
250 |
{ |
{ |
251 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
268 |
while (out < end) |
while (out < end) |
269 |
{ |
{ |
270 |
value = g_colmap[*(data++)]; |
value = g_colmap[*(data++)]; |
271 |
|
|
272 |
if (g_xserver_be) |
if (g_xserver_be) |
273 |
{ |
{ |
274 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
481 |
|
|
482 |
if (g_host_be) |
if (g_host_be) |
483 |
{ |
{ |
484 |
BSWAP16(pixel)} |
BSWAP16(pixel); |
485 |
|
} |
486 |
|
|
487 |
value = make_colour(split_colour16(pixel)); |
value = make_colour(split_colour16(pixel)); |
488 |
|
|
532 |
static void |
static void |
533 |
translate24to24(uint8 * data, uint8 * out, uint8 * end) |
translate24to24(uint8 * data, uint8 * out, uint8 * end) |
534 |
{ |
{ |
535 |
|
uint32 pixel; |
536 |
|
uint32 value; |
537 |
|
|
538 |
while (out < end) |
while (out < end) |
539 |
{ |
{ |
540 |
*(out++) = (*(data++)); |
pixel = *(data++) << 16; |
541 |
|
pixel |= *(data++) << 8; |
542 |
|
pixel |= *(data++); |
543 |
|
|
544 |
|
value = make_colour(split_colour24(pixel)); |
545 |
|
|
546 |
|
if (g_xserver_be) |
547 |
|
{ |
548 |
|
*(out++) = value >> 16; |
549 |
|
*(out++) = value >> 8; |
550 |
|
*(out++) = value; |
551 |
|
} |
552 |
|
else |
553 |
|
{ |
554 |
|
*(out++) = value; |
555 |
|
*(out++) = value >> 8; |
556 |
|
*(out++) = value >> 16; |
557 |
|
} |
558 |
} |
} |
559 |
} |
} |
560 |
|
|
561 |
static void |
static void |
562 |
translate24to32(uint8 * data, uint8 * out, uint8 * end) |
translate24to32(uint8 * data, uint8 * out, uint8 * end) |
563 |
{ |
{ |
564 |
|
uint32 pixel; |
565 |
|
uint32 value; |
566 |
|
|
567 |
while (out < end) |
while (out < end) |
568 |
{ |
{ |
569 |
|
pixel = *(data++) << 16; |
570 |
|
pixel |= *(data++) << 8; |
571 |
|
pixel |= *(data++); |
572 |
|
|
573 |
|
value = make_colour(split_colour24(pixel)); |
574 |
|
|
575 |
if (g_xserver_be) |
if (g_xserver_be) |
576 |
{ |
{ |
577 |
*(out++) = 0x00; |
*(out++) = value >> 24; |
578 |
*(out++) = *(data++); |
*(out++) = value >> 16; |
579 |
*(out++) = *(data++); |
*(out++) = value >> 8; |
580 |
*(out++) = *(data++); |
*(out++) = value; |
581 |
} |
} |
582 |
else |
else |
583 |
{ |
{ |
584 |
*(out++) = *(data++); |
*(out++) = value; |
585 |
*(out++) = *(data++); |
*(out++) = value >> 8; |
586 |
*(out++) = *(data++); |
*(out++) = value >> 16; |
587 |
*(out++) = 0x00; |
*(out++) = value >> 24; |
588 |
} |
} |
589 |
} |
} |
590 |
} |
} |
730 |
|
|
731 |
g_visual = vi.visual; |
g_visual = vi.visual; |
732 |
g_owncolmap = False; |
g_owncolmap = False; |
733 |
calculate_shifts(vi.red_mask, &g_red_shift_r, &g_red_shift_l); |
calculate_shifts(vi.red_mask, &g_red_shift_r, &g_red_shift_l); |
734 |
calculate_shifts(vi.blue_mask, &g_blue_shift_r, &g_blue_shift_l); |
calculate_shifts(vi.blue_mask, &g_blue_shift_r, &g_blue_shift_l); |
735 |
calculate_shifts(vi.green_mask, &g_green_shift_r, &g_green_shift_l); |
calculate_shifts(vi.green_mask, &g_green_shift_r, &g_green_shift_l); |
736 |
} |
} |
737 |
|
|
849 |
g_display = NULL; |
g_display = NULL; |
850 |
} |
} |
851 |
|
|
|
#define NULL_POINTER_MASK "\x80" |
|
|
#define NULL_POINTER_DATA "\x0\x0\x0" |
|
|
|
|
852 |
BOOL |
BOOL |
853 |
ui_create_window(void) |
ui_create_window(void) |
854 |
{ |
{ |
855 |
|
uint8 null_pointer_mask[1] = { 0x80 }; |
856 |
|
uint8 null_pointer_data[4] = { 0x00, 0x00, 0x00, 0x00 }; |
857 |
XSetWindowAttributes attribs; |
XSetWindowAttributes attribs; |
858 |
XClassHint *classhints; |
XClassHint *classhints; |
859 |
XSizeHints *sizehints; |
XSizeHints *sizehints; |
936 |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
937 |
|
|
938 |
/* create invisible 1x1 cursor to be used as null cursor */ |
/* create invisible 1x1 cursor to be used as null cursor */ |
939 |
g_null_cursor = ui_create_cursor(0, 0, 1, 1, NULL_POINTER_MASK, NULL_POINTER_DATA); |
g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data); |
940 |
|
|
941 |
return True; |
return True; |
942 |
} |
} |
945 |
ui_destroy_window(void) |
ui_destroy_window(void) |
946 |
{ |
{ |
947 |
ui_destroy_cursor(g_null_cursor); |
ui_destroy_cursor(g_null_cursor); |
948 |
|
|
949 |
if (g_IC != NULL) |
if (g_IC != NULL) |
950 |
XDestroyIC(g_IC); |
XDestroyIC(g_IC); |
951 |
|
|