Unify mouse input

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
Clay
OGRE Community Helper
OGRE Community Helper
Posts: 518
Joined: Wed Mar 17, 2004 4:14 am
Contact:

Unify mouse input

Post by Clay »

While working on the next tutorial, I ran into this. The MouseMotionListener callbacks use the old 0, 1, 2... button IDs instead of button masks:

Code: Select all

if ( e->getButtonID() == 0 )
So does the InputReader using unbuffered input:

Code: Select all

if ( mInputDevice->getMouseButton( 0 ) )
But the MouseListener uses button masks for the same function:

Code: Select all

if ( e->getButtonID() & MouseEvent::BUTTON0_MASK )
This is very inconsistant, and it causes a huge problem if you try to do something if both mouse buttons are held down. However, any changes to it now will break source compatibility with anyone using Ogre input.

---

Also, could you consider changing these:

Code: Select all

		virtual void mouseClicked(MouseEvent* e) = 0;
		virtual void mouseEntered(MouseEvent* e) = 0;
		virtual void mouseExited(MouseEvent* e) = 0;
and maybe just all of the MouseListener and MouseMotionListener methods to be not pure-virtual? I end up with a lot of code that simply turns them off. This second suggestion would not break source compatability.

Edit: Alternatively, would you accept a patch to fix this to make everything work with button masks? I'm hesitiant to get started on it since I'm not sure it would be accepted (breaking source compatibility after 1.0.0 and all).
User avatar
Clay
OGRE Community Helper
OGRE Community Helper
Posts: 518
Joined: Wed Mar 17, 2004 4:14 am
Contact:

Re: Unify mouse input

Post by Clay »

Clay wrote:While working on the next tutorial, I ran into this. The MouseMotionListener callbacks use the old 0, 1, 2... button IDs instead of button masks:

Code: Select all

if ( e->getButtonID() == 0 )
Ok I think I was wrong on this one. No matter which button I hold down when performing a mouse-drag, the MouseMotionListener always returns 0 from MouseEvent::getButtonID, not the button id. I think this is actually more of a bug than inconsistancy like I originally thought.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Patches are welcome, if they break interface compatibility they will be applied to Dagon and not to the maintenance branch; we maintain 2 branches at any one time.
Post Reply