[in.xpert] Moving pointer in software ?

cadp16@vaxa.strath.ac.uk (03/12/91)

Is it possible to change the position of the mouse pointer through software?

I think I have seen this is a program somewhere, but I can`t remember
exactly.

all I want to do is specify where the mouse pointer has to be and send it
there.
 
--------------------------------------------------------------------------------
Electric Monk~~~			      		/^^^\                
					     	       > o.o <              
Strathclyde University			      		\___/           
Computer Science			      		/ V \            
3rd Year				     	       <==+==>        
Amiga and X-Windows a speciality	    	      /       \       
					  	     ^^^U^^^U^^^     
--------------------------------------------------------------------------------

cjmchale@cs.tcd.ie (Ciaran McHale) (03/13/91)

In <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?

You can use XWarpPointer to achieve this. However, it is very antisocial
behavior.


Ciaran.
-- 
Ciaran McHale		"Verbosity says it all"			      ____
Department of Computer Science, Trinity College, Dublin 2, Ireland.   \  /
Telephone: +353-1-772941 ext 1538	FAX: +353-1-772204	       \/
Telex: 93782 TCD EI			email: cjmchale@cs.tcd.ie

klee@wsl.dec.com (Ken Lee) (03/14/91)

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.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

leconte@irisa.fr (Thierry Leconte) (03/14/91)

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 <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <stdio.h>



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  |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~