<br><div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Yan Seiner wrote: <br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> I am looking for a really simple X program to test an embedded setup.</blockquote><div><br>Below is a simple very X program to draw a single line. <br><br>Pat<br>---<br><br>/*<br> * Draw a line <br> * <br> * build with: gcc
xline.c -lX11 -o xline<br> *<br> * PEK 2007<br> */<br>#define WIDTH 128<br>#define HEIGHT 128<br><br>main()<br>{<br> Display * dpy;<br> Window win;<br> XEvent event;<br> int scrn;<br> int x1, y1, x2, y2;
<br><br> if ((dpy = XOpenDisplay("")) == NULL)<br> {<br> printf("Can not connect to X server.\n");<br> exit(1);<br> }<br> scrn = DefaultScreen(dpy);<br><br> win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
<br> 0, 0,<br> WIDTH, HEIGHT,<br> 5,<br> BlackPixel(dpy,scrn), WhitePixel(dpy,scrn));<br><br> XSelectInput(dpy, win, KeyPressMask|ExposureMask|ButtonPressMask);
<br><br> XMapRaised(dpy,win);<br><br> /* wait for first expose event */<br> XWindowEvent(dpy, win, ExposureMask, &event); <br><br> x1 = 0; y1 = 0;<br> x2 = WIDTH-1; y2 = HEIGHT-1;<br> XDrawLine (dpy, win, DefaultGC(dpy, scrn), x1, y1, x2, y2);
<br><br> /* wait for key or button */<br> XWindowEvent(dpy, win, KeyPressMask|ButtonPressMask, &event); <br>}<br><br></div><br></div><br>