Bug in SDL2 RC2 under Visual studio 2008

With SDL2 RC2, creating a window under Windows XP at position 0,0 will position the window border off-screen.

Linking with rc2 of SDL2 under Visual Studio 2008.------------------------
C is the God’s Programming Language

This actually isn’t technically a bug, since the window position is in
terms of the client area, and there aren’t API functions to get the window
border size.

I agree it’s not ideal though and am open to suggestions.On Tue, Jun 11, 2013 at 3:06 AM, neoaggelos wrote:

**
With SDL2 RC2, creating a window under Windows XP at position 0,0 will
position the window border off-screen.

Linking with rc2 of SDL2 under Visual Studio 2008.


C is the God’s Programming Language


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

As per web-search wisdom, one CAN get the border size (and thus could
automatically adjust the position away from 0,0 accordingly).

On XP one can use GetWindowRect (see
GetWindowRect function (winuser.h) - Win32 apps | Microsoft Learn).
On Vista and above OS’s it is more complicated. One needs to dynamically
bind to dwmapi.dll, use GetProcAddress() to obtain the
DwmGetWindowAttribute() function (see
DwmGetWindowAttribute function (dwmapi.h) - Win32 apps | Microsoft Learn),
then call it with the DWMWA_EXTENDED_FRAME_BOUNDS argument to request
the genuine window frame dimensions.

Here is some working Python code to illustrate this:

In either case one would need to create the window off screen, query for
the framesize and then position with the framesize as fudge factor.

What are the positioning behaviors across other platforms? Client area
or client+frame area?On 6/12/2013 10:22 PM, Sam Lantinga wrote:

This actually isn’t technically a bug, since the window position is in
terms of the client area, and there aren’t API functions to get the
window border size.

I agree it’s not ideal though and am open to suggestions.

On Tue, Jun 11, 2013 at 3:06 AM, neoaggelos <neoaggelos at gmail.com <mailto:neoaggelos at gmail.com>> wrote:

With SDL2 RC2, creating a window under Windows XP at position 0,0
will position the window border off-screen.

Linking with rc2 of SDL2 under Visual Studio 2008.


------------------------------------------------------------------------

C is the God's Programming Language

_______________________________________________
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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

Sorry, to clarify, there aren’t SDL functions to get the window borders.
:slight_smile:

The positioning behavior is (should be) client area across all platforms.On Wed, Jun 12, 2013 at 10:44 PM, Andreas Schiffler <aschiffler at ferzkopp.net wrote:

As per web-search wisdom, one CAN get the border size (and thus could
automatically adjust the position away from 0,0 accordingly).

On XP one can use GetWindowRect (see
GetWindowRect function (winuser.h) - Win32 apps | Microsoft Learn).
On Vista and above OS’s it is more complicated. One needs to dynamically
bind to dwmapi.dll, use GetProcAddress() to obtain the
DwmGetWindowAttribute() function (see
DwmGetWindowAttribute function (dwmapi.h) - Win32 apps | Microsoft Learn),
then call it with the DWMWA_EXTENDED_FRAME_BOUNDS argument to request the
genuine window frame dimensions.

Here is some working Python code to illustrate this:
python - GetWindowRect too small on Windows 7 - Stack Overflow

In either case one would need to create the window off screen, query for
the framesize and then position with the framesize as fudge factor.

What are the positioning behaviors across other platforms? Client area or
client+frame area?

On 6/12/2013 10:22 PM, Sam Lantinga wrote:

This actually isn’t technically a bug, since the window position is in
terms of the client area, and there aren’t API functions to get the window
border size.

I agree it’s not ideal though and am open to suggestions.

On Tue, Jun 11, 2013 at 3:06 AM, neoaggelos wrote:

With SDL2 RC2, creating a window under Windows XP at position 0,0 will
position the window border off-screen.

Linking with rc2 of SDL2 under Visual Studio 2008.


C is the God’s Programming Language


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


SDL mailing listSDL at lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

This may be a good candidate for a new SDL 2.1 API - either in the form
of a special window creation flag that adjusts the position according to
the frame size and/or a function operating on an existing window that
returns the framesize.On 6/12/2013 10:46 PM, Sam Lantinga wrote:

Sorry, to clarify, there aren’t SDL functions to get the window
borders. :slight_smile:

The positioning behavior is (should be) client area across all platforms.

On Wed, Jun 12, 2013 at 10:44 PM, Andreas Schiffler <@Andreas_Schiffler mailto:Andreas_Schiffler> wrote:

As per web-search wisdom, one CAN get the border size (and thus
could automatically adjust the position away from 0,0 accordingly).

On XP one can use GetWindowRect (see
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519%28v=vs.85%29.aspx).
On Vista and above OS's it is more complicated. One needs to
dynamically bind to dwmapi.dll, use GetProcAddress() to obtain the
DwmGetWindowAttribute() function (see
http://msdn.microsoft.com/en-us/library/windows/desktop/aa969515%28v=vs.85%29.aspx),
then call it with the DWMWA_EXTENDED_FRAME_BOUNDS argument to
request the genuine window frame dimensions.

Here is some working Python code to illustrate this:
http://stackoverflow.com/questions/3192232/getwindowrect-too-small-on-windows-7


In either case one would need to create the window off screen,
query for the framesize and then position with the framesize as
fudge factor.

What are the positioning behaviors across other platforms? Client
area or client+frame area?



On 6/12/2013 10:22 PM, Sam Lantinga wrote:
This actually isn't technically a bug, since the window position
is in terms of the client area, and there aren't API functions to
get the window border size.

I agree it's not ideal though and am open to suggestions.


On Tue, Jun 11, 2013 at 3:06 AM, neoaggelos <neoaggelos at gmail.com <mailto:neoaggelos at gmail.com>> wrote:

    With SDL2 RC2, creating a window under Windows XP at position
    0,0 will position the window border off-screen.

    Linking with rc2 of SDL2 under Visual Studio 2008.


    ------------------------------------------------------------------------

    C is the God's Programming Language

    _______________________________________________
    SDL mailing list
    SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
    http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




_______________________________________________
SDL mailing list
SDL at lists.libsdl.org  <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org