[gtk+/rendering-cleanup-next: 137/155] 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: 137/155] testgtk: Use draw signal in scrolling test
- Date: Wed, 15 Sep 2010 03:08:26 +0000 (UTC)
commit 2b7f747ae19bded89c72ff6a98ebac7db892523c
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 | 30 +++++++++++-------------------
1 files changed, 11 insertions(+), 19 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 199be1c..e93e7ea 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -9086,27 +9086,21 @@ 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,
+ 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++)
@@ -9115,8 +9109,6 @@ scroll_test_expose (GtkWidget *widget, GdkEventExpose *event,
cairo_fill (cr);
- cairo_destroy (cr);
-
return TRUE;
}
@@ -9212,8 +9204,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]