Applied null cursor patch from jeroen@oldambt7.com

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@507 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Åstrand 2003-10-22 10:55:11 +00:00
parent 156874bb74
commit 0affa3f3ff
5 changed files with 46 additions and 11 deletions

View File

@ -137,11 +137,18 @@ enum RDP_UPDATE_PDU_TYPE
enum RDP_POINTER_PDU_TYPE
{
RDP_POINTER_SYSTEM = 1,
RDP_POINTER_MOVE = 3,
RDP_POINTER_COLOR = 6,
RDP_POINTER_CACHED = 7
};
enum RDP_SYSTEM_POINTER_TYPE
{
RDP_NULL_POINTER = 0,
RDP_DEFAULT_POINTER = 0x7F00
};
enum RDP_INPUT_DEVICE
{
RDP_INPUT_SYNCHRONIZE = 0,

View File

@ -152,6 +152,7 @@ HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height,
uint8 * xormask);
void ui_set_cursor(HCURSOR cursor);
void ui_destroy_cursor(HCURSOR cursor);
void ui_set_null_cursor(void);
HCOLOURMAP ui_create_colourmap(COLOURMAP * colours);
void ui_destroy_colourmap(HCOLOURMAP map);
void ui_set_colourmap(HCOLOURMAP map);

32
rdp.c
View File

@ -607,15 +607,6 @@ process_demand_active(STREAM s)
reset_order_state();
}
/* Process a null system pointer PDU */
void
process_null_system_pointer_pdu(STREAM s)
{
// FIXME: We should probably set another cursor here,
// like the X window system base cursor or something.
ui_set_cursor(cache_get_cursor(0));
}
/* Process a colour pointer PDU */
void
process_colour_pointer_pdu(STREAM s)
@ -648,6 +639,23 @@ process_cached_pointer_pdu(STREAM s)
ui_set_cursor(cache_get_cursor(cache_idx));
}
/* Process a system pointer PDU */
void
process_system_pointer_pdu(STREAM s)
{
uint16 system_pointer_type;
in_uint16(s, system_pointer_type);
switch (system_pointer_type)
{
case RDP_NULL_POINTER:
ui_set_null_cursor();
break;
default:
unimpl("System pointer message 0x%x\n", system_pointer_type);
}
}
/* Process a pointer PDU */
static void
@ -676,8 +684,12 @@ process_pointer_pdu(STREAM s)
process_cached_pointer_pdu(s);
break;
case RDP_POINTER_SYSTEM:
process_system_pointer_pdu(s);
break;
default:
DEBUG(("Pointer message 0x%x\n", message_type));
unimpl("Pointer message 0x%x\n", message_type);
}
}

2
rdp5.c
View File

@ -68,7 +68,7 @@ rdp5_process(STREAM s, BOOL encryption)
case 3: /* probably an palette with offset 3. Weird */
break;
case 5:
process_null_system_pointer_pdu(s);
ui_set_null_cursor();
break;
case 8:
in_uint16_le(s, x);

15
xwin.c
View File

@ -49,6 +49,7 @@ static XIM g_IM;
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;
@ -797,6 +798,9 @@ ui_deinit(void)
g_display = NULL;
}
#define NULL_POINTER_MASK "\x80"
#define NULL_POINTER_DATA "\x0\x0\x0"
BOOL
ui_create_window(void)
{
@ -881,12 +885,17 @@ ui_create_window(void)
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);
@ -1402,6 +1411,12 @@ ui_destroy_cursor(HCURSOR cursor)
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; \