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



commit 82e1e35f1d0b7ac562149d394e85c9940daa69cf
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 a16d2dd..6bd5b7f 100644
--- a/libgimpwidgets/gimpchainbutton.c
+++ b/libgimpwidgets/gimpchainbutton.c
@@ -322,9 +322,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
 {
@@ -343,7 +343,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
@@ -365,23 +365,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;
@@ -454,7 +448,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]