Consistently use getNativeHandle
function name
This commit is contained in:
parent
282dedd0d5
commit
1cca7cde7e
@ -155,7 +155,7 @@ protected:
|
||||
/// \return The internal (OS-specific) handle of the socket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketHandle getHandle() const;
|
||||
SocketHandle getNativeHandle() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create the internal representation of the socket
|
||||
|
@ -424,7 +424,7 @@ public:
|
||||
/// \return System handle of the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle getSystemHandle() const;
|
||||
WindowHandle getNativeHandle() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a Vulkan rendering surface
|
||||
|
@ -92,7 +92,7 @@ using WindowHandle = "platform-specific";
|
||||
/// On macOS, a sf::Window can be created either from an
|
||||
/// existing \p NSWindow* or an \p NSView*. When the window
|
||||
/// 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,
|
||||
/// which is a \p NSWindow* by default.
|
||||
///
|
||||
|
@ -91,7 +91,7 @@ bool Socket::isBlocking() const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
SocketHandle Socket::getHandle() const
|
||||
SocketHandle Socket::getNativeHandle() const
|
||||
{
|
||||
return m_socket;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ SocketSelector& SocketSelector::operator=(SocketSelector&&) noexcept = default;
|
||||
////////////////////////////////////////////////////////////
|
||||
void SocketSelector::add(Socket& socket)
|
||||
{
|
||||
const SocketHandle handle = socket.getHandle();
|
||||
const SocketHandle handle = socket.getNativeHandle();
|
||||
if (handle != priv::SocketImpl::invalidSocket())
|
||||
{
|
||||
|
||||
@ -132,7 +132,7 @@ void SocketSelector::add(Socket& socket)
|
||||
////////////////////////////////////////////////////////////
|
||||
void SocketSelector::remove(Socket& socket)
|
||||
{
|
||||
const SocketHandle handle = socket.getHandle();
|
||||
const SocketHandle handle = socket.getNativeHandle();
|
||||
if (handle != priv::SocketImpl::invalidSocket())
|
||||
{
|
||||
|
||||
@ -189,7 +189,7 @@ bool SocketSelector::wait(Time timeout)
|
||||
////////////////////////////////////////////////////////////
|
||||
bool SocketSelector::isReady(Socket& socket) const
|
||||
{
|
||||
const SocketHandle handle = socket.getHandle();
|
||||
const SocketHandle handle = socket.getNativeHandle();
|
||||
if (handle != priv::SocketImpl::invalidSocket())
|
||||
{
|
||||
|
||||
|
@ -45,12 +45,12 @@ TcpListener::TcpListener() : Socket(Type::Tcp)
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short TcpListener::getLocalPort() const
|
||||
{
|
||||
if (getHandle() != priv::SocketImpl::invalidSocket())
|
||||
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
||||
{
|
||||
// Retrieve information about the local end of the socket
|
||||
sockaddr_in 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);
|
||||
}
|
||||
@ -76,7 +76,7 @@ Socket::Status TcpListener::listen(unsigned short port, const IpAddress& address
|
||||
|
||||
// Bind the socket to the specified 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...
|
||||
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
|
||||
if (::listen(getHandle(), SOMAXCONN) == -1)
|
||||
if (::listen(getNativeHandle(), SOMAXCONN) == -1)
|
||||
{
|
||||
// Oops, socket is deaf
|
||||
err() << "Failed to listen to port " << port << std::endl;
|
||||
@ -107,7 +107,7 @@ void TcpListener::close()
|
||||
Socket::Status TcpListener::accept(TcpSocket& socket)
|
||||
{
|
||||
// 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;
|
||||
return Status::Error;
|
||||
@ -116,7 +116,7 @@ Socket::Status TcpListener::accept(TcpSocket& socket)
|
||||
// Accept a new connection
|
||||
sockaddr_in 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
|
||||
if (remote == priv::SocketImpl::invalidSocket())
|
||||
|
@ -63,12 +63,12 @@ TcpSocket::TcpSocket() : Socket(Type::Tcp)
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short TcpSocket::getLocalPort() const
|
||||
{
|
||||
if (getHandle() != priv::SocketImpl::invalidSocket())
|
||||
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
||||
{
|
||||
// Retrieve information about the local end of the socket
|
||||
sockaddr_in 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);
|
||||
}
|
||||
@ -82,12 +82,12 @@ unsigned short TcpSocket::getLocalPort() 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
|
||||
sockaddr_in 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));
|
||||
}
|
||||
@ -101,12 +101,12 @@ std::optional<IpAddress> TcpSocket::getRemoteAddress() 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
|
||||
sockaddr_in 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);
|
||||
}
|
||||
@ -134,7 +134,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
|
||||
// ----- We're not using a timeout: just try to connect -----
|
||||
|
||||
// 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();
|
||||
|
||||
// Connection succeeded
|
||||
@ -152,7 +152,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
|
||||
setBlocking(false);
|
||||
|
||||
// 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...)
|
||||
setBlocking(blocking);
|
||||
@ -172,7 +172,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
|
||||
// Setup the selector
|
||||
fd_set selector;
|
||||
FD_ZERO(&selector);
|
||||
FD_SET(getHandle(), &selector);
|
||||
FD_SET(getNativeHandle(), &selector);
|
||||
|
||||
// Setup the timeout
|
||||
timeval time;
|
||||
@ -180,7 +180,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
|
||||
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)
|
||||
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.
|
||||
// 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 ignored "-Wuseless-cast"
|
||||
// Send a chunk of data
|
||||
result = static_cast<int>(
|
||||
::send(getHandle(), static_cast<const char*>(data) + sent, static_cast<priv::SocketImpl::Size>(size - sent), flags));
|
||||
result = static_cast<int>(::send(getNativeHandle(),
|
||||
static_cast<const char*>(data) + sent,
|
||||
static_cast<priv::SocketImpl::Size>(size - sent),
|
||||
flags));
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// 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"
|
||||
// Receive a chunk of bytes
|
||||
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
|
||||
|
||||
// Check the number of bytes received
|
||||
|
@ -48,12 +48,12 @@ UdpSocket::UdpSocket() : Socket(Type::Udp)
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned short UdpSocket::getLocalPort() const
|
||||
{
|
||||
if (getHandle() != priv::SocketImpl::invalidSocket())
|
||||
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
||||
{
|
||||
// Retrieve information about the local end of the socket
|
||||
sockaddr_in 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);
|
||||
}
|
||||
@ -79,7 +79,7 @@ Socket::Status UdpSocket::bind(unsigned short port, const IpAddress& address)
|
||||
|
||||
// Bind the socket
|
||||
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;
|
||||
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"
|
||||
// Send the data (unlike TCP, all the data is always sent in one call)
|
||||
const int sent = static_cast<int>(
|
||||
sendto(getHandle(),
|
||||
sendto(getNativeHandle(),
|
||||
static_cast<const char*>(data),
|
||||
static_cast<priv::SocketImpl::Size>(size),
|
||||
0,
|
||||
@ -161,7 +161,7 @@ Socket::Status UdpSocket::receive(void* data,
|
||||
// Receive a chunk of bytes
|
||||
priv::SocketImpl::AddrLength addressSize = sizeof(address);
|
||||
const int sizeReceived = static_cast<int>(
|
||||
recvfrom(getHandle(),
|
||||
recvfrom(getNativeHandle(),
|
||||
static_cast<char*>(data),
|
||||
static_cast<priv::SocketImpl::Size>(size),
|
||||
0,
|
||||
|
@ -87,7 +87,7 @@ WindowImplAndroid::~WindowImplAndroid()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle WindowImplAndroid::getSystemHandle() const
|
||||
WindowHandle WindowImplAndroid::getNativeHandle() const
|
||||
{
|
||||
ActivityStates& states = getActivity();
|
||||
std::lock_guard lock(states.mutex);
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
/// \return Handle of the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle getSystemHandle() const override;
|
||||
WindowHandle getNativeHandle() const override;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the window
|
||||
|
@ -59,7 +59,7 @@ WindowImplDRM::~WindowImplDRM()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle WindowImplDRM::getSystemHandle() const
|
||||
WindowHandle WindowImplDRM::getNativeHandle() const
|
||||
{
|
||||
const Drm& drm = sf::priv::DRMContext::getDRM();
|
||||
return static_cast<WindowHandle>(drm.fileDescriptor);
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
/// \return Handle of the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle getSystemHandle() const override;
|
||||
WindowHandle getNativeHandle() const override;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the window
|
||||
|
@ -166,7 +166,7 @@ EglContext::EglContext(EglContext* shared,
|
||||
#if !defined(SFML_SYSTEM_ANDROID)
|
||||
// Create EGL surface (except on Android because the window is created
|
||||
// asynchronously, its activity manager will call it for us)
|
||||
createSurface(owner.getSystemHandle());
|
||||
createSurface(owner.getNativeHandle());
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, cons
|
||||
ensureExtensionsInit(m_display, DefaultScreen(m_display));
|
||||
|
||||
// Create the rendering surface from the owner window
|
||||
createSurface(owner.getSystemHandle());
|
||||
createSurface(owner.getNativeHandle());
|
||||
|
||||
// Create the context
|
||||
createContext(shared);
|
||||
|
@ -145,7 +145,7 @@ Vector2i InputImpl::getMousePosition()
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo)
|
||||
{
|
||||
const WindowHandle handle = relativeTo.getSystemHandle();
|
||||
const WindowHandle handle = relativeTo.getNativeHandle();
|
||||
if (handle)
|
||||
{
|
||||
// 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
|
||||
Display* display = openDisplay();
|
||||
|
||||
const WindowHandle handle = relativeTo.getSystemHandle();
|
||||
const WindowHandle handle = relativeTo.getNativeHandle();
|
||||
if (handle)
|
||||
{
|
||||
XWarpPointer(display, None, handle, 0, 0, 0, 0, position.x, position.y);
|
||||
|
@ -720,7 +720,7 @@ WindowImplX11::~WindowImplX11()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle WindowImplX11::getSystemHandle() const
|
||||
WindowHandle WindowImplX11::getNativeHandle() const
|
||||
{
|
||||
return m_window;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
/// \return Handle of the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle getSystemHandle() const override;
|
||||
WindowHandle getNativeHandle() const override;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the window
|
||||
|
@ -654,7 +654,7 @@ Vector2i InputImpl::getMousePosition()
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo)
|
||||
{
|
||||
WindowHandle handle = relativeTo.getSystemHandle();
|
||||
WindowHandle handle = relativeTo.getNativeHandle();
|
||||
if (handle)
|
||||
{
|
||||
POINT point;
|
||||
@ -679,7 +679,7 @@ void InputImpl::setMousePosition(const Vector2i& position)
|
||||
////////////////////////////////////////////////////////////
|
||||
void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& relativeTo)
|
||||
{
|
||||
WindowHandle handle = relativeTo.getSystemHandle();
|
||||
WindowHandle handle = relativeTo.getNativeHandle();
|
||||
if (handle)
|
||||
{
|
||||
POINT point = {position.x, position.y};
|
||||
|
@ -135,7 +135,7 @@ WglContext::WglContext(WglContext* shared, const ContextSettings& settings, cons
|
||||
m_settings = settings;
|
||||
|
||||
// Create the rendering surface from the owner window
|
||||
createSurface(owner.getSystemHandle(), bitsPerPixel);
|
||||
createSurface(owner.getNativeHandle(), bitsPerPixel);
|
||||
|
||||
// Create the context
|
||||
createContext(shared);
|
||||
|
@ -274,7 +274,7 @@ WindowImplWin32::~WindowImplWin32()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle WindowImplWin32::getSystemHandle() const
|
||||
WindowHandle WindowImplWin32::getNativeHandle() const
|
||||
{
|
||||
return m_handle;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
/// \return Handle of the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle getSystemHandle() const override;
|
||||
WindowHandle getNativeHandle() const override;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the window
|
||||
|
@ -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{};
|
||||
}
|
||||
|
||||
|
||||
|
@ -333,7 +333,7 @@ bool WindowImpl::createVulkanSurface([[maybe_unused]] const VkInstance&
|
||||
|
||||
#else
|
||||
|
||||
return VulkanImplType::createVulkanSurface(instance, getSystemHandle(), surface, allocator);
|
||||
return VulkanImplType::createVulkanSurface(instance, getNativeHandle(), surface, allocator);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
/// \return Handle of the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual WindowHandle getSystemHandle() const = 0;
|
||||
virtual WindowHandle getNativeHandle() const = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the window
|
||||
|
@ -179,7 +179,7 @@ std::vector<sf::Vector2i> touchPositions;
|
||||
#pragma GCC diagnostic push
|
||||
#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
|
||||
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
/// \return Handle of the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle getSystemHandle() const override;
|
||||
WindowHandle getNativeHandle() const override;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the window
|
||||
|
@ -94,7 +94,7 @@ void WindowImplUIKit::processEvents()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle WindowImplUIKit::getSystemHandle() const
|
||||
WindowHandle WindowImplUIKit::getNativeHandle() const
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
|
@ -55,7 +55,7 @@ namespace sf::priv
|
||||
////////////////////////////////////////////////////////////
|
||||
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 ...
|
||||
SFOpenGLView* view = nil;
|
||||
|
@ -111,7 +111,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
- (sf::WindowHandle)getSystemHandle
|
||||
- (sf::WindowHandle)getNativeHandle
|
||||
{
|
||||
return m_view;
|
||||
}
|
||||
|
@ -336,7 +336,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
- (sf::WindowHandle)getSystemHandle
|
||||
- (sf::WindowHandle)getNativeHandle
|
||||
{
|
||||
return m_window;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public:
|
||||
/// \return Handle of the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle getSystemHandle() const override;
|
||||
WindowHandle getNativeHandle() const override;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the window
|
||||
|
@ -390,10 +390,10 @@ void WindowImplCocoa::processEvents()
|
||||
#pragma mark WindowImplCocoa's private methods
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowHandle WindowImplCocoa::getSystemHandle() const
|
||||
WindowHandle WindowImplCocoa::getNativeHandle() const
|
||||
{
|
||||
const AutoreleasePool pool;
|
||||
return [m_delegate getSystemHandle];
|
||||
return [m_delegate getNativeHandle];
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ class WindowImplCocoa;
|
||||
/// \return Return the main view or window.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
- (sf::WindowHandle)getSystemHandle;
|
||||
- (sf::WindowHandle)getNativeHandle;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Determine where the mouse is
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
|
||||
using sf::Socket::close;
|
||||
using sf::Socket::create;
|
||||
using sf::Socket::getHandle;
|
||||
using sf::Socket::getNativeHandle;
|
||||
};
|
||||
|
||||
TEST_CASE("[Network] sf::Socket")
|
||||
@ -38,7 +38,7 @@ TEST_CASE("[Network] sf::Socket")
|
||||
{
|
||||
const TestSocket testSocket;
|
||||
CHECK(testSocket.isBlocking());
|
||||
CHECK(testSocket.getHandle() == invalidHandle);
|
||||
CHECK(testSocket.getNativeHandle() == invalidHandle);
|
||||
}
|
||||
|
||||
SECTION("Move semantics")
|
||||
@ -50,7 +50,7 @@ TEST_CASE("[Network] sf::Socket")
|
||||
movedTestSocket.create();
|
||||
const TestSocket testSocket(std::move(movedTestSocket));
|
||||
CHECK(!testSocket.isBlocking());
|
||||
CHECK(testSocket.getHandle() != invalidHandle);
|
||||
CHECK(testSocket.getNativeHandle() != invalidHandle);
|
||||
}
|
||||
|
||||
SECTION("Assignment")
|
||||
@ -61,7 +61,7 @@ TEST_CASE("[Network] sf::Socket")
|
||||
TestSocket testSocket;
|
||||
testSocket = std::move(movedTestSocket);
|
||||
CHECK(!testSocket.isBlocking());
|
||||
CHECK(testSocket.getHandle() != invalidHandle);
|
||||
CHECK(testSocket.getNativeHandle() != invalidHandle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,12 +77,12 @@ TEST_CASE("[Network] sf::Socket")
|
||||
TestSocket testSocket;
|
||||
testSocket.create();
|
||||
CHECK(testSocket.isBlocking());
|
||||
CHECK(testSocket.getHandle() != invalidHandle);
|
||||
CHECK(testSocket.getNativeHandle() != invalidHandle);
|
||||
|
||||
// Recreate socket to ensure nothing changed
|
||||
testSocket.create();
|
||||
CHECK(testSocket.isBlocking());
|
||||
CHECK(testSocket.getHandle() != invalidHandle);
|
||||
CHECK(testSocket.getNativeHandle() != invalidHandle);
|
||||
}
|
||||
|
||||
SECTION("close()")
|
||||
@ -90,14 +90,14 @@ TEST_CASE("[Network] sf::Socket")
|
||||
TestSocket testSocket;
|
||||
testSocket.create();
|
||||
CHECK(testSocket.isBlocking());
|
||||
CHECK(testSocket.getHandle() != invalidHandle);
|
||||
CHECK(testSocket.getNativeHandle() != invalidHandle);
|
||||
testSocket.close();
|
||||
CHECK(testSocket.isBlocking());
|
||||
CHECK(testSocket.getHandle() == invalidHandle);
|
||||
CHECK(testSocket.getNativeHandle() == invalidHandle);
|
||||
|
||||
// Reclose socket to ensure nothing changed
|
||||
testSocket.close();
|
||||
CHECK(testSocket.isBlocking());
|
||||
CHECK(testSocket.getHandle() == invalidHandle);
|
||||
CHECK(testSocket.getNativeHandle() == invalidHandle);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ TEST_CASE("[Window] sf::WindowBase", runDisplayTests())
|
||||
CHECK(windowBase.getPosition() == sf::Vector2i());
|
||||
CHECK(windowBase.getSize() == sf::Vector2u());
|
||||
CHECK(!windowBase.hasFocus());
|
||||
CHECK(windowBase.getSystemHandle() == sf::WindowHandle());
|
||||
CHECK(windowBase.getNativeHandle() == sf::WindowHandle());
|
||||
}
|
||||
|
||||
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");
|
||||
CHECK(windowBase.isOpen());
|
||||
CHECK(windowBase.getSize() == sf::Vector2u(360, 240));
|
||||
CHECK(windowBase.getSystemHandle() != sf::WindowHandle());
|
||||
CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
|
||||
}
|
||||
|
||||
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);
|
||||
CHECK(windowBase.isOpen());
|
||||
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");
|
||||
CHECK(windowBase.isOpen());
|
||||
CHECK(windowBase.getSize() == sf::Vector2u(240, 360));
|
||||
CHECK(windowBase.getSystemHandle() != sf::WindowHandle());
|
||||
CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
|
||||
}
|
||||
|
||||
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);
|
||||
CHECK(windowBase.isOpen());
|
||||
CHECK(windowBase.getSize() == sf::Vector2u(240, 360));
|
||||
CHECK(windowBase.getSystemHandle() != sf::WindowHandle());
|
||||
CHECK(windowBase.getNativeHandle() != sf::WindowHandle());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user