Odd bug with mouse buttons

Hi

I am currently working on a higher level C++ API and had a samewhat 

odd bug. I have checked every thing twice and so (hope) it should not be
on my side.
I get the folowing bug:
If I am presing the mouse I get the mouse down event and just a harbeat
later I get a mouse up event. Once I release the moue I get a mouse up
event again.

I am using SDL in the version 1.2.7 on debian linux. Witch the IA34 arch…

Sean

Sean Farrell wrote:

Hi

I am currently working on a higher level C++ API and had a samewhat
odd bug. I have checked every thing twice and so (hope) it should not
be on my side.
I get the folowing bug:
If I am presing the mouse I get the mouse down event and just a
harbeat later I get a mouse up event. Once I release the moue I get a
mouse up event again.

I am using SDL in the version 1.2.7 on debian linux. Witch the IA34
arch…

IA32 or IA64 ?

Stephane.

Stephane Marchesin wrote:

Sean Farrell wrote:

Hi

I am currently working on a higher level C++ API and had a
samewhat odd bug. I have checked every thing twice and so (hope) it
should not be on my side.
I get the folowing bug:
If I am presing the mouse I get the mouse down event and just a
harbeat later I get a mouse up event. Once I release the moue I get a
mouse up event again.

I am using SDL in the version 1.2.7 on debian linux. Witch the IA34
arch…

IA32 or IA64 ?

Stephane.


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

The closest … IA32 …

Sean

Sean Farrell wrote:

Stephane Marchesin wrote:

Sean Farrell wrote:

Hi

I am currently working on a higher level C++ API and had a
samewhat odd bug. I have checked every thing twice and so (hope) it
should not be on my side.
I get the folowing bug:
If I am presing the mouse I get the mouse down event and just a
harbeat later I get a mouse up event. Once I release the moue I get
a mouse up event again.

I am using SDL in the version 1.2.7 on debian linux. Witch the IA34
arch…

IA32 or IA64 ?

Stephane.


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

The closest … IA32 …

Sean


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

Ok I aplogise, the problem wasent in SDL…

I simply wrote a simple test program and it seams to work fine… Now
komes the hard part where the heck ist that bug!?

Sean

P.S. If it helps some one else:

#include
#include
#include “SDL.h”

using namespace std;

bool runing = true;

void init_sdl() {
if (SDL_Init(SDL_INIT_VIDEO) == -1) {
throw runtime_error(SDL_GetError());
}

if (SDL_SetVideoMode(640,480,16, 0) == NULL) {
throw runtime_error(SDL_GetError());
}
}

void dequeue_events() {
SDL_Event event;

while(SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_MOUSEMOTION:
cout << "motion at x: " << event.motion.x << " " <<
event.motion.xrel << " y: " << event.motion.y << " " <<
event.motion.yrel << endl;
break;
case SDL_MOUSEBUTTONDOWN:
cout << "button down : " << event.button.button << endl;
break;
case SDL_MOUSEBUTTONUP:
cout << "button up : " << event.button.button << endl;
break;
case SDL_QUIT:
runing = false;
break;
}
}
}

int main() {
try {

init_sdl();

while (runing) {
  dequeue_events();
}

} catch (exception& err) {
cerr << err.what() << endl;
}
SDL_Quit();
}

Sean Farrell wrote:

Sean Farrell wrote:

Stephane Marchesin wrote:

Sean Farrell wrote:

Hi

I am currently working on a higher level C++ API and had a
samewhat odd bug. I have checked every thing twice and so (hope) it
should not be on my side.
I get the folowing bug:
If I am presing the mouse I get the mouse down event and just a
harbeat later I get a mouse up event. Once I release the moue I get
a mouse up event again.

I am using SDL in the version 1.2.7 on debian linux. Witch the IA34
arch…

IA32 or IA64 ?

Stephane.


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

The closest … IA32 …

Sean


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

Ok I aplogise, the problem wasent in SDL…

I simply wrote a simple test program and it seams to work fine… Now
komes the hard part where the heck ist that bug!?

Sean

P.S. If it helps some one else:

[snip]


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

Ok I am back… I seems still to be very odd

If you consider the folowing code:

SDL_Event event;

// loop all events off
while(SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_MOUSEBUTTONDOWN:
//get_mouse().get_button(event.button.button).down = true;

//get_mouse().get_button(event.button.button).on_press(get_mouse().get_button(event.button.button));
std::cout << “down” << std::endl;
break;
case SDL_MOUSEBUTTONUP:
//get_mouse().get_button(event.button.button).down = false;

//get_mouse().get_button(event.button.button).on_release(get_mouse().get_button(event.button.button));
std::cout << “up” << std::endl;
break;
case SDL_QUIT:

qgl::application::get_instance().on_quit_request(qgl::application::get_instance());
break;
}
}
}

The odd thing is that the output at every click is:
down
up
up

And the first two on the press and the last on re realease.

What can influence the behaviour of the event system?

Sean

Sean Farrell wrote:

Sean Farrell wrote:

Stephane Marchesin wrote:

Sean Farrell wrote:

Hi

I am currently working on a higher level C++ API and had a
samewhat odd bug. I have checked every thing twice and so (hope) it
should not be on my side.
I get the folowing bug:
If I am presing the mouse I get the mouse down event and just a
harbeat later I get a mouse up event. Once I release the moue I get
a mouse up event again.

I am using SDL in the version 1.2.7 on debian linux. Witch the IA34
arch…

IA32 or IA64 ?

Stephane.


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

The closest … IA32 …

Sean


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

Ok I aplogise, the problem wasent in SDL…

I simply wrote a simple test program and it seams to work fine… Now
komes the hard part where the heck ist that bug!?

Sean

P.S. If it helps some one else:

[snip]


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

Ok I am back… I seems still to be very odd

If you consider the folowing code:

SDL_Event event;

// loop all events off
while(SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_MOUSEBUTTONDOWN:
//get_mouse().get_button(event.button.button).down = true;

//get_mouse().get_button(event.button.button).on_press(get_mouse().get_button(event.button.button));
std::cout << “down” << std::endl;
break;
case SDL_MOUSEBUTTONUP:
//get_mouse().get_button(event.button.button).down = false;

//get_mouse().get_button(event.button.button).on_release(get_mouse().get_button(event.button.button));
std::cout << “up” << std::endl;
break;
case SDL_QUIT:

qgl::application::get_instance().on_quit_request(qgl::application::get_instance());
break;
}
}
}

The odd thing is that the output at every click is:
down
up
up

And the first two on the press and the last on re realease.

What can influence the behaviour of the event system?

Memory corruption caused by some other part of your program?

Or else maybe one of you “break” statements is commented out somehow?

Try switching the order of the mouse event code in the switch statement
and see what happens.

	Bob PendletonOn Sat, 2004-12-11 at 10:04, Sean Farrell wrote:

Sean


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

±-------------------------------------+

Bob Pendleton wrote:>On Sat, 2004-12-11 at 10:04, Sean Farrell wrote:

Sean Farrell wrote:

Sean Farrell wrote:

Stephane Marchesin wrote:

Sean Farrell wrote:

Hi

I am currently working on a higher level C++ API and had a
samewhat odd bug. I have checked every thing twice and so (hope) it
should not be on my side.
I get the folowing bug:
If I am presing the mouse I get the mouse down event and just a
harbeat later I get a mouse up event. Once I release the moue I get
a mouse up event again.

I am using SDL in the version 1.2.7 on debian linux. Witch the IA34
arch…

IA32 or IA64 ?

Stephane.


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

The closest … IA32 …

Sean


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

Ok I aplogise, the problem wasent in SDL…

I simply wrote a simple test program and it seams to work fine… Now
komes the hard part where the heck ist that bug!?

Sean

P.S. If it helps some one else:

[snip]


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

Ok I am back… I seems still to be very odd

If you consider the folowing code:

SDL_Event event;

// loop all events off
while(SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_MOUSEBUTTONDOWN:
//get_mouse().get_button(event.button.button).down = true;

//get_mouse().get_button(event.button.button).on_press(get_mouse().get_button(event.button.button));
std::cout << “down” << std::endl;
break;
case SDL_MOUSEBUTTONUP:
//get_mouse().get_button(event.button.button).down = false;

//get_mouse().get_button(event.button.button).on_release(get_mouse().get_button(event.button.button));
std::cout << “up” << std::endl;
break;
case SDL_QUIT:

qgl::application::get_instance().on_quit_request(qgl::application::get_instance());
break;
}
}
}

The odd thing is that the output at every click is:
down
up
up

And the first two on the press and the last on re realease.

What can influence the behaviour of the event system?

Memory corruption caused by some other part of your program?

Or else maybe one of you “break” statements is commented out somehow?

Try switching the order of the mouse event code in the switch statement
and see what happens.

  Bob Pendleton

Sean


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

Ok what I tried was:
I swiched the order and also removed the button down event. And still I
get two button up events. I also tried making shour the SDL Init
sequence is the same as in the test program.
At the curent point the lib is quite simplistic and the code is serial.
… I will look into that issue.

Sean