summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-05-23 15:02:21 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-05-26 08:22:01 +0000
commitfffe6ce631502ee846de103be70e763c567a2678 (patch)
treeeae3286d9753a9a5c165d1859bfbf0b243f0e0df
parentbcf7e38f4289fb13f0a5823d33f4cfc20f45683a (diff)
Resolves: tdf#99874 gtk3: all-black xbm cursors
(cherry picked from commit 81a8d1250319023f6ca272e0b233ef638cae40f7) Change-Id: I1feca80dd75f7a09e05ac43293e8645da391a775 Reviewed-on: https://gerrit.libreoffice.org/25436 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--vcl/unx/gtk/gtkdata.cxx24
1 files changed, 17 insertions, 7 deletions
diff --git a/vcl/unx/gtk/gtkdata.cxx b/vcl/unx/gtk/gtkdata.cxx
index b5c64e05d302..22ac4319b39d 100644
--- a/vcl/unx/gtk/gtkdata.cxx
+++ b/vcl/unx/gtk/gtkdata.cxx
@@ -301,31 +301,41 @@ GdkCursor* GtkSalDisplay::getFromXBM( const unsigned char *pBitmap,
int cairo_stride = cairo_format_stride_for_width(CAIRO_FORMAT_A1, nWidth);
unsigned char *pPaddedXBM = ensurePaddedForCairo(pBitmap, nWidth, nHeight, cairo_stride);
- cairo_surface_t *s = cairo_image_surface_create_for_data(
+ cairo_surface_t *source = cairo_image_surface_create_for_data(
pPaddedXBM,
CAIRO_FORMAT_A1, nWidth, nHeight,
cairo_stride);
- cairo_t *cr = cairo_create(s);
unsigned char *pPaddedMaskXBM = ensurePaddedForCairo(pMask, nWidth, nHeight, cairo_stride);
cairo_surface_t *mask = cairo_image_surface_create_for_data(
pPaddedMaskXBM,
CAIRO_FORMAT_A1, nWidth, nHeight,
cairo_stride);
+
+ cairo_surface_t *s = cairo_surface_create_similar(source, CAIRO_CONTENT_ALPHA, nWidth, nHeight);
+ cairo_t *cr = cairo_create(s);
+ cairo_set_source_surface(cr, source, 0, 0);
cairo_mask_surface(cr, mask, 0, 0);
cairo_destroy(cr);
+
+#if GTK_CHECK_VERSION(3,10,0)
+ GdkCursor *cursor = gdk_cursor_new_from_surface(m_pGdkDisplay, s, nXHot, nYHot);
+#else
+ GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, nWidth, nHeight);
+ GdkCursor *cursor = gdk_cursor_new_from_pixbuf(m_pGdkDisplay, pixbuf, nXHot, nYHot);
+ g_object_unref(pixbuf);
+#endif
+
+ cairo_surface_destroy(s);
cairo_surface_destroy(mask);
+ cairo_surface_destroy(source);
+
if (pPaddedMaskXBM != pMask)
delete [] pPaddedMaskXBM;
- GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, nWidth, nHeight);
- cairo_surface_destroy(s);
if (pPaddedXBM != pBitmap)
delete [] pPaddedXBM;
- GdkCursor *cursor = gdk_cursor_new_from_pixbuf(m_pGdkDisplay, pixbuf, nXHot, nYHot);
- g_object_unref(pixbuf);
-
return cursor;
#else
GdkScreen *pScreen = gdk_display_get_default_screen( m_pGdkDisplay );