Mouse motion events incorrect after a new screen

I’ve encountered a weird problem that only seems to happen in OpenGL mode.
Here’s how I can duplicate it in my app:

  1. Create a screen of size 640x480 with SDL_SetVideoMode

  2. Move the mouse around the screen, printing mouse motion events, which
    confirms the upper-left corner is 0,0 and the lower-right is 639, 479

  3. Create a new screen of size 640x420 (or any size smaller than the
    original)

  4. Move the mouse around the screen, printing mouse motion events, which
    confirms the upper-left corner is 0,0 and the lower-right is 639, 419

  5. Create yet another new screen of size 640x480

  6. Move the mouse around the screen, printing mouse motion events, which
    confirms the upper-left corner is 0,0. However, events are only generated
    up to 639x419, not 639, 479.

There essentially is a dead area if a subsequent screen is created that is
larger than the last one. It’s as if the event subsystem is clamped to
the old screen size.

This only happens for me in OpenGL mode in Linux. The same code running
in software mode is fine, as are both modes (I think) in Windows and OSX.

Has anyone heard of anything like this before?

Thanks,
SA

I’ve confirmed that it doesn’t happen in SDL 1.2.13. It’s happening in
1.2.14, both with the version compiled into Kubuntu 10.04 as well as from
official source.

I’ll research this over the next few days. Hopefully I can track down
what changed between 1.2.13 and 1.2.14.

SAOn July 29, 2010 07:13:33 pm Stephen Anthony wrote:

I’ve encountered a weird problem that only seems to happen in OpenGL
mode. Here’s how I can duplicate it in my app:

My preliminary testing indicates that an extra ConfigureNotify X11 event
is being received, even after the old screen is deleted. This calls
SDL_PrivateResize with the old coordinates, which then sets
SDL_SetMouseRange with the old coordinates.

So my guess that clipping is performed was correct. After creating a
screen of size 640x480 and previously having a screen of size 640x420, the
mouse range is clipped to 640x420. And this is exactly what I’m seeing in
the app.

Has anyone seen this before? Any idea why an extra ConfigureNotify event
is generated, even after the video mode has been deleted??

Thanks,
SA

Sorry for replying to myself, but nobody else seems to be answering :frowning:
The reason this error is happening in 1.2.14 is because the SetMouseRange
is new. Previously, the mouse coordinates where calculated at the time of
the mouse event, not clamped by SetMouseRange at the time of the
ConfigureNotify event.

Of course, I’m not yet ruling out that something else in the app is
causing an extra ConfigureNotify event. I just can’t seem to find it …

SA