[gimp/gtk3-port: 30/231] app: port to GtkWidget::draw()



commit a69aea6a139736be94bfb415e1010816b5b0c3d1
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 15 16:11:12 2010 +0200

    app: port to GtkWidget::draw()

 app/widgets/gimpview.c |   44 +++++++++++++++-----------------------------
 1 files changed, 15 insertions(+), 29 deletions(-)
---
diff --git a/app/widgets/gimpview.c b/app/widgets/gimpview.c
index 7de146a..0c295c4 100644
--- a/app/widgets/gimpview.c
+++ b/app/widgets/gimpview.c
@@ -63,10 +63,9 @@ static void        gimp_view_size_request         (GtkWidget        *widget,
                                                    GtkRequisition   *requisition);
 static void        gimp_view_size_allocate        (GtkWidget        *widget,
                                                    GtkAllocation    *allocation);
-static void        gimp_view_style_set            (GtkWidget        *widget,
-                                                   GtkStyle         *prev_style);
-static gboolean    gimp_view_expose_event         (GtkWidget        *widget,
-                                                   GdkEventExpose   *event);
+static void        gimp_view_style_updated        (GtkWidget        *widget);
+static gboolean    gimp_view_draw                 (GtkWidget        *widget,
+                                                   cairo_t          *cr);
 static gboolean    gimp_view_button_press_event   (GtkWidget        *widget,
                                                    GdkEventButton   *bevent);
 static gboolean    gimp_view_button_release_event (GtkWidget        *widget,
@@ -150,8 +149,8 @@ gimp_view_class_init (GimpViewClass *klass)
   widget_class->unmap                = gimp_view_unmap;
   widget_class->size_request         = gimp_view_size_request;
   widget_class->size_allocate        = gimp_view_size_allocate;
-  widget_class->style_set            = gimp_view_style_set;
-  widget_class->expose_event         = gimp_view_expose_event;
+  widget_class->style_updated        = gimp_view_style_updated;
+  widget_class->draw                 = gimp_view_draw;
   widget_class->button_press_event   = gimp_view_button_press_event;
   widget_class->button_release_event = gimp_view_button_release_event;
   widget_class->enter_notify_event   = gimp_view_enter_notify_event;
@@ -385,40 +384,27 @@ gimp_view_size_allocate (GtkWidget     *widget,
 }
 
 static void
-gimp_view_style_set (GtkWidget *widget,
-                     GtkStyle  *prev_style)
+gimp_view_style_updated (GtkWidget *widget)
 {
   GimpView *view = GIMP_VIEW (widget);
 
-  GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+  GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
 
   gimp_view_renderer_invalidate (view->renderer);
 }
 
 static gboolean
-gimp_view_expose_event (GtkWidget      *widget,
-                        GdkEventExpose *event)
+gimp_view_draw (GtkWidget *widget,
+                cairo_t   *cr)
 {
-  if (gtk_widget_is_drawable (widget))
-    {
-      GtkAllocation  allocation;
-      cairo_t       *cr;
-
-      gtk_widget_get_allocation (widget, &allocation);
-
-      cr = gdk_cairo_create (event->window);
-      gdk_cairo_region (cr, event->region);
-      cairo_clip (cr);
+  GtkAllocation allocation;
 
-      cairo_translate (cr, allocation.x, allocation.y);
-
-      gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer,
-                               widget, cr,
-                               allocation.width,
-                               allocation.height);
+  gtk_widget_get_allocation (widget, &allocation);
 
-      cairo_destroy (cr);
-    }
+  gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer,
+                           widget, cr,
+                           allocation.width,
+                           allocation.height);
 
   return FALSE;
 }


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