[gimp/gtk3-port: 40/247] app: port to GtkWidget::draw()



commit 46c15d80258339918c3907d75448bbcb20c00776
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 15 14:26:48 2010 +0200

    app: port to GtkWidget::draw()

 app/widgets/gimphandlebar.c |   24 +++++-------------------
 1 files changed, 5 insertions(+), 19 deletions(-)
---
diff --git a/app/widgets/gimphandlebar.c b/app/widgets/gimphandlebar.c
index 5bfab70..27efb2f 100644
--- a/app/widgets/gimphandlebar.c
+++ b/app/widgets/gimphandlebar.c
@@ -44,8 +44,8 @@ static void      gimp_handle_bar_get_property       (GObject        *object,
                                                      GValue         *value,
                                                      GParamSpec     *pspec);
 
-static gboolean  gimp_handle_bar_expose             (GtkWidget      *widget,
-                                                     GdkEventExpose *eevent);
+static gboolean  gimp_handle_bar_draw               (GtkWidget      *widget,
+                                                     cairo_t        *cr);
 static gboolean  gimp_handle_bar_button_press       (GtkWidget      *widget,
                                                      GdkEventButton *bevent);
 static gboolean  gimp_handle_bar_button_release     (GtkWidget      *widget,
@@ -71,7 +71,7 @@ gimp_handle_bar_class_init (GimpHandleBarClass *klass)
   object_class->set_property         = gimp_handle_bar_set_property;
   object_class->get_property         = gimp_handle_bar_get_property;
 
-  widget_class->expose_event         = gimp_handle_bar_expose;
+  widget_class->draw                 = gimp_handle_bar_draw;
   widget_class->button_press_event   = gimp_handle_bar_button_press;
   widget_class->button_release_event = gimp_handle_bar_button_release;
   widget_class->motion_notify_event  = gimp_handle_bar_motion_notify;
@@ -141,12 +141,11 @@ gimp_handle_bar_get_property (GObject    *object,
 }
 
 static gboolean
-gimp_handle_bar_expose (GtkWidget      *widget,
-                        GdkEventExpose *eevent)
+gimp_handle_bar_draw (GtkWidget *widget,
+                      cairo_t   *cr)
 {
   GimpHandleBar *bar = GIMP_HANDLE_BAR (widget);
   GtkAllocation  allocation;
-  cairo_t       *cr;
   gint           x, y;
   gint           width, height;
   gint           i;
@@ -158,17 +157,6 @@ gimp_handle_bar_expose (GtkWidget      *widget,
   width  = allocation.width  - 2 * x;
   height = allocation.height - 2 * y;
 
-  if (! gtk_widget_get_has_window (widget))
-    {
-      x += allocation.x;
-      y += allocation.y;
-    }
-
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
-
-  gdk_cairo_region (cr, eevent->region);
-  cairo_clip (cr);
-
   cairo_set_line_width (cr, 1.0);
   cairo_translate (cr, 0.5, 0.5);
 
@@ -205,8 +193,6 @@ gimp_handle_bar_expose (GtkWidget      *widget,
         }
     }
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 



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