[gimp/gtk3-port: 20/240] app: port to GtkWidget::draw()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 20/240] app: port to GtkWidget::draw()
- Date: Sat, 28 Apr 2018 18:24:38 +0000 (UTC)
commit 86fc43ae9151f73d4d759e905f497fb92198c714
Author: Michael Natterer <mitch gimp org>
Date: Fri Oct 15 13:42:19 2010 +0200
app: port to GtkWidget::draw()
app/widgets/gimpcurveview.c | 29 ++++++++++-------------------
1 files changed, 10 insertions(+), 19 deletions(-)
---
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 2acd166..4f4bd5c 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -80,8 +80,8 @@ static void gimp_curve_view_get_property (GObject *object,
static void gimp_curve_view_style_set (GtkWidget *widget,
GtkStyle *prev_style);
-static gboolean gimp_curve_view_expose (GtkWidget *widget,
- GdkEventExpose *event);
+static gboolean gimp_curve_view_draw (GtkWidget *widget,
+ cairo_t *cr);
static gboolean gimp_curve_view_button_press (GtkWidget *widget,
GdkEventButton *bevent);
static gboolean gimp_curve_view_button_release (GtkWidget *widget,
@@ -124,7 +124,7 @@ gimp_curve_view_class_init (GimpCurveViewClass *klass)
object_class->get_property = gimp_curve_view_get_property;
widget_class->style_set = gimp_curve_view_style_set;
- widget_class->expose_event = gimp_curve_view_expose;
+ widget_class->draw = gimp_curve_view_draw;
widget_class->button_press_event = gimp_curve_view_button_press;
widget_class->button_release_event = gimp_curve_view_button_release;
widget_class->motion_notify_event = gimp_curve_view_motion_notify;
@@ -464,14 +464,12 @@ gimp_curve_view_draw_curve (GimpCurveView *view,
}
static gboolean
-gimp_curve_view_expose (GtkWidget *widget,
- GdkEventExpose *event)
+gimp_curve_view_draw (GtkWidget *widget,
+ cairo_t *cr)
{
- GimpCurveView *view = GIMP_CURVE_VIEW (widget);
- GdkWindow *window = gtk_widget_get_window (widget);
- GtkStyle *style = gtk_widget_get_style (widget);
+ GimpCurveView *view = GIMP_CURVE_VIEW (widget);
+ GtkStyle *style = gtk_widget_get_style (widget);
GtkAllocation allocation;
- cairo_t *cr;
GList *list;
gint border;
gint width;
@@ -481,7 +479,7 @@ gimp_curve_view_expose (GtkWidget *widget,
gdouble x, y;
gint i;
- GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
+ GTK_WIDGET_CLASS (parent_class)->draw (widget, cr);
if (! view->curve)
return FALSE;
@@ -492,16 +490,11 @@ gimp_curve_view_expose (GtkWidget *widget,
width = allocation.width - 2 * border;
height = allocation.height - 2 * border;
- cr = gdk_cairo_create (gtk_widget_get_window (widget));
-
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
-
if (gtk_widget_has_focus (widget))
{
- gtk_paint_focus (style, window,
+ gtk_paint_focus (style, cr,
gtk_widget_get_state (widget),
- &event->area, widget, NULL,
+ widget, NULL,
border - 2, border - 2,
width + 4, height + 4);
}
@@ -749,8 +742,6 @@ gimp_curve_view_expose (GtkWidget *widget,
cairo_paint_with_alpha (cr, 0.6);
}
- cairo_destroy (cr);
-
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]