mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0023628: Snapshots have wrong dimension when OCCT is built by VC++ 11
Use AdjustWindowRect() function to adjust window rectangle instead of manual GetSystemMetrics().
This commit is contained in:
parent
e6aad0ee24
commit
7fe83417f1
@ -18,11 +18,6 @@
|
|||||||
// purpose or non-infringement. Please see the License for the specific terms
|
// purpose or non-infringement. Please see the License for the specific terms
|
||||||
// and conditions governing the rights and limitations under the License.
|
// and conditions governing the rights and limitations under the License.
|
||||||
|
|
||||||
// Updated by DPF Fri Mar 21 18:40:58 1997
|
|
||||||
// Added casting in void to compile
|
|
||||||
// on AO1 int 32 bits -> pointer 64 bits ????
|
|
||||||
// Robert Boehne 30 May 2000 : Dec Osf
|
|
||||||
|
|
||||||
// include windows.h first to have all definitions available
|
// include windows.h first to have all definitions available
|
||||||
#ifdef WNT
|
#ifdef WNT
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -1474,13 +1469,19 @@ void DrawWindow::Init(Standard_Integer theXLeft, Standard_Integer theYTop,
|
|||||||
|
|
||||||
// include decorations in the window dimensions
|
// include decorations in the window dimensions
|
||||||
// to reproduce same behaviour of Xlib window.
|
// to reproduce same behaviour of Xlib window.
|
||||||
theXLeft -= GetSystemMetrics(SM_CXSIZEFRAME);
|
DWORD aWinStyle = GetWindowLongPtr (win, GWL_STYLE);
|
||||||
theYTop -= GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION);
|
DWORD aWinStyleEx = GetWindowLongPtr (win, GWL_EXSTYLE);
|
||||||
theWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
|
HMENU aMenu = GetMenu (win);
|
||||||
theHeight += 2 * GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION);
|
|
||||||
|
|
||||||
SetPosition (theXLeft, theYTop);
|
RECT aRect;
|
||||||
SetDimension (theWidth, theHeight);
|
aRect.top = theYTop;
|
||||||
|
aRect.bottom = theYTop + theHeight;
|
||||||
|
aRect.left = theXLeft;
|
||||||
|
aRect.right = theXLeft + theWidth;
|
||||||
|
AdjustWindowRectEx (&aRect, aWinStyle, aMenu != NULL ? TRUE : FALSE, aWinStyleEx);
|
||||||
|
|
||||||
|
SetPosition (aRect.left, aRect.top);
|
||||||
|
SetDimension (aRect.right - aRect.left, aRect.bottom - aRect.top);
|
||||||
// Save the pointer at the instance associated to the window
|
// Save the pointer at the instance associated to the window
|
||||||
SetWindowLong(win, CLIENTWND, (LONG)this);
|
SetWindowLong(win, CLIENTWND, (LONG)this);
|
||||||
HDC hDC = GetDC(win);
|
HDC hDC = GetDC(win);
|
||||||
|
@ -119,15 +119,18 @@ WNT_Window::WNT_Window (const Handle(WNT_GraphicDevice)& theDevice,
|
|||||||
dwStyle |= WS_CLIPCHILDREN;
|
dwStyle |= WS_CLIPCHILDREN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dwStyle & WS_OVERLAPPEDWINDOW)
|
// include decorations in the window dimensions
|
||||||
{
|
// to reproduce same behaviour of Xw_Window.
|
||||||
// include decorations in the window dimensions
|
RECT aRect;
|
||||||
// to reproduce same behaviour of Xw_Window.
|
aRect.top = aYTop;
|
||||||
aXLeft -= GetSystemMetrics(SM_CXSIZEFRAME);
|
aRect.bottom = aYBottom;
|
||||||
aYTop -= GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION);
|
aRect.left = aXLeft;
|
||||||
aXRight += GetSystemMetrics(SM_CXSIZEFRAME);
|
aRect.right = aXRight;
|
||||||
aYBottom += GetSystemMetrics(SM_CYSIZEFRAME);
|
AdjustWindowRect (&aRect, dwStyle, theMenu != NULL ? TRUE : FALSE);
|
||||||
}
|
aXLeft = aRect.left;
|
||||||
|
aYTop = aRect.top;
|
||||||
|
aXRight = aRect.right;
|
||||||
|
aYBottom = aRect.bottom;
|
||||||
|
|
||||||
myHWindow = CreateWindow (
|
myHWindow = CreateWindow (
|
||||||
myWClass->Name(), // window's class name
|
myWClass->Name(), // window's class name
|
||||||
@ -198,15 +201,18 @@ WNT_Window::WNT_Window (const Handle(WNT_GraphicDevice)& theDevice,
|
|||||||
dwStyle |= WS_CLIPCHILDREN;
|
dwStyle |= WS_CLIPCHILDREN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dwStyle & WS_OVERLAPPEDWINDOW)
|
// include decorations in the window dimensions
|
||||||
{
|
// to reproduce same behaviour of Xw_Window.
|
||||||
// include decorations in the window dimensions
|
RECT aRect;
|
||||||
// to reproduce same behaviour of Xw_Window.
|
aRect.top = aYTop;
|
||||||
aXLeft -= GetSystemMetrics(SM_CXSIZEFRAME);
|
aRect.bottom = aYBottom;
|
||||||
aYTop -= GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION);
|
aRect.left = aXLeft;
|
||||||
aXRight += GetSystemMetrics(SM_CXSIZEFRAME);
|
aRect.right = aXRight;
|
||||||
aYBottom += GetSystemMetrics(SM_CYSIZEFRAME);
|
AdjustWindowRect (&aRect, dwStyle, theMenu != NULL ? TRUE : FALSE);
|
||||||
}
|
aXLeft = aRect.left;
|
||||||
|
aYTop = aRect.top;
|
||||||
|
aXRight = aRect.right;
|
||||||
|
aYBottom = aRect.bottom;
|
||||||
|
|
||||||
myHWindow = CreateWindow (
|
myHWindow = CreateWindow (
|
||||||
myWClass->Name(), // window's class name
|
myWClass->Name(), // window's class name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user