🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #12491

Re: Help! Anyone know how to force the mouse to a location?

#12491
From: Paul T Russell
Date: Wed, 06 Jun 1990 09:40
108 lines
3166 bytes
From article <16995@phoenix.Princeton.EDU>, by bskendig@phoenix.Princeton.EDU (Brian Kendig):
> In article <1990Jun5.091419.14219@portia.Stanford.EDU> canuck@portia.Stanford.EDU (William Stocker) writes:
>>I'm writing a Mac program in THINK Pascal 3.0, and need to force the
>>mouse to a particular screen location.  I'm sure it's against Apple's
>>guidelines (there's no SetMouse command I can find in Inside Mac I-V),
>>but there's a good purpose for it -- trust me!
> 
>     DON'T DO IT.  It's *very* bad technique, and your application
>     won't run, besides.

I know you shouldn't do it, but there are times when it is justified.
Here is a Pascal implementation of SetMouse (watch out - here come
the Thought Police!)...

unit UMouseStuff; { mouse utilities }

interface

	procedure SetMouse (pt: Point); { move the current cursor position to the given point }

implementation

	const { low memory globals }
		jCrsrTask = $08EE; { ProcPtr }
		MTemp = $0828; { Point - Low Level interupt mouse location }
		RawMouse = $082C; { Point - unprocessed mouse location }
		Mouse = $830; { Point - processed mouse location }
		CrsrNew = $08CE; { char - set != 0 if mouse has moved }
		CrsrCouple = $08CF; { char - set = 0 if cursor not allowed to move }

	type
		PointPtr = ^Point; { a pointer to a point }

{--- private functions for accessing low memory globals ---}

	function Get_MTemp: Point;

	begin
		Get_MTemp := PointPtr(MTemp)^;
	end; { Get_MTemp }

	procedure Set_MTemp (pt: Point);

		var
			ptp: PointPtr;

	begin
		ptp := PointPtr(MTemp);
		ptp^ := pt;
	end; { Set_MTemp }

	function Get_RawMouse: Point;

	begin
		Get_RawMouse := PointPtr(RawMouse)^;
	end; { Get_RawMouse }

	procedure Set_RawMouse (pt: Point);

		var
			ptp: PointPtr;

	begin
		ptp := PointPtr(RawMouse);
		ptp^ := pt;
	end; { Set_RawMouse }

	function Get_Mouse: Point;

	begin
		Get_Mouse := PointPtr(Mouse)^;
	end; { Get_Mouse }

	procedure Set_Mouse (pt: Point);

		var
			ptp: PointPtr;

	begin
		ptp := PointPtr(Mouse);
		ptp^ := pt;
	end; { Set_Mouse }

	procedure Set_CrsrNew;

		var
			p: Ptr;

	begin
		p := Ptr(CrsrNew);
		p^ := 1;
	end;

	procedure SetMouse (pt: Point);

	begin
		Set_MTemp(pt); { set both of these low memory mouse positions to the new point }
		Set_RawMouse(pt); { (this prevents scaling) }
		Set_CrsrNew; { flag that the mouse has moved }
	end; { SetMouse }

end.

-- 
           Paul Russell, Department of Experimental Psychology
         University of Sussex, Falmer, Brighton BN1 9QG, England
     Janet: paulr@uk.ac.sussex.syma  Nsfnet: paulr@syma.sussex.ac.uk
    Bitnet: paulr%sussex.syma@ukacrl.bitnet  Usenet: ...ukc!syma!paulr
Technical Details
Message-ID: <2808@syma.sussex.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!ukc!icdoc!syma!paulr
References: <16995@phoenix.Princeton.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!ukc!icdoc!syma!paulr
From: paulr@syma.sussex.ac.uk (Paul T Russell)
Newsgroups: comp.sys.mac
Subject: Re: Help! Anyone know how to force the mouse to a location?
Message-ID: <2808@syma.sussex.ac.uk>
Date: 6 Jun 90 09:40:32 GMT
References: <16995@phoenix.Princeton.EDU>
Organization: University of Sussex
Lines: 108