Mouse/trackball motion detection

I am using a trackball (MS USB optical) to control the rotational motion
of a hardware device. Since the ball has unlimited rotational motion, I
guess there must be a way to decode the signals from it to enable
unlimited rotational motion control of my device, but I don’t know how
to capture the info. By default mouse positions are constrained to the
screen, i.e. the range x: 0 -> 1023, y: 0 -> 767.

In my XF86Config-4 I have:

Section "InputDevice"
Identifier "USB Mouse"
Driver "mouse"
Option "CorePointer"
Option “SendCoreEvents” "true"
Option “Device” "/dev/gpmdata"
Option “Protocol” “ImPS/2”

Do I need a different driver, protocol, options, or something else
altogether? It occurs to me that maybe I need to be able to read the
position in mickeys. Does SDL provide this capability?

thanks
Gib–

Gib Bogle @Gib_Bogle
1/44 Arthur St Tel: (64-9) 525-6878
Ellerslie, N.Z. Fax: (64-9) 525-6878

I am using a trackball (MS USB optical) to control the rotational motion
of a hardware device. Since the ball has unlimited rotational motion, I
guess there must be a way to decode the signals from it to enable
unlimited rotational motion control of my device, but I don’t know how
to capture the info. By default mouse positions are constrained to the
screen, i.e. the range x: 0 -> 1023, y: 0 -> 767.

Your X Server is using the trackball like any other mouse, and so constrains
you to the screen dimensions when delivering motion events. SDL will try to
give you completely relative motion if you hide the mouse cursor and grab the
input. Do do this, use SDL_ShowCursor(0), and SDL_WM_GrabInput(SDL_GRAB_ON),
and then use the xrel and yrel fields of the SDL mouse motion event.

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Message: 12

I am using a trackball (MS USB optical) to control the rotational motion
of a hardware device. Since the ball has unlimited rotational motion, I
guess there must be a way to decode the signals from it to enable
unlimited rotational motion control of my device, but I don’t know how
to capture the info. By default mouse positions are constrained to the
screen, i.e. the range x: 0 -> 1023, y: 0 -> 767.

Your X Server is using the trackball like any other mouse, and so constrains
you to the screen dimensions when delivering motion events. SDL will try to
give you completely relative motion if you hide the mouse cursor and grab the
input. Do do this, use SDL_ShowCursor(0), and SDL_WM_GrabInput(SDL_GRAB_ON),
and then use the xrel and yrel fields of the SDL mouse motion event.

Fantastic! My searches for X mouse info were turning up blank all over,
and I was starting to think I’d have to delve into driver code
(scary!). Is there anything you haven’t already thought of??

Gib> To: sdl at libsdl.org

Subject: Re: [SDL] Mouse/trackball motion detection
From: Sam Lantinga
Date: Mon, 14 Oct 2002 19:02:02 -0700
Reply-To: sdl at libsdl.org


Gib Bogle @Gib_Bogle
1/44 Arthur St Tel: (64-9) 525-6878
Ellerslie, N.Z. Fax: (64-9) 525-6878