\File{lines.c},{16:33},{May  1 1992}
\L{\LB{\K{\#include} \<stdio.h\>}}
\L{\LB{\K{\#include} \<X11\/Xlib.h\>               \C{}\/* standard Xlib headers *\/\CE{}}}
\L{\LB{\K{\#include} \<math.h\>}}
\L{\LB{}}
\L{\LB{Pixmap start\_graphics();            \C{}\/* declare type of start\_graphics *\/\CE{}}}
\L{\LB{XButtonEvent *get\_mouse\_event();    \C{}\/* declare type of get\_mouse\_event *\/\CE{}}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{\Proc{main}main()}}
\L{\LB{\{}}
\L{\LB{     Pixmap my\_drawing;                 \C{}\/* buffer to draw into *\/\CE{}}}
\L{\LB{     Display *my\_display;               \C{}\/* pointer to X display variable *\/\CE{}}}
\L{\LB{     GC my\_context;                     \C{}\/* X graphics context *\/\CE{}}}
\L{\LB{     \K{int} xp, xpo, ypo, yp;                             \C{}\/* loop counter *\/\CE{}}}
\L{\LB{     \K{double} value, y;}}
\L{\LB{     XButtonEvent *looking;}}
\L{\LB{}}
\L{\LB{     my\_drawing = start\_graphics(500,500,\&my\_display,\&my\_context);}}
\L{\LB{     update\_graphics();}}
\L{\LB{     }}
\L{\LB{     y = value;}}
\L{\LB{     ypo = 0;}}
\L{\LB{     xpo = 0;}}
\L{\LB{     }}
\L{\LB{     update\_graphics();}}
\L{\LB{     \K{while}(1)}}
\L{\LB{       \{}}
\L{\LB{}\Tab{8}{    looking = get\_mouse\_event();}}
\L{\LB{}\Tab{8}{    \K{if} (looking\-\>type == ButtonPress)}}
\L{\LB{}\Tab{8}{      \{}}
\L{\LB{}\Tab{16}{   XDrawLine(my\_display,my\_drawing,my\_context,xpo,ypo,}}
\L{\LB{}\Tab{24}{      looking\-\>x, looking\-\>y);}}
\L{\LB{}\Tab{16}{   xpo = looking\-\>x;}}
\L{\LB{}\Tab{16}{   ypo = looking\-\>y;}}
\L{\LB{}\Tab{8}{      \}}}
\L{\LB{       \}}}
\L{\LB{     }}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{}}
