From c5b5a88d6d74242939ea9db67c8a8098ed74171d Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 28 May 2010 18:41:20 +0100 Subject: [PATCH] test-pixmap: Draw something more interesting when the mouse is clicked When the mouse button is pressed it would previously draw a small 1-pixel wide fully transparent line to the pixmap. This is a useful feature to help test the automatic updates but the line is quite hard to see so it's to easy miss. This patch changes it to draw a thick black circle. The circle is drawn at a different position every time the button is clicked. --- tests/interactive/test-pixmap.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tests/interactive/test-pixmap.c b/tests/interactive/test-pixmap.c index 193d3e94b..6f4051b9c 100644 --- a/tests/interactive/test-pixmap.c +++ b/tests/interactive/test-pixmap.c @@ -71,16 +71,29 @@ stage_button_press_cb (ClutterActor *actor, { Pixmap pxm = (Pixmap)data; Display *dpy = clutter_x11_get_default_display (); - GC gc; - XGCValues gc_values = {0}; + static GC gc = None; + static int x = 100, y = 100; + if (gc == None) + { + XGCValues gc_values = { 0 }; - gc = XCreateGC (dpy, - pxm, - 0, - &gc_values); + gc_values.line_width = 12; + /* This is an attempt to get a black pixel will full + opacity. Seemingly the BlackPixel macro and the default GC + value are a fully transparent color */ + gc_values.foreground = 0xff000000; - XDrawLine (dpy, pxm, gc, 0, 0, 100, 100); + gc = XCreateGC (dpy, + pxm, + GCLineWidth | GCForeground, + &gc_values); + } + + XDrawArc (dpy, pxm, gc, x, y, 100, 100, 0, 360 * 64); + + x -= 5; + y -= 5; return FALSE; }