From 02ea6de9dc44579a240ab8d9c34c5323133389e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Wed, 14 Sep 2011 14:47:04 -0400 Subject: [PATCH] xfreerdp: add support for no-codec bitmaps in X11-GDI --- client/X11/xf_gdi.c | 21 +++++++++++++++++++++ client/X11/xfreerdp.c | 2 ++ client/X11/xfreerdp.h | 1 + libfreerdp-core/capabilities.c | 8 +++++--- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/client/X11/xf_gdi.c b/client/X11/xf_gdi.c index e40ea73e6..f7f3c227c 100644 --- a/client/X11/xf_gdi.c +++ b/client/X11/xf_gdi.c @@ -616,7 +616,28 @@ void xf_gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_c } else if (surface_bits_command->codecID == CODEC_ID_NONE) { + XSetFunction(xfi->display, xfi->gc, GXcopy); + XSetFillStyle(xfi->display, xfi->gc, FillSolid); + xfi->bmp_codec_none = (uint8*) xrealloc(xfi->bmp_codec_none, + surface_bits_command->width * surface_bits_command->height * 4); + + freerdp_image_invert(surface_bits_command->bitmapData, xfi->bmp_codec_none, + surface_bits_command->width, surface_bits_command->height, 32); + + image = XCreateImage(xfi->display, xfi->visual, 24, ZPixmap, 0, + (char*) xfi->bmp_codec_none, surface_bits_command->width, surface_bits_command->height, 32, 0); + + XPutImage(xfi->display, xfi->primary, xfi->gc, image, 0, 0, + surface_bits_command->destLeft, surface_bits_command->destTop, + surface_bits_command->width, surface_bits_command->height); + + XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc, + surface_bits_command->destLeft, surface_bits_command->destTop, + surface_bits_command->width, surface_bits_command->height, + surface_bits_command->destLeft, surface_bits_command->destTop); + + XSetClipMask(xfi->display, xfi->gc, None); } else { diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index bb2c7ea12..a7a4234bc 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -445,6 +445,8 @@ boolean xf_post_connect(freerdp* instance) xfi->image = XCreateImage(xfi->display, xfi->visual, xfi->depth, ZPixmap, 0, (char*) gdi->primary_buffer, gdi->width, gdi->height, xfi->scanline_pad, 0); + xfi->bmp_codec_none = (uint8*) xmalloc(64 * 64 * 4); + instance->update->BeginPaint = xf_begin_paint; instance->update->EndPaint = xf_end_paint; instance->update->DesktopResize = xf_desktop_resize; diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index 4510e0c0b..af09cca5f 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -91,6 +91,7 @@ struct xf_info XSetWindowAttributes attribs; boolean complex_regions; VIRTUAL_SCREEN vscreen; + uint8* bmp_codec_none; void* rfx_context; Atom _NET_WM_ICON; diff --git a/libfreerdp-core/capabilities.c b/libfreerdp-core/capabilities.c index 25ef026d7..57dc91e3b 100644 --- a/libfreerdp-core/capabilities.c +++ b/libfreerdp-core/capabilities.c @@ -50,7 +50,8 @@ uint8 CAPSET_TYPE_STRINGS[][32] = "Multifragment Update", "Large Pointer", "Surface Commands", - "Bitmap Codecs" + "Bitmap Codecs", + "Frame Acknowledge" }; /* CODEC_GUID_REMOTEFX 0x76772F12BD724463AFB3B73C9C6F7886 */ @@ -974,9 +975,10 @@ void rdp_write_bitmap_cache_v2_capability_set(STREAM* s, rdpSettings* settings) void rdp_read_virtual_channel_capability_set(STREAM* s, rdpSettings* settings) { + uint32 flags; uint32 VCChunkSize; - stream_seek_uint32(s); /* flags (4 bytes) */ + stream_read_uint32(s, flags); /* flags (4 bytes) */ stream_read_uint32(s, VCChunkSize); /* VCChunkSize (4 bytes) */ if (!settings->server_mode) @@ -1648,7 +1650,7 @@ boolean rdp_read_capability_sets(STREAM* s, rdpSettings* settings, uint16 number } if (s->p != em) - printf("incorrect offset, type:%d actual:%d expected:%d\n", + printf("incorrect offset, type:0x%02X actual:%d expected:%d\n", type, (int) (s->p - bm), (int) (em - bm)); stream_set_mark(s, em);