test-pixmap: add timeout to draw arcs on pixmap

As a convenient test that clipped redraws are working correctly in
response to X pixmap damage this updates test-pixmap to have a repeating
1 second timeout that draws arcs on the pixmap.
This commit is contained in:
Robert Bragg 2010-09-30 02:37:24 +01:00
parent 18e3273fb1
commit 471659ed4b

View File

@ -97,11 +97,8 @@ stage_key_release_cb (ClutterActor *actor,
} }
static gboolean static gboolean
stage_button_press_cb (ClutterActor *actor, draw_arc (Pixmap pixmap)
ClutterEvent *event,
gpointer data)
{ {
Pixmap pxm = (Pixmap)data;
Display *dpy = clutter_x11_get_default_display (); Display *dpy = clutter_x11_get_default_display ();
static GC gc = None; static GC gc = None;
static int x = 100, y = 100; static int x = 100, y = 100;
@ -117,16 +114,25 @@ stage_button_press_cb (ClutterActor *actor,
gc_values.foreground = 0xff000000; gc_values.foreground = 0xff000000;
gc = XCreateGC (dpy, gc = XCreateGC (dpy,
pxm, pixmap,
GCLineWidth | GCForeground, GCLineWidth | GCForeground,
&gc_values); &gc_values);
} }
XDrawArc (dpy, pxm, gc, x, y, 100, 100, 0, 360 * 64); XDrawArc (dpy, pixmap, gc, x, y, 100, 100, 0, 360 * 64);
x -= 5; x -= 5;
y -= 5; y -= 5;
return TRUE;
}
static gboolean
stage_button_press_cb (ClutterActor *actor,
ClutterEvent *event,
gpointer data)
{
draw_arc ((Pixmap)data);
return FALSE; return FALSE;
} }
@ -384,6 +390,8 @@ test_pixmap_main (int argc, char **argv)
if (!disable_animation) if (!disable_animation)
clutter_timeline_start (timeline); clutter_timeline_start (timeline);
g_timeout_add_seconds (1, (GSourceFunc)draw_arc, GUINT_TO_POINTER (pixmap));
clutter_main (); clutter_main ();
# endif /* USE_GDKPIXBUF */ # endif /* USE_GDKPIXBUF */