[gimp/gtk3-port: 27/237] app: port to GtkWidget::draw()



commit 1d5310da7c537de032039c5571c5073c13b5263c
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 304a068..0590072 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -76,8 +76,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,
@@ -120,7 +120,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;
@@ -450,14 +450,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;
@@ -465,7 +463,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;
@@ -476,16 +474,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);
     }
@@ -661,8 +654,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]