[gimp/gtk3-port: 77/143] app: port to GtkWidget::draw()



commit c3f0b6e43c3231c72a418dbc13b5d1794387a488
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 19 19:11:06 2010 +0200

    app: port to GtkWidget::draw()

 app/widgets/gimpoverlayframe.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/app/widgets/gimpoverlayframe.c b/app/widgets/gimpoverlayframe.c
index 7ba1ada..f824cf8 100644
--- a/app/widgets/gimpoverlayframe.c
+++ b/app/widgets/gimpoverlayframe.c
@@ -34,8 +34,8 @@ static void       gimp_overlay_frame_size_request  (GtkWidget      *widget,
                                                     GtkRequisition *requisition);
 static void       gimp_overlay_frame_size_allocate (GtkWidget      *widget,
                                                     GtkAllocation  *allocation);
-static gboolean   gimp_overlay_frame_expose        (GtkWidget      *widget,
-                                                    GdkEventExpose *eevent);
+static gboolean   gimp_overlay_frame_draw          (GtkWidget      *widget,
+                                                    cairo_t        *cr);
 
 
 G_DEFINE_TYPE (GimpOverlayFrame, gimp_overlay_frame, GTK_TYPE_BIN)
@@ -50,7 +50,7 @@ gimp_overlay_frame_class_init (GimpOverlayFrameClass *klass)
 
   widget_class->size_request  = gimp_overlay_frame_size_request;
   widget_class->size_allocate = gimp_overlay_frame_size_allocate;
-  widget_class->expose_event  = gimp_overlay_frame_expose;
+  widget_class->draw          = gimp_overlay_frame_draw;
 }
 
 static void
@@ -74,7 +74,7 @@ gimp_overlay_frame_size_request (GtkWidget      *widget,
 
   if (child && gtk_widget_get_visible (child))
     {
-      gtk_widget_size_request (child, &child_requisition);
+      gtk_widget_get_preferred_size (child, &child_requisition, NULL);
     }
   else
     {
@@ -110,21 +110,18 @@ gimp_overlay_frame_size_allocate (GtkWidget     *widget,
 }
 
 static gboolean
-gimp_overlay_frame_expose (GtkWidget      *widget,
-                           GdkEventExpose *eevent)
+gimp_overlay_frame_draw (GtkWidget *widget,
+                         cairo_t   *cr)
 {
-  cairo_t  *cr    = gdk_cairo_create (gtk_widget_get_window (widget));
   GtkStyle *style = gtk_widget_get_style (widget);
   gboolean  rgba;
 
-  rgba = gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget)) != NULL;
+  rgba = gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget)) != NULL;
 
   if (rgba)
     {
       cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
-      gdk_cairo_region (cr, eevent->region);
-      cairo_clip_preserve (cr);
-      cairo_fill (cr);
+      cairo_paint (cr);
     }
 
   cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
@@ -242,9 +239,7 @@ gimp_overlay_frame_expose (GtkWidget      *widget,
 
   cairo_paint (cr);
 
-  cairo_destroy (cr);
-
-  return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, eevent);
+  return GTK_WIDGET_CLASS (parent_class)->draw (widget, cr);
 }
 
 GtkWidget *



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