Confining cursor movement

158 views
Skip to first unread message

Vincent Scheib

unread,
Aug 23, 2011, 3:18:43 PM8/23/11
to Chromium-dev
I'm seeking an API on Mac to confine a cursor to a region. E.g. the same as ClipCursor on Windows or XGrabPointer on linux

I'm finding CGAssociateMouseAndMouseCursorPosition and CGWarpMouseCursorPosition, which I suppose I could cobble together a solution with by disabling cursor movement, reading delta values, and warping the Mouse around so long as it would stay in my bounding rect. But.. would rather find a magic ClipCursor equivalent ;)

Avi Drissman

unread,
Aug 23, 2011, 3:44:08 PM8/23/11
to sch...@chromium.org, Chromium-dev
I'm not aware of anything like that. You could put something together via the calls you describe, but I don't know how good it will be.

Avi

On Tue, Aug 23, 2011 at 3:18 PM, Vincent Scheib <sch...@chromium.org> wrote:
I'm seeking an API on Mac to confine a cursor to a region. E.g. the same as ClipCursor on Windows or XGrabPointer on linux

I'm finding CGAssociateMouseAndMouseCursorPosition and CGWarpMouseCursorPosition, which I suppose I could cobble together a solution with by disabling cursor movement, reading delta values, and warping the Mouse around so long as it would stay in my bounding rect. But.. would rather find a magic ClipCursor equivalent ;)

--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Dominic Mazzoni

unread,
Aug 23, 2011, 4:03:39 PM8/23/11
to sch...@chromium.org, Chromium-dev
Is your goal to get Mac users to grab torches and pitchforks?

Because, if you actually implement this, I'm pretty sure that's what would happen. :)

- Dominic

On Tue, Aug 23, 2011 at 12:18 PM, Vincent Scheib <sch...@chromium.org> wrote:
I'm seeking an API on Mac to confine a cursor to a region. E.g. the same as ClipCursor on Windows or XGrabPointer on linux

I'm finding CGAssociateMouseAndMouseCursorPosition and CGWarpMouseCursorPosition, which I suppose I could cobble together a solution with by disabling cursor movement, reading delta values, and warping the Mouse around so long as it would stay in my bounding rect. But.. would rather find a magic ClipCursor equivalent ;)

--

Peter Kasting

unread,
Aug 23, 2011, 4:05:15 PM8/23/11
to dmaz...@google.com, sch...@chromium.org, Chromium-dev
On Tue, Aug 23, 2011 at 1:03 PM, Dominic Mazzoni <dmaz...@chromium.org> wrote:
Is your goal to get Mac users to grab torches and pitchforks?

Because, if you actually implement this, I'm pretty sure that's what would happen. :)

I'm pretty sure this is for games, so e.g. someone can implement Quake and "capture" the mouse movement.  Without something like this you can't really use the mouse as an input device for many games.

PK 

Avi Drissman

unread,
Aug 23, 2011, 4:06:36 PM8/23/11
to dmaz...@google.com, sch...@chromium.org, Chromium-dev
Forgot to ask: what are you trying to accomplish?

If pkasting's right, and it's for games, usually they dissociate the mouse from the pointer. Usually they don't try to constrain.

Vincent Scheib

unread,
Aug 23, 2011, 4:14:08 PM8/23/11
to Avi Drissman, dmaz...@google.com
Yes, this is for Mouse Lock. Mac users will have to riot along side with Windows and Linux users. ;)

We're considering a few different approaches for this API. The currently drafted spec is bundled, it hides the cursor and sends back delta movements. There's an open question of can we offer web apps delta values always, allow CSS to hide the cursor, and then add an API to confine the cursor. That would benefit RTS games and or apps like Maps that want a 'normal' cursor but have good uses for confining it. 

For that non API level discussion, please see: 
Reply all
Reply to author
Forward
0 new messages