[gtk+/rendering-cleanup-next: 70/153] scrolledwindow: Port to draw vfunc



commit d2776d796c44b3aa59d5f91d318d412e41bbdd2f
Author: Benjamin Otte <otte redhat com>
Date:   Tue Sep 7 19:18:46 2010 +0200

    scrolledwindow: Port to draw vfunc

 gtk/gtkscrolledwindow.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 0429e8c..c24af4d 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -122,8 +122,10 @@ static void     gtk_scrolled_window_get_property       (GObject           *objec
 
 static void     gtk_scrolled_window_screen_changed     (GtkWidget         *widget,
                                                         GdkScreen         *previous_screen);
-static gboolean gtk_scrolled_window_expose             (GtkWidget         *widget,
-                                                        GdkEventExpose    *event);
+static gboolean gtk_scrolled_window_draw               (GtkWidget         *widget,
+                                                        cairo_t           *cr,
+                                                        int                width,
+                                                        int                height);
 static void     gtk_scrolled_window_size_allocate      (GtkWidget         *widget,
                                                         GtkAllocation     *allocation);
 static gboolean gtk_scrolled_window_scroll_event       (GtkWidget         *widget,
@@ -225,7 +227,7 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
   object_class->destroy = gtk_scrolled_window_destroy;
 
   widget_class->screen_changed = gtk_scrolled_window_screen_changed;
-  widget_class->expose_event = gtk_scrolled_window_expose;
+  widget_class->draw = gtk_scrolled_window_draw;
   widget_class->size_allocate = gtk_scrolled_window_size_allocate;
   widget_class->scroll_event = gtk_scrolled_window_scroll_event;
   widget_class->focus = gtk_scrolled_window_focus;
@@ -1085,15 +1087,16 @@ gtk_scrolled_window_screen_changed (GtkWidget *widget,
 }
 
 static gboolean
-gtk_scrolled_window_expose (GtkWidget      *widget,
-			    GdkEventExpose *event)
+gtk_scrolled_window_draw (GtkWidget *widget,
+                          cairo_t   *cr,
+                          int        width,
+                          int        height)
 {
   GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
   GtkScrolledWindowPrivate *priv = scrolled_window->priv;
 
   if (priv->shadow_type != GTK_SHADOW_NONE)
     {
-      GtkAllocation allocation;
       GtkAllocation relative_allocation;
       GtkStyle *style;
       gboolean scrollbars_within_bevel;
@@ -1101,8 +1104,6 @@ gtk_scrolled_window_expose (GtkWidget      *widget,
       style = gtk_widget_get_style (widget);
       gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
 
-      gtk_widget_get_allocation (widget, &allocation);
-
       if (!scrollbars_within_bevel)
         {
           gtk_scrolled_window_relative_allocation (widget, &relative_allocation);
@@ -1121,21 +1122,21 @@ gtk_scrolled_window_expose (GtkWidget      *widget,
 
           relative_allocation.x = border_width;
           relative_allocation.y = border_width;
-          relative_allocation.width = allocation.width - 2 * border_width;
-          relative_allocation.height = allocation.height - 2 * border_width;
+          relative_allocation.width = width - 2 * border_width;
+          relative_allocation.height = height - 2 * border_width;
         }
 
-      gtk_paint_shadow (style,
-                        gtk_widget_get_window (widget),
+      gtk_cairo_paint_shadow (style,
+                        cr,
 			GTK_STATE_NORMAL, priv->shadow_type,
-			&event->area, widget, "scrolled_window",
-                        allocation.x + relative_allocation.x,
-                        allocation.y + relative_allocation.y,
+			widget, "scrolled_window",
+                        relative_allocation.x,
+                        relative_allocation.y,
 			relative_allocation.width,
 			relative_allocation.height);
     }
 
-  GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->expose_event (widget, event);
+  GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->draw (widget, cr, width, height);
 
   return FALSE;
 }



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