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.
This commit is contained in:
parent
02de8b9ad5
commit
c5b5a88d6d
@ -71,16 +71,29 @@ stage_button_press_cb (ClutterActor *actor,
|
|||||||
{
|
{
|
||||||
Pixmap pxm = (Pixmap)data;
|
Pixmap pxm = (Pixmap)data;
|
||||||
Display *dpy = clutter_x11_get_default_display ();
|
Display *dpy = clutter_x11_get_default_display ();
|
||||||
GC gc;
|
static GC gc = None;
|
||||||
XGCValues gc_values = {0};
|
static int x = 100, y = 100;
|
||||||
|
|
||||||
|
if (gc == None)
|
||||||
|
{
|
||||||
|
XGCValues gc_values = { 0 };
|
||||||
|
|
||||||
gc = XCreateGC (dpy,
|
gc_values.line_width = 12;
|
||||||
pxm,
|
/* This is an attempt to get a black pixel will full
|
||||||
0,
|
opacity. Seemingly the BlackPixel macro and the default GC
|
||||||
&gc_values);
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user