[gimp] libgimpwidgets: port to GtkWidget::draw()



commit 7e6a2d270ed4db16f51af4d52ef341ac108ac816
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 15 10:44:11 2010 +0200

    libgimpwidgets: port to GtkWidget::draw()

 libgimpwidgets/gimpchainbutton.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/libgimpwidgets/gimpchainbutton.c b/libgimpwidgets/gimpchainbutton.c
index 054a1bd..974e5ae 100644
--- a/libgimpwidgets/gimpchainbutton.c
+++ b/libgimpwidgets/gimpchainbutton.c
@@ -323,9 +323,9 @@ gimp_chain_button_update_image (GimpChainButton *button)
  * don't need any input events.
  */
 
-static GType     gimp_chain_line_get_type     (void) G_GNUC_CONST;
-static gboolean  gimp_chain_line_expose_event (GtkWidget       *widget,
-                                               GdkEventExpose  *event);
+static GType     gimp_chain_line_get_type (void) G_GNUC_CONST;
+static gboolean  gimp_chain_line_draw     (GtkWidget *widget,
+                                           cairo_t   *cr);
 
 struct _GimpChainLine
 {
@@ -344,7 +344,7 @@ gimp_chain_line_class_init (GimpChainLineClass *klass)
 {
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  widget_class->expose_event = gimp_chain_line_expose_event;
+  widget_class->draw = gimp_chain_line_draw;
 }
 
 static void
@@ -366,23 +366,17 @@ gimp_chain_line_new (GimpChainPosition  position,
 }
 
 static gboolean
-gimp_chain_line_expose_event (GtkWidget      *widget,
-                              GdkEventExpose *event)
+gimp_chain_line_draw (GtkWidget *widget,
+                      cairo_t   *cr)
 {
   GtkStyle          *style = gtk_widget_get_style (widget);
   GimpChainLine     *line  = ((GimpChainLine *) widget);
   GtkAllocation      allocation;
   GdkPoint           points[3];
   GimpChainPosition  position;
-  cairo_t           *cr;
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
-  gdk_cairo_region (cr, event->region);
-  cairo_translate (cr, allocation.x, allocation.y);
-  cairo_clip (cr);
-
 #define SHORT_LINE 4
   points[0].x = allocation.width  / 2;
   points[0].y = allocation.height / 2;
@@ -455,7 +449,5 @@ gimp_chain_line_expose_event (GtkWidget      *widget,
 
   cairo_stroke (cr);
 
-  cairo_destroy (cr);
-
   return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]