From e2d6f0e37afc2df53b3dcc6c637d76b4ad91b851 Mon Sep 17 00:00:00 2001 From: kgv Date: Fri, 10 Sep 2021 21:45:03 +0300 Subject: [PATCH] 0032423: Coding Rules - NSOpenGLContext deprecation warnings during compilation for macOS 10.14+ The warning has been suppressed for building TKOpenGl. --- src/Aspect/Aspect_RenderingContext.hxx | 4 ++++ src/OpenGl/OpenGl_Window_1.mm | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/Aspect/Aspect_RenderingContext.hxx b/src/Aspect/Aspect_RenderingContext.hxx index 112c6feb82..7e4633878b 100644 --- a/src/Aspect/Aspect_RenderingContext.hxx +++ b/src/Aspect/Aspect_RenderingContext.hxx @@ -22,6 +22,8 @@ #ifndef _Aspect_RenderingContext_HeaderFile #define _Aspect_RenderingContext_HeaderFile +#include + #if defined(__APPLE__) && !defined(HAVE_XLIB) #import #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE @@ -37,7 +39,9 @@ #else struct NSOpenGLContext; #endif + Standard_DISABLE_DEPRECATION_WARNINGS typedef NSOpenGLContext* Aspect_RenderingContext; + Standard_ENABLE_DEPRECATION_WARNINGS #endif #else typedef void* Aspect_RenderingContext; // GLXContext under UNIX diff --git a/src/OpenGl/OpenGl_Window_1.mm b/src/OpenGl/OpenGl_Window_1.mm index 93e0470ac6..49108d4f2b 100644 --- a/src/OpenGl/OpenGl_Window_1.mm +++ b/src/OpenGl/OpenGl_Window_1.mm @@ -216,7 +216,9 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_GraphicDriver)& theDriver, } NSView* aView = (NSView* )myPlatformWindow->NativeHandle(); + Standard_DISABLE_DEPRECATION_WARNINGS [aGLContext setView: aView]; + Standard_ENABLE_DEPRECATION_WARNINGS isCore = (aTryCore == 1); } @@ -273,7 +275,9 @@ void OpenGl_Window::Resize() #else // check backing store change (moving to another screen) NSOpenGLContext* aGLCtx = myGlContext->myGContext; + Standard_DISABLE_DEPRECATION_WARNINGS NSView* aView = [aGLCtx view]; + Standard_ENABLE_DEPRECATION_WARNINGS if (![aView respondsToSelector: @selector(convertSizeToBacking:)]) { return; @@ -353,7 +357,9 @@ void OpenGl_Window::Init() 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