[gimp/gtk3-port: 6/228] libgimpwidgets: port to GtkWidget::draw()



commit e1721d97d36ea692b15e2bf738b348e1a2857e49
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 7823431..767200a 100644
--- a/libgimpwidgets/gimpchainbutton.c
+++ b/libgimpwidgets/gimpchainbutton.c
@@ -321,9 +321,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
 {
@@ -342,7 +342,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
@@ -364,23 +364,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;
@@ -453,7 +447,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]