🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #5547

Re: Finding current mouse status.

#5547
From: Kent Paul Dolan
Date: Mon, 01 Oct 1990 06:42
42 lines
1963 bytes
cmcmanis@stpeter.Eng.Sun.COM (Chuck McManis) writes:
>In article <1990Sep18.192348.3594@cs.umn.edu> (Russell Cattelan) writes:
[asks for a simple way to just look at a structure for mouse position]

>A friendly way to do this is to create an input handler which simply
>tracks the mouse by looking at all of the mousemove events. It should
>open a public message port with some well known name like "MousePosition"
>and keep with the port two shorts which contain the mouse position. Since
>your code will only be reading the position you don't have to worry about
>multiple writers. So your code  will look something like :
>
>main()
>	...
>	struct custom_port {
>		struct MsgPort	port;
>		USHORT		MouseX;
>		USHORT		MouseY;
>	} *mp;
>
>	mp = FindPort("MousePosition");
>	if (mp == NULL) 
>		/* error can't find handler's port */
>
>	...
>	MouseX = mp->MouseX;
>	MouseY = mp->MouseY;
>	/* etc */
>}
>
>You can kick off the input handler from your code or you can have
>a separate program to do that. In 2.0 you would build a commodity
>to do this fairly easily. 

Probably you want to forbid(); permit(): (or whatever's appropriate)
around the two assignments to prevent picking up a new MouseX and an
old MouseY from a parallel multitasking routine (if a handler can be
interrupted in turn by a time slice preempt).

A nit, but of such is great code made.

Kent, the man from xanth.
<xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us>
Technical Details
Message-ID: <1990Oct1.064220.7690@zorch.SF-Bay.ORG>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!mips!wyse!vsi1!zorch!xanthian
References: <1990Sep18.192348.3594@cs.umn.edu> <143184@sun.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!mips!wyse!vsi1!zorch!xanthian
From: xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Finding current mouse status.
Summary: Safe X
Keywords: Mouse
Message-ID: <1990Oct1.064220.7690@zorch.SF-Bay.ORG>
Date: 1 Oct 90 06:42:20 GMT
References: <1990Sep18.192348.3594@cs.umn.edu> <143184@sun.Eng.Sun.COM>
Distribution: comp
Organization: SF-Bay Public-Access Unix
Lines: 42