// =======================================================================
void OpenGl_Window::Resize()
{
-#if !defined(_WIN32) && !defined(HAVE_EGL)
- Display* aDisp = (Display* )myGlContext->myDisplay;
- if (aDisp == NULL)
- return;
-#endif
-
- Standard_Integer aWidth = 0;
- Standard_Integer aHeight = 0;
+ Standard_Integer aWidth = 0, aHeight = 0;
myPlatformWindow->Size (aWidth, aHeight);
-
- // If the size is not changed - do nothing
- if ((myWidth == aWidth) && (myHeight == aHeight))
+ if (myWidth == aWidth
+ && myHeight == aHeight)
+ {
+ // if the size is not changed - do nothing
return;
+ }
myWidth = aWidth;
myHeight = aHeight;
-#if !defined(_WIN32) && !defined(HAVE_EGL)
- XResizeWindow (aDisp, myGlContext->myWindow, (unsigned int )myWidth, (unsigned int )myHeight);
- XSync (aDisp, False);
-#endif
-
Init();
}
eglQuerySurface ((EGLDisplay )myGlContext->myDisplay, (EGLSurface )myGlContext->myWindow, EGL_WIDTH, &myWidth);
eglQuerySurface ((EGLDisplay )myGlContext->myDisplay, (EGLSurface )myGlContext->myWindow, EGL_HEIGHT, &myHeight);
}
-#elif defined(_WIN32)
- //
#else
- Window aRootWin;
- int aDummy;
- unsigned int aDummyU;
- unsigned int aNewWidth = 0;
- unsigned int aNewHeight = 0;
- Display* aDisp = (Display* )myGlContext->myDisplay;
- XGetGeometry (aDisp, myGlContext->myWindow, &aRootWin, &aDummy, &aDummy, &aNewWidth, &aNewHeight, &aDummyU, &aDummyU);
- myWidth = aNewWidth;
- myHeight = aNewHeight;
+ //
#endif
glDisable (GL_DITHER);
// =======================================================================
Aspect_TypeOfResize Xw_Window::DoResize()
{
- if (myXWindow == 0)
+ if (IsVirtual() || myXWindow == 0)
{
return Aspect_TOR_UNKNOWN;
}
// =======================================================================
Standard_Real Xw_Window::Ratio() const
{
- if (myXWindow == 0)
+ if (IsVirtual() || myXWindow == 0)
{
- return 1.0;
+ return Standard_Real(myXRight - myXLeft) / Standard_Real(myYBottom - myYTop);
}
XFlush (myDisplay->GetDisplay());
// function : Position
// purpose :
// =======================================================================
-void Xw_Window::Position (Standard_Integer& X1, Standard_Integer& Y1,
- Standard_Integer& X2, Standard_Integer& Y2) const
+void Xw_Window::Position (Standard_Integer& theX1, Standard_Integer& theY1,
+ Standard_Integer& theX2, Standard_Integer& theY2) const
{
- if (myXWindow == 0)
+ if (IsVirtual() || myXWindow == 0)
{
+ theX1 = myXLeft;
+ theX2 = myXRight;
+ theY1 = myYTop;
+ theY2 = myYBottom;
return;
}
XTranslateCoordinates (myDisplay->GetDisplay(), anAttributes.root, myXWindow,
0, 0, &anAttributes.x, &anAttributes.y, &aChild);
- X1 = -anAttributes.x;
- X2 = X1 + anAttributes.width;
- Y1 = -anAttributes.y;
- Y2 = Y1 + anAttributes.height;
+ theX1 = -anAttributes.x;
+ theX2 = theX1 + anAttributes.width;
+ theY1 = -anAttributes.y;
+ theY2 = theY1 + anAttributes.height;
}
// =======================================================================
void Xw_Window::Size (Standard_Integer& theWidth,
Standard_Integer& theHeight) const
{
- if (myXWindow == 0)
+ if (IsVirtual() || myXWindow == 0)
{
+ theWidth = myXRight - myXLeft;
+ theHeight = myYBottom - myYTop;
return;
}