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; |
static BOOL g_focused; |
55 |
static BOOL g_mouse_in_wnd; |
static BOOL g_mouse_in_wnd; |
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 */ |
335 |
|
|
336 |
if (g_host_be) |
if (g_host_be) |
337 |
{ |
{ |
338 |
BSWAP16(pixel) |
BSWAP16(pixel)} |
|
} |
|
339 |
|
|
340 |
value = make_colour16(split_colour15(pixel)); |
value = make_colour16(split_colour15(pixel)); |
341 |
|
|
364 |
|
|
365 |
if (g_host_be) |
if (g_host_be) |
366 |
{ |
{ |
367 |
BSWAP16(pixel) |
BSWAP16(pixel)} |
|
} |
|
368 |
|
|
369 |
value = make_colour24(split_colour15(pixel)); |
value = make_colour24(split_colour15(pixel)); |
370 |
if (g_xserver_be) |
if (g_xserver_be) |
457 |
|
|
458 |
if (g_host_be) |
if (g_host_be) |
459 |
{ |
{ |
460 |
BSWAP16(pixel) |
BSWAP16(pixel)} |
|
} |
|
461 |
|
|
462 |
value = make_colour24(split_colour16(pixel)); |
value = make_colour24(split_colour16(pixel)); |
463 |
|
|
488 |
|
|
489 |
if (g_host_be) |
if (g_host_be) |
490 |
{ |
{ |
491 |
BSWAP16(pixel) |
BSWAP16(pixel)} |
|
} |
|
492 |
|
|
493 |
value = make_colour32(split_colour16(pixel)); |
value = make_colour32(split_colour16(pixel)); |
494 |
|
|
498 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
499 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
500 |
*(out++) = value; |
*(out++) = value; |
501 |
} |
} |
502 |
else |
else |
503 |
{ |
{ |
504 |
*(out++) = value; |
*(out++) = value; |
505 |
*(out++) = value >> 8; |
*(out++) = value >> 8; |
506 |
*(out++) = value >> 16; |
*(out++) = value >> 16; |
507 |
*(out++) = value >> 24; |
*(out++) = value >> 24; |
508 |
} |
} |
509 |
} |
} |
510 |
} |
} |
511 |
|
|
512 |
static void |
static void |
721 |
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
g_host_be = !(BOOL) (*(uint8 *) (&test)); |
722 |
g_xserver_be = (ImageByteOrder(g_display) == MSBFirst); |
g_xserver_be = (ImageByteOrder(g_display) == MSBFirst); |
723 |
|
|
724 |
if ((g_width == 0) || (g_height == 0)) |
/* |
725 |
|
* Determine desktop size |
726 |
|
*/ |
727 |
|
if (g_width < 0) |
728 |
|
{ |
729 |
|
/* Percent of screen */ |
730 |
|
g_height = HeightOfScreen(g_screen) * (-g_width) / 100; |
731 |
|
g_width = WidthOfScreen(g_screen) * (-g_width) / 100; |
732 |
|
} |
733 |
|
else if (g_width == 0) |
734 |
{ |
{ |
735 |
/* Fetch geometry from _NET_WORKAREA */ |
/* Fetch geometry from _NET_WORKAREA */ |
736 |
uint32 x, y, cx, cy; |
uint32 x, y, cx, cy; |
747 |
g_height = 600; |
g_height = 600; |
748 |
} |
} |
749 |
} |
} |
750 |
|
else if (g_fullscreen) |
|
if (g_fullscreen) |
|
751 |
{ |
{ |
752 |
g_width = WidthOfScreen(g_screen); |
g_width = WidthOfScreen(g_screen); |
753 |
g_height = HeightOfScreen(g_screen); |
g_height = HeightOfScreen(g_screen); |
769 |
|
|
770 |
g_mod_map = XGetModifierMapping(g_display); |
g_mod_map = XGetModifierMapping(g_display); |
771 |
|
|
772 |
|
xkeymap_init(); |
773 |
|
|
774 |
if (g_enable_compose) |
if (g_enable_compose) |
775 |
g_IM = XOpenIM(g_display, NULL, NULL, NULL); |
g_IM = XOpenIM(g_display, NULL, NULL, NULL); |
776 |
|
|
|
xkeymap_init(); |
|
777 |
xclip_init(); |
xclip_init(); |
778 |
|
|
779 |
/* todo take this out when high colour is done */ |
/* todo take this out when high colour is done */ |
798 |
g_display = NULL; |
g_display = NULL; |
799 |
} |
} |
800 |
|
|
801 |
|
#define NULL_POINTER_MASK "\x80" |
802 |
|
#define NULL_POINTER_DATA "\x0\x0\x0" |
803 |
|
|
804 |
BOOL |
BOOL |
805 |
ui_create_window(void) |
ui_create_window(void) |
806 |
{ |
{ |
885 |
g_kill_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True); |
g_kill_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True); |
886 |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); |
887 |
|
|
888 |
|
/* create invisible 1x1 cursor to be used as null cursor */ |
889 |
|
g_null_cursor = ui_create_cursor(0, 0, 1, 1, NULL_POINTER_MASK, NULL_POINTER_DATA); |
890 |
|
|
891 |
return True; |
return True; |
892 |
} |
} |
893 |
|
|
894 |
void |
void |
895 |
ui_destroy_window(void) |
ui_destroy_window(void) |
896 |
{ |
{ |
897 |
|
ui_destroy_cursor(g_null_cursor); |
898 |
|
|
899 |
if (g_IC != NULL) |
if (g_IC != NULL) |
900 |
XDestroyIC(g_IC); |
XDestroyIC(g_IC); |
901 |
|
|
1217 |
{ |
{ |
1218 |
FD_SET(g_dsp_fd, &wfds); |
FD_SET(g_dsp_fd, &wfds); |
1219 |
n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n; |
n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n; |
1220 |
} |
} |
1221 |
#endif |
#endif |
1222 |
|
|
1223 |
switch (select(n, &rfds, &wfds, NULL, NULL)) |
switch (select(n, &rfds, &wfds, NULL, NULL)) |
1411 |
XFreeCursor(g_display, (Cursor) cursor); |
XFreeCursor(g_display, (Cursor) cursor); |
1412 |
} |
} |
1413 |
|
|
1414 |
|
void |
1415 |
|
ui_set_null_cursor(void) |
1416 |
|
{ |
1417 |
|
ui_set_cursor(g_null_cursor); |
1418 |
|
} |
1419 |
|
|
1420 |
#define MAKE_XCOLOR(xc,c) \ |
#define MAKE_XCOLOR(xc,c) \ |
1421 |
(xc)->red = ((c)->red << 8) | (c)->red; \ |
(xc)->red = ((c)->red << 8) | (c)->red; \ |
1422 |
(xc)->green = ((c)->green << 8) | (c)->green; \ |
(xc)->green = ((c)->green << 8) | (c)->green; \ |