work on new(color) cursors

This commit is contained in:
Jay Sorg 2013-03-12 22:50:10 -07:00
parent a47a3cee1a
commit 494150f1a9
7 changed files with 72 additions and 28 deletions

View File

@ -126,6 +126,7 @@
#define RDP_POINTER_MOVE 3 #define RDP_POINTER_MOVE 3
#define RDP_POINTER_COLOR 6 #define RDP_POINTER_COLOR 6
#define RDP_POINTER_CACHED 7 #define RDP_POINTER_CACHED 7
#define RDP_POINTER_POINTER 8
#define RDP_NULL_POINTER 0 #define RDP_NULL_POINTER 0
#define RDP_DEFAULT_POINTER 0x7F00 #define RDP_DEFAULT_POINTER 0x7F00

View File

@ -417,10 +417,12 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
/*****************************************************************************/ /*****************************************************************************/
int EXPORT_CC int EXPORT_CC
libxrdp_send_pointer(struct xrdp_session *session, int cache_idx, libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
char *data, char *mask, int x, int y) char *data, char *mask, int x, int y, int bpp)
{ {
struct stream *s; struct stream *s;
char *p; char *p;
tui16 *p16;
tui32 *p32;
int i; int i;
int j; int j;
@ -428,7 +430,15 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
make_stream(s); make_stream(s);
init_stream(s, 8192); init_stream(s, 8192);
xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s); xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s);
out_uint16_le(s, RDP_POINTER_COLOR); if (bpp == 0)
{
out_uint16_le(s, RDP_POINTER_COLOR);
}
else
{
out_uint16_le(s, RDP_POINTER_POINTER);
out_uint16_le(s, bpp);
}
out_uint16_le(s, 0); /* pad */ out_uint16_le(s, 0); /* pad */
out_uint16_le(s, cache_idx); /* cache_idx */ out_uint16_le(s, cache_idx); /* cache_idx */
out_uint16_le(s, x); out_uint16_le(s, x);
@ -437,24 +447,52 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx,
out_uint16_le(s, 32); out_uint16_le(s, 32);
out_uint16_le(s, 128); out_uint16_le(s, 128);
out_uint16_le(s, 3072); out_uint16_le(s, 3072);
p = data;
for (i = 0; i < 32; i++) if (bpp == 16)
{ {
for (j = 0; j < 32; j++) p16 = (tui16 *) data;
for (i = 0; i < 32; i++)
{ {
out_uint8(s, *p); for (j = 0; j < 32; j++)
p++; {
out_uint8(s, *p); out_uint16_le(s, *p16);
p++; p16++;
out_uint8(s, *p); }
p++; }
}
else if (bpp == 32)
{
p32 = (tui32 *) data;
for (i = 0; i < 32; i++)
{
for (j = 0; j < 32; j++)
{
out_uint32_le(s, *p32);
p32++;
}
}
}
else if ((bpp == 0) || (bpp == 24))
{
p = data;
for (i = 0; i < 32; i++)
{
for (j = 0; j < 32; j++)
{
out_uint8(s, *p);
p++;
out_uint8(s, *p);
p++;
out_uint8(s, *p);
p++;
}
} }
} }
out_uint8a(s, mask, 128); /* mask */ out_uint8a(s, mask, 128); /* mask */
s_mark_end(s); s_mark_end(s);
xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s, RDP_DATA_PDU_POINTER); xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s,
RDP_DATA_PDU_POINTER);
free_stream(s); free_stream(s);
return 0; return 0;
} }

View File

@ -91,7 +91,7 @@ libxrdp_send_bitmap(struct xrdp_session* session, int width, int height,
int bpp, char* data, int x, int y, int cx, int cy); int bpp, char* data, int x, int y, int cx, int cy);
int DEFAULT_CC int DEFAULT_CC
libxrdp_send_pointer(struct xrdp_session* session, int cache_idx, libxrdp_send_pointer(struct xrdp_session* session, int cache_idx,
char* data, char* mask, int x, int y); char* data, char* mask, int x, int y, int bpp);
int DEFAULT_CC int DEFAULT_CC
libxrdp_set_pointer(struct xrdp_session* session, int cache_idx); libxrdp_set_pointer(struct xrdp_session* session, int cache_idx);
int DEFAULT_CC int DEFAULT_CC

View File

@ -126,7 +126,7 @@ int APP_CC
xrdp_wm_pu(struct xrdp_wm* self, struct xrdp_bitmap* control); xrdp_wm_pu(struct xrdp_wm* self, struct xrdp_bitmap* control);
int APP_CC int APP_CC
xrdp_wm_send_pointer(struct xrdp_wm* self, int cache_idx, xrdp_wm_send_pointer(struct xrdp_wm* self, int cache_idx,
char* data, char* mask, int x, int y); char* data, char* mask, int x, int y, int bpp);
int APP_CC int APP_CC
xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y); xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y);
int int

View File

@ -475,9 +475,10 @@ xrdp_cache_add_pointer(struct xrdp_cache *self,
if (self->pointer_items[i].x == pointer_item->x && if (self->pointer_items[i].x == pointer_item->x &&
self->pointer_items[i].y == pointer_item->y && self->pointer_items[i].y == pointer_item->y &&
g_memcmp(self->pointer_items[i].data, g_memcmp(self->pointer_items[i].data,
pointer_item->data, 32 * 32 * 3) == 0 && pointer_item->data, 32 * 32 * 4) == 0 &&
g_memcmp(self->pointer_items[i].mask, g_memcmp(self->pointer_items[i].mask,
pointer_item->mask, 32 * 32 / 8) == 0) pointer_item->mask, 32 * 32 / 8) == 0 &&
self->pointer_items[i].bpp == pointer_item->bpp)
{ {
self->pointer_items[i].stamp = self->pointer_stamp; self->pointer_items[i].stamp = self->pointer_stamp;
xrdp_wm_set_pointer(self->wm, i); xrdp_wm_set_pointer(self->wm, i);
@ -511,7 +512,8 @@ xrdp_cache_add_pointer(struct xrdp_cache *self,
self->pointer_items[index].data, self->pointer_items[index].data,
self->pointer_items[index].mask, self->pointer_items[index].mask,
self->pointer_items[index].x, self->pointer_items[index].x,
self->pointer_items[index].y); self->pointer_items[index].y,
self->pointer_items[index].bpp);
self->wm->current_pointer = index; self->wm->current_pointer = index;
DEBUG(("adding pointer at %d", index)); DEBUG(("adding pointer at %d", index));
return index; return index;
@ -541,7 +543,8 @@ xrdp_cache_add_pointer_static(struct xrdp_cache *self,
self->pointer_items[index].data, self->pointer_items[index].data,
self->pointer_items[index].mask, self->pointer_items[index].mask,
self->pointer_items[index].x, self->pointer_items[index].x,
self->pointer_items[index].y); self->pointer_items[index].y,
self->pointer_items[index].bpp);
self->wm->current_pointer = index; self->wm->current_pointer = index;
DEBUG(("adding pointer at %d", index)); DEBUG(("adding pointer at %d", index));
return index; return index;

View File

@ -170,8 +170,9 @@ struct xrdp_pointer_item
int stamp; int stamp;
int x; /* hotspot */ int x; /* hotspot */
int y; int y;
char data[32 * 32 * 3]; char data[32 * 32 * 4];
char mask[32 * 32 / 8]; char mask[32 * 32 / 8];
int bpp;
}; };
struct xrdp_brush_item struct xrdp_brush_item

View File

@ -292,9 +292,10 @@ xrdp_wm_load_pointer(struct xrdp_wm *self, char *file_name, char *data,
/*****************************************************************************/ /*****************************************************************************/
int APP_CC int APP_CC
xrdp_wm_send_pointer(struct xrdp_wm *self, int cache_idx, xrdp_wm_send_pointer(struct xrdp_wm *self, int cache_idx,
char *data, char *mask, int x, int y) char *data, char *mask, int x, int y, int bpp)
{ {
return libxrdp_send_pointer(self->session, cache_idx, data, mask, x, y); return libxrdp_send_pointer(self->session, cache_idx, data, mask,
x, y, bpp);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -541,13 +542,13 @@ xrdp_wm_init(struct xrdp_wm *self)
names->auto_free = 1; names->auto_free = 1;
values = list_create(); values = list_create();
values->auto_free = 1; values->auto_free = 1;
/* domain names that starts with '_' are reserved for IP/DNS to simplify /* domain names that starts with '_' are reserved for IP/DNS to
* for the user in a gateway setup */ * simplify for the user in a gateway setup */
if(self->session->client_info->domain[0]!='_') if (self->session->client_info->domain[0] != '_')
{ {
g_strncpy(section_name, self->session->client_info->domain, 255); g_strncpy(section_name, self->session->client_info->domain,
} 255);
}
if (section_name[0] == 0) if (section_name[0] == 0)
{ {
if (autorun_name[0] == 0) if (autorun_name[0] == 0)