--- sourceforge.net/trunk/rdesktop/xwin.c 2003/10/11 19:12:10 483 +++ sourceforge.net/trunk/rdesktop/xwin.c 2003/10/28 03:30:51 517 @@ -49,6 +49,7 @@ static XIC g_IC; static XModifierKeymap *g_mod_map; static Cursor g_current_cursor; +static HCURSOR g_null_cursor; static Atom g_protocol_atom, g_kill_atom; static BOOL g_focused; static BOOL g_mouse_in_wnd; @@ -69,6 +70,7 @@ #ifdef WITH_RDPSND extern int g_dsp_fd; extern BOOL g_dsp_busy; +extern BOOL g_rdpsnd; #endif /* MWM decorations */ @@ -333,8 +335,7 @@ if (g_host_be) { - BSWAP16(pixel) - } + BSWAP16(pixel)} value = make_colour16(split_colour15(pixel)); @@ -363,8 +364,7 @@ if (g_host_be) { - BSWAP16(pixel) - } + BSWAP16(pixel)} value = make_colour24(split_colour15(pixel)); if (g_xserver_be) @@ -457,8 +457,7 @@ if (g_host_be) { - BSWAP16(pixel) - } + BSWAP16(pixel)} value = make_colour24(split_colour16(pixel)); @@ -489,8 +488,7 @@ if (g_host_be) { - BSWAP16(pixel) - } + BSWAP16(pixel)} value = make_colour32(split_colour16(pixel)); @@ -500,15 +498,15 @@ *(out++) = value >> 16; *(out++) = value >> 8; *(out++) = value; - } - else - { + } + else + { *(out++) = value; *(out++) = value >> 8; *(out++) = value >> 16; *(out++) = value >> 24; - } - } + } + } } static void @@ -707,7 +705,11 @@ return False; } - if (g_owncolmap != True) + /* private colour map code only works for 8 bpp */ + if (g_owncolmap && (g_bpp > 8)) + g_owncolmap = False; + + if (!g_owncolmap) { g_xcolmap = DefaultColormapOfScreen(g_screen); if (g_depth <= 8) @@ -723,7 +725,16 @@ g_host_be = !(BOOL) (*(uint8 *) (&test)); g_xserver_be = (ImageByteOrder(g_display) == MSBFirst); - if ((g_width == 0) || (g_height == 0)) + /* + * Determine desktop size + */ + if (g_width < 0) + { + /* Percent of screen */ + g_height = HeightOfScreen(g_screen) * (-g_width) / 100; + g_width = WidthOfScreen(g_screen) * (-g_width) / 100; + } + else if (g_width == 0) { /* Fetch geometry from _NET_WORKAREA */ uint32 x, y, cx, cy; @@ -740,8 +751,7 @@ g_height = 600; } } - - if (g_fullscreen) + else if (g_fullscreen) { g_width = WidthOfScreen(g_screen); g_height = HeightOfScreen(g_screen); @@ -763,10 +773,11 @@ g_mod_map = XGetModifierMapping(g_display); + xkeymap_init(); + if (g_enable_compose) g_IM = XOpenIM(g_display, NULL, NULL, NULL); - xkeymap_init(); xclip_init(); /* todo take this out when high colour is done */ @@ -791,6 +802,9 @@ g_display = NULL; } +#define NULL_POINTER_MASK "\x80" +#define NULL_POINTER_DATA "\x0\x0\x0" + BOOL ui_create_window(void) { @@ -875,12 +889,17 @@ g_kill_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True); XSetWMProtocols(g_display, g_wnd, &g_kill_atom, 1); + /* create invisible 1x1 cursor to be used as null cursor */ + g_null_cursor = ui_create_cursor(0, 0, 1, 1, NULL_POINTER_MASK, NULL_POINTER_DATA); + return True; } void ui_destroy_window(void) { + ui_destroy_cursor(g_null_cursor); + if (g_IC != NULL) XDestroyIC(g_IC); @@ -1202,7 +1221,7 @@ { FD_SET(g_dsp_fd, &wfds); n = (g_dsp_fd + 1 > n) ? g_dsp_fd + 1 : n; - } + } #endif switch (select(n, &rfds, &wfds, NULL, NULL)) @@ -1396,6 +1415,12 @@ XFreeCursor(g_display, (Cursor) cursor); } +void +ui_set_null_cursor(void) +{ + ui_set_cursor(g_null_cursor); +} + #define MAKE_XCOLOR(xc,c) \ (xc)->red = ((c)->red << 8) | (c)->red; \ (xc)->green = ((c)->green << 8) | (c)->green; \ @@ -1596,8 +1621,8 @@ case 2: /* Hatch */ fill = (Pixmap) ui_create_glyph(8, 8, hatch_patterns + brush->pattern[0] * 8); - SET_FOREGROUND(bgcolour); - SET_BACKGROUND(fgcolour); + SET_FOREGROUND(fgcolour); + SET_BACKGROUND(bgcolour); XSetFillStyle(g_display, g_gc, FillOpaqueStippled); XSetStipple(g_display, g_gc, fill); XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);