Incorrect mouse position while pressed some key

Hello,

we think, that we have found an error in getting mouse position in Win32
applications, running OpenGL and SDL.

Sample app with source code can be downloaded from
www.freex.sk/sdl/sdl_mouse_problem.rar This sample app is minimal implemetation
we have made to show this error.

When yor run the app, and move mouse, circle in window will move. It’s
OK. But when you press some key on keyboard, for example “e”, the mouse
will move in skips.

It’s because when we get relative mouse position through
SDL_GetRelativeMouseState() - with pressed key “e” on keyboard, the
relative positons will skip from small numbers to high numbers, for
example: 3, 3, 3, 90 in each frame. Try it. In console windows we are
logging this numbers, so you can see.

This problem doesn’t exist, when SDL_ShowCursor(SDL_ENABLE). But we
want do hide default mouse cursor.

This problem exists in windowed and fullscreen apps too.

This problem occures only in small FPS, or when there is a lot of
rendering. I tried to simulate this by SDL_Delay(100) in main loop.
But in our main application, it’s slowed by rendering code, so this is
only simulation of real delaying.

Tested on:
Windows 2000, SP2
Visual C++ 6.0 SP5
SDL 1.2.4, downloaded 8/31/2002

Thanks for any help,
Marek Rosa

I had a similar problem with mouse coordinates under the OpenGL renderer,
but it was fixed in SDL v1.2.4. What version of SDL are you using?

– Jeff

“Marek Rosa” wrote in message
news:mailman.1031085122.29836.sdl at libsdl.org

Hello,

we think, that we have found an error in getting mouse position in Win32
applications, running OpenGL and SDL.

Sample app with source code can be downloaded from
www.freex.sk/sdl/sdl_mouse_problem.rar This sample app is minimal
implemetation> we have made to show this error.

When yor run the app, and move mouse, circle in window will move. It’s
OK. But when you press some key on keyboard, for example “e”, the mouse
will move in skips.

It’s because when we get relative mouse position through
SDL_GetRelativeMouseState() - with pressed key “e” on keyboard, the
relative positons will skip from small numbers to high numbers, for
example: 3, 3, 3, 90 in each frame. Try it. In console windows we are
logging this numbers, so you can see.

This problem doesn’t exist, when SDL_ShowCursor(SDL_ENABLE). But we
want do hide default mouse cursor.

This problem exists in windowed and fullscreen apps too.

This problem occures only in small FPS, or when there is a lot of
rendering. I tried to simulate this by SDL_Delay(100) in main loop.
But in our main application, it’s slowed by rendering code, so this is
only simulation of real delaying.

Tested on:
Windows 2000, SP2
Visual C++ 6.0 SP5
SDL 1.2.4, downloaded 8/31/2002

Thanks for any help,
Marek Rosa

I am using SDL 1.2.4, downloaded 8/31/2002.

Marek> I had a similar problem with mouse coordinates under the OpenGL renderer,

but it was fixed in SDL v1.2.4. What version of SDL are you using?

– Jeff

“Marek Rosa” <@Marek_Rosa> wrote in message
news:mailman.1031085122.29836.sdl at libsdl.org

Hello,

we think, that we have found an error in getting mouse position in Win32
applications, running OpenGL and SDL.

Sample app with source code can be downloaded from
www.freex.sk/sdl/sdl_mouse_problem.rar This sample app is minimal
implemetation
we have made to show this error.

When yor run the app, and move mouse, circle in window will move. It’s
OK. But when you press some key on keyboard, for example “e”, the mouse
will move in skips.

It’s because when we get relative mouse position through
SDL_GetRelativeMouseState() - with pressed key “e” on keyboard, the
relative positons will skip from small numbers to high numbers, for
example: 3, 3, 3, 90 in each frame. Try it. In console windows we are
logging this numbers, so you can see.

This problem doesn’t exist, when SDL_ShowCursor(SDL_ENABLE). But we
want do hide default mouse cursor.

This problem exists in windowed and fullscreen apps too.

This problem occures only in small FPS, or when there is a lot of
rendering. I tried to simulate this by SDL_Delay(100) in main loop.
But in our main application, it’s slowed by rendering code, so this is
only simulation of real delaying.

Tested on:
Windows 2000, SP2
Visual C++ 6.0 SP5
SDL 1.2.4, downloaded 8/31/2002

Thanks for any help,
Marek Rosa


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

we think, that we have found an error in getting mouse position in Win32
applications, running OpenGL and SDL.

Sample app with source code can be downloaded from
www.freex.sk/sdl/sdl_mouse_problem.rar This sample app is minimal implemetation
we have made to show this error.

When yor run the app, and move mouse, circle in window will move. It’s
OK. But when you press some key on keyboard, for example “e”, the mouse
will move in skips.

I’m not seeing this on my system.
I have Windows 98, NVidia drivers, SDL CVS code, and Cygwin gcc.

I’m attaching the code and output I got.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/octet-stream
Size: 3116 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020905/d5917a69/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/octet-stream
Size: 1130 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020905/d5917a69/attachment-0001.obj

On all Windows 2000 systems we have tryed, relative coordinates from mouse are smaller
when some key is pressed on keyboard, and FPS is low.

On Win98 it’s OK, no slowing mouse.

This is my output when key IS NOT PRESSED (on Win2000):

-4 1
-50 5
-38 1
-33 -1
-44 0
-114 -4
-30 -1
-22 -1
-53 -1
15 0
15 0

And this is output when key IS PRESSED (on Win2000):

2 0
1 0
4 0
3 0
2 0
2 0
3 0
3 0
3 0
3 0
6 0
1 0
20 1
2 1
3 0
8 1
8 0
47 5
6 1
2 0
7 1
8 1
5 1
10 1
73 6
11 1
11 2
6 0
19 2
5 0
61 1
9 1
5 0
8 0
11 -2
6 0
11 0
4 0
20 6

And I am trying to move mouse same speed.>> we think, that we have found an error in getting mouse position in Win32

applications, running OpenGL and SDL.

Sample app with source code can be downloaded from
www.freex.sk/sdl/sdl_mouse_problem.rar This sample app is minimal implemetation
we have made to show this error.

When yor run the app, and move mouse, circle in window will move. It’s
OK. But when you press some key on keyboard, for example “e”, the mouse
will move in skips.

I’m not seeing this on my system.
I have Windows 98, NVidia drivers, SDL CVS code, and Cygwin gcc.

I’m attaching the code and output I got.

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

I will bet that what you are seeing is the effect of motion event
compression. During normal operation the system (can be OS, or X, or
game library) is collecting a number of motion events together and
sending out a single motion event once in a while. Often enough that
normal use isn’t affected, but slow enough that applications aren’t
swamped by motion events.

When you hold down a key and move the mouse a couple of things happen.
The system starts send keystroke events and it will send a mouse motion
event before each keystroke event. It has to to make sure that the key
is going to the right widget. Also, holding down a key while moving the
mouse often signals that something “important” is happening so it is
best for the system to send fine grain motion events while a key is
pressed.

This can be a real pain for games where you want high resolution mouse
motion all the time. Usually there is some way to turn this off.

	Bob PendletonOn Mon, 2002-10-14 at 07:39, Marek Rosa wrote:

On all Windows 2000 systems we have tryed, relative coordinates from mouse are smaller
when some key is pressed on keyboard, and FPS is low.

On Win98 it’s OK, no slowing mouse.

This is my output when key IS NOT PRESSED (on Win2000):

-4 1
-50 5
-38 1
-33 -1
-44 0
-114 -4
-30 -1
-22 -1
-53 -1
15 0
15 0

And this is output when key IS PRESSED (on Win2000):

2 0
1 0
4 0
3 0
2 0
2 0
3 0
3 0
3 0
3 0
6 0
1 0
20 1
2 1
3 0
8 1
8 0
47 5
6 1
2 0
7 1
8 1
5 1
10 1
73 6
11 1
11 2
6 0
19 2
5 0
61 1
9 1
5 0
8 0
11 -2
6 0
11 0
4 0
20 6

And I am trying to move mouse same speed.

we think, that we have found an error in getting mouse position in Win32
applications, running OpenGL and SDL.

Sample app with source code can be downloaded from
www.freex.sk/sdl/sdl_mouse_problem.rar This sample app is minimal implemetation
we have made to show this error.

When yor run the app, and move mouse, circle in window will move. It’s
OK. But when you press some key on keyboard, for example “e”, the mouse
will move in skips.

I’m not seeing this on my system.
I have Windows 98, NVidia drivers, SDL CVS code, and Cygwin gcc.

I’m attaching the code and output I got.

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


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

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

What we will do with this?> I will bet that what you are seeing is the effect of motion event

compression. During normal operation the system (can be OS, or X, or
game library) is collecting a number of motion events together and
sending out a single motion event once in a while. Often enough that
normal use isn’t affected, but slow enough that applications aren’t
swamped by motion events.

When you hold down a key and move the mouse a couple of things happen.
The system starts send keystroke events and it will send a mouse motion
event before each keystroke event. It has to to make sure that the key
is going to the right widget. Also, holding down a key while moving the
mouse often signals that something “important” is happening so it is
best for the system to send fine grain motion events while a key is
pressed.

This can be a real pain for games where you want high resolution mouse
motion all the time. Usually there is some way to turn this off.

            Bob Pendleton

On Mon, 2002-10-14 at 07:39, Marek Rosa wrote:

On all Windows 2000 systems we have tryed, relative coordinates from mouse are smaller
when some key is pressed on keyboard, and FPS is low.

On Win98 it’s OK, no slowing mouse.

This is my output when key IS NOT PRESSED (on Win2000):

-4 1
-50 5
-38 1
-33 -1
-44 0
-114 -4
-30 -1
-22 -1
-53 -1
15 0
15 0

And this is output when key IS PRESSED (on Win2000):

2 0
1 0
4 0
3 0
2 0
2 0
3 0
3 0
3 0
3 0
6 0
1 0
20 1
2 1
3 0
8 1
8 0
47 5
6 1
2 0
7 1
8 1
5 1
10 1
73 6
11 1
11 2
6 0
19 2
5 0
61 1
9 1
5 0
8 0
11 -2
6 0
11 0
4 0
20 6

And I am trying to move mouse same speed.

we think, that we have found an error in getting mouse position in Win32
applications, running OpenGL and SDL.

Sample app with source code can be downloaded from
www.freex.sk/sdl/sdl_mouse_problem.rar This sample app is minimal implemetation
we have made to show this error.

When yor run the app, and move mouse, circle in window will move. It’s
OK. But when you press some key on keyboard, for example “e”, the mouse
will move in skips.

I’m not seeing this on my system.
I have Windows 98, NVidia drivers, SDL CVS code, and Cygwin gcc.

I’m attaching the code and output I got.

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


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

What we will do with this?

Any suggestions?

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

What we will do with this?

Any suggestions?

Compressing mouse motion events is easy, and has been discussed on this
list many times. The usual complaint is that we are getting to many
events. OTOH, if you want more precise motion events and the OS won’t
give them to you, you are up that well known creek. Someone, not me, I
haven’t done Windows in a long time, should do a detailed search in the
MS knowledge base on the subject and try to find a way to turn this
effect off.

'cause I think the choices are “turn it off” and “live with it.”

		Bob PendletonOn Wed, 2002-10-16 at 16:41, Sam Lantinga wrote:

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


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

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

You can easily do this just by turning off mouse motion events and querying
the current mouse position with the SDL API.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment> On Wed, 2002-10-16 at 16:41, Sam Lantinga wrote:

What we will do with this?

Any suggestions?

Compressing mouse motion events is easy, and has been discussed on this
list many times.

Well, I don’t think “motion event flooding” is an issue, but rather a
matter of knowing how to handle motion events correctly. (This is done
all the time by normal applications and/or the GUI toolkits they use.
Should be common knowledge.)

So, the proper solution IMHO, would be to kill these undesired
compression features when possible, to ensure consistency across
platforms, and across mouse button states.

Question is how. (And I generally stay at least a crosscompile away from
Win32. :slight_smile:

//David Olofson - Programmer, Composer, Open Source Advocate

.- Coming soon from VaporWare Inc…------------------------.
| The Return of Audiality! Real, working software. Really! |
| Real time and off-line synthesis, scripting, MIDI, LGPL…|
-----------------------------------> (Public Release RSN) -' .- M A I A -------------------------------------------------. | The Multimedia Application Integration Architecture |----------------------------> http://www.linuxdj.com/maia -’
http://olofson.nethttp://www.reologica.se —On Thursday 17 October 2002 00:10, Bob Pendleton wrote:

On Wed, 2002-10-16 at 16:41, Sam Lantinga wrote:

What we will do with this?

Any suggestions?

Compressing mouse motion events is easy, and has been discussed on this
list many times. The usual complaint is that we are getting to many
events. OTOH, if you want more precise motion events and the OS won’t
give them to you, you are up that well known creek. Someone, not me, I
haven’t done Windows in a long time, should do a detailed search in the
MS knowledge base on the subject and try to find a way to turn this
effect off.

'cause I think the choices are “turn it off” and “live with it.”

Hello,

I am quering mouse position with: SDL_GetRelativeMouseState().

I have tryed to get mouse position through SDL events, with same
result.

Is this error of SDL?>> On Wed, 2002-10-16 at 16:41, Sam Lantinga wrote:

What we will do with this?

Any suggestions?

Compressing mouse motion events is easy, and has been discussed on this
list many times.

You can easily do this just by turning off mouse motion events and querying
the current mouse position with the SDL API.

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


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