mirror of
https://github.com/SFML/SFML.git
synced 2025-01-18 23:35:11 +08:00
Fix some macOS deprecation warnings
This commit is contained in:
parent
d4ff27caad
commit
8aa08e92d2
@ -34,8 +34,6 @@
|
|||||||
#define GREEN @"Green"
|
#define GREEN @"Green"
|
||||||
#define RED @"Red"
|
#define RED @"Red"
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
|
|
||||||
// Our PIMPL
|
// Our PIMPL
|
||||||
struct SFMLmainWindow
|
struct SFMLmainWindow
|
||||||
{
|
{
|
||||||
@ -195,7 +193,7 @@ struct SFMLmainWindow
|
|||||||
- (IBAction)visibleChanged:(NSButton*)sender
|
- (IBAction)visibleChanged:(NSButton*)sender
|
||||||
{
|
{
|
||||||
if (self.initialized)
|
if (self.initialized)
|
||||||
self.visible = [sender state] == NSOnState;
|
self.visible = [sender state] == NSControlStateValueOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)textChanged:(NSTextField*)sender
|
- (IBAction)textChanged:(NSTextField*)sender
|
||||||
|
@ -335,6 +335,10 @@ elseif(SFML_OS_ANDROID)
|
|||||||
target_link_libraries(sfml-window PRIVATE android)
|
target_link_libraries(sfml-window PRIVATE android)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(SFML_OS_MACOS OR SFML_OS_IOS)
|
||||||
|
target_compile_definitions(sfml-window PRIVATE GL_SILENCE_DEPRECATION)
|
||||||
|
endif()
|
||||||
|
|
||||||
# on some platforms (e.g. Raspberry Pi 3 armhf), GCC requires linking libatomic to use <atomic> features
|
# on some platforms (e.g. Raspberry Pi 3 armhf), GCC requires linking libatomic to use <atomic> features
|
||||||
# that aren't supported by native CPU instructions (64-bit atomic operations on 32-bit architecture)
|
# that aren't supported by native CPU instructions (64-bit atomic operations on 32-bit architecture)
|
||||||
if(SFML_COMPILER_GCC)
|
if(SFML_COMPILER_GCC)
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#import <SFML/Window/macOS/SFApplication.h>
|
#import <SFML/Window/macOS/SFApplication.h>
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@implementation SFApplication
|
@implementation SFApplication
|
||||||
@ -41,7 +39,7 @@
|
|||||||
[SFApplication sharedApplication]; // Make sure NSApp exists
|
[SFApplication sharedApplication]; // Make sure NSApp exists
|
||||||
NSEvent* event = nil;
|
NSEvent* event = nil;
|
||||||
|
|
||||||
while ((event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
while ((event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
||||||
untilDate:[NSDate distantPast]
|
untilDate:[NSDate distantPast]
|
||||||
inMode:NSDefaultRunLoopMode
|
inMode:NSDefaultRunLoopMode
|
||||||
dequeue:YES])) // Remove the event from the queue
|
dequeue:YES])) // Remove the event from the queue
|
||||||
@ -142,7 +140,7 @@
|
|||||||
addItemWithTitle:@"Hide Others"
|
addItemWithTitle:@"Hide Others"
|
||||||
action:@selector(hideOtherApplications:)
|
action:@selector(hideOtherApplications:)
|
||||||
keyEquivalent:@"h"];
|
keyEquivalent:@"h"];
|
||||||
[hideOtherItem setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)];
|
[hideOtherItem setKeyEquivalentModifierMask:(NSEventModifierFlagOption | NSEventModifierFlagCommand)];
|
||||||
|
|
||||||
// SHOW ALL
|
// SHOW ALL
|
||||||
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
||||||
@ -253,7 +251,7 @@
|
|||||||
// custom OpenGL view. See -[SFOpenGLView sfKeyUp:] for more details.
|
// custom OpenGL view. See -[SFOpenGLView sfKeyUp:] for more details.
|
||||||
|
|
||||||
id firstResponder = [[anEvent window] firstResponder];
|
id firstResponder = [[anEvent window] firstResponder];
|
||||||
if (([anEvent type] != NSKeyUp) || (![firstResponder tryToPerform:@selector(sfKeyUp:) with:anEvent]))
|
if (([anEvent type] != NSEventTypeKeyUp) || (![firstResponder tryToPerform:@selector(sfKeyUp:) with:anEvent]))
|
||||||
{
|
{
|
||||||
// It's either not a key up event or no responder has a sfKeyUp
|
// It's either not a key up event or no responder has a sfKeyUp
|
||||||
// message implemented.
|
// message implemented.
|
||||||
|
@ -77,7 +77,7 @@ SFContext::SFContext(SFContext* shared, const ContextSettings& settings, Vector2
|
|||||||
// Create a dummy window/view pair (hidden) and assign it our context.
|
// Create a dummy window/view pair (hidden) and assign it our context.
|
||||||
m_window = [[NSWindow alloc]
|
m_window = [[NSWindow alloc]
|
||||||
initWithContentRect:NSMakeRect(0, 0, size.x, size.y)
|
initWithContentRect:NSMakeRect(0, 0, size.x, size.y)
|
||||||
styleMask:NSBorderlessWindowMask
|
styleMask:NSWindowStyleMaskBorderless
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:NO]; // Don't defer it!
|
defer:NO]; // Don't defer it!
|
||||||
m_view = [[NSOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, size.x, size.y)];
|
m_view = [[NSOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, size.x, size.y)];
|
||||||
@ -148,7 +148,7 @@ void SFContext::setVerticalSyncEnabled(bool enabled)
|
|||||||
const AutoreleasePool pool;
|
const AutoreleasePool pool;
|
||||||
const GLint swapInterval = enabled;
|
const GLint swapInterval = enabled;
|
||||||
|
|
||||||
[m_context setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
|
[m_context setValues:&swapInterval forParameter:NSOpenGLContextParameterSwapInterval];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
#import <SFML/Window/macOS/SFKeyboardModifiersHelper.h>
|
#import <SFML/Window/macOS/SFKeyboardModifiersHelper.h>
|
||||||
#include <SFML/Window/macOS/WindowImplCocoa.hpp>
|
#include <SFML/Window/macOS/WindowImplCocoa.hpp>
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Here are define the mask value for the 'modifiers'
|
/// Here are define the mask value for the 'modifiers'
|
||||||
@ -163,10 +161,10 @@ sf::Event::KeyPressed keyPressedEventWithModifiers(NSUInteger modifiers, sf::Key
|
|||||||
sf::Event::KeyPressed event;
|
sf::Event::KeyPressed event;
|
||||||
event.code = key;
|
event.code = key;
|
||||||
event.scancode = code;
|
event.scancode = code;
|
||||||
event.alt = modifiers & NSAlternateKeyMask;
|
event.alt = modifiers & NSEventModifierFlagOption;
|
||||||
event.control = modifiers & NSControlKeyMask;
|
event.control = modifiers & NSEventModifierFlagControl;
|
||||||
event.shift = modifiers & NSShiftKeyMask;
|
event.shift = modifiers & NSEventModifierFlagShift;
|
||||||
event.system = modifiers & NSCommandKeyMask;
|
event.system = modifiers & NSEventModifierFlagCommand;
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,10 +175,10 @@ sf::Event::KeyReleased keyReleasedEventWithModifiers(NSUInteger modifiers, sf::K
|
|||||||
sf::Event::KeyReleased event;
|
sf::Event::KeyReleased event;
|
||||||
event.code = key;
|
event.code = key;
|
||||||
event.scancode = code;
|
event.scancode = code;
|
||||||
event.alt = modifiers & NSAlternateKeyMask;
|
event.alt = modifiers & NSEventModifierFlagOption;
|
||||||
event.control = modifiers & NSControlKeyMask;
|
event.control = modifiers & NSEventModifierFlagControl;
|
||||||
event.shift = modifiers & NSShiftKeyMask;
|
event.shift = modifiers & NSEventModifierFlagShift;
|
||||||
event.system = modifiers & NSCommandKeyMask;
|
event.system = modifiers & NSEventModifierFlagCommand;
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
#import <SFML/Window/macOS/SFOpenGLView+keyboard_priv.h>
|
#import <SFML/Window/macOS/SFOpenGLView+keyboard_priv.h>
|
||||||
#include <SFML/Window/macOS/WindowImplCocoa.hpp>
|
#include <SFML/Window/macOS/WindowImplCocoa.hpp>
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// In this file, we implement keyboard handling for SFOpenGLView
|
/// In this file, we implement keyboard handling for SFOpenGLView
|
||||||
///
|
///
|
||||||
|
@ -350,8 +350,8 @@
|
|||||||
// is dissociated from its position.
|
// is dissociated from its position.
|
||||||
|
|
||||||
// Ignore any non-move related event
|
// Ignore any non-move related event
|
||||||
if (([eventOrNil type] == NSMouseMoved) || ([eventOrNil type] == NSLeftMouseDragged) ||
|
if (([eventOrNil type] == NSEventTypeMouseMoved) || ([eventOrNil type] == NSEventTypeLeftMouseDragged) ||
|
||||||
([eventOrNil type] == NSRightMouseDragged) || ([eventOrNil type] == NSOtherMouseDragged))
|
([eventOrNil type] == NSEventTypeRightMouseDragged) || ([eventOrNil type] == NSEventTypeOtherMouseDragged))
|
||||||
{
|
{
|
||||||
// Without this factor, the cursor flies around waaay too fast!
|
// Without this factor, the cursor flies around waaay too fast!
|
||||||
// But I don't know if it because of retina display or because
|
// But I don't know if it because of retina display or because
|
||||||
|
@ -33,8 +33,6 @@
|
|||||||
|
|
||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// SFOpenGLView class: Privates Methods Declaration
|
/// SFOpenGLView class: Privates Methods Declaration
|
||||||
|
@ -177,7 +177,7 @@
|
|||||||
NSRect windowRect = NSMakeRect(0, 0, desktop.size.x, desktop.size.y);
|
NSRect windowRect = NSMakeRect(0, 0, desktop.size.x, desktop.size.y);
|
||||||
m_window = [[SFWindow alloc]
|
m_window = [[SFWindow alloc]
|
||||||
initWithContentRect:windowRect
|
initWithContentRect:windowRect
|
||||||
styleMask:NSBorderlessWindowMask
|
styleMask:NSWindowStyleMaskBorderless
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:NO];
|
defer:NO];
|
||||||
|
|
||||||
@ -243,13 +243,13 @@
|
|||||||
NSRect rect = NSMakeRect(0, 0, mode.size.x, mode.size.y);
|
NSRect rect = NSMakeRect(0, 0, mode.size.x, mode.size.y);
|
||||||
|
|
||||||
// Convert the SFML window style to Cocoa window style.
|
// Convert the SFML window style to Cocoa window style.
|
||||||
unsigned int nsStyle = NSBorderlessWindowMask;
|
unsigned int nsStyle = NSWindowStyleMaskBorderless;
|
||||||
if (style & sf::Style::Titlebar)
|
if (style & sf::Style::Titlebar)
|
||||||
nsStyle |= NSTitledWindowMask | NSMiniaturizableWindowMask;
|
nsStyle |= NSWindowStyleMaskTitled | NSWindowStyleMaskMiniaturizable;
|
||||||
if (style & sf::Style::Resize)
|
if (style & sf::Style::Resize)
|
||||||
nsStyle |= NSResizableWindowMask;
|
nsStyle |= NSWindowStyleMaskResizable;
|
||||||
if (style & sf::Style::Close)
|
if (style & sf::Style::Close)
|
||||||
nsStyle |= NSClosableWindowMask;
|
nsStyle |= NSWindowStyleMaskClosable;
|
||||||
|
|
||||||
// Create the window.
|
// Create the window.
|
||||||
m_window = [[SFWindow alloc]
|
m_window = [[SFWindow alloc]
|
||||||
@ -352,17 +352,17 @@
|
|||||||
- (void)setCursorGrabbed:(BOOL)grabbed
|
- (void)setCursorGrabbed:(BOOL)grabbed
|
||||||
{
|
{
|
||||||
// Remove or restore resizeable style if needed
|
// Remove or restore resizeable style if needed
|
||||||
BOOL resizeable = (([m_window styleMask] & NSResizableWindowMask) != 0) ? YES : NO;
|
BOOL resizeable = (([m_window styleMask] & NSWindowStyleMaskResizable) != 0) ? YES : NO;
|
||||||
if (grabbed && resizeable)
|
if (grabbed && resizeable)
|
||||||
{
|
{
|
||||||
m_restoreResize = YES;
|
m_restoreResize = YES;
|
||||||
NSUInteger newStyle = [m_window styleMask] & ~NSResizableWindowMask;
|
NSUInteger newStyle = [m_window styleMask] & ~NSWindowStyleMaskResizable;
|
||||||
[m_window setStyleMask:newStyle];
|
[m_window setStyleMask:newStyle];
|
||||||
}
|
}
|
||||||
else if (!grabbed && m_restoreResize)
|
else if (!grabbed && m_restoreResize)
|
||||||
{
|
{
|
||||||
m_restoreResize = NO;
|
m_restoreResize = NO;
|
||||||
NSUInteger newStyle = [m_window styleMask] | NSResizableWindowMask;
|
NSUInteger newStyle = [m_window styleMask] | NSWindowStyleMaskResizable;
|
||||||
[m_window setStyleMask:newStyle];
|
[m_window setStyleMask:newStyle];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,6 @@
|
|||||||
#include <SFML/Window/WindowEnums.hpp>
|
#include <SFML/Window/WindowEnums.hpp>
|
||||||
#include <SFML/Window/WindowImpl.hpp>
|
#include <SFML/Window/WindowImpl.hpp>
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Predefine OBJ-C classes
|
/// Predefine OBJ-C classes
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -387,5 +384,3 @@ private:
|
|||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
@ -36,9 +36,6 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
|
|
||||||
namespace sf::priv
|
namespace sf::priv
|
||||||
{
|
{
|
||||||
class WindowImplCocoa;
|
class WindowImplCocoa;
|
||||||
@ -252,5 +249,3 @@ class WindowImplCocoa;
|
|||||||
- (void)applyContext:(NSOpenGLContext*)context;
|
- (void)applyContext:(NSOpenGLContext*)context;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
Loading…
Reference in New Issue
Block a user