34 |
extern char g_title[]; |
extern char g_title[]; |
35 |
extern int g_server_bpp; |
extern int g_server_bpp; |
36 |
extern int g_win_button_size; |
extern int g_win_button_size; |
|
BOOL g_enable_compose = False; |
|
|
BOOL g_focused; |
|
|
BOOL g_mouse_in_wnd; |
|
37 |
|
|
38 |
Display *g_display; |
Display *g_display; |
39 |
Time g_last_gesturetime; |
Time g_last_gesturetime; |
40 |
static int g_x_socket; |
static int g_x_socket; |
41 |
static Screen *g_screen; |
static Screen *g_screen; |
42 |
Window g_wnd; |
Window g_wnd; |
43 |
|
BOOL g_enable_compose = False; |
44 |
static GC g_gc; |
static GC g_gc; |
45 |
static Visual *g_visual; |
static Visual *g_visual; |
46 |
static int g_depth; |
static int g_depth; |
49 |
static XIC g_IC; |
static XIC g_IC; |
50 |
static XModifierKeymap *g_mod_map; |
static XModifierKeymap *g_mod_map; |
51 |
static Cursor g_current_cursor; |
static Cursor g_current_cursor; |
52 |
|
static HCURSOR g_null_cursor; |
53 |
static Atom g_protocol_atom, g_kill_atom; |
static Atom g_protocol_atom, g_kill_atom; |
54 |
|
static BOOL g_focused; |
55 |
|
static BOOL g_mouse_in_wnd; |
56 |
|
|
57 |
/* endianness */ |
/* endianness */ |
58 |
static BOOL g_host_be; |
static BOOL g_host_be; |
70 |
#ifdef WITH_RDPSND |
#ifdef WITH_RDPSND |
71 |
extern int g_dsp_fd; |
extern int g_dsp_fd; |
72 |
extern BOOL g_dsp_busy; |
extern BOOL g_dsp_busy; |
73 |
|
extern BOOL g_rdpsnd; |
74 |
#endif |
#endif |
75 |
|
|
76 |
/* MWM decorations */ |
/* MWM decorations */ |
275 |
colour = make_colour16(split_colour24(colour)); |
colour = make_colour16(split_colour24(colour)); |
276 |
break; |
break; |
277 |
case 24: |
case 24: |
278 |
|
colour = make_colour24(split_colour24(colour)); |
279 |
break; |
break; |
280 |
case 32: |
case 32: |
281 |
colour = make_colour32(split_colour24(colour)); |
colour = make_colour32(split_colour24(colour)); |
283 |
} |
} |
284 |
break; |
break; |
285 |
} |
} |
|
switch (g_bpp) |
|
|
{ |
|
|
case 16: |
|
|
if (g_host_be != g_xserver_be) |
|
|
BSWAP16(colour); |
|
|
break; |
|
|
|
|
|
case 24: |
|
|
if (g_xserver_be) |
|
|
BSWAP24(colour); |
|
|
break; |
|
|
|
|
|
case 32: |
|
|
if (g_host_be != g_xserver_be) |
|
|
BSWAP32(colour); |
|
|
break; |
|
|
} |
|
|
|
|
286 |
return colour; |
return colour; |
287 |
} |
} |
288 |
|
|
294 |
} |
} |
295 |
|
|
296 |
static void |
static void |
297 |
translate8to16(uint8 * data, uint16 * out, uint16 * end) |
translate8to16(uint8 * data, uint8 * out, uint8 * end) |
298 |
{ |
{ |
299 |
|
uint16 value; |
300 |
|
|
301 |
while (out < end) |
while (out < end) |
302 |
*(out++) = (uint16) g_colmap[*(data++)]; |
{ |
303 |
|
value = (uint16) g_colmap[*(data++)]; |
304 |
|
|
305 |
|
if (g_xserver_be) |
306 |
|
{ |
307 |
|
*(out++) = value >> 8; |
308 |
|
*(out++) = value; |
309 |
|
} |
310 |
|
else |
311 |
|
{ |
312 |
|
*(out++) = value; |
313 |
|
*(out++) = value >> 8; |
314 |
|
} |
315 |
|
} |
316 |
} |
} |
317 |
|
|
318 |
/* little endian - conversion happens when colourmap is built */ |
/* little endian - conversion happens when colourmap is built */ |
324 |
while (out < end) |
while (out < end) |
325 |
{ |
{ |
326 |
value = g_colmap[*(data++)]; |
value = g_colmap[*(data++)]; |
327 |
*(out++) = value; |
|
328 |
*(out++) = value >> 8; |
if (g_xserver_be) |
329 |
*(out++) = value >> 16; |
{ |
330 |
|
*(out++) = value >> 16; |
331 |
|
*(out++) = value >> 8; |
332 |
|
*(out++) = value; |
333 |
|
} |
334 |
|
else |
335 |
|
{ |
336 |
|
*(out++) = value; |
337 |
|
*(out++) = value >> 8; |
338 |
|
*(out++) = value >> 16; |
339 |
|
} |
340 |
} |
} |
341 |
} |
} |
342 |
|
|
343 |
static void |
static void |
344 |
translate8to32(uint8 * data, uint32 * out, uint32 * end) |
translate8to32(uint8 * data, uint8 * out, uint8 * end) |
345 |
{ |
{ |
346 |
|
uint32 value; |
347 |
|
|
348 |
while (out < end) |
while (out < end) |
349 |
*(out++) = g_colmap[*(data++)]; |
{ |
350 |
|
value = g_colmap[*(data++)]; |
351 |
|
|
352 |
|
if (g_xserver_be) |
353 |
|
{ |
354 |
|
*(out++) = value >> 24; |
355 |
|
*(out++) = value >> 16; |
356 |
|
*(out++) = value >> 8; |
357 |
|
*(out++) = value; |
358 |
|
} |
359 |
|
else |
360 |
|
{ |
361 |
|
*(out++) = value; |
362 |
|
*(out++) = value >> 8; |
363 |
|
*(out++) = value >> 16; |
364 |
|
*(out++) = value >> 24; |
365 |
|
} |
366 |
|
} |
367 |
} |
} |
368 |
|
|
369 |
/* todo the remaining translate function might need some big endian check ?? */ |
/* todo the remaining translate function might need some big endian check ?? */ |
370 |
|
|
371 |
static void |
static void |
372 |
translate15to16(uint16 * data, uint16 * out, uint16 * end) |
translate15to16(uint16 * data, uint8 * out, uint8 * end) |
373 |
{ |
{ |
374 |
|
uint16 pixel; |
375 |
|
uint16 value; |
376 |
|
|
377 |
while (out < end) |
while (out < end) |
378 |
*(out++) = (uint16) make_colour16(split_colour15(*(data++))); |
{ |
379 |
|
pixel = *(data++); |
380 |
|
|
381 |
|
if (g_host_be) |
382 |
|
{ |
383 |
|
BSWAP16(pixel); |
384 |
|
} |
385 |
|
|
386 |
|
value = make_colour16(split_colour15(pixel)); |
387 |
|
|
388 |
|
if (g_xserver_be) |
389 |
|
{ |
390 |
|
*(out++) = value >> 8; |
391 |
|
*(out++) = value; |
392 |
|
} |
393 |
|
else |
394 |
|
{ |
395 |
|
*(out++) = value; |
396 |
|
*(out++) = value >> 8; |
397 |
|
} |
398 |
|
} |
399 |
} |
} |
400 |
|
|
401 |
static void |
static void |
402 |
translate15to24(uint16 * data, uint8 * out, uint8 * end) |
translate15to24(uint16 * data, uint8 * out, uint8 * end) |
403 |
{ |
{ |
404 |
uint32 value; |
uint32 value; |
405 |
|
uint16 pixel; |
406 |
|
|
407 |
while (out < end) |
while (out < end) |
408 |
{ |
{ |
409 |
value = make_colour24(split_colour15(*(data++))); |
pixel = *(data++); |
410 |
*(out++) = value; |
|
411 |
*(out++) = value >> 8; |
if (g_host_be) |
412 |
*(out++) = value >> 16; |
{ |
413 |
|
BSWAP16(pixel); |
414 |
|
} |
415 |
|
|
416 |
|
value = make_colour24(split_colour15(pixel)); |
417 |
|
if (g_xserver_be) |
418 |
|
{ |
419 |
|
*(out++) = value >> 16; |
420 |
|
*(out++) = value >> 8; |
421 |
|
*(out++) = value; |
422 |
|
} |
423 |
|
else |
424 |
|
{ |
425 |
|
*(out++) = value; |
426 |
|
*(out++) = value >> 8; |
427 |
|
*(out++) = value >> 16; |
428 |
|
} |
429 |
} |
} |
430 |
} |
} |
431 |
|
|
432 |
static void |
static void |
433 |
translate15to32(uint16 * data, uint32 * out, uint32 * end) |
translate15to32(uint16 * data, uint8 * out, uint8 * end) |
434 |
{ |
{ |
435 |
uint16 pixel; |
uint16 pixel; |
436 |
|
uint32 value; |
437 |
|
|
438 |
while (out < end) |
while (out < end) |
439 |
{ |
{ |
440 |
|
pixel = *(data++); |
441 |
|
|
442 |
if (g_host_be) |
if (g_host_be) |
443 |
{ |
{ |
444 |
pixel = *(data++); |
BSWAP16(pixel); |
445 |
pixel = (pixel & 0xff) << 8 | (pixel & 0xff00) >> 8; |
} |
446 |
*(out++) = make_colour32(split_colour15(pixel)); |
|
447 |
|
value = make_colour32(split_colour15(pixel)); |
448 |
|
|
449 |
|
if (g_xserver_be) |
450 |
|
{ |
451 |
|
*(out++) = value >> 24; |
452 |
|
*(out++) = value >> 16; |
453 |
|
*(out++) = value >> 8; |
454 |
|
*(out++) = value; |
455 |
} |
} |
456 |
else |
else |
457 |
{ |
{ |
458 |
*(out++) = make_colour32(split_colour15(*(data++))); |
*(out++) = value; |
459 |
|
*(out++) = value >> 8; |
460 |
|
*(out++) = value >> 16; |
461 |
|
*(out++) = value >> 24; |
462 |
} |
} |
463 |
} |
} |
464 |
} |
} |
466 |
static void |
static void |
467 |
translate16to16(uint16 * data, uint16 * out, uint16 * end) |
translate16to16(uint16 * data, uint16 * out, uint16 * end) |
468 |
{ |
{ |
469 |
while (out < end) |
uint16 value; |
470 |
*(out++) = (uint16) (*(data++)); |
|
471 |
|
if (g_xserver_be) |
472 |
|
{ |
473 |
|
while (out < end) |
474 |
|
{ |
475 |
|
value = *data; |
476 |
|
BSWAP16(value); |
477 |
|
*out = value; |
478 |
|
data++; |
479 |
|
out++; |
480 |
|
} |
481 |
|
|
482 |
|
} |
483 |
|
else |
484 |
|
{ |
485 |
|
while (out < end) |
486 |
|
{ |
487 |
|
*out = *data; |
488 |
|
out++; |
489 |
|
data++; |
490 |
|
} |
491 |
|
} |
492 |
} |
} |
493 |
|
|
494 |
|
|
496 |
translate16to24(uint16 * data, uint8 * out, uint8 * end) |
translate16to24(uint16 * data, uint8 * out, uint8 * end) |
497 |
{ |
{ |
498 |
uint32 value; |
uint32 value; |
499 |
|
uint16 pixel; |
500 |
|
|
501 |
while (out < end) |
while (out < end) |
502 |
{ |
{ |
503 |
value = make_colour24(split_colour16(*(data++))); |
pixel = *(data++); |
504 |
*(out++) = value; |
|
505 |
*(out++) = value >> 8; |
if (g_host_be) |
506 |
*(out++) = value >> 16; |
{ |
507 |
|
BSWAP16(pixel); |
508 |
|
} |
509 |
|
|
510 |
|
value = make_colour24(split_colour16(pixel)); |
511 |
|
|
512 |
|
if (g_xserver_be) |
513 |
|
{ |
514 |
|
*(out++) = value >> 16; |
515 |
|
*(out++) = value >> 8; |
516 |
|
*(out++) = value; |
517 |
|
} |
518 |
|
else |
519 |
|
{ |
520 |
|
*(out++) = value; |
521 |
|
*(out++) = value >> 8; |
522 |
|
*(out++) = value >> 16; |
523 |
|
} |
524 |
} |
} |
525 |
} |
} |
526 |
|
|
527 |
static void |
static void |
528 |
translate16to32(uint16 * data, uint32 * out, uint32 * end) |
translate16to32(uint16 * data, uint8 * out, uint8 * end) |
529 |
{ |
{ |
530 |
uint16 pixel; |
uint16 pixel; |
531 |
|
uint32 value; |
532 |
|
|
533 |
while (out < end) |
while (out < end) |
534 |
{ |
{ |
535 |
|
pixel = *(data++); |
536 |
|
|
537 |
if (g_host_be) |
if (g_host_be) |
538 |
{ |
{ |
539 |
pixel = *(data++); |
BSWAP16(pixel)} |
540 |
pixel = (pixel & 0xff) << 8 | (pixel & 0xff00) >> 8; |
|
541 |
*(out++) = make_colour32(split_colour16(pixel)); |
value = make_colour32(split_colour16(pixel)); |
542 |
|
|
543 |
|
if (g_xserver_be) |
544 |
|
{ |
545 |
|
*(out++) = value >> 24; |
546 |
|
*(out++) = value >> 16; |
547 |
|
*(out++) = value >> 8; |
548 |
|
*(out++) = value; |
549 |
} |
} |
550 |
else |
else |
551 |
{ |
{ |
552 |
*(out++) = make_colour32(split_colour16(*(data++))); |
*(out++) = value; |
553 |
|
*(out++) = value >> 8; |
554 |
|
*(out++) = value >> 16; |
555 |
|
*(out++) = value >> 24; |
556 |
} |
} |
557 |
} |
} |
558 |
} |
} |
559 |
|
|
560 |
static void |
static void |
561 |
translate24to16(uint8 * data, uint16 * out, uint16 * end) |
translate24to16(uint8 * data, uint8 * out, uint8 * end) |
562 |
{ |
{ |
563 |
uint32 pixel = 0; |
uint32 pixel = 0; |
564 |
|
uint16 value; |
565 |
while (out < end) |
while (out < end) |
566 |
{ |
{ |
567 |
pixel = *(data++) << 16; |
pixel = *(data++) << 16; |
568 |
pixel |= *(data++) << 8; |
pixel |= *(data++) << 8; |
569 |
pixel |= *(data++); |
pixel |= *(data++); |
570 |
*(out++) = (uint16) make_colour16(split_colour24(pixel)); |
|
571 |
|
value = (uint16) make_colour16(split_colour24(pixel)); |
572 |
|
|
573 |
|
if (g_xserver_be) |
574 |
|
{ |
575 |
|
*(out++) = value >> 8; |
576 |
|
*(out++) = value; |
577 |
|
} |
578 |
|
else |
579 |
|
{ |
580 |
|
*(out++) = value; |
581 |
|
*(out++) = value >> 8; |
582 |
|
} |
583 |
} |
} |
584 |
} |
} |
585 |
|
|
593 |
} |
} |
594 |
|
|
595 |
static void |
static void |
596 |
translate24to32(uint8 * data, uint32 * out, uint32 * end) |
translate24to32(uint8 * data, uint8 * out, uint8 * end) |
597 |
{ |
{ |
|
uint32 pixel = 0; |
|
598 |
while (out < end) |
while (out < end) |
599 |
{ |
{ |
600 |
if (g_host_be) |
if (g_xserver_be) |
601 |
{ |
{ |
602 |
pixel = *(data++) << 16; |
*(out++) = 0x00; |
603 |
pixel |= *(data++) << 8; |
*(out++) = *(data++); |
604 |
pixel |= *(data++); |
*(out++) = *(data++); |
605 |
|
*(out++) = *(data++); |
606 |
} |
} |
607 |
else |
else |
608 |
{ |
{ |
609 |
pixel = *(data++); |
*(out++) = *(data++); |
610 |
pixel |= *(data++) << 8; |
*(out++) = *(data++); |
611 |
pixel |= *(data++) << 16; |
*(out++) = *(data++); |
612 |
|
*(out++) = 0x00; |
613 |
} |
} |
|
*(out++) = pixel; |
|
614 |
} |
} |
615 |
} |
} |
616 |
|
|
627 |
switch (g_bpp) |
switch (g_bpp) |
628 |
{ |
{ |
629 |
case 32: |
case 32: |
630 |
translate24to32(data, (uint32 *) out, (uint32 *) end); |
translate24to32(data, out, end); |
631 |
break; |
break; |
632 |
case 24: |
case 24: |
633 |
translate24to24(data, out, end); |
translate24to24(data, out, end); |
634 |
break; |
break; |
635 |
case 16: |
case 16: |
636 |
translate24to16(data, (uint16 *) out, (uint16 *) end); |
translate24to16(data, out, end); |
637 |
break; |
break; |
638 |
} |
} |
639 |
break; |
break; |
641 |
switch (g_bpp) |
switch (g_bpp) |
642 |
{ |
{ |
643 |
case 32: |
case 32: |
644 |
translate16to32((uint16 *) data, (uint32 *) out, |
translate16to32((uint16 *) data, out, end); |
|
(uint32 *) end); |
|
645 |
break; |
break; |
646 |
case 24: |
case 24: |
647 |
translate16to24((uint16 *) data, out, end); |
translate16to24((uint16 *) data, out, end); |
656 |
switch (g_bpp) |
switch (g_bpp) |
657 |
{ |
{ |
658 |
case 32: |
case 32: |
659 |
translate15to32((uint16 *) data, (uint32 *) out, |
translate15to32((uint16 *) data, out, end); |
|
(uint32 *) end); |
|
660 |
break; |
break; |
661 |
case 24: |
case 24: |
662 |
translate15to24((uint16 *) data, out, end); |
translate15to24((uint16 *) data, out, end); |
663 |
break; |
break; |
664 |
case 16: |
case 16: |
665 |
translate15to16((uint16 *) data, (uint16 *) out, |
translate15to16((uint16 *) data, out, end); |
|
(uint16 *) end); |
|
666 |
break; |
break; |
667 |
} |
} |
668 |
break; |
break; |
673 |
translate8to8(data, out, end); |
translate8to8(data, out, end); |
674 |
break; |
break; |
675 |
case 16: |
case 16: |
676 |
translate8to16(data, (uint16 *) out, (uint16 *) end); |
translate8to16(data, out, end); |
677 |
break; |
break; |
678 |
case 24: |
case 24: |
679 |
translate8to24(data, out, end); |
translate8to24(data, out, end); |
680 |
break; |
break; |
681 |
case 32: |
case 32: |
682 |
translate8to32(data, (uint32 *) out, (uint32 *) end); |
translate8to32(data, out, end); |
683 |
break; |
break; |
684 |
} |
} |
685 |
break; |
break; |
753 |
return False; |
return False; |
754 |
} |
} |
755 |
|
|
756 |
if (g_owncolmap != True) |
/* private colour map code only works for 8 bpp */ |
757 |
|
if (g_owncolmap && (g_bpp > 8)) |
758 |
|
g_owncolmap = False; |
759 |
|
|
760 |
|
if (!g_owncolmap) |
761 |
{ |
{ |
762 |
g_xcolmap = DefaultColormapOfScreen(g_screen); |
g_xcolmap = DefaultColormapOfScreen(g_screen); |
763 |
if (g_depth <= 8) |
if (g_depth <= 8) |
773 |
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
774 |
g_xserver_be = (ImageByteOrder(g_display) == MSBFirst); |
g_xserver_be = (ImageByteOrder(g_display) == MSBFirst); |
775 |
|
|
776 |
if ((g_width == 0) || (g_height == 0)) |
/* |
777 |
|
* Determine desktop size |
778 |
|
*/ |
779 |
|
if (g_width < 0) |
780 |
|
{ |
781 |
|
/* Percent of screen */ |
782 |
|
g_height = HeightOfScreen(g_screen) * (-g_width) / 100; |
783 |
|
g_width = WidthOfScreen(g_screen) * (-g_width) / 100; |
784 |
|
} |
785 |
|
else if (g_width == 0) |
786 |
{ |
{ |
787 |
/* Fetch geometry from _NET_WORKAREA */ |
/* Fetch geometry from _NET_WORKAREA */ |
788 |
uint32 x, y, cx, cy; |
uint32 x, y, cx, cy; |
799 |
g_height = 600; |
g_height = 600; |
800 |
} |
} |
801 |
} |
} |
802 |
|
else if (g_fullscreen) |
|
if (g_fullscreen) |
|
803 |
{ |
{ |
804 |
g_width = WidthOfScreen(g_screen); |
g_width = WidthOfScreen(g_screen); |
805 |
g_height = HeightOfScreen(g_screen); |
g_height = HeightOfScreen(g_screen); |
821 |
|
|
822 |
g_mod_map = XGetModifierMapping(g_display); |
g_mod_map = XGetModifierMapping(g_display); |
823 |
|
|
824 |
|
xkeymap_init(); |
825 |
|
|
826 |
if (g_enable_compose) |
if (g_enable_compose) |
827 |
g_IM = XOpenIM(g_display, NULL, NULL, NULL); |
g_IM = XOpenIM(g_display, NULL, NULL, NULL); |
828 |
|
|
|
xkeymap_init(); |
|
829 |
xclip_init(); |
xclip_init(); |
830 |
|
|
831 |
/* todo take this out when high colour is done */ |
DEBUG_RDP5(("server bpp %d client bpp %d depth %d\n", g_server_bpp, g_bpp, g_depth)); |
|
printf("server bpp %d client bpp %d depth %d\n", g_server_bpp, g_bpp, g_depth); |
|
832 |
|
|
833 |
return True; |
return True; |
834 |
} |
} |
849 |
g_display = NULL; |
g_display = NULL; |
850 |
} |
} |
851 |
|
|
852 |
|
#define NULL_POINTER_MASK "\x80" |
853 |
|
#define NULL_POINTER_DATA "\x0\x0\x0" |
854 |
|
|
855 |
BOOL |
BOOL |
856 |
ui_create_window(void) |
ui_create_window(void) |
857 |
{ |
{ |
936 |
g_kill_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True); |
g_kill_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True); |
937 |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
938 |
|
|
939 |
|
/* create invisible 1x1 cursor to be used as null cursor */ |
940 |
|
g_null_cursor = ui_create_cursor(0, 0, 1, 1, NULL_POINTER_MASK, NULL_POINTER_DATA); |
941 |
|
|
942 |
return True; |
return True; |
943 |
} |
} |
944 |
|
|
945 |
void |
void |
946 |
ui_destroy_window(void) |
ui_destroy_window(void) |
947 |
{ |
{ |
948 |
|
ui_destroy_cursor(g_null_cursor); |
949 |
|
|
950 |
if (g_IC != NULL) |
if (g_IC != NULL) |
951 |
XDestroyIC(g_IC); |
XDestroyIC(g_IC); |
952 |
|
|
1268 |
{ |
{ |
1269 |
FD_SET(g_dsp_fd, &wfds); |
FD_SET(g_dsp_fd, &wfds); |
1270 |
n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n; |
n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n; |
1271 |
} |
} |
1272 |
#endif |
#endif |
1273 |
|
|
1274 |
switch (select(n, &rfds, &wfds, NULL, NULL)) |
switch (select(n, &rfds, &wfds, NULL, NULL)) |
1302 |
XImage *image; |
XImage *image; |
1303 |
Pixmap bitmap; |
Pixmap bitmap; |
1304 |
uint8 *tdata; |
uint8 *tdata; |
1305 |
|
int bitmap_pad; |
1306 |
|
|
1307 |
|
if (g_server_bpp == 8) |
1308 |
|
{ |
1309 |
|
bitmap_pad = 8; |
1310 |
|
} |
1311 |
|
else |
1312 |
|
{ |
1313 |
|
bitmap_pad = g_bpp; |
1314 |
|
|
1315 |
|
if (g_bpp == 24) |
1316 |
|
bitmap_pad = 32; |
1317 |
|
} |
1318 |
|
|
1319 |
tdata = (g_owncolmap ? data : translate_image(width, height, data)); |
tdata = (g_owncolmap ? data : translate_image(width, height, data)); |
1320 |
bitmap = XCreatePixmap(g_display, g_wnd, width, height, g_depth); |
bitmap = XCreatePixmap(g_display, g_wnd, width, height, g_depth); |
1321 |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
1322 |
(char *) tdata, width, height, g_server_bpp == 8 ? 8 : g_bpp, 0); |
(char *) tdata, width, height, bitmap_pad, 0); |
1323 |
|
|
1324 |
XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height); |
XPutImage(g_display, bitmap, g_gc, image, 0, 0, 0, 0, width, height); |
1325 |
|
|
1334 |
{ |
{ |
1335 |
XImage *image; |
XImage *image; |
1336 |
uint8 *tdata; |
uint8 *tdata; |
1337 |
|
int bitmap_pad; |
1338 |
|
|
1339 |
|
if (g_server_bpp == 8) |
1340 |
|
{ |
1341 |
|
bitmap_pad = 8; |
1342 |
|
} |
1343 |
|
else |
1344 |
|
{ |
1345 |
|
bitmap_pad = g_bpp; |
1346 |
|
|
1347 |
|
if (g_bpp == 24) |
1348 |
|
bitmap_pad = 32; |
1349 |
|
} |
1350 |
|
|
1351 |
tdata = (g_owncolmap ? data : translate_image(width, height, data)); |
tdata = (g_owncolmap ? data : translate_image(width, height, data)); |
1352 |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, |
1353 |
(char *) tdata, width, height, g_server_bpp == 8 ? 8 : g_bpp, 0); |
(char *) tdata, width, height, bitmap_pad, 0); |
1354 |
|
|
1355 |
if (g_ownbackstore) |
if (g_ownbackstore) |
1356 |
{ |
{ |
1489 |
XFreeCursor(g_display, (Cursor) cursor); |
XFreeCursor(g_display, (Cursor) cursor); |
1490 |
} |
} |
1491 |
|
|
1492 |
|
void |
1493 |
|
ui_set_null_cursor(void) |
1494 |
|
{ |
1495 |
|
ui_set_cursor(g_null_cursor); |
1496 |
|
} |
1497 |
|
|
1498 |
#define MAKE_XCOLOR(xc,c) \ |
#define MAKE_XCOLOR(xc,c) \ |
1499 |
(xc)->red = ((c)->red << 8) | (c)->red; \ |
(xc)->red = ((c)->red << 8) | (c)->red; \ |
1500 |
(xc)->green = ((c)->green << 8) | (c)->green; \ |
(xc)->green = ((c)->green << 8) | (c)->green; \ |
1695 |
case 2: /* Hatch */ |
case 2: /* Hatch */ |
1696 |
fill = (Pixmap) ui_create_glyph(8, 8, |
fill = (Pixmap) ui_create_glyph(8, 8, |
1697 |
hatch_patterns + brush->pattern[0] * 8); |
hatch_patterns + brush->pattern[0] * 8); |
1698 |
SET_FOREGROUND(bgcolour); |
SET_FOREGROUND(fgcolour); |
1699 |
SET_BACKGROUND(fgcolour); |
SET_BACKGROUND(bgcolour); |
1700 |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
XSetFillStyle(g_display, g_gc, FillOpaqueStippled); |
1701 |
XSetStipple(g_display, g_gc, fill); |
XSetStipple(g_display, g_gc, fill); |
1702 |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |
XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin); |