[gtk+/rendering-cleanup-next: 98/153] toolitemgroup: Connect to draw signal



commit acb7c481e64074601a081c8dfee1bbeefc6cecb8
Author: Benjamin Otte <otte redhat com>
Date:   Wed Sep 8 17:06:07 2010 +0200

    toolitemgroup: Connect to draw signal

 gtk/gtktoolitemgroup.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index 552e6da..5837333 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -260,11 +260,12 @@ gtk_tool_item_group_tool_shell_init (GtkToolShellIface *iface)
 }
 
 static gboolean
-gtk_tool_item_group_header_expose_event_cb (GtkWidget      *widget,
-                                            GdkEventExpose *event,
-                                            gpointer        data)
+gtk_tool_item_group_header_draw_cb (GtkWidget *widget,
+                                    cairo_t   *cr,
+                                    int        width,
+                                    int        height,
+                                    gpointer   data)
 {
-  GtkAllocation allocation;
   GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (data);
   GtkToolItemGroupPrivate* priv = group->priv;
   GtkExpanderStyle expander_style;
@@ -276,20 +277,19 @@ gtk_tool_item_group_header_expose_event_cb (GtkWidget      *widget,
   expander_style = priv->expander_style;
   direction = gtk_widget_get_direction (widget);
 
-  gtk_widget_get_allocation (widget, &allocation);
   if (GTK_ORIENTATION_VERTICAL == orientation)
     {
       if (GTK_TEXT_DIR_RTL == direction)
-        x = allocation.x + allocation.width - priv->expander_size / 2;
+        x = width - priv->expander_size / 2;
       else
-        x = allocation.x + priv->expander_size / 2;
+        x = priv->expander_size / 2;
 
-      y = allocation.y + allocation.height / 2;
+      y = height / 2;
     }
   else
     {
-      x = allocation.x + allocation.width / 2;
-      y = allocation.y + priv->expander_size / 2;
+      x = width / 2;
+      y = priv->expander_size / 2;
 
       /* Unfortunatly gtk_paint_expander() doesn't support rotated drawing
        * modes. Luckily the following shady arithmetics produce the desired
@@ -297,10 +297,10 @@ gtk_tool_item_group_header_expose_event_cb (GtkWidget      *widget,
       expander_style = GTK_EXPANDER_EXPANDED - expander_style;
     }
 
-  gtk_paint_expander (gtk_widget_get_style (widget),
-                      gtk_widget_get_window (widget),
+  gtk_cairo_paint_expander (gtk_widget_get_style (widget),
+                      cr,
                       gtk_widget_get_state (priv->header),
-                      &event->area, GTK_WIDGET (group),
+                      GTK_WIDGET (group),
                       "tool-palette-header", x, y,
                       expander_style);
 
@@ -409,8 +409,8 @@ gtk_tool_item_group_init (GtkToolItemGroup *group)
 
   gtk_tool_item_group_header_adjust_style (group);
 
-  g_signal_connect_after (alignment, "expose-event",
-                          G_CALLBACK (gtk_tool_item_group_header_expose_event_cb),
+  g_signal_connect_after (alignment, "draw",
+                          G_CALLBACK (gtk_tool_item_group_header_draw_cb),
                           group);
   g_signal_connect_after (alignment, "size-request",
                           G_CALLBACK (gtk_tool_item_group_header_size_request_cb),



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