Mouse button numbers

I’m using the Win32 port of SDL and I have noticed that the buttons of my
mouse (2 buttons and a wheel) are numbered like this :

left button : 1, right button : 3, middle button (wheel) : 2

So, how can I distinguish between the right button of a two-button mouse
(which is probably reported as button ‘2’) and the right button of a wheel
mouse? The games I’ve checked allways call the right button ‘2’, (and the
extra button ‘3’). Also, I seem to miss a function like
SDL_NumberOfMouseButtons() ?

Dominique Biesmans

I’m using the Win32 port of SDL and I have noticed that the buttons of my
mouse (2 buttons and a wheel) are numbered like this :

left button : 1, right button : 3, middle button (wheel) : 2

So, how can I distinguish between the right button of a two-button mouse
(which is probably reported as button ‘2’) and the right button of a wheel
mouse? The games I’ve checked allways call the right button ‘2’, (and the
extra button ‘3’).

If you look at SDL_mouse.h, you’ll see that the middle button is always
2 and the right button is always 3. If there is no middle button, then
the right button is still three. If it doesn’t actually happen that way
for your mouse, then it’s a bug in the input mapping. Make sure you’re
using the latest SDL CVS and check out src/video/wincommon/ and see what’s
happening.

Also, I seem to miss a function like SDL_NumberOfMouseButtons() ?

That information isn’t usually available to the underlying drivers.

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Aha, the right button of a 2 button mouse is also ‘3’. So I was making the
wrong assumption (don’t have a 2 button mouse). Thanks.

Dominique Biesmans> -----Original Message-----

From: Sam Lantinga [mailto:slouken at devolution.com]
Sent: donderdag 30 november 2000 3:24
To: sdl at lokigames.com
Subject: Re: [SDL] mouse button numbers

I’m using the Win32 port of SDL and I have noticed that the
buttons of my
mouse (2 buttons and a wheel) are numbered like this :

left button : 1, right button : 3, middle button (wheel) : 2

So, how can I distinguish between the right button of a
two-button mouse
(which is probably reported as button ‘2’) and the right
button of a wheel
mouse? The games I’ve checked allways call the right button
’2’, (and the
extra button ‘3’).

If you look at SDL_mouse.h, you’ll see that the middle button
is always
2 and the right button is always 3. If there is no middle
button, then
the right button is still three. If it doesn’t actually
happen that way
for your mouse, then it’s a bug in the input mapping. Make
sure you’re
using the latest SDL CVS and check out src/video/wincommon/
and see what’s
happening.

Also, I seem to miss a function like SDL_NumberOfMouseButtons() ?

That information isn’t usually available to the underlying drivers.

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Aha, the right button of a 2 button mouse is also ‘3’. So I was making the
wrong assumption (don’t have a 2 button mouse). Thanks.

No problem. When in doubt, consult the SDL headers.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software