mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0031815: Visualization, TKOpenGl - avoid XResizeWindow() within OpenGl_Window::Resize()
OpenGl_Window::Resize() no more calls XResizeWindow() and relies only on dimensions returned by Aspect_Window. Xw_Window::Size() now ignores Window in case of virtual window in similar way as WNT_Window does.
This commit is contained in:
parent
0aeb898418
commit
e89202ea02
@ -715,28 +715,18 @@ Standard_Boolean OpenGl_Window::Activate()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Window::Resize()
|
void OpenGl_Window::Resize()
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32) && !defined(HAVE_EGL)
|
Standard_Integer aWidth = 0, aHeight = 0;
|
||||||
Display* aDisp = (Display* )myGlContext->myDisplay;
|
|
||||||
if (aDisp == NULL)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Standard_Integer aWidth = 0;
|
|
||||||
Standard_Integer aHeight = 0;
|
|
||||||
myPlatformWindow->Size (aWidth, aHeight);
|
myPlatformWindow->Size (aWidth, aHeight);
|
||||||
|
if (myWidth == aWidth
|
||||||
// If the size is not changed - do nothing
|
&& myHeight == aHeight)
|
||||||
if ((myWidth == aWidth) && (myHeight == aHeight))
|
{
|
||||||
|
// if the size is not changed - do nothing
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
myWidth = aWidth;
|
myWidth = aWidth;
|
||||||
myHeight = aHeight;
|
myHeight = aHeight;
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(HAVE_EGL)
|
|
||||||
XResizeWindow (aDisp, myGlContext->myWindow, (unsigned int )myWidth, (unsigned int )myHeight);
|
|
||||||
XSync (aDisp, False);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -778,18 +768,8 @@ void OpenGl_Window::Init()
|
|||||||
eglQuerySurface ((EGLDisplay )myGlContext->myDisplay, (EGLSurface )myGlContext->myWindow, EGL_WIDTH, &myWidth);
|
eglQuerySurface ((EGLDisplay )myGlContext->myDisplay, (EGLSurface )myGlContext->myWindow, EGL_WIDTH, &myWidth);
|
||||||
eglQuerySurface ((EGLDisplay )myGlContext->myDisplay, (EGLSurface )myGlContext->myWindow, EGL_HEIGHT, &myHeight);
|
eglQuerySurface ((EGLDisplay )myGlContext->myDisplay, (EGLSurface )myGlContext->myWindow, EGL_HEIGHT, &myHeight);
|
||||||
}
|
}
|
||||||
#elif defined(_WIN32)
|
|
||||||
//
|
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
glDisable (GL_DITHER);
|
glDisable (GL_DITHER);
|
||||||
|
@ -391,7 +391,7 @@ void Xw_Window::Unmap() const
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Aspect_TypeOfResize Xw_Window::DoResize()
|
Aspect_TypeOfResize Xw_Window::DoResize()
|
||||||
{
|
{
|
||||||
if (myXWindow == 0)
|
if (IsVirtual() || myXWindow == 0)
|
||||||
{
|
{
|
||||||
return Aspect_TOR_UNKNOWN;
|
return Aspect_TOR_UNKNOWN;
|
||||||
}
|
}
|
||||||
@ -447,9 +447,9 @@ Standard_Boolean Xw_Window::DoMapping() const
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Real Xw_Window::Ratio() const
|
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());
|
XFlush (myDisplay->GetDisplay());
|
||||||
@ -462,11 +462,15 @@ Standard_Real Xw_Window::Ratio() const
|
|||||||
// function : Position
|
// function : Position
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void Xw_Window::Position (Standard_Integer& X1, Standard_Integer& Y1,
|
void Xw_Window::Position (Standard_Integer& theX1, Standard_Integer& theY1,
|
||||||
Standard_Integer& X2, Standard_Integer& Y2) const
|
Standard_Integer& theX2, Standard_Integer& theY2) const
|
||||||
{
|
{
|
||||||
if (myXWindow == 0)
|
if (IsVirtual() || myXWindow == 0)
|
||||||
{
|
{
|
||||||
|
theX1 = myXLeft;
|
||||||
|
theX2 = myXRight;
|
||||||
|
theY1 = myYTop;
|
||||||
|
theY2 = myYBottom;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,10 +481,10 @@ void Xw_Window::Position (Standard_Integer& X1, Standard_Integer& Y1,
|
|||||||
XTranslateCoordinates (myDisplay->GetDisplay(), anAttributes.root, myXWindow,
|
XTranslateCoordinates (myDisplay->GetDisplay(), anAttributes.root, myXWindow,
|
||||||
0, 0, &anAttributes.x, &anAttributes.y, &aChild);
|
0, 0, &anAttributes.x, &anAttributes.y, &aChild);
|
||||||
|
|
||||||
X1 = -anAttributes.x;
|
theX1 = -anAttributes.x;
|
||||||
X2 = X1 + anAttributes.width;
|
theX2 = theX1 + anAttributes.width;
|
||||||
Y1 = -anAttributes.y;
|
theY1 = -anAttributes.y;
|
||||||
Y2 = Y1 + anAttributes.height;
|
theY2 = theY1 + anAttributes.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -490,8 +494,10 @@ void Xw_Window::Position (Standard_Integer& X1, Standard_Integer& Y1,
|
|||||||
void Xw_Window::Size (Standard_Integer& theWidth,
|
void Xw_Window::Size (Standard_Integer& theWidth,
|
||||||
Standard_Integer& theHeight) const
|
Standard_Integer& theHeight) const
|
||||||
{
|
{
|
||||||
if (myXWindow == 0)
|
if (IsVirtual() || myXWindow == 0)
|
||||||
{
|
{
|
||||||
|
theWidth = myXRight - myXLeft;
|
||||||
|
theHeight = myYBottom - myYTop;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user