Jump to content

Incorrect window size


bandrewk
 Share

Recommended Posts

Hello,

 

Leadwerks is not creating correctly sized windows. When setting the resolution to 800 x 600:

 

window = Window::Create("UISystem", 0, 0, 800, 600);

 

A window with the window size of 800 x 600 will be created, it seems correct at first but what I really wanted (and expected) this command to do is create a client area with the size of 800 x 600.

 

Leadwerks behavior:

post-7919-0-91030200-1393475752_thumb.png

 

Expected behavior:

post-7919-0-18364300-1393475758_thumb.png

 

Thank you.

Link to comment
Share on other sites

This is a difficult situation because with Aero Microsoft broke the functionality of the Windows API to create a window of a specific size. Really. There's a bug report somewhere on this forum with a link to their actual documentation explaining this.

 

That's complete nonsense. Just use the AdjustWindowRect Windows API function. I fixed a related bug on another engine with the code below.

 

//Window
rectW.left	 = GetSystemMetrics(SM_CXSCREEN)/2 - nScreenWidth/2;
rectW.top	 = GetSystemMetrics(SM_CYSCREEN)/2 - nScreenHeight/2;
rectW.right	 = rectW.left + nScreenWidth;
rectW.bottom = rectW.top + nScreenHeight;
styleW		 = WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_VISIBLE; //WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;

AdjustWindowRect(&rectW,styleW,false);

Link to comment
Share on other sites

That's complete nonsense. Just use the AdjustWindowRect Windows API function. I fixed a related bug on another engine with the code below.

 

//Window
rectW.left	 = GetSystemMetrics(SM_CXSCREEN)/2 - nScreenWidth/2;
rectW.top	 = GetSystemMetrics(SM_CYSCREEN)/2 - nScreenHeight/2;
rectW.right	 = rectW.left + nScreenWidth;
rectW.bottom = rectW.top + nScreenHeight;
styleW		 = WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_VISIBLE; //WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;

AdjustWindowRect(&rectW,styleW,false);

Well, that's still not the right behavior. That creates a window with a specific client size. The Leadwerks function Windows::Create() is designed to create a window with a specified outer size. Which Windows can't actually do precisely, and it is a known bug in Aero. (Not sure if this is the same bug, but it probably is):

http://connect.microsoft.com/VisualStudio/feedback/details/758042/visual-studio-2012-app-window-size-behaviour-differ-from-previous-vs-versions-window-creation

 

Since this is asking for new functionality different from the intended behavior, this is a feature request, not a bug report. It's probably a good idea to add an additional creation flag like Window::ClientCoords in the future, so that the function behaves in the way the OP suggested.

 

In the meantime, calling Context:GetWidth()/GetHeight() will return the correct client dimensions.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...