diff options
author | Rene Rheaume <rene.rheaume@gmail.com> | 2014-06-25 01:17:03 +0400 |
---|---|---|
committer | Rene Rheaume <rene.rheaume@gmail.com> | 2014-06-25 01:17:03 +0400 |
commit | fe1c9f72b535fd9ccbdaf70b75327e9840582508 (patch) | |
tree | 1e6360e013072f0a8d21e6c83d850612fc0a2a15 /remmina-plugins/rdp | |
parent | a7f2e624706e5b6eb3d312061606d3a1e321e167 (diff) |
GTK+2 compatibility
* RDP mouse cursor image reference count is no longer decremented. It probably introduces a memory leak, but decrementing the reference count causes a segfault.
* The Quick Connect bar of the main window no longer take half of the window height.
* The protocol selector of the Quick Connect bar looks like a regular drop-down list on QtCurve theme.
Diffstat (limited to 'remmina-plugins/rdp')
-rw-r--r-- | remmina-plugins/rdp/rdp_event.c | 13 | ||||
-rw-r--r-- | remmina-plugins/rdp/rdp_graphics.c | 8 |
2 files changed, 20 insertions, 1 deletions
diff --git a/remmina-plugins/rdp/rdp_event.c b/remmina-plugins/rdp/rdp_event.c index 8dacbe292..5b536d220 100644 --- a/remmina-plugins/rdp/rdp_event.c +++ b/remmina-plugins/rdp/rdp_event.c @@ -677,16 +677,24 @@ static void remmina_rdp_event_connected(RemminaProtocolWidget* gp, RemminaPlugin static void remmina_rdp_event_create_cursor(RemminaProtocolWidget* gp, RemminaPluginRdpUiObject* ui) { - cairo_surface_t* surface; GdkPixbuf* pixbuf; rfContext* rfi = GET_DATA(gp); rdpPointer* pointer = (rdpPointer*)ui->cursor.pointer; +#if GTK_VERSION == 3 + cairo_surface_t* surface; UINT8* data = malloc(pointer->width * pointer->height * 4); +#else + guchar *data = g_malloc0(pointer->width * pointer->height * 4); +#endif freerdp_alpha_cursor_convert(data, pointer->xorMaskData, pointer->andMaskData, pointer->width, pointer->height, pointer->xorBpp, rfi->clrconv); +#if GTK_VERSION == 3 surface = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, pointer->width, pointer->height, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, pointer->width)); pixbuf = gdk_pixbuf_get_from_surface(surface, 0, 0, pointer->width, pointer->height); cairo_surface_destroy(surface); +#else + pixbuf = gdk_pixbuf_new_from_data(data, GDK_COLORSPACE_RGB, TRUE, 8, pointer->width, pointer->height, (pointer->width * 4), NULL, NULL); +#endif ((rfPointer*)ui->cursor.pointer)->cursor = gdk_cursor_new_from_pixbuf(rfi->display, pixbuf, pointer->xPos, pointer->yPos); } @@ -695,7 +703,10 @@ static void remmina_rdp_event_free_cursor(RemminaProtocolWidget* gp, RemminaPlug rfContext* rfi = GET_DATA(gp); g_mutex_lock(rfi->gmutex); + /* Ugly leak with GTK2, otherwise g_object_unref segfaults */ +#if GTK_VERSION == 3 g_object_unref(ui->cursor.pointer->cursor); +#endif ui->cursor.pointer->cursor = NULL; g_cond_signal(rfi->gcond); g_mutex_unlock(rfi->gmutex); diff --git a/remmina-plugins/rdp/rdp_graphics.c b/remmina-plugins/rdp/rdp_graphics.c index d635a22ec..e1065a316 100644 --- a/remmina-plugins/rdp/rdp_graphics.c +++ b/remmina-plugins/rdp/rdp_graphics.c @@ -186,7 +186,11 @@ void rf_Pointer_Free(rdpContext* context, rdpPointer* pointer) RemminaPluginRdpUiObject* ui; rfContext* rfi = (rfContext*) context; +#if GTK_VERSION == 2 + if (((rfPointer*) pointer)->cursor != NULL) +#else if (G_IS_OBJECT(((rfPointer*) pointer)->cursor)) +#endif { ui = g_new0(RemminaPluginRdpUiObject, 1); ui->type = REMMINA_RDP_UI_CURSOR; @@ -196,7 +200,11 @@ void rf_Pointer_Free(rdpContext* context, rdpPointer* pointer) rf_queue_ui(rfi->protocol_widget, ui); g_mutex_lock(rfi->gmutex); +#if GTK_VERSION == 2 + while (((rfPointer*) pointer)->cursor != NULL) +#else while (G_IS_OBJECT(((rfPointer*) pointer)->cursor)) +#endif { g_cond_wait(rfi->gcond, rfi->gmutex); } |