[gtk+/rendering-cleanup-next: 136/153] testgtk: Use draw signal in scrolling test
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 136/153] testgtk: Use draw signal in scrolling test
- Date: Sat, 11 Sep 2010 05:02:52 +0000 (UTC)
commit 68c875806ef9cfe16322195e7be9b33de8ee7d8a
Author: Benjamin Otte <otte redhat com>
Date: Thu Sep 9 03:33:02 2010 +0200
testgtk: Use draw signal in scrolling test
tests/testgtk.c | 32 +++++++++++++-------------------
1 files changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index d4d4c84..18ea550 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -9085,27 +9085,23 @@ create_selection_test (GtkWidget *widget)
static int scroll_test_pos = 0.0;
static gint
-scroll_test_expose (GtkWidget *widget, GdkEventExpose *event,
- GtkAdjustment *adj)
+scroll_test_draw (GtkWidget *widget,
+ cairo_t *cr,
+ int width,
+ int height,
+ GtkAdjustment *adj)
{
- GdkWindow *window;
gint i,j;
gint imin, imax, jmin, jmax;
- cairo_t *cr;
+ GdkRectangle clip;
- imin = (event->area.x) / 10;
- imax = (event->area.x + event->area.width + 9) / 10;
+ gdk_cairo_get_clip_rectangle (cr, &clip);
- jmin = ((int)adj->value + event->area.y) / 10;
- jmax = ((int)adj->value + event->area.y + event->area.height + 9) / 10;
+ imin = (clip.x) / 10;
+ imax = (clip.x + clip.width + 9) / 10;
- window = gtk_widget_get_window (widget);
-
- gdk_window_clear_area (window,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- cr = gdk_cairo_create (window);
+ jmin = ((int)adj->value + clip.y) / 10;
+ jmax = ((int)adj->value + clip.y + clip.height + 9) / 10;
for (i=imin; i<imax; i++)
for (j=jmin; j<jmax; j++)
@@ -9114,8 +9110,6 @@ scroll_test_expose (GtkWidget *widget, GdkEventExpose *event,
cairo_fill (cr);
- cairo_destroy (cr);
-
return TRUE;
}
@@ -9211,8 +9205,8 @@ create_scroll_test (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (hbox), scrollbar, FALSE, FALSE, 0);
gtk_widget_show (scrollbar);
- g_signal_connect (drawing_area, "expose_event",
- G_CALLBACK (scroll_test_expose), adj);
+ g_signal_connect (drawing_area, "draw",
+ G_CALLBACK (scroll_test_draw), adj);
g_signal_connect (drawing_area, "configure_event",
G_CALLBACK (scroll_test_configure), adj);
g_signal_connect (drawing_area, "scroll_event",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]