Window offset

When creating a top application window on windows 10 i now get a opengl rendering Surface that is extended 8 pixel to the left under the window decorations and 31 pixel under the titlebar. Is there any flag to disable this behaviour at window Creation time as it breaks window compatibility ?

I can see that it is realted to the [b]WM_NCCALCSIZE[/b] event that somehow Changes the client area within the window. I would like to disable this behaviour of my application window.

I guess that windows with Aero enabled in windows 10 adds a transparent border of 8x31 pixels. Only happends for the topmost window. Does not happend for popup or fullscreen windows

Are you calling AdjustWindowRect() before CreateWindow() (or SetWindowPos()) to let the OS bloat the window bounds to account for the frame, border, and caption pixels?:


RECT rect;
rect.left   = 0;
rect.top    = 0;
rect.right  = width;
rect.bottom = height;
AdjustWindowRect( &rect, winStyle, FALSE );

HWND win = CreateWindow( "className", "My Window", winStyle,
                         winOriginX, winOriginY,
                         ( rect.right  - rect.left ),  // Adjusted width
                         ( rect.bottom - rect.top  ),  // Adjusted height
                         NULL, NULL, instance, NULL);

Related reading:

[ul]
[li]MFC dialog Border padding changed after switching from VS2010 to 2012 or later [/li][li]GetWindowRect on non-resizable windows under Aero Glass [/li][li]GetWindowRect returns a size including “invisible” borders [/li][/ul]

Yes you are right but… That can be done and that will extend the size of the window at creation time and then updated by the NCCALCSIZE.It will then receive the expected size on WM_SIZE then but if i create a viewport using this size with glViewport i wont get the modelview transform right.

E.g. i have an app that in a traditional non aero environment creates a perfect quad in an perspective view. A unit modelview and an outline from -1 to 1 in x and y will create a perfect outline of the window extent. The same works in a window mode where i use full screen or a Child window in windows 10.

BUT in a top application that is adjusted with AdjustWindowRect i get exactly the same size of WM_SIZE but now the quad i located outside the visible window. That means that the mapping made by gzViewport dosnt map to the WM_SIZE window so the presentation is wrong. All values in the application regarding size and vieweport are the same

Perhaps this is a NVidia driver bug…

GetClientRect is your friend.

Only resetting your viewport on a resize event is actually a total micro-optimization; all that the viewport does is set a few state bits and transforms; you can safely make a GetClientRect call at the start of each frame, calculate new viewport bounds from that, and make a glViewport call each frame, and trust me - you will not notice one microsecond of measurable performance difference.

What i am trying to explain is that is exactly what i do and I get the same values from VM_SIZE. However in the top view window application the scaling is wrong. In the fullscreen ist correct and in a non aero window its correct. Exactly the same values are received in the VM_SIZE event

Its a driver issue. It happends on Intel 4.4.0 opengl drivers. Works ok on Intel 4.3.0 and on NVidia 385->

Solved…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.