diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2013-03-12 23:22:11 -0700 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2013-03-12 23:22:11 -0700 |
commit | 39a828d52f7870c4b6cae93c8462098ec1ee42a6 (patch) | |
tree | ba1e08e432c6885ce92400bc4ab31b8cc398e19e /libxrdp | |
parent | 494150f1a9fd8ae717b8f4e41f6e13f6f89d3bef (diff) | |
download | xrdp-proprietary-39a828d52f7870c4b6cae93c8462098ec1ee42a6.tar.gz xrdp-proprietary-39a828d52f7870c4b6cae93c8462098ec1ee42a6.zip |
work on new(color) cursors
Diffstat (limited to 'libxrdp')
-rw-r--r-- | libxrdp/libxrdp.c | 91 |
1 files changed, 56 insertions, 35 deletions
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index 78823135..91ff1e35 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -425,73 +425,94 @@ libxrdp_send_pointer(struct xrdp_session *session, int cache_idx, tui32 *p32; int i; int j; + int data_bytes; DEBUG(("libxrdp_send_pointer sending cursor")); + /* error check */ + if ((session->client_info->pointer_flags & 1) == 0) + { + if (bpp != 0) + { + g_writeln("libxrdp_send_pointer: error"); + return 1; + } + } + if ((bpp != 0) && (bpp == 15) && (bpp != 16) && + (bpp != 24) && (bpp != 32)) + { + g_writeln("libxrdp_send_pointer: error"); + return 1; + } make_stream(s); init_stream(s, 8192); xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s); if (bpp == 0) { out_uint16_le(s, RDP_POINTER_COLOR); + out_uint16_le(s, 0); /* pad */ + data_bytes = 3072; } else { out_uint16_le(s, RDP_POINTER_POINTER); + out_uint16_le(s, 0); /* pad */ out_uint16_le(s, bpp); + data_bytes = ((bpp + 7) / 8) * 32 * 32; } - out_uint16_le(s, 0); /* pad */ out_uint16_le(s, cache_idx); /* cache_idx */ out_uint16_le(s, x); out_uint16_le(s, y); out_uint16_le(s, 32); out_uint16_le(s, 32); out_uint16_le(s, 128); - out_uint16_le(s, 3072); + out_uint16_le(s, data_bytes); - if (bpp == 16) + switch (bpp) { - p16 = (tui16 *) data; - for (i = 0; i < 32; i++) - { - for (j = 0; j < 32; j++) + case 15: + case 16: + p16 = (tui16 *) data; + for (i = 0; i < 32; i++) { - out_uint16_le(s, *p16); - p16++; + for (j = 0; j < 32; j++) + { + out_uint16_le(s, *p16); + p16++; + } } - } - } - else if (bpp == 32) - { - p32 = (tui32 *) data; - for (i = 0; i < 32; i++) - { - for (j = 0; j < 32; j++) + break; + case 0: + case 24: + p = data; + for (i = 0; i < 32; i++) { - out_uint32_le(s, *p32); - p32++; + for (j = 0; j < 32; j++) + { + out_uint8(s, *p); + p++; + out_uint8(s, *p); + p++; + out_uint8(s, *p); + p++; + } } - } - } - else if ((bpp == 0) || (bpp == 24)) - { - p = data; - for (i = 0; i < 32; i++) - { - for (j = 0; j < 32; j++) + break; + case 32: + p32 = (tui32 *) data; + for (i = 0; i < 32; i++) { - out_uint8(s, *p); - p++; - out_uint8(s, *p); - p++; - out_uint8(s, *p); - p++; + for (j = 0; j < 32; j++) + { + out_uint32_le(s, *p32); + p32++; + } } - } + break; } out_uint8a(s, mask, 128); /* mask */ s_mark_end(s); - xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s, + xrdp_rdp_send_data((struct xrdp_rdp *)(session->rdp), s, RDP_DATA_PDU_POINTER); free_stream(s); return 0; |