SDL_MOUSEBUTTONUP doesnt report for the right mouse button?

ive got this code here that sets mouse state vars according to the
events. It all works fine other than one thing, upon releasing the
right mouse button MOUSEBUTTONUP does not occur. The others work fine. I
tried another mouse too just to make sure but I got the same results.

switch (event.type)
{
case SDL_MOUSEBUTTONDOWN:
switch (event.button.button)
{
case SDL_BUTTON_LEFT:
state.mousebutton_left = true;
break;

	case SDL_BUTTON_MIDDLE:
		state.mousebutton_middle = true;
	break;

	case SDL_BUTTON_RIGHT:
		state.mousebutton_right = true;
	break;

	default:
	break;
	}

break;

case SDL_MOUSEBUTTONUP:
switch (event.button.button)
{
case SDL_BUTTON_LEFT:
state.mousebutton_left = false;
break;

	case SDL_BUTTON_MIDDLE:
		state.mousebutton_middle = false;
	break;

	case SDL_BUTTON_RIGHT:
		//this is never reached
		state.mousebutton_left = false;
	break;

	default:
		//this is not reached either
	break;
	}

break;
}–
Matt Pruett <@Matt_Pruett>

I dont know how many times I looked at that line, and somehow didnt
notive I was unsetting left instead of right…On Thu, 2005-06-23 at 11:27 -0700, Matt Pruett wrote:

ive got this code here that sets mouse state vars according to the
events. It all works fine other than one thing, upon releasing the
right mouse button MOUSEBUTTONUP does not occur. The others work fine. I
tried another mouse too just to make sure but I got the same results.

switch (event.type)
{
case SDL_MOUSEBUTTONDOWN:
switch (event.button.button)
{
case SDL_BUTTON_LEFT:
state.mousebutton_left = true;
break;

  case SDL_BUTTON_MIDDLE:
  	state.mousebutton_middle = true;
  break;

  case SDL_BUTTON_RIGHT:
  	state.mousebutton_right = true;
  break;

  default:
  break;
  }

break;

case SDL_MOUSEBUTTONUP:
switch (event.button.button)
{
case SDL_BUTTON_LEFT:
state.mousebutton_left = false;
break;

  case SDL_BUTTON_MIDDLE:
  	state.mousebutton_middle = false;
  break;

  case SDL_BUTTON_RIGHT:
  	//this is never reached
  	state.mousebutton_left = false;
  break;

  default:
  	//this is not reached either
  break;
  }

break;
}

Matt Pruett <@Matt_Pruett>

I’m guessing that you didn’t mean this:

case SDL_BUTTON_RIGHT:
//this is never reached
state.mousebutton_left = false;
break;

Note the emphasis on left, in the right mouse button handler. I think that’s
the problem you should actually be concerned about =)

JoshOn 6/24/05, Matt Pruett wrote:

ive got this code here that sets mouse state vars according to the
events. It all works fine other than one thing, upon releasing the
right mouse button MOUSEBUTTONUP does not occur. The others work fine. I
tried another mouse too just to make sure but I got the same results.

switch (event.type)
{
case SDL_MOUSEBUTTONDOWN:
switch (event.button.button)
{
case SDL_BUTTON_LEFT:
state.mousebutton_left = true;
break;

case SDL_BUTTON_MIDDLE:
state.mousebutton_middle = true;
break;

case SDL_BUTTON_RIGHT:
state.mousebutton_right = true;
break;

default:
break;
}
break;

case SDL_MOUSEBUTTONUP:
switch (event.button.button)
{
case SDL_BUTTON_LEFT:
state.mousebutton_left = false;
break;

case SDL_BUTTON_MIDDLE:
state.mousebutton_middle = false;
break;

case SDL_BUTTON_RIGHT:
//this is never reached
state.mousebutton_left = false;
break;

default:
//this is not reached either
break;
}
break;
}

Matt Pruett


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl