[comp.windows.x] X programs without events

mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (10/30/89)

Just in case someone still thinks that an X program must handle events
to be useful, I offer the following, which I wrote because I wanted the
functionality and couldn't find an existing tool for it.

As its author, I hereby place this program into the public domain.
It's simple enough anyway that it's a little silly to try to claim
ownership of it.

I call it xwarp.

	#include <stdio.h>
	
	#include <X11/X.h>
	#include <X11/Xlib.h>
	
	char *displayname = 0;
	
	Display *disp;
	
	main(ac,av)
	int ac;
	char **av;
	{
	 char *pgm;
	
	 pgm = av[0];
	 if ((ac >= 3) && !strcmp(av[1],"-display"))
	  { displayname = av[2];
	    av += 2;
	    ac -= 2;
	  }
	 if (ac != 3)
	  { fprintf(stderr,"Usage: %s [-display <display>] <x> <y>\n",pgm);
	    exit(1);
	  }
	 disp = XOpenDisplay(displayname);
	 if (disp == 0)
	  { fprintf(stderr,"%s: can't open display %s\n",pgm,XDisplayName(displayname));
	    exit(1);
	  }
	 XWarpPointer(disp,None,XRootWindowOfScreen(XDefaultScreenOfDisplay(disp)),0,0,0,0,atoi(av[1]),atoi(av[2]));
	 XCloseDisplay(disp);
	 exit(0);
	}

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

envbvs@epb2.lbl.gov (Brian V. Smith) (10/31/89)

In article <8910300603.AA06783@Larry.McRCIM.McGill.EDU>,
mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) writes:
< 
< Just in case someone still thinks that an X program must handle events
< to be useful, I offer the following, which I wrote because I wanted the
< functionality and couldn't find an existing tool for it.
< 
< As its author, I hereby place this program into the public domain.
< It's simple enough anyway that it's a little silly to try to claim
< ownership of it.
< 
< I call it xwarp.
< 

[ really "useful" program deleted ]

Finally an X program for people with two broken arms!

OK, let's all admit there are some programs that can be written for X
without handling events, but let's keep the discussion limited to 
*useful* programs.
_____________________________________
Brian V. Smith    (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
I don't speak for LBL, these non-opinions are all mine.