mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0032991: Visualization, TKOpenGl - OpenGl_Window::Resize() ignores window virtual flag on macOS
Added handling of Aspect_Window::IsVirtual() flag on macOS platform (7.6.x backport).
This commit is contained in:
@@ -436,15 +436,6 @@ void Cocoa_Window::InvalidateContent (const Handle(Aspect_DisplayConnection)& )
|
||||
return;
|
||||
}
|
||||
|
||||
if ([NSThread isMainThread])
|
||||
{
|
||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
[myHView setNeedsDisplay];
|
||||
#else
|
||||
[myHView setNeedsDisplay: YES];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
[myHView performSelectorOnMainThread: @selector(invalidateContentOcct:)
|
||||
withObject: NULL
|
||||
|
@@ -264,11 +264,20 @@ OpenGl_Window::~OpenGl_Window()
|
||||
void OpenGl_Window::Resize()
|
||||
{
|
||||
// If the size is not changed - do nothing
|
||||
Standard_Integer aWidthPt = 0;
|
||||
Standard_Integer aHeightPt = 0;
|
||||
myPlatformWindow->Size (aWidthPt, aHeightPt);
|
||||
if (myWidthPt == aWidthPt
|
||||
&& myHeightPt == aHeightPt)
|
||||
Graphic3d_Vec2i aWinSize;
|
||||
myPlatformWindow->Size (aWinSize.x(), aWinSize.y());
|
||||
if (myPlatformWindow->IsVirtual())
|
||||
{
|
||||
if (myWidth == aWinSize.x()
|
||||
&& myHeight == aWinSize.y())
|
||||
{
|
||||
return;
|
||||
}
|
||||
myWidth = aWinSize.x();
|
||||
myHeight = aWinSize.y();
|
||||
}
|
||||
else if (myWidthPt == aWinSize.x()
|
||||
&& myHeightPt == aWinSize.y())
|
||||
{
|
||||
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
|
||||
return;
|
||||
@@ -293,8 +302,8 @@ void OpenGl_Window::Resize()
|
||||
#endif
|
||||
}
|
||||
|
||||
myWidthPt = aWidthPt;
|
||||
myHeightPt = aHeightPt;
|
||||
myWidthPt = aWinSize.x();
|
||||
myHeightPt = aWinSize.y();
|
||||
|
||||
Init();
|
||||
}
|
||||
@@ -356,35 +365,39 @@ void OpenGl_Window::Init()
|
||||
aDefFbo->BindBuffer (myGlContext);
|
||||
aDefFbo.Nullify();
|
||||
#else
|
||||
NSOpenGLContext* aGLCtx = myGlContext->myGContext;
|
||||
Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
NSView* aView = [aGLCtx view];
|
||||
Standard_ENABLE_DEPRECATION_WARNINGS
|
||||
NSRect aBounds = [aView bounds];
|
||||
|
||||
// we should call this method each time when window is resized
|
||||
[aGLCtx update];
|
||||
|
||||
if ([aView respondsToSelector: @selector(convertSizeToBacking:)])
|
||||
if (!myPlatformWindow->IsVirtual())
|
||||
{
|
||||
NSSize aRes = [aView convertSizeToBacking: aBounds.size];
|
||||
myWidth = Standard_Integer(aRes.width);
|
||||
myHeight = Standard_Integer(aRes.height);
|
||||
NSOpenGLContext* aGLCtx = myGlContext->myGContext;
|
||||
Standard_DISABLE_DEPRECATION_WARNINGS
|
||||
NSView* aView = [aGLCtx view];
|
||||
Standard_ENABLE_DEPRECATION_WARNINGS
|
||||
NSRect aBounds = [aView bounds];
|
||||
|
||||
// we should call this method each time when window is resized
|
||||
[aGLCtx update];
|
||||
|
||||
if ([aView respondsToSelector: @selector(convertSizeToBacking:)])
|
||||
{
|
||||
NSSize aRes = [aView convertSizeToBacking: aBounds.size];
|
||||
myWidth = Standard_Integer(aRes.width);
|
||||
myHeight = Standard_Integer(aRes.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
myWidth = Standard_Integer(aBounds.size.width);
|
||||
myHeight = Standard_Integer(aBounds.size.height);
|
||||
}
|
||||
myWidthPt = Standard_Integer(aBounds.size.width);
|
||||
myHeightPt = Standard_Integer(aBounds.size.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
myWidth = Standard_Integer(aBounds.size.width);
|
||||
myHeight = Standard_Integer(aBounds.size.height);
|
||||
}
|
||||
myWidthPt = Standard_Integer(aBounds.size.width);
|
||||
myHeightPt = Standard_Integer(aBounds.size.height);
|
||||
#endif
|
||||
|
||||
::glDisable (GL_DITHER);
|
||||
::glDisable (GL_SCISSOR_TEST);
|
||||
::glViewport (0, 0, myWidth, myHeight);
|
||||
const Standard_Integer aViewport[4] = { 0, 0, myWidth, myHeight };
|
||||
myGlContext->ResizeViewport (aViewport);
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
::glDrawBuffer (GL_BACK);
|
||||
myGlContext->SetDrawBuffer (GL_BACK);
|
||||
if (myGlContext->core11ffp != NULL)
|
||||
{
|
||||
::glMatrixMode (GL_MODELVIEW);
|
||||
|
@@ -196,7 +196,7 @@ void ViewerTest_EventManager::handleViewRedraw (const Handle(AIS_InteractiveCont
|
||||
&& (!aRedrawer.IsStarted() || aRedrawer.IsPaused()))
|
||||
{
|
||||
myIsTmpContRedraw = true;
|
||||
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__)
|
||||
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__) && !defined(__APPLE__)
|
||||
aRedrawer.Start (theView, 60.0);
|
||||
#endif
|
||||
}
|
||||
@@ -210,7 +210,7 @@ void ViewerTest_EventManager::handleViewRedraw (const Handle(AIS_InteractiveCont
|
||||
else if (myIsTmpContRedraw)
|
||||
{
|
||||
myIsTmpContRedraw = false;
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
ViewerTest_ContinuousRedrawer& aRedrawer = ViewerTest_ContinuousRedrawer::Instance();
|
||||
aRedrawer.Pause();
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user