mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Cocoa: Fix some macOS 10.14 deprecation warnings
This commit is contained in:
parent
245461eb86
commit
6dfc12a439
@ -32,7 +32,6 @@
|
|||||||
// Needed for _NSGetProgname
|
// Needed for _NSGetProgname
|
||||||
#include <crt_externs.h>
|
#include <crt_externs.h>
|
||||||
|
|
||||||
// HACK: The 10.12 SDK adds new symbols and immediately deprecates the old ones
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
||||||
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
|
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
|
||||||
#define NSWindowStyleMaskClosable NSClosableWindowMask
|
#define NSWindowStyleMaskClosable NSClosableWindowMask
|
||||||
@ -48,8 +47,13 @@
|
|||||||
#define NSEventMaskAny NSAnyEventMask
|
#define NSEventMaskAny NSAnyEventMask
|
||||||
#define NSEventTypeApplicationDefined NSApplicationDefined
|
#define NSEventTypeApplicationDefined NSApplicationDefined
|
||||||
#define NSEventTypeKeyUp NSKeyUp
|
#define NSEventTypeKeyUp NSKeyUp
|
||||||
|
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101300
|
||||||
|
#define NSPasteboardTypeFileURL NSFilenamesPboardType
|
||||||
|
#define NSPasteboardTypeString NSStringPboardType
|
||||||
|
#endif
|
||||||
|
|
||||||
// Returns the style mask corresponding to the window settings
|
// Returns the style mask corresponding to the window settings
|
||||||
//
|
//
|
||||||
@ -439,7 +443,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
|
|
||||||
[self updateTrackingAreas];
|
[self updateTrackingAreas];
|
||||||
[self registerForDraggedTypes:[NSArray arrayWithObjects:
|
[self registerForDraggedTypes:[NSArray arrayWithObjects:
|
||||||
NSFilenamesPboardType, nil]];
|
NSPasteboardTypeFileURL, nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@ -720,7 +724,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
|
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
|
||||||
{
|
{
|
||||||
NSPasteboard* pasteboard = [sender draggingPasteboard];
|
NSPasteboard* pasteboard = [sender draggingPasteboard];
|
||||||
NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType];
|
NSArray* files = [pasteboard propertyListForType:NSPasteboardTypeFileURL];
|
||||||
|
|
||||||
const NSRect contentRect = [window->ns.view frame];
|
const NSRect contentRect = [window->ns.view frame];
|
||||||
_glfwInputCursorPos(window,
|
_glfwInputCursorPos(window,
|
||||||
@ -1728,7 +1732,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||||||
hasAlpha:YES
|
hasAlpha:YES
|
||||||
isPlanar:NO
|
isPlanar:NO
|
||||||
colorSpaceName:NSCalibratedRGBColorSpace
|
colorSpaceName:NSCalibratedRGBColorSpace
|
||||||
bitmapFormat:NSAlphaNonpremultipliedBitmapFormat
|
bitmapFormat:NSBitmapFormatAlphaNonpremultiplied
|
||||||
bytesPerRow:image->width * 4
|
bytesPerRow:image->width * 4
|
||||||
bitsPerPixel:32];
|
bitsPerPixel:32];
|
||||||
|
|
||||||
@ -1795,26 +1799,26 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
|||||||
|
|
||||||
void _glfwPlatformSetClipboardString(const char* string)
|
void _glfwPlatformSetClipboardString(const char* string)
|
||||||
{
|
{
|
||||||
NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil];
|
NSArray* types = [NSArray arrayWithObjects:NSPasteboardTypeString, nil];
|
||||||
|
|
||||||
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
||||||
[pasteboard declareTypes:types owner:nil];
|
[pasteboard declareTypes:types owner:nil];
|
||||||
[pasteboard setString:[NSString stringWithUTF8String:string]
|
[pasteboard setString:[NSString stringWithUTF8String:string]
|
||||||
forType:NSStringPboardType];
|
forType:NSPasteboardTypeString];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* _glfwPlatformGetClipboardString(void)
|
const char* _glfwPlatformGetClipboardString(void)
|
||||||
{
|
{
|
||||||
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
||||||
|
|
||||||
if (![[pasteboard types] containsObject:NSStringPboardType])
|
if (![[pasteboard types] containsObject:NSPasteboardTypeString])
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
"Cocoa: Failed to retrieve string from pasteboard");
|
"Cocoa: Failed to retrieve string from pasteboard");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* object = [pasteboard stringForType:NSStringPboardType];
|
NSString* object = [pasteboard stringForType:NSPasteboardTypeString];
|
||||||
if (!object)
|
if (!object)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
|
||||||
|
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
||||||
|
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
||||||
|
#endif
|
||||||
|
|
||||||
static void makeContextCurrentNSGL(_GLFWwindow* window)
|
static void makeContextCurrentNSGL(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
@ -49,7 +53,7 @@ static void swapIntervalNSGL(int interval)
|
|||||||
|
|
||||||
GLint sync = interval;
|
GLint sync = interval;
|
||||||
[window->context.nsgl.object setValues:&sync
|
[window->context.nsgl.object setValues:&sync
|
||||||
forParameter:NSOpenGLCPSwapInterval];
|
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||||
}
|
}
|
||||||
|
|
||||||
static int extensionSupportedNSGL(const char* extension)
|
static int extensionSupportedNSGL(const char* extension)
|
||||||
@ -299,7 +303,8 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||||||
if (fbconfig->transparent)
|
if (fbconfig->transparent)
|
||||||
{
|
{
|
||||||
GLint opaque = 0;
|
GLint opaque = 0;
|
||||||
[window->context.nsgl.object setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
|
[window->context.nsgl.object setValues:&opaque
|
||||||
|
forParameter:NSOpenGLContextParameterSurfaceOpacity];
|
||||||
}
|
}
|
||||||
|
|
||||||
[window->context.nsgl.object setView:window->ns.view];
|
[window->context.nsgl.object setView:window->ns.view];
|
||||||
|
Loading…
Reference in New Issue
Block a user