[PATCH] Broken behavior in window bar

View: New views
2 Messages — Rating Filter:   Alert me  

[PATCH] Broken behavior in window bar

by Gabriel Gambetta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I found and fixed an obscure and hard to trigger bug in SDL 1.2.14 in Windows.

If you changed the video mode while holding the mouse button down, and then clicked on the window, you couldn't move the mouse pointer over the title bar or the close window button.

It turns out WinMessage in SDL_Sysevents.c was using a static int mouse_pressed to keep track of whether it should call SetCapture() and ReleaseCapture(). Since it was static and initialized only once, it wasn't cleared when the video mode changed, so there was a kind of one-off error and SetCapture() and ReleaseCapture() weren't being called when they should.

Here's a patch - I just made that int accessible from the outside and reset it to 0 in SDL_SetVideoMode, wrapped in #ifdef WIN32. Suggestions on how to make this more elegant are welcome.

BTW, what's the policy with new patches? Are they commited to SVN but there are no new SDL 1.2 releases?

--Gabriel



_______________________________________________
SDL mailing list
SDL@...
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

mouse_pressed_patch.diff (2K) Download Attachment

Re: [PATCH] Broken behavior in window bar

by Sam Lantinga-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yep, although it's better if bugs are reported in bugzilla so they
don't get missed on the mailing list.
http://bugzilla.libsdl.org/

On Tue, Nov 3, 2009 at 12:39 PM, Gabriel Gambetta <mystml@...> wrote:

> I found and fixed an obscure and hard to trigger bug in SDL 1.2.14 in
> Windows.
>
> If you changed the video mode while holding the mouse button down, and then
> clicked on the window, you couldn't move the mouse pointer over the title
> bar or the close window button.
>
> It turns out WinMessage in SDL_Sysevents.c was using a static int
> mouse_pressed to keep track of whether it should call SetCapture() and
> ReleaseCapture(). Since it was static and initialized only once, it wasn't
> cleared when the video mode changed, so there was a kind of one-off error
> and SetCapture() and ReleaseCapture() weren't being called when they should.
>
> Here's a patch - I just made that int accessible from the outside and reset
> it to 0 in SDL_SetVideoMode, wrapped in #ifdef WIN32. Suggestions on how to
> make this more elegant are welcome.
>
> BTW, what's the policy with new patches? Are they commited to SVN but there
> are no new SDL 1.2 releases?
>
> --Gabriel
>
>
> _______________________________________________
> SDL mailing list
> SDL@...
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>



--
        -Sam Lantinga, Founder and President, Galaxy Gameworks LLC
_______________________________________________
SDL mailing list
SDL@...
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org