[squeak-dev] Grabbing the mouse

Levente Uzonyi leves at elte.hu
Tue Feb 22 06:48:33 UTC 2011

On Mon, 21 Feb 2011, Matthew Fulmer wrote:

> On Fri, Feb 11, 2011 at 11:46:04PM -0500, Matthew Fulmer wrote:
>> Is there a way in squeak to completely grab the mouse so you can
>> get all events, and not even bother with the cursor? a lot of
>> games do it for various features, and trying to do the same in
>> Open Cobalt for the camera controls
> I discovered that there is InputSensor >> cursorPoint: that
> claims to move the mouse pointer position, but the primitive
> seems to be un-implemented on all three platforms.
> To try it:
> Sensor cursorPoint: 100 at 100

It uses primitive 91, but that doesn't change the cursor position anymore:
(91 primitiveTestDisplayDepth)			"Blue Book: primitiveCursorLocPut"

You can do it with FFI calls. On windows it's:

setCursorPosX: x y: y

 	<apicall: bool 'SetCursorPos' (long long) module: 'user32.dll'>
 	^self externalCallFailed

Note that x and y are absolute values, not relative to the current window.


> -- 
> Matthew Fulmer (a.k.a. Tapple)

More information about the Squeak-dev mailing list