[gimp/gtk3-port: 11/235] libgimpwidgets: port to GtkWidget::draw()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 11/235] libgimpwidgets: port to GtkWidget::draw()
- Date: Fri, 7 Oct 2011 10:57:02 +0000 (UTC)
commit 0da27ace7d290e87e6e050cee7d60ab7b0908ea9
Author: Michael Natterer <mitch gimp org>
Date: Fri Oct 15 11:20:14 2010 +0200
libgimpwidgets: port to GtkWidget::draw()
libgimpwidgets/gimpoffsetarea.c | 26 +++++++++-----------------
1 files changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/libgimpwidgets/gimpoffsetarea.c b/libgimpwidgets/gimpoffsetarea.c
index a012751..4b733e1 100644
--- a/libgimpwidgets/gimpoffsetarea.c
+++ b/libgimpwidgets/gimpoffsetarea.c
@@ -55,8 +55,8 @@ static void gimp_offset_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gboolean gimp_offset_area_event (GtkWidget *widget,
GdkEvent *event);
-static gboolean gimp_offset_area_expose_event (GtkWidget *widget,
- GdkEventExpose *eevent);
+static gboolean gimp_offset_area_draw (GtkWidget *widget,
+ cairo_t *cr);
G_DEFINE_TYPE (GimpOffsetArea, gimp_offset_area, GTK_TYPE_DRAWING_AREA)
@@ -85,7 +85,7 @@ gimp_offset_area_class_init (GimpOffsetAreaClass *klass)
widget_class->size_allocate = gimp_offset_area_size_allocate;
widget_class->realize = gimp_offset_area_realize;
widget_class->event = gimp_offset_area_event;
- widget_class->expose_event = gimp_offset_area_expose_event;
+ widget_class->draw = gimp_offset_area_draw;
}
static void
@@ -394,22 +394,16 @@ gimp_offset_area_event (GtkWidget *widget,
}
static gboolean
-gimp_offset_area_expose_event (GtkWidget *widget,
- GdkEventExpose *eevent)
+gimp_offset_area_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- GimpOffsetArea *area = GIMP_OFFSET_AREA (widget);
- GtkStyle *style = gtk_widget_get_style (widget);
- GdkWindow *window = gtk_widget_get_window (widget);
- cairo_t *cr;
+ GimpOffsetArea *area = GIMP_OFFSET_AREA (widget);
+ GtkStyle *style = gtk_widget_get_style (widget);
GtkAllocation allocation;
GdkPixbuf *pixbuf;
gint w, h;
gint x, y;
- cr = gdk_cairo_create (eevent->window);
- gdk_cairo_region (cr, eevent->region);
- cairo_clip (cr);
-
gtk_widget_get_allocation (widget, &allocation);
x = (area->display_ratio_x *
@@ -442,9 +436,9 @@ gimp_offset_area_expose_event (GtkWidget *widget,
}
else
{
- gtk_paint_shadow (style, window, GTK_STATE_NORMAL,
+ gtk_paint_shadow (style, cr, GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
- NULL, widget, NULL,
+ widget, NULL,
x, y, w, h);
}
@@ -494,7 +488,5 @@ gimp_offset_area_expose_event (GtkWidget *widget,
cairo_stroke (cr);
}
- cairo_destroy (cr);
-
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]