[gimp/gtk3-port: 49/233] app: port to GtkWidget::draw()



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

    app: port to GtkWidget::draw()

 app/widgets/gimpoverlayframe.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/app/widgets/gimpoverlayframe.c b/app/widgets/gimpoverlayframe.c
index 039b2b4..d3ca2f3 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,19 +110,15 @@ 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);
   GtkAllocation  allocation;
   gboolean       rgba;
   gint           border_width;
 
-  rgba = gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget)) != NULL;
-
-  gdk_cairo_region (cr, eevent->region);
-  cairo_clip (cr);
+  rgba = gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget)) != NULL;
 
   if (rgba)
     {
@@ -193,9 +189,7 @@ gimp_overlay_frame_expose (GtkWidget      *widget,
       cairo_stroke (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]