Skip to content

Commit

Permalink
Merge pull request xbmc#23880 from enen92/deprecations_osx
Browse files Browse the repository at this point in the history
[macos][cocoainterface] Address deprecations
  • Loading branch information
enen92 authored Oct 6, 2023
2 parents 02edb3e + a06ff3e commit df97ff5
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions xbmc/platform/darwin/osx/CocoaInterface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,15 @@

CGDirectDisplayID Cocoa_GetDisplayIDFromScreen(NSScreen *screen);

NSOpenGLContext* Cocoa_GL_GetCurrentContext(void)
{
return [NSOpenGLContext currentContext];
}

uint32_t Cocoa_GL_GetCurrentDisplayID(void)
{
// Find which display we are on from the current context (default to main display)
CGDirectDisplayID display_id = kCGDirectMainDisplay;

NSNumber* __block screenID;
auto getScreenNumber = ^{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
screenID = Cocoa_GL_GetCurrentContext().view.window.screen.deviceDescription[@"NSScreenNumber"];
#pragma clang diagnostic pop
screenID =
NSApplication.sharedApplication.keyWindow.screen.deviceDescription[@"NSScreenNumber"];
};
if (NSThread.isMainThread)
getScreenNumber();
Expand All @@ -64,10 +57,8 @@ bool Cocoa_CVDisplayLinkCreate(void *displayLinkcallback, void *displayLinkConte

// OpenGL Flush synchronised with vertical retrace
GLint swapInterval = 1;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[[NSOpenGLContext currentContext] setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
#pragma clang diagnostic pop
[[NSOpenGLContext currentContext] setValues:&swapInterval
forParameter:NSOpenGLContextParameterSwapInterval];

display_id = (CGDirectDisplayID)Cocoa_GL_GetCurrentDisplayID();
if (!displayLink)
Expand Down

0 comments on commit df97ff5

Please sign in to comment.