Consistently use getNativeHandle function name

This commit is contained in:
Chris Thrasher 2023-08-27 15:34:31 -06:00
parent 282dedd0d5
commit 1cca7cde7e
35 changed files with 76 additions and 74 deletions

View File

@ -155,7 +155,7 @@ protected:
/// \return The internal (OS-specific) handle of the socket /// \return The internal (OS-specific) handle of the socket
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
SocketHandle getHandle() const; SocketHandle getNativeHandle() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Create the internal representation of the socket /// \brief Create the internal representation of the socket

View File

@ -424,7 +424,7 @@ public:
/// \return System handle of the window /// \return System handle of the window
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle getSystemHandle() const; WindowHandle getNativeHandle() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Create a Vulkan rendering surface /// \brief Create a Vulkan rendering surface

View File

@ -92,7 +92,7 @@ using WindowHandle = "platform-specific";
/// On macOS, a sf::Window can be created either from an /// On macOS, a sf::Window can be created either from an
/// existing \p NSWindow* or an \p NSView*. When the window /// existing \p NSWindow* or an \p NSView*. When the window
/// is created from a window, SFML will use its content view /// is created from a window, SFML will use its content view
/// as the OpenGL area. sf::Window::getSystemHandle() will /// as the OpenGL area. sf::Window::getNativeHandle() will
/// return the handle that was used to create the window, /// return the handle that was used to create the window,
/// which is a \p NSWindow* by default. /// which is a \p NSWindow* by default.
/// ///

View File

@ -91,7 +91,7 @@ bool Socket::isBlocking() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
SocketHandle Socket::getHandle() const SocketHandle Socket::getNativeHandle() const
{ {
return m_socket; return m_socket;
} }

View File

@ -90,7 +90,7 @@ SocketSelector& SocketSelector::operator=(SocketSelector&&) noexcept = default;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SocketSelector::add(Socket& socket) void SocketSelector::add(Socket& socket)
{ {
const SocketHandle handle = socket.getHandle(); const SocketHandle handle = socket.getNativeHandle();
if (handle != priv::SocketImpl::invalidSocket()) if (handle != priv::SocketImpl::invalidSocket())
{ {
@ -132,7 +132,7 @@ void SocketSelector::add(Socket& socket)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SocketSelector::remove(Socket& socket) void SocketSelector::remove(Socket& socket)
{ {
const SocketHandle handle = socket.getHandle(); const SocketHandle handle = socket.getNativeHandle();
if (handle != priv::SocketImpl::invalidSocket()) if (handle != priv::SocketImpl::invalidSocket())
{ {
@ -189,7 +189,7 @@ bool SocketSelector::wait(Time timeout)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool SocketSelector::isReady(Socket& socket) const bool SocketSelector::isReady(Socket& socket) const
{ {
const SocketHandle handle = socket.getHandle(); const SocketHandle handle = socket.getNativeHandle();
if (handle != priv::SocketImpl::invalidSocket()) if (handle != priv::SocketImpl::invalidSocket())
{ {

View File

@ -45,12 +45,12 @@ TcpListener::TcpListener() : Socket(Type::Tcp)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned short TcpListener::getLocalPort() const unsigned short TcpListener::getLocalPort() const
{ {
if (getHandle() != priv::SocketImpl::invalidSocket()) if (getNativeHandle() != priv::SocketImpl::invalidSocket())
{ {
// Retrieve information about the local end of the socket // Retrieve information about the local end of the socket
sockaddr_in address; sockaddr_in address;
priv::SocketImpl::AddrLength size = sizeof(address); priv::SocketImpl::AddrLength size = sizeof(address);
if (getsockname(getHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1) if (getsockname(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
{ {
return ntohs(address.sin_port); return ntohs(address.sin_port);
} }
@ -76,7 +76,7 @@ Socket::Status TcpListener::listen(unsigned short port, const IpAddress& address
// Bind the socket to the specified port // Bind the socket to the specified port
sockaddr_in addr = priv::SocketImpl::createAddress(address.toInteger(), port); sockaddr_in addr = priv::SocketImpl::createAddress(address.toInteger(), port);
if (bind(getHandle(), reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) == -1) if (bind(getNativeHandle(), reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) == -1)
{ {
// Not likely to happen, but... // Not likely to happen, but...
err() << "Failed to bind listener socket to port " << port << std::endl; err() << "Failed to bind listener socket to port " << port << std::endl;
@ -84,7 +84,7 @@ Socket::Status TcpListener::listen(unsigned short port, const IpAddress& address
} }
// Listen to the bound port // Listen to the bound port
if (::listen(getHandle(), SOMAXCONN) == -1) if (::listen(getNativeHandle(), SOMAXCONN) == -1)
{ {
// Oops, socket is deaf // Oops, socket is deaf
err() << "Failed to listen to port " << port << std::endl; err() << "Failed to listen to port " << port << std::endl;
@ -107,7 +107,7 @@ void TcpListener::close()
Socket::Status TcpListener::accept(TcpSocket& socket) Socket::Status TcpListener::accept(TcpSocket& socket)
{ {
// Make sure that we're listening // Make sure that we're listening
if (getHandle() == priv::SocketImpl::invalidSocket()) if (getNativeHandle() == priv::SocketImpl::invalidSocket())
{ {
err() << "Failed to accept a new connection, the socket is not listening" << std::endl; err() << "Failed to accept a new connection, the socket is not listening" << std::endl;
return Status::Error; return Status::Error;
@ -116,7 +116,7 @@ Socket::Status TcpListener::accept(TcpSocket& socket)
// Accept a new connection // Accept a new connection
sockaddr_in address; sockaddr_in address;
priv::SocketImpl::AddrLength length = sizeof(address); priv::SocketImpl::AddrLength length = sizeof(address);
const SocketHandle remote = ::accept(getHandle(), reinterpret_cast<sockaddr*>(&address), &length); const SocketHandle remote = ::accept(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &length);
// Check for errors // Check for errors
if (remote == priv::SocketImpl::invalidSocket()) if (remote == priv::SocketImpl::invalidSocket())

View File

@ -63,12 +63,12 @@ TcpSocket::TcpSocket() : Socket(Type::Tcp)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned short TcpSocket::getLocalPort() const unsigned short TcpSocket::getLocalPort() const
{ {
if (getHandle() != priv::SocketImpl::invalidSocket()) if (getNativeHandle() != priv::SocketImpl::invalidSocket())
{ {
// Retrieve information about the local end of the socket // Retrieve information about the local end of the socket
sockaddr_in address; sockaddr_in address;
priv::SocketImpl::AddrLength size = sizeof(address); priv::SocketImpl::AddrLength size = sizeof(address);
if (getsockname(getHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1) if (getsockname(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
{ {
return ntohs(address.sin_port); return ntohs(address.sin_port);
} }
@ -82,12 +82,12 @@ unsigned short TcpSocket::getLocalPort() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
std::optional<IpAddress> TcpSocket::getRemoteAddress() const std::optional<IpAddress> TcpSocket::getRemoteAddress() const
{ {
if (getHandle() != priv::SocketImpl::invalidSocket()) if (getNativeHandle() != priv::SocketImpl::invalidSocket())
{ {
// Retrieve information about the remote end of the socket // Retrieve information about the remote end of the socket
sockaddr_in address; sockaddr_in address;
priv::SocketImpl::AddrLength size = sizeof(address); priv::SocketImpl::AddrLength size = sizeof(address);
if (getpeername(getHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1) if (getpeername(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
{ {
return IpAddress(ntohl(address.sin_addr.s_addr)); return IpAddress(ntohl(address.sin_addr.s_addr));
} }
@ -101,12 +101,12 @@ std::optional<IpAddress> TcpSocket::getRemoteAddress() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned short TcpSocket::getRemotePort() const unsigned short TcpSocket::getRemotePort() const
{ {
if (getHandle() != priv::SocketImpl::invalidSocket()) if (getNativeHandle() != priv::SocketImpl::invalidSocket())
{ {
// Retrieve information about the remote end of the socket // Retrieve information about the remote end of the socket
sockaddr_in address; sockaddr_in address;
priv::SocketImpl::AddrLength size = sizeof(address); priv::SocketImpl::AddrLength size = sizeof(address);
if (getpeername(getHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1) if (getpeername(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
{ {
return ntohs(address.sin_port); return ntohs(address.sin_port);
} }
@ -134,7 +134,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
// ----- We're not using a timeout: just try to connect ----- // ----- We're not using a timeout: just try to connect -----
// Connect the socket // Connect the socket
if (::connect(getHandle(), reinterpret_cast<sockaddr*>(&address), sizeof(address)) == -1) if (::connect(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), sizeof(address)) == -1)
return priv::SocketImpl::getErrorStatus(); return priv::SocketImpl::getErrorStatus();
// Connection succeeded // Connection succeeded
@ -152,7 +152,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
setBlocking(false); setBlocking(false);
// Try to connect to the remote address // Try to connect to the remote address
if (::connect(getHandle(), reinterpret_cast<sockaddr*>(&address), sizeof(address)) >= 0) if (::connect(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), sizeof(address)) >= 0)
{ {
// We got instantly connected! (it may no happen a lot...) // We got instantly connected! (it may no happen a lot...)
setBlocking(blocking); setBlocking(blocking);
@ -172,7 +172,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
// Setup the selector // Setup the selector
fd_set selector; fd_set selector;
FD_ZERO(&selector); FD_ZERO(&selector);
FD_SET(getHandle(), &selector); FD_SET(getNativeHandle(), &selector);
// Setup the timeout // Setup the timeout
timeval time; timeval time;
@ -180,7 +180,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
time.tv_usec = static_cast<int>(timeout.asMicroseconds() % 1000000); time.tv_usec = static_cast<int>(timeout.asMicroseconds() % 1000000);
// Wait for something to write on our socket (which means that the connection request has returned) // Wait for something to write on our socket (which means that the connection request has returned)
if (select(static_cast<int>(getHandle() + 1), nullptr, &selector, nullptr, &time) > 0) if (select(static_cast<int>(getNativeHandle() + 1), nullptr, &selector, nullptr, &time) > 0)
{ {
// At this point the connection may have been either accepted or refused. // At this point the connection may have been either accepted or refused.
// To know whether it's a success or a failure, we must check the address of the connected peer // To know whether it's a success or a failure, we must check the address of the connected peer
@ -250,8 +250,10 @@ Socket::Status TcpSocket::send(const void* data, std::size_t size, std::size_t&
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wuseless-cast"
// Send a chunk of data // Send a chunk of data
result = static_cast<int>( result = static_cast<int>(::send(getNativeHandle(),
::send(getHandle(), static_cast<const char*>(data) + sent, static_cast<priv::SocketImpl::Size>(size - sent), flags)); static_cast<const char*>(data) + sent,
static_cast<priv::SocketImpl::Size>(size - sent),
flags));
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
// Check for errors // Check for errors
@ -287,7 +289,7 @@ Socket::Status TcpSocket::receive(void* data, std::size_t size, std::size_t& rec
#pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wuseless-cast"
// Receive a chunk of bytes // Receive a chunk of bytes
const int sizeReceived = static_cast<int>( const int sizeReceived = static_cast<int>(
recv(getHandle(), static_cast<char*>(data), static_cast<priv::SocketImpl::Size>(size), flags)); recv(getNativeHandle(), static_cast<char*>(data), static_cast<priv::SocketImpl::Size>(size), flags));
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
// Check the number of bytes received // Check the number of bytes received

View File

@ -48,12 +48,12 @@ UdpSocket::UdpSocket() : Socket(Type::Udp)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
unsigned short UdpSocket::getLocalPort() const unsigned short UdpSocket::getLocalPort() const
{ {
if (getHandle() != priv::SocketImpl::invalidSocket()) if (getNativeHandle() != priv::SocketImpl::invalidSocket())
{ {
// Retrieve information about the local end of the socket // Retrieve information about the local end of the socket
sockaddr_in address; sockaddr_in address;
priv::SocketImpl::AddrLength size = sizeof(address); priv::SocketImpl::AddrLength size = sizeof(address);
if (getsockname(getHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1) if (getsockname(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
{ {
return ntohs(address.sin_port); return ntohs(address.sin_port);
} }
@ -79,7 +79,7 @@ Socket::Status UdpSocket::bind(unsigned short port, const IpAddress& address)
// Bind the socket // Bind the socket
sockaddr_in addr = priv::SocketImpl::createAddress(address.toInteger(), port); sockaddr_in addr = priv::SocketImpl::createAddress(address.toInteger(), port);
if (::bind(getHandle(), reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) == -1) if (::bind(getNativeHandle(), reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) == -1)
{ {
err() << "Failed to bind socket to port " << port << std::endl; err() << "Failed to bind socket to port " << port << std::endl;
return Status::Error; return Status::Error;
@ -118,7 +118,7 @@ Socket::Status UdpSocket::send(const void* data, std::size_t size, const IpAddre
#pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wuseless-cast"
// Send the data (unlike TCP, all the data is always sent in one call) // Send the data (unlike TCP, all the data is always sent in one call)
const int sent = static_cast<int>( const int sent = static_cast<int>(
sendto(getHandle(), sendto(getNativeHandle(),
static_cast<const char*>(data), static_cast<const char*>(data),
static_cast<priv::SocketImpl::Size>(size), static_cast<priv::SocketImpl::Size>(size),
0, 0,
@ -161,7 +161,7 @@ Socket::Status UdpSocket::receive(void* data,
// Receive a chunk of bytes // Receive a chunk of bytes
priv::SocketImpl::AddrLength addressSize = sizeof(address); priv::SocketImpl::AddrLength addressSize = sizeof(address);
const int sizeReceived = static_cast<int>( const int sizeReceived = static_cast<int>(
recvfrom(getHandle(), recvfrom(getNativeHandle(),
static_cast<char*>(data), static_cast<char*>(data),
static_cast<priv::SocketImpl::Size>(size), static_cast<priv::SocketImpl::Size>(size),
0, 0,

View File

@ -87,7 +87,7 @@ WindowImplAndroid::~WindowImplAndroid()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle WindowImplAndroid::getSystemHandle() const WindowHandle WindowImplAndroid::getNativeHandle() const
{ {
ActivityStates& states = getActivity(); ActivityStates& states = getActivity();
std::lock_guard lock(states.mutex); std::lock_guard lock(states.mutex);

View File

@ -76,7 +76,7 @@ public:
/// \return Handle of the window /// \return Handle of the window
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle getSystemHandle() const override; WindowHandle getNativeHandle() const override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the position of the window /// \brief Get the position of the window

View File

@ -59,7 +59,7 @@ WindowImplDRM::~WindowImplDRM()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle WindowImplDRM::getSystemHandle() const WindowHandle WindowImplDRM::getNativeHandle() const
{ {
const Drm& drm = sf::priv::DRMContext::getDRM(); const Drm& drm = sf::priv::DRMContext::getDRM();
return static_cast<WindowHandle>(drm.fileDescriptor); return static_cast<WindowHandle>(drm.fileDescriptor);

View File

@ -70,7 +70,7 @@ public:
/// \return Handle of the window /// \return Handle of the window
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle getSystemHandle() const override; WindowHandle getNativeHandle() const override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the position of the window /// \brief Get the position of the window

View File

@ -166,7 +166,7 @@ EglContext::EglContext(EglContext* shared,
#if !defined(SFML_SYSTEM_ANDROID) #if !defined(SFML_SYSTEM_ANDROID)
// Create EGL surface (except on Android because the window is created // Create EGL surface (except on Android because the window is created
// asynchronously, its activity manager will call it for us) // asynchronously, its activity manager will call it for us)
createSurface(owner.getSystemHandle()); createSurface(owner.getNativeHandle());
#endif #endif
} }

View File

@ -138,7 +138,7 @@ GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, cons
ensureExtensionsInit(m_display, DefaultScreen(m_display)); ensureExtensionsInit(m_display, DefaultScreen(m_display));
// Create the rendering surface from the owner window // Create the rendering surface from the owner window
createSurface(owner.getSystemHandle()); createSurface(owner.getNativeHandle());
// Create the context // Create the context
createContext(shared); createContext(shared);

View File

@ -145,7 +145,7 @@ Vector2i InputImpl::getMousePosition()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo) Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo)
{ {
const WindowHandle handle = relativeTo.getSystemHandle(); const WindowHandle handle = relativeTo.getNativeHandle();
if (handle) if (handle)
{ {
// Open a connection with the X server // Open a connection with the X server
@ -194,7 +194,7 @@ void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& rel
// Open a connection with the X server // Open a connection with the X server
Display* display = openDisplay(); Display* display = openDisplay();
const WindowHandle handle = relativeTo.getSystemHandle(); const WindowHandle handle = relativeTo.getNativeHandle();
if (handle) if (handle)
{ {
XWarpPointer(display, None, handle, 0, 0, 0, 0, position.x, position.y); XWarpPointer(display, None, handle, 0, 0, 0, 0, position.x, position.y);

View File

@ -720,7 +720,7 @@ WindowImplX11::~WindowImplX11()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle WindowImplX11::getSystemHandle() const WindowHandle WindowImplX11::getNativeHandle() const
{ {
return m_window; return m_window;
} }

View File

@ -77,7 +77,7 @@ public:
/// \return Handle of the window /// \return Handle of the window
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle getSystemHandle() const override; WindowHandle getNativeHandle() const override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the position of the window /// \brief Get the position of the window

View File

@ -654,7 +654,7 @@ Vector2i InputImpl::getMousePosition()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo) Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo)
{ {
WindowHandle handle = relativeTo.getSystemHandle(); WindowHandle handle = relativeTo.getNativeHandle();
if (handle) if (handle)
{ {
POINT point; POINT point;
@ -679,7 +679,7 @@ void InputImpl::setMousePosition(const Vector2i& position)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& relativeTo) void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& relativeTo)
{ {
WindowHandle handle = relativeTo.getSystemHandle(); WindowHandle handle = relativeTo.getNativeHandle();
if (handle) if (handle)
{ {
POINT point = {position.x, position.y}; POINT point = {position.x, position.y};

View File

@ -135,7 +135,7 @@ WglContext::WglContext(WglContext* shared, const ContextSettings& settings, cons
m_settings = settings; m_settings = settings;
// Create the rendering surface from the owner window // Create the rendering surface from the owner window
createSurface(owner.getSystemHandle(), bitsPerPixel); createSurface(owner.getNativeHandle(), bitsPerPixel);
// Create the context // Create the context
createContext(shared); createContext(shared);

View File

@ -274,7 +274,7 @@ WindowImplWin32::~WindowImplWin32()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle WindowImplWin32::getSystemHandle() const WindowHandle WindowImplWin32::getNativeHandle() const
{ {
return m_handle; return m_handle;
} }

View File

@ -77,7 +77,7 @@ public:
/// \return Handle of the window /// \return Handle of the window
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle getSystemHandle() const override; WindowHandle getNativeHandle() const override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the position of the window /// \brief Get the position of the window

View File

@ -352,9 +352,9 @@ bool WindowBase::hasFocus() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle WindowBase::getSystemHandle() const WindowHandle WindowBase::getNativeHandle() const
{ {
return m_impl ? m_impl->getSystemHandle() : WindowHandle{}; return m_impl ? m_impl->getNativeHandle() : WindowHandle{};
} }

View File

@ -333,7 +333,7 @@ bool WindowImpl::createVulkanSurface([[maybe_unused]] const VkInstance&
#else #else
return VulkanImplType::createVulkanSurface(instance, getSystemHandle(), surface, allocator); return VulkanImplType::createVulkanSurface(instance, getNativeHandle(), surface, allocator);
#endif #endif
} }

View File

@ -133,7 +133,7 @@ public:
/// \return Handle of the window /// \return Handle of the window
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
virtual WindowHandle getSystemHandle() const = 0; virtual WindowHandle getNativeHandle() const = 0;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the position of the window /// \brief Get the position of the window

View File

@ -179,7 +179,7 @@ std::vector<sf::Vector2i> touchPositions;
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wold-style-cast"
UIViewController* rootViewController = [((__bridge UIWindow*)(self.sfWindow->getSystemHandle())) rootViewController]; UIViewController* rootViewController = [((__bridge UIWindow*)(self.sfWindow->getNativeHandle())) rootViewController];
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View File

@ -71,7 +71,7 @@ public:
/// \return Handle of the window /// \return Handle of the window
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle getSystemHandle() const override; WindowHandle getNativeHandle() const override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the position of the window /// \brief Get the position of the window

View File

@ -94,7 +94,7 @@ void WindowImplUIKit::processEvents()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle WindowImplUIKit::getSystemHandle() const WindowHandle WindowImplUIKit::getNativeHandle() const
{ {
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wold-style-cast"

View File

@ -55,7 +55,7 @@ namespace sf::priv
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
SFOpenGLView* getSFOpenGLViewFromSFMLWindow(const WindowBase& window) SFOpenGLView* getSFOpenGLViewFromSFMLWindow(const WindowBase& window)
{ {
const id nsHandle = static_cast<id>(window.getSystemHandle()); const id nsHandle = static_cast<id>(window.getNativeHandle());
// Get our SFOpenGLView from ... // Get our SFOpenGLView from ...
SFOpenGLView* view = nil; SFOpenGLView* view = nil;

View File

@ -111,7 +111,7 @@
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
- (sf::WindowHandle)getSystemHandle - (sf::WindowHandle)getNativeHandle
{ {
return m_view; return m_view;
} }

View File

@ -336,7 +336,7 @@
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
- (sf::WindowHandle)getSystemHandle - (sf::WindowHandle)getNativeHandle
{ {
return m_window; return m_window;
} }

View File

@ -245,7 +245,7 @@ public:
/// \return Handle of the window /// \return Handle of the window
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle getSystemHandle() const override; WindowHandle getNativeHandle() const override;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the position of the window /// \brief Get the position of the window

View File

@ -390,10 +390,10 @@ void WindowImplCocoa::processEvents()
#pragma mark WindowImplCocoa's private methods #pragma mark WindowImplCocoa's private methods
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowHandle WindowImplCocoa::getSystemHandle() const WindowHandle WindowImplCocoa::getNativeHandle() const
{ {
const AutoreleasePool pool; const AutoreleasePool pool;
return [m_delegate getSystemHandle]; return [m_delegate getNativeHandle];
} }

View File

@ -91,7 +91,7 @@ class WindowImplCocoa;
/// \return Return the main view or window. /// \return Return the main view or window.
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
- (sf::WindowHandle)getSystemHandle; - (sf::WindowHandle)getNativeHandle;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Determine where the mouse is /// \brief Determine where the mouse is

View File

@ -13,7 +13,7 @@ public:
using sf::Socket::close; using sf::Socket::close;
using sf::Socket::create; using sf::Socket::create;
using sf::Socket::getHandle; using sf::Socket::getNativeHandle;
}; };
TEST_CASE("[Network] sf::Socket") TEST_CASE("[Network] sf::Socket")
@ -38,7 +38,7 @@ TEST_CASE("[Network] sf::Socket")
{ {
const TestSocket testSocket; const TestSocket testSocket;
CHECK(testSocket.isBlocking()); CHECK(testSocket.isBlocking());
CHECK(testSocket.getHandle() == invalidHandle); CHECK(testSocket.getNativeHandle() == invalidHandle);
} }
SECTION("Move semantics") SECTION("Move semantics")
@ -50,7 +50,7 @@ TEST_CASE("[Network] sf::Socket")
movedTestSocket.create(); movedTestSocket.create();
const TestSocket testSocket(std::move(movedTestSocket)); const TestSocket testSocket(std::move(movedTestSocket));
CHECK(!testSocket.isBlocking()); CHECK(!testSocket.isBlocking());
CHECK(testSocket.getHandle() != invalidHandle); CHECK(testSocket.getNativeHandle() != invalidHandle);
} }
SECTION("Assignment") SECTION("Assignment")
@ -61,7 +61,7 @@ TEST_CASE("[Network] sf::Socket")
TestSocket testSocket; TestSocket testSocket;
testSocket = std::move(movedTestSocket); testSocket = std::move(movedTestSocket);
CHECK(!testSocket.isBlocking()); CHECK(!testSocket.isBlocking());
CHECK(testSocket.getHandle() != invalidHandle); CHECK(testSocket.getNativeHandle() != invalidHandle);
} }
} }
@ -77,12 +77,12 @@ TEST_CASE("[Network] sf::Socket")
TestSocket testSocket; TestSocket testSocket;
testSocket.create(); testSocket.create();
CHECK(testSocket.isBlocking()); CHECK(testSocket.isBlocking());
CHECK(testSocket.getHandle() != invalidHandle); CHECK(testSocket.getNativeHandle() != invalidHandle);
// Recreate socket to ensure nothing changed // Recreate socket to ensure nothing changed
testSocket.create(); testSocket.create();
CHECK(testSocket.isBlocking()); CHECK(testSocket.isBlocking());
CHECK(testSocket.getHandle() != invalidHandle); CHECK(testSocket.getNativeHandle() != invalidHandle);
} }
SECTION("close()") SECTION("close()")
@ -90,14 +90,14 @@ TEST_CASE("[Network] sf::Socket")
TestSocket testSocket; TestSocket testSocket;
testSocket.create(); testSocket.create();
CHECK(testSocket.isBlocking()); CHECK(testSocket.isBlocking());
CHECK(testSocket.getHandle() != invalidHandle); CHECK(testSocket.getNativeHandle() != invalidHandle);
testSocket.close(); testSocket.close();
CHECK(testSocket.isBlocking()); CHECK(testSocket.isBlocking());
CHECK(testSocket.getHandle() == invalidHandle); CHECK(testSocket.getNativeHandle() == invalidHandle);
// Reclose socket to ensure nothing changed // Reclose socket to ensure nothing changed
testSocket.close(); testSocket.close();
CHECK(testSocket.isBlocking()); CHECK(testSocket.isBlocking());
CHECK(testSocket.getHandle() == invalidHandle); CHECK(testSocket.getNativeHandle() == invalidHandle);
} }
} }

View File

@ -30,7 +30,7 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests())
CHECK(windowBase.getPosition() == sf::Vector2i()); CHECK(windowBase.getPosition() == sf::Vector2i());
CHECK(windowBase.getSize() == sf::Vector2u()); CHECK(windowBase.getSize() == sf::Vector2u());
CHECK(!windowBase.hasFocus()); CHECK(!windowBase.hasFocus());
CHECK(windowBase.getSystemHandle() == sf::WindowHandle()); CHECK(windowBase.getNativeHandle() == sf::WindowHandle());
} }
SECTION("Mode and title constructor") SECTION("Mode and title constructor")
@ -38,7 +38,7 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests())
const sf::WindowBase windowBase(sf::VideoMode({360, 240}), "WindowBase Tests"); const sf::WindowBase windowBase(sf::VideoMode({360, 240}), "WindowBase Tests");
CHECK(windowBase.isOpen()); CHECK(windowBase.isOpen());
CHECK(windowBase.getSize() == sf::Vector2u(360, 240)); CHECK(windowBase.getSize() == sf::Vector2u(360, 240));
CHECK(windowBase.getSystemHandle() != sf::WindowHandle()); CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
} }
SECTION("Mode, title, and style constructor") SECTION("Mode, title, and style constructor")
@ -46,7 +46,7 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests())
const sf::WindowBase windowBase(sf::VideoMode({360, 240}), "WindowBase Tests", sf::Style::Resize); const sf::WindowBase windowBase(sf::VideoMode({360, 240}), "WindowBase Tests", sf::Style::Resize);
CHECK(windowBase.isOpen()); CHECK(windowBase.isOpen());
CHECK(windowBase.getSize() == sf::Vector2u(360, 240)); CHECK(windowBase.getSize() == sf::Vector2u(360, 240));
CHECK(windowBase.getSystemHandle() != sf::WindowHandle()); CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
} }
} }
@ -59,7 +59,7 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests())
windowBase.create(sf::VideoMode({240, 360}), "WindowBase Tests"); windowBase.create(sf::VideoMode({240, 360}), "WindowBase Tests");
CHECK(windowBase.isOpen()); CHECK(windowBase.isOpen());
CHECK(windowBase.getSize() == sf::Vector2u(240, 360)); CHECK(windowBase.getSize() == sf::Vector2u(240, 360));
CHECK(windowBase.getSystemHandle() != sf::WindowHandle()); CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
} }
SECTION("Mode, title, and style") SECTION("Mode, title, and style")
@ -67,7 +67,7 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests())
windowBase.create(sf::VideoMode({240, 360}), "WindowBase Tests", sf::Style::Resize); windowBase.create(sf::VideoMode({240, 360}), "WindowBase Tests", sf::Style::Resize);
CHECK(windowBase.isOpen()); CHECK(windowBase.isOpen());
CHECK(windowBase.getSize() == sf::Vector2u(240, 360)); CHECK(windowBase.getSize() == sf::Vector2u(240, 360));
CHECK(windowBase.getSystemHandle() != sf::WindowHandle()); CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
} }
} }