summaryrefslogtreecommitdiff
path: root/cut-n-paste
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-10 00:12:56 +0100
committerinfirit <[email protected]>2014-12-10 00:54:06 +0100
commit7abbbdbf7ccef858d5bdb18880c64eb2fca7e2c2 (patch)
treef9df8810071ba5886b20465817a79b4367d0e946 /cut-n-paste
parent0cda5a72c129bdb835c91a03c08562a11b056868 (diff)
downloadatril-7abbbdbf7ccef858d5bdb18880c64eb2fca7e2c2.tar.bz2
atril-7abbbdbf7ccef858d5bdb18880c64eb2fca7e2c2.tar.xz
Gtk3: [gimpcellrenderertoggle] Paint a shadow when the mouse is over the cell renderer
Taken from evince commit: 0a2d3c2d9dd1158dfb8cacd72abb498acd0e6fef From: Carlos Garcia Campos <[email protected]>
Diffstat (limited to 'cut-n-paste')
-rw-r--r--cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c
index 577aa086..2ae52737 100644
--- a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c
+++ b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c
@@ -309,6 +309,9 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
GtkStyle *style = gtk_widget_get_style (widget);
GdkRectangle toggle_rect;
GdkRectangle draw_rect;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkRectangle clip_rect;
+#endif
GtkStateType state;
gboolean active;
gint xpad;
@@ -369,7 +372,24 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
state = GTK_STATE_INSENSITIVE;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
+#if GTK_CHECK_VERSION (3, 0, 0)
+ if ((flags & GTK_CELL_RENDERER_PRELIT) &&
+ gdk_cairo_get_clip_rectangle(cr, &clip_rect) &&
+ gdk_rectangle_intersect (&clip_rect, cell_area, &draw_rect))
+ {
+ cairo_save (cr);
+ gdk_cairo_rectangle (cr, &draw_rect);
+ cairo_clip (cr);
+ gtk_paint_shadow (style,
+ cr,
+ state,
+ active ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
+ widget, NULL,
+ toggle_rect.x, toggle_rect.y,
+ toggle_rect.width, toggle_rect.height);
+ cairo_restore (cr);
+ }
+#else
if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) &&
(flags & GTK_CELL_RENDERER_PRELIT))
gtk_paint_shadow (style,