[gtk+/rendering-cleanup-next: 132/203] testgtk: Use draw signal in resize grips example



commit 8b1d48268036de372c8bb596b92d20f49fb2ada1
Author: Benjamin Otte <otte redhat com>
Date:   Thu Sep 9 02:31:38 2010 +0200

    testgtk: Use draw signal in resize grips example

 tests/testgtk.c |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 65c43c8..5a5a7f9 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -2594,20 +2594,17 @@ grippy_button_press (GtkWidget *area, GdkEventButton *event, GdkWindowEdge edge)
 }
 
 static gboolean
-grippy_expose (GtkWidget *area, GdkEventExpose *event, GdkWindowEdge edge)
+grippy_draw (GtkWidget *area, cairo_t *cr, GdkWindowEdge edge)
 {
-  GtkAllocation allocation;
-
-  gtk_widget_get_allocation (area, &allocation);
-  gtk_paint_resize_grip (gtk_widget_get_style (area),
-                         gtk_widget_get_window (area),
+  gtk_cairo_paint_resize_grip (gtk_widget_get_style (area),
+                         cr,
 			 gtk_widget_get_state (area),
-			 &event->area,
 			 area,
 			 "statusbar",
 			 edge,
 			 0, 0,
-                         allocation.width, allocation.height);
+                         gtk_widget_get_allocated_width (area),
+                         gtk_widget_get_allocated_height (area));
 
   return TRUE;
 }
@@ -2641,7 +2638,7 @@ create_resize_grips (GtkWidget *widget)
       area = gtk_drawing_area_new ();
       gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
       gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE, 0);
-      g_signal_connect (area, "expose_event", G_CALLBACK (grippy_expose),
+      g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH_WEST));
       g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH_WEST));
@@ -2650,7 +2647,7 @@ create_resize_grips (GtkWidget *widget)
       area = gtk_drawing_area_new ();
       gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
       gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE, 0);
-      g_signal_connect (area, "expose_event", G_CALLBACK (grippy_expose),
+      g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH));
       g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH));
@@ -2659,7 +2656,7 @@ create_resize_grips (GtkWidget *widget)
       area = gtk_drawing_area_new ();
       gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
       gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE, 0);
-      g_signal_connect (area, "expose_event", G_CALLBACK (grippy_expose),
+      g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH_EAST));
       g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_NORTH_EAST));
@@ -2671,7 +2668,7 @@ create_resize_grips (GtkWidget *widget)
       area = gtk_drawing_area_new ();
       gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
       gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE, 0);
-      g_signal_connect (area, "expose_event", G_CALLBACK (grippy_expose),
+      g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_WEST));
       g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_WEST));
@@ -2684,7 +2681,7 @@ create_resize_grips (GtkWidget *widget)
       area = gtk_drawing_area_new ();
       gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
       gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE, 0);
-      g_signal_connect (area, "expose_event", G_CALLBACK (grippy_expose),
+      g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_EAST));
       g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_EAST));
@@ -2697,7 +2694,7 @@ create_resize_grips (GtkWidget *widget)
       area = gtk_drawing_area_new ();
       gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
       gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE, 0);
-      g_signal_connect (area, "expose_event", G_CALLBACK (grippy_expose),
+      g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH_WEST));
       g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH_WEST));
@@ -2705,7 +2702,7 @@ create_resize_grips (GtkWidget *widget)
       area = gtk_drawing_area_new ();
       gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
       gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE, 0);
-      g_signal_connect (area, "expose_event", G_CALLBACK (grippy_expose),
+      g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH));
       g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH));
@@ -2714,7 +2711,7 @@ create_resize_grips (GtkWidget *widget)
       area = gtk_drawing_area_new ();
       gtk_widget_add_events (area, GDK_BUTTON_PRESS_MASK);
       gtk_box_pack_start (GTK_BOX (hbox), area, TRUE, TRUE, 0);
-      g_signal_connect (area, "expose_event", G_CALLBACK (grippy_expose),
+      g_signal_connect (area, "draw", G_CALLBACK (grippy_draw),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH_EAST));
       g_signal_connect (area, "button_press_event", G_CALLBACK (grippy_button_press),
 			GINT_TO_POINTER (GDK_WINDOW_EDGE_SOUTH_EAST));



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