Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!corton!irisa!leconte From: leconte@irisa.fr (Thierry Leconte) Newsgroups: comp.windows.x,in.xpert Subject: Re: Moving pointer in software ? Message-ID: <1991Mar13.184933.15331@irisa.fr> Date: 13 Mar 91 18:49:33 GMT References: <1991Mar13.094825@wsl.dec.com> Sender: news@irisa.fr Organization: IRISA, Rennes (FR) Lines: 80 From article <1991Mar13.094825@wsl.dec.com>, by klee@wsl.dec.com (Ken Lee): > In article <1991Mar12.094355.10444@vaxa.strath.ac.uk>, cadp16@vaxa.strath.ac.uk writes: > |> Is it possible to change the position of the mouse pointer through software? > > XWarpPointer() does this, but is generally considered anti-social. > Yes but sometime very fun ! Try this : (cc xgag.c -lX -lXt -o xgag) ------------------------CUT HERE------------------------------------ /* ********************************************************************* * * xgag.c T. Leconte 1 April 1990 * ********************************************************************* */ #include #include #include #include static Display *screen; static XtAppContext context; int xdel=2; int ydel=3; int timedel=50; void bouge(cyc, id) char *cyc; XtIntervalId *id; { XWarpPointer(screen,None,None,0,0,0,0,xdel,ydel); XtAppAddTimeOut(context, timedel , bouge, 0); } main(argc, argv) int argc; char **argv; { XtToolkitInitialize(); context = XtCreateApplicationContext(); screen = XtOpenDisplay(context, NULL, "xgag", "XGag", 0, 0, &argc, argv); if (screen==NULL) { fprintf(stderr,"Unable to open display\n"); exit(-1); } if (argc >1) xdel=atoi(argv[1]); if (argc >2) ydel=atoi(argv[2]); if (argc >3) timedel=atoi(argv[3]); XtAppAddTimeOut(context, timedel, bouge, 0); XtAppMainLoop(context); } ------------------------CUT HERE------------------------------------ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Thierry LECONTE | , ,--- ,--- | | INRIA/IRISA | / / /--- | | Campus de Beaulieu | (___ (___ (___ | | 35042 RENNES CEDEX | | | FRANCE | (INRIA/BULL) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Tel: 99 36 20 00 e-mail: Thierry.Leconte@irisa.fr | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~