summaryrefslogtreecommitdiff
path: root/libview/ev-loading-window.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-01-21 17:10:42 +0100
committerStefano Karapetsas <[email protected]>2014-01-21 17:10:42 +0100
commit75173c8f5ebdac9a095a466af602d6b07324029f (patch)
treec62c097c1e2cb3e80319f6e8125ece792e75f1fe /libview/ev-loading-window.c
parent5109344eba11c4da9d10970dabe8aa159c6596c3 (diff)
downloadatril-75173c8f5ebdac9a095a466af602d6b07324029f.tar.bz2
atril-75173c8f5ebdac9a095a466af602d6b07324029f.tar.xz
libview: Add GTK3 support
Diffstat (limited to 'libview/ev-loading-window.c')
-rw-r--r--libview/ev-loading-window.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libview/ev-loading-window.c b/libview/ev-loading-window.c
index 049ce0a1..973cfa45 100644
--- a/libview/ev-loading-window.c
+++ b/libview/ev-loading-window.c
@@ -177,7 +177,12 @@ ev_loading_window_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
EvLoadingWindow *window = EV_LOADING_WINDOW (widget);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ cairo_surface_t *surface;
+ cairo_region_t *shape;
+#else
GdkPixmap *mask;
+#endif
cairo_t *cr;
double r;
@@ -189,8 +194,13 @@ ev_loading_window_size_allocate (GtkWidget *widget,
window->width = allocation->width;
window->height = allocation->height;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ surface = cairo_image_surface_create (CAIRO_FORMAT_A8, window->width, window->height);
+ cr = cairo_create (surface);
+#else
mask = gdk_pixmap_new (NULL, window->width, window->height, 1);
cr = gdk_cairo_create (GDK_DRAWABLE (mask));
+#endif
cairo_save (cr);
cairo_rectangle (cr, 0, 0, window->width, window->height);
@@ -205,8 +215,16 @@ ev_loading_window_size_allocate (GtkWidget *widget,
cairo_destroy (cr);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ shape = gdk_cairo_region_create_from_surface (surface);
+ cairo_surface_destroy (surface);
+
+ gtk_widget_shape_combine_region (widget, shape);
+ cairo_region_destroy (shape);
+#else
gtk_widget_shape_combine_mask (widget, mask, 0, 0);
g_object_unref (mask);
+#endif
}
static void