We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1031

Summary: SDL_VideoResize event width and heiht are off by one
Product: SDL Reporter: PulkoMandy <pulkomandy>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: jspradlin, pulkomandy, scottmc2
Version: 1.2.14   
Hardware: Other   
OS: BeOS   
Attachments: Small testcase program showing the video resize wrong behaviour.

Description PulkoMandy 2010-07-27 13:41:51 UTC
Created attachment 527 [details]
Small testcase program showing the video resize wrong behaviour.

I just installed SDL on my Haiku installation and compiled some programs (grafx2 and dcto8d).
For some reason the windows of these programs (wich allow video resizing) grows when switching between workspaces or moving other windows above theirs. I think the SDL_VIDEORESIZE event width and height fields are off by one (one pixel too big); leading to an evergrowing window.

I made a small test case program that exposes the issue and attached the sourcecode. Run it, and notice how the window grows when one switch workspaces.
Comment 1 PulkoMandy 2010-11-28 14:11:47 UTC
We now have a patch for this, done by Daniel Marth as part of the Google Code-In program.

 The problem was that in the file "./src/video/bwindow/SDL_sysevents.cc" the method "SDL_BWin::DirectConnected" called "SDL_PrivateResize" with wrong parameters (1 pixel too much for width and height).

Before:

void SDL_BWin::DirectConnected(direct_buffer_info *info) {
    switch (info->buffer_state & B_DIRECT_MODE_MASK) {
        case B_DIRECT_START:
        case B_DIRECT_MODIFY:
            {
                int32 width = info->window_bounds.right -
                    info->window_bounds.left + 1;
                int32 height = info->window_bounds.bottom -
                    info->window_bounds.top + 1;
                SDL_PrivateResize(width, height);
                break;
            }
        default:
            break;
    }
}

After:

void SDL_BWin::DirectConnected(direct_buffer_info *info) {
    switch (info->buffer_state & B_DIRECT_MODE_MASK) {
        case B_DIRECT_START:
        case B_DIRECT_MODIFY:
            {
                int32 width = info->window_bounds.right -
                    info->window_bounds.left;
                int32 height = info->window_bounds.bottom -
                    info->window_bounds.top;
                SDL_PrivateResize(width, height);
                break;
            }
        default:
            break;
    }
}
Comment 2 Jen Spradlin 2011-04-12 20:24:46 UTC
Thank you for your bug report!

We're busy working on getting SDL 1.3 ready for a high quality release, and want to make sure as many things are fixed there as possible.
Could you check to see if your bug is resolved by the latest SDL 1.3 snapshot?
http://www.libsdl.org/tmp/SDL-1.3.zip

Thanks!
Comment 3 Scott McCreary 2011-08-10 12:32:53 UTC
This was fixed in changeset 4928:
http://hg.libsdl.org/SDL/annotate/930614179450/src/video/bwindow/SDL_sysevents.cc#l391