Use in-class member initializers

This commit is contained in:
Chris Thrasher 2022-12-15 00:41:19 -07:00 committed by GitHub
parent e8fa5d7d31
commit c0acaef204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 152 additions and 385 deletions

View File

@ -75,11 +75,9 @@ public:
////////////////////////////////////////////////////////////
struct SFML_WINDOW_API Identification
{
Identification();
String name; //!< Name of the joystick
unsigned int vendorId; //!< Manufacturer identifier
unsigned int productId; //!< Product identifier
String name{"No Joystick"}; //!< Name of the joystick
unsigned int vendorId{0}; //!< Manufacturer identifier
unsigned int productId{0}; //!< Product identifier
};
////////////////////////////////////////////////////////////

View File

@ -100,8 +100,8 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2u size; //!< Video mode width and height, in pixels
unsigned int bitsPerPixel; //!< Video mode pixel depth, in bits per pixels
Vector2u size; //!< Video mode width and height, in pixels
unsigned int bitsPerPixel{0}; //!< Video mode pixel depth, in bits per pixels
};
////////////////////////////////////////////////////////////

View File

@ -31,14 +31,6 @@ namespace sf
{
namespace priv
{
////////////////////////////////////////////////////////////
CursorImpl::CursorImpl()
{
// Nothing.
}
////////////////////////////////////////////////////////////
bool CursorImpl::loadFromPixels(const std::uint8_t* /* pixels */, Vector2u /* size */, Vector2u /* hotspot */)
{

View File

@ -52,7 +52,7 @@ public:
/// Refer to sf::Cursor::Cursor().
///
////////////////////////////////////////////////////////////
CursorImpl();
CursorImpl() = default;
////////////////////////////////////////////////////////////
/// \brief Deleted copy constructor

View File

@ -52,11 +52,7 @@ namespace priv
WindowImplAndroid* WindowImplAndroid::singleInstance = nullptr;
////////////////////////////////////////////////////////////
WindowImplAndroid::WindowImplAndroid(WindowHandle /* handle */) :
m_size(0, 0),
m_windowBeingCreated(false),
m_windowBeingDestroyed(false),
m_hasFocus(false)
WindowImplAndroid::WindowImplAndroid(WindowHandle /* handle */)
{
}
@ -66,10 +62,7 @@ WindowImplAndroid::WindowImplAndroid(VideoMode mode,
const String& /* title */,
unsigned long style,
const ContextSettings& /* settings */) :
m_size(mode.size),
m_windowBeingCreated(false),
m_windowBeingDestroyed(false),
m_hasFocus(false)
m_size(mode.size)
{
ActivityStates& states = getActivity();
std::scoped_lock lock(states.mutex);

View File

@ -233,9 +233,9 @@ private:
static int getUnicode(AInputEvent* event);
Vector2u m_size;
bool m_windowBeingCreated;
bool m_windowBeingDestroyed;
bool m_hasFocus;
bool m_windowBeingCreated{false};
bool m_windowBeingDestroyed{false};
bool m_hasFocus{false};
};
} // namespace priv

View File

@ -34,12 +34,6 @@ namespace sf
{
namespace priv
{
////////////////////////////////////////////////////////////
CursorImpl::CursorImpl()
{
}
////////////////////////////////////////////////////////////
bool CursorImpl::loadFromPixels(const std::uint8_t* /*pixels*/, Vector2u /*size*/, Vector2u /*hotspot*/)
{

View File

@ -50,7 +50,7 @@ public:
/// Refer to sf::Cursor::Cursor().
///
////////////////////////////////////////////////////////////
CursorImpl();
CursorImpl() = default;
////////////////////////////////////////////////////////////
/// \brief Deleted copy constructor

View File

@ -511,17 +511,7 @@ namespace sf
namespace priv
{
////////////////////////////////////////////////////////////
DRMContext::DRMContext(DRMContext* shared) :
m_display(EGL_NO_DISPLAY),
m_context(EGL_NO_CONTEXT),
m_surface(EGL_NO_SURFACE),
m_config(nullptr),
m_currentBO(nullptr),
m_nextBO(nullptr),
m_gbmSurface(nullptr),
m_size(0, 0),
m_shown(false),
m_scanOut(false)
DRMContext::DRMContext(DRMContext* shared)
{
contextCount++;
@ -543,17 +533,7 @@ m_scanOut(false)
////////////////////////////////////////////////////////////
DRMContext::DRMContext(DRMContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
m_display(EGL_NO_DISPLAY),
m_context(EGL_NO_CONTEXT),
m_surface(EGL_NO_SURFACE),
m_config(nullptr),
m_currentBO(nullptr),
m_nextBO(nullptr),
m_gbmSurface(nullptr),
m_size(0, 0),
m_shown(false),
m_scanOut(false)
DRMContext::DRMContext(DRMContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel)
{
contextCount++;
@ -573,17 +553,7 @@ m_scanOut(false)
////////////////////////////////////////////////////////////
DRMContext::DRMContext(DRMContext* shared, const ContextSettings& settings, const Vector2u& size) :
m_display(EGL_NO_DISPLAY),
m_context(EGL_NO_CONTEXT),
m_surface(EGL_NO_SURFACE),
m_config(nullptr),
m_currentBO(nullptr),
m_nextBO(nullptr),
m_gbmSurface(nullptr),
m_size(0, 0),
m_shown(false),
m_scanOut(false)
DRMContext::DRMContext(DRMContext* shared, const ContextSettings& settings, const Vector2u& size)
{
contextCount++;

View File

@ -199,17 +199,17 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
EGLDisplay m_display; ///< The internal EGL display
EGLContext m_context; ///< The internal EGL context
EGLSurface m_surface; ///< The internal EGL surface
EGLConfig m_config; ///< The internal EGL config
EGLDisplay m_display{EGL_NO_DISPLAY}; ///< The internal EGL display
EGLContext m_context{EGL_NO_CONTEXT}; ///< The internal EGL context
EGLSurface m_surface{EGL_NO_SURFACE}; ///< The internal EGL surface
EGLConfig m_config{nullptr}; ///< The internal EGL config
gbm_bo* m_currentBO;
gbm_bo* m_nextBO;
gbm_surface* m_gbmSurface;
gbm_bo* m_currentBO{nullptr};
gbm_bo* m_nextBO{nullptr};
gbm_surface* m_gbmSurface{nullptr};
Vector2u m_size;
bool m_shown;
bool m_scanOut;
bool m_shown{false};
bool m_scanOut{false};
};
} // namespace priv

View File

@ -47,13 +47,9 @@ namespace
{
struct TouchSlot
{
int oldId;
int id;
int oldId{-1};
int id{-1};
sf::Vector2i pos;
TouchSlot() : oldId(-1), id(-1), pos(0, 0)
{
}
};
std::recursive_mutex inputMutex; // threadsafe? maybe...

View File

@ -38,7 +38,7 @@ namespace sf
namespace priv
{
////////////////////////////////////////////////////////////
WindowImplDRM::WindowImplDRM(WindowHandle /*handle*/) : m_size(0, 0)
WindowImplDRM::WindowImplDRM(WindowHandle /*handle*/)
{
sf::priv::InputImpl::setTerminalConfig();
}

View File

@ -102,11 +102,7 @@ namespace sf
namespace priv
{
////////////////////////////////////////////////////////////
EglContext::EglContext(EglContext* shared) :
m_display(EGL_NO_DISPLAY),
m_context(EGL_NO_CONTEXT),
m_surface(EGL_NO_SURFACE),
m_config(nullptr)
EglContext::EglContext(EglContext* shared)
{
EglContextImpl::ensureInit();
@ -132,11 +128,7 @@ m_config(nullptr)
EglContext::EglContext(EglContext* shared,
const ContextSettings& settings,
[[maybe_unused]] const WindowImpl& owner,
unsigned int bitsPerPixel) :
m_display(EGL_NO_DISPLAY),
m_context(EGL_NO_CONTEXT),
m_surface(EGL_NO_SURFACE),
m_config(nullptr)
unsigned int bitsPerPixel)
{
EglContextImpl::ensureInit();
@ -170,11 +162,7 @@ m_config(nullptr)
////////////////////////////////////////////////////////////
EglContext::EglContext(EglContext* /*shared*/, const ContextSettings& /*settings*/, const Vector2u& /*size*/) :
m_display(EGL_NO_DISPLAY),
m_context(EGL_NO_CONTEXT),
m_surface(EGL_NO_SURFACE),
m_config(nullptr)
EglContext::EglContext(EglContext* /*shared*/, const ContextSettings& /*settings*/, const Vector2u& /*size*/)
{
EglContextImpl::ensureInit();

View File

@ -188,10 +188,10 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
EGLDisplay m_display; //!< The internal EGL display
EGLContext m_context; //!< The internal EGL context
EGLSurface m_surface; //!< The internal EGL surface
EGLConfig m_config; //!< The internal EGL config
EGLDisplay m_display{EGL_NO_DISPLAY}; //!< The internal EGL display
EGLContext m_context{EGL_NO_CONTEXT}; //!< The internal EGL context
EGLSurface m_surface{EGL_NO_SURFACE}; //!< The internal EGL surface
EGLConfig m_config{nullptr}; //!< The internal EGL config
};
} // namespace priv

View File

@ -79,10 +79,4 @@ void Joystick::update()
return priv::JoystickManager::getInstance().update();
}
////////////////////////////////////////////////////////////
Joystick::Identification::Identification() : name("No Joystick"), vendorId(0), productId(0)
{
}
} // namespace sf

View File

@ -220,10 +220,10 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
bool m_isValid; ///< If any error occurs this variable is false
CFDataRef m_layoutData; ///< CFData containing the layout
UCKeyboardLayout* m_layout; ///< Current Keyboard Layout
IOHIDManagerRef m_manager; ///< HID Manager
bool m_isValid{true}; ///< If any error occurs this variable is false
CFDataRef m_layoutData{0}; ///< CFData containing the layout
UCKeyboardLayout* m_layout{nullptr}; ///< Current Keyboard Layout
IOHIDManagerRef m_manager{0}; ///< HID Manager
IOHIDElements m_keys[Keyboard::KeyCount]; ///< All the keys on any connected keyboard

View File

@ -94,7 +94,7 @@ CFDictionaryRef HIDInputManager::copyDevicesMask(UInt32 page, UInt32 usage)
////////////////////////////////////////////////////////////
HIDInputManager::HIDInputManager() : m_isValid(true), m_layoutData(0), m_layout(0), m_manager(0)
HIDInputManager::HIDInputManager()
{
// Get the current keyboard layout
TISInputSourceRef tis = TISCopyCurrentKeyboardLayoutInputSource();

View File

@ -69,7 +69,7 @@ CFSetRef HIDJoystickManager::copyJoysticks()
////////////////////////////////////////////////////////////
HIDJoystickManager::HIDJoystickManager() : m_manager(0), m_joystickCount(0)
HIDJoystickManager::HIDJoystickManager()
{
m_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);

View File

@ -123,8 +123,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
IOHIDManagerRef m_manager; ///< HID Manager
unsigned int m_joystickCount; ///< Number of joysticks currently connected
IOHIDManagerRef m_manager{0}; ///< HID Manager
unsigned int m_joystickCount{0}; ///< Number of joysticks currently connected
};

View File

@ -156,9 +156,9 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
NSOpenGLContextRef m_context; ///< OpenGL context.
NSOpenGLViewRef m_view; ///< Only for offscreen context.
NSWindowRef m_window; ///< Only for offscreen context.
NSOpenGLContextRef m_context{0}; ///< OpenGL context.
NSOpenGLViewRef m_view{0}; ///< Only for offscreen context.
NSWindowRef m_window{0}; ///< Only for offscreen context.
};
} // namespace priv

View File

@ -44,7 +44,7 @@ namespace priv
////////////////////////////////////////////////////////////
SFContext::SFContext(SFContext* shared) : m_context(0), m_view(0), m_window(0)
SFContext::SFContext(SFContext* shared)
{
AutoreleasePool pool;
// Create the context
@ -53,10 +53,7 @@ SFContext::SFContext(SFContext* shared) : m_context(0), m_view(0), m_window(0)
////////////////////////////////////////////////////////////
SFContext::SFContext(SFContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
m_context(0),
m_view(0),
m_window(0)
SFContext::SFContext(SFContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel)
{
AutoreleasePool pool;
// Create the context.
@ -69,10 +66,7 @@ m_window(0)
////////////////////////////////////////////////////////////
SFContext::SFContext(SFContext* shared, const ContextSettings& settings, const Vector2u& size) :
m_context(0),
m_view(0),
m_window(0)
SFContext::SFContext(SFContext* shared, const ContextSettings& settings, const Vector2u& size)
{
AutoreleasePool pool;
// Ensure the process is setup in order to create a valid window.

View File

@ -364,8 +364,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
WindowImplDelegateRef m_delegate; ///< Implementation in Obj-C.
bool m_showCursor; ///< Is the cursor displayed or hidden?
WindowImplDelegateRef m_delegate; ///< Implementation in Obj-C.
bool m_showCursor{true}; ///< Is the cursor displayed or hidden?
};
} // namespace priv

View File

@ -85,7 +85,7 @@ void showMouseCursor()
#pragma mark WindowImplCocoa's ctor/dtor
////////////////////////////////////////////////////////////
WindowImplCocoa::WindowImplCocoa(WindowHandle handle) : m_showCursor(true)
WindowImplCocoa::WindowImplCocoa(WindowHandle handle)
{
AutoreleasePool pool;
// Treat the handle as it real type
@ -118,8 +118,7 @@ WindowImplCocoa::WindowImplCocoa(WindowHandle handle) : m_showCursor(true)
////////////////////////////////////////////////////////////
WindowImplCocoa::WindowImplCocoa(VideoMode mode, const String& title, unsigned long style, const ContextSettings& /*settings*/) :
m_showCursor(true)
WindowImplCocoa::WindowImplCocoa(VideoMode mode, const String& title, unsigned long style, const ContextSettings& /*settings*/)
{
AutoreleasePool pool;
// Transform the app process.

View File

@ -74,7 +74,7 @@ void ClipboardImpl::processEvents()
////////////////////////////////////////////////////////////
ClipboardImpl::ClipboardImpl() : m_window(0), m_requestResponded(false)
ClipboardImpl::ClipboardImpl()
{
// Open a connection with the X server
m_display = openDisplay();

View File

@ -136,16 +136,16 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
::Window m_window; ///< X identifier defining our window
::Display* m_display; ///< Pointer to the display
Atom m_clipboard; ///< X Atom identifying the CLIPBOARD selection
Atom m_targets; ///< X Atom identifying TARGETS
Atom m_text; ///< X Atom identifying TEXT
Atom m_utf8String; ///< X Atom identifying UTF8_STRING
Atom m_targetProperty; ///< X Atom identifying our destination window property
String m_clipboardContents; ///< Our clipboard contents
std::deque<XEvent> m_events; ///< Queue we use to store pending events for this window
bool m_requestResponded; ///< Holds whether our selection request has been responded to or not
::Window m_window{0}; ///< X identifier defining our window
::Display* m_display; ///< Pointer to the display
Atom m_clipboard; ///< X Atom identifying the CLIPBOARD selection
Atom m_targets; ///< X Atom identifying TARGETS
Atom m_text; ///< X Atom identifying TEXT
Atom m_utf8String; ///< X Atom identifying UTF8_STRING
Atom m_targetProperty; ///< X Atom identifying our destination window property
String m_clipboardContents; ///< Our clipboard contents
std::deque<XEvent> m_events; ///< Queue we use to store pending events for this window
bool m_requestResponded{false}; ///< Holds whether our selection request has been responded to or not
};
} // namespace priv

View File

@ -42,9 +42,8 @@ namespace priv
{
////////////////////////////////////////////////////////////
CursorImpl::CursorImpl() : m_display(openDisplay()), m_cursor(None)
CursorImpl::CursorImpl() : m_display(openDisplay())
{
// That's it.
}

View File

@ -125,7 +125,7 @@ private:
// Member data
////////////////////////////////////////////////////////////
::Display* m_display;
::Cursor m_cursor;
::Cursor m_cursor{None};
};
} // namespace priv

View File

@ -81,7 +81,7 @@ int handleXError(::Display*, XErrorEvent*)
class GlxErrorHandler
{
public:
GlxErrorHandler(::Display* display) : m_lock(glxErrorMutex), m_display(display)
GlxErrorHandler(::Display* display) : m_display(display)
{
glxErrorOccurred = false;
m_previousHandler = XSetErrorHandler(handleXError);
@ -94,7 +94,7 @@ public:
}
private:
std::scoped_lock<std::recursive_mutex> m_lock;
std::scoped_lock<std::recursive_mutex> m_lock{glxErrorMutex};
::Display* m_display;
int (*m_previousHandler)(::Display*, XErrorEvent*);
};
@ -106,12 +106,7 @@ namespace sf
namespace priv
{
////////////////////////////////////////////////////////////
GlxContext::GlxContext(GlxContext* shared) :
m_display(nullptr),
m_window(0),
m_context(nullptr),
m_pbuffer(0),
m_ownsWindow(false)
GlxContext::GlxContext(GlxContext* shared)
{
// Save the creation settings
m_settings = ContextSettings();
@ -131,12 +126,7 @@ m_ownsWindow(false)
////////////////////////////////////////////////////////////
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int /*bitsPerPixel*/) :
m_display(nullptr),
m_window(0),
m_context(nullptr),
m_pbuffer(0),
m_ownsWindow(false)
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int /*bitsPerPixel*/)
{
// Save the creation settings
m_settings = settings;
@ -156,12 +146,7 @@ m_ownsWindow(false)
////////////////////////////////////////////////////////////
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const Vector2u& size) :
m_display(nullptr),
m_window(0),
m_context(nullptr),
m_pbuffer(0),
m_ownsWindow(false)
GlxContext::GlxContext(GlxContext* shared, const ContextSettings& settings, const Vector2u& size)
{
// Save the creation settings
m_settings = settings;

View File

@ -176,11 +176,11 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
::Display* m_display; ///< Connection to the X server
::Window m_window; ///< Window to which the context is attached
GLXContext m_context; ///< OpenGL context
GLXPbuffer m_pbuffer; ///< GLX pbuffer ID if one was created
bool m_ownsWindow; ///< Do we own the window associated to the context?
::Display* m_display{nullptr}; ///< Connection to the X server
::Window m_window{0}; ///< Window to which the context is attached
GLXContext m_context{nullptr}; ///< OpenGL context
GLXPbuffer m_pbuffer{0}; ///< GLX pbuffer ID if one was created
bool m_ownsWindow{false}; ///< Do we own the window associated to the context?
};
} // namespace priv

View File

@ -434,13 +434,6 @@ namespace sf
{
namespace priv
{
////////////////////////////////////////////////////////////
JoystickImpl::JoystickImpl() : m_file(-1)
{
std::fill(m_mapping, m_mapping + ABS_MAX + 1, 0);
}
////////////////////////////////////////////////////////////
void JoystickImpl::initialize()
{

View File

@ -44,12 +44,6 @@ namespace priv
class JoystickImpl
{
public:
////////////////////////////////////////////////////////////
/// \brief Constructor
///
////////////////////////////////////////////////////////////
JoystickImpl();
////////////////////////////////////////////////////////////
/// \brief Perform the global initialization of the joystick module
///
@ -116,10 +110,10 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
int m_file; ///< File descriptor of the joystick
char m_mapping[ABS_MAX + 1]; ///< Axes mapping (index to axis id)
JoystickState m_state; ///< Current state of the joystick
sf::Joystick::Identification m_identification; ///< Identification of the joystick
int m_file{-1}; ///< File descriptor of the joystick
char m_mapping[ABS_MAX + 1]{0}; ///< Axes mapping (index to axis id)
JoystickState m_state; ///< Current state of the joystick
sf::Joystick::Identification m_identification; ///< Identification of the joystick
};
} // namespace priv

View File

@ -41,14 +41,6 @@ namespace
{
struct VulkanLibraryWrapper
{
VulkanLibraryWrapper() :
library(nullptr),
vkGetInstanceProcAddr(nullptr),
vkEnumerateInstanceLayerProperties(nullptr),
vkEnumerateInstanceExtensionProperties(nullptr)
{
}
~VulkanLibraryWrapper()
{
if (library)
@ -98,11 +90,11 @@ struct VulkanLibraryWrapper
return (entryPoint != nullptr);
}
void* library;
void* library{nullptr};
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties;
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{nullptr};
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties{nullptr};
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties{nullptr};
};
VulkanLibraryWrapper wrapper;

View File

@ -478,25 +478,7 @@ namespace sf
namespace priv
{
////////////////////////////////////////////////////////////
WindowImplX11::WindowImplX11(WindowHandle handle) :
m_window(0),
m_screen(0),
m_inputMethod(nullptr),
m_inputContext(nullptr),
m_isExternal(true),
m_oldVideoMode(0),
m_oldRRCrtc(0),
m_hiddenCursor(0),
m_lastCursor(None),
m_keyRepeat(true),
m_previousSize(-1, -1),
m_useSizeHints(false),
m_fullscreen(false),
m_cursorGrabbed(false),
m_windowMapped(false),
m_iconPixmap(0),
m_iconMaskPixmap(0),
m_lastInputTime(0)
WindowImplX11::WindowImplX11(WindowHandle handle) : m_isExternal(true)
{
using namespace WindowsImplX11Impl;
@ -530,24 +512,9 @@ m_lastInputTime(0)
////////////////////////////////////////////////////////////
WindowImplX11::WindowImplX11(VideoMode mode, const String& title, unsigned long style, const ContextSettings& settings) :
m_window(0),
m_screen(0),
m_inputMethod(nullptr),
m_inputContext(nullptr),
m_isExternal(false),
m_oldVideoMode(0),
m_oldRRCrtc(0),
m_hiddenCursor(0),
m_lastCursor(None),
m_keyRepeat(true),
m_previousSize(-1, -1),
m_useSizeHints(false),
m_fullscreen((style & Style::Fullscreen) != 0),
m_cursorGrabbed(m_fullscreen),
m_windowMapped(false),
m_iconPixmap(0),
m_iconMaskPixmap(0),
m_lastInputTime(0)
m_cursorGrabbed(m_fullscreen)
{
using namespace WindowsImplX11Impl;

View File

@ -297,25 +297,25 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
::Window m_window; ///< X identifier defining our window
::Display* m_display; ///< Pointer to the display
int m_screen; ///< Screen identifier
XIM m_inputMethod; ///< Input method linked to the X display
XIC m_inputContext; ///< Input context used to get unicode input in our window
bool m_isExternal; ///< Tell whether the window has been created externally or by SFML
RRMode m_oldVideoMode; ///< Video mode in use before we switch to fullscreen
RRCrtc m_oldRRCrtc; ///< RRCrtc in use before we switch to fullscreen
::Cursor m_hiddenCursor; ///< As X11 doesn't provide cursor hiding, we must create a transparent one
::Cursor m_lastCursor; ///< Last cursor used -- this data is not owned by the window and is required to be always valid
bool m_keyRepeat; ///< Is the KeyRepeat feature enabled?
Vector2i m_previousSize; ///< Previous size of the window, to find if a ConfigureNotify event is a resize event (could be a move event only)
bool m_useSizeHints; ///< Is the size of the window fixed with size hints?
bool m_fullscreen; ///< Is the window in fullscreen?
bool m_cursorGrabbed; ///< Is the mouse cursor trapped?
bool m_windowMapped; ///< Has the window been mapped by the window manager?
Pixmap m_iconPixmap; ///< The current icon pixmap if in use
Pixmap m_iconMaskPixmap; ///< The current icon mask pixmap if in use
::Time m_lastInputTime; ///< Last time we received user input
::Window m_window{0}; ///< X identifier defining our window
::Display* m_display; ///< Pointer to the display
int m_screen; ///< Screen identifier
XIM m_inputMethod{nullptr}; ///< Input method linked to the X display
XIC m_inputContext{nullptr}; ///< Input context used to get unicode input in our window
bool m_isExternal; ///< Tell whether the window has been created externally or by SFML
RRMode m_oldVideoMode{0}; ///< Video mode in use before we switch to fullscreen
RRCrtc m_oldRRCrtc{0}; ///< RRCrtc in use before we switch to fullscreen
::Cursor m_hiddenCursor{0}; ///< As X11 doesn't provide cursor hiding, we must create a transparent one
::Cursor m_lastCursor{None}; ///< Last cursor used -- this data is not owned by the window and is required to be always valid
bool m_keyRepeat{true}; ///< Is the KeyRepeat feature enabled?
Vector2i m_previousSize{-1, -1}; ///< Previous size of the window, to find if a ConfigureNotify event is a resize event (could be a move event only)
bool m_useSizeHints{false}; ///< Is the size of the window fixed with size hints?
bool m_fullscreen{false}; ///< Is the window in fullscreen?
bool m_cursorGrabbed{false}; ///< Is the mouse cursor trapped?
bool m_windowMapped{false}; ///< Has the window been mapped by the window manager?
Pixmap m_iconPixmap{0}; ///< The current icon pixmap if in use
Pixmap m_iconMaskPixmap{0}; ///< The current icon mask pixmap if in use
::Time m_lastInputTime{0}; ///< Last time we received user input
};
} // namespace priv

View File

@ -35,9 +35,7 @@
namespace sf
{
////////////////////////////////////////////////////////////
VideoMode::VideoMode() : size(0, 0), bitsPerPixel(0)
{
}
VideoMode::VideoMode() = default;
////////////////////////////////////////////////////////////

View File

@ -37,14 +37,6 @@ namespace sf
{
namespace priv
{
////////////////////////////////////////////////////////////
CursorImpl::CursorImpl() : m_cursor(nullptr), m_systemCursor(false)
{
// That's it.
}
////////////////////////////////////////////////////////////
CursorImpl::~CursorImpl()
{

View File

@ -49,7 +49,7 @@ public:
/// Refer to sf::Cursor::Cursor().
///
////////////////////////////////////////////////////////////
CursorImpl();
CursorImpl() = default;
////////////////////////////////////////////////////////////
/// \brief Destructor
@ -99,8 +99,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
void* m_cursor; // Type erasure via `void*` is used here to avoid depending on `windows.h`
bool m_systemCursor;
void* m_cursor{nullptr}; // Type erasure via `void*` is used here to avoid depending on `windows.h`
bool m_systemCursor{false};
};
} // namespace priv

View File

@ -103,10 +103,7 @@ namespace
{
struct ConnectionCache
{
ConnectionCache() : connected(false)
{
}
bool connected;
bool connected{false};
sf::Clock timer;
};
const sf::Time connectionRefreshDelay = sf::milliseconds(500);

View File

@ -40,14 +40,6 @@ namespace
{
struct VulkanLibraryWrapper
{
VulkanLibraryWrapper() :
library(nullptr),
vkGetInstanceProcAddr(nullptr),
vkEnumerateInstanceLayerProperties(nullptr),
vkEnumerateInstanceExtensionProperties(nullptr)
{
}
~VulkanLibraryWrapper()
{
if (library)
@ -97,11 +89,11 @@ struct VulkanLibraryWrapper
return (entryPoint != nullptr);
}
HMODULE library;
HMODULE library{nullptr};
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties;
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr{nullptr};
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties{nullptr};
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties{nullptr};
};
VulkanLibraryWrapper wrapper;

View File

@ -116,12 +116,7 @@ WglContext::WglContext(WglContext* shared) : WglContext(shared, ContextSettings(
////////////////////////////////////////////////////////////
WglContext::WglContext(WglContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
m_window(nullptr),
m_pbuffer(nullptr),
m_deviceContext(nullptr),
m_context(nullptr),
m_ownsWindow(false)
WglContext::WglContext(WglContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel)
{
WglContextImpl::ensureInit();
@ -137,12 +132,7 @@ m_ownsWindow(false)
////////////////////////////////////////////////////////////
WglContext::WglContext(WglContext* shared, const ContextSettings& settings, const Vector2u& size) :
m_window(nullptr),
m_pbuffer(nullptr),
m_deviceContext(nullptr),
m_context(nullptr),
m_ownsWindow(false)
WglContext::WglContext(WglContext* shared, const ContextSettings& settings, const Vector2u& size)
{
WglContextImpl::ensureInit();

View File

@ -179,11 +179,11 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
HWND m_window; //!< Window to which the context is attached
HPBUFFERARB m_pbuffer; //!< Handle to a pbuffer if one was created
HDC m_deviceContext; //!< Device context associated to the context
HGLRC m_context; //!< OpenGL context
bool m_ownsWindow; //!< Do we own the target window?
HWND m_window{nullptr}; //!< Window to which the context is attached
HPBUFFERARB m_pbuffer{nullptr}; //!< Handle to a pbuffer if one was created
HDC m_deviceContext{nullptr}; //!< Device context associated to the context
HGLRC m_context{nullptr}; //!< OpenGL context
bool m_ownsWindow{false}; //!< Do we own the target window?
};
} // namespace priv

View File

@ -130,19 +130,7 @@ namespace sf
namespace priv
{
////////////////////////////////////////////////////////////
WindowImplWin32::WindowImplWin32(WindowHandle handle) :
m_handle(handle),
m_callback(0),
m_cursorVisible(true), // might need to call GetCursorInfo
m_lastCursor(LoadCursor(nullptr, IDC_ARROW)),
m_icon(nullptr),
m_keyRepeatEnabled(true),
m_lastSize(0, 0),
m_resizing(false),
m_surrogate(0),
m_mouseInside(false),
m_fullscreen(false),
m_cursorGrabbed(false)
WindowImplWin32::WindowImplWin32(WindowHandle handle) : m_handle(handle)
{
// Set that this process is DPI aware and can handle DPI scaling
setProcessDpiAware();
@ -164,16 +152,7 @@ m_cursorGrabbed(false)
////////////////////////////////////////////////////////////
WindowImplWin32::WindowImplWin32(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& /*settings*/) :
m_handle(nullptr),
m_callback(0),
m_cursorVisible(true), // might need to call GetCursorInfo
m_lastCursor(LoadCursor(nullptr, IDC_ARROW)),
m_icon(nullptr),
m_keyRepeatEnabled(true),
m_lastSize(mode.size),
m_resizing(false),
m_surrogate(0),
m_mouseInside(false),
m_fullscreen((style & Style::Fullscreen) != 0),
m_cursorGrabbed(m_fullscreen)
{

View File

@ -269,18 +269,19 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
HWND m_handle; //!< Win32 handle of the window
LONG_PTR m_callback; //!< Stores the original event callback function of the control
bool m_cursorVisible; //!< Is the cursor visible or hidden?
HCURSOR m_lastCursor; //!< Last cursor used -- this data is not owned by the window and is required to be always valid
HICON m_icon; //!< Custom icon assigned to the window
bool m_keyRepeatEnabled; //!< Automatic key-repeat state for keydown events
Vector2u m_lastSize; //!< The last handled size of the window
bool m_resizing; //!< Is the window being resized?
std::uint16_t m_surrogate; //!< First half of the surrogate pair, in case we're receiving a Unicode character in two events
bool m_mouseInside; //!< Mouse is inside the window?
bool m_fullscreen; //!< Is the window fullscreen?
bool m_cursorGrabbed; //!< Is the mouse cursor trapped?
HWND m_handle{nullptr}; //!< Win32 handle of the window
LONG_PTR m_callback{0}; //!< Stores the original event callback function of the control
bool m_cursorVisible{true}; //!< Is the cursor visible or hidden?
HCURSOR m_lastCursor{
LoadCursor(nullptr, IDC_ARROW)}; //!< Last cursor used -- this data is not owned by the window and is required to be always valid
HICON m_icon{nullptr}; //!< Custom icon assigned to the window
bool m_keyRepeatEnabled{true}; //!< Automatic key-repeat state for keydown events
Vector2u m_lastSize; //!< The last handled size of the window
bool m_resizing{false}; //!< Is the window being resized?
std::uint16_t m_surrogate{0}; //!< First half of the surrogate pair, in case we're receiving a Unicode character in two events
bool m_mouseInside{false}; //!< Mouse is inside the window?
bool m_fullscreen{false}; //!< Is the window fullscreen?
bool m_cursorGrabbed{false}; //!< Is the mouse cursor trapped?
};
} // namespace priv

View File

@ -37,22 +37,18 @@
namespace sf
{
////////////////////////////////////////////////////////////
Window::Window() : m_context(), m_frameTimeLimit(Time::Zero)
{
}
Window::Window() = default;
////////////////////////////////////////////////////////////
Window::Window(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings) :
m_context(),
m_frameTimeLimit(Time::Zero)
Window::Window(VideoMode mode, const String& title, std::uint32_t style, const ContextSettings& settings)
{
Window::create(mode, title, style, settings);
}
////////////////////////////////////////////////////////////
Window::Window(WindowHandle handle, const ContextSettings& settings) : m_context(), m_frameTimeLimit(Time::Zero)
Window::Window(WindowHandle handle, const ContextSettings& settings)
{
Window::create(handle, settings);
}

View File

@ -46,20 +46,18 @@ const sf::WindowBase* fullscreenWindow = nullptr;
namespace sf
{
////////////////////////////////////////////////////////////
WindowBase::WindowBase() : m_impl(), m_size(0, 0)
{
}
WindowBase::WindowBase() = default;
////////////////////////////////////////////////////////////
WindowBase::WindowBase(VideoMode mode, const String& title, std::uint32_t style) : m_impl(), m_size(0, 0)
WindowBase::WindowBase(VideoMode mode, const String& title, std::uint32_t style)
{
WindowBase::create(mode, title, style);
}
////////////////////////////////////////////////////////////
WindowBase::WindowBase(WindowHandle handle) : m_impl(), m_size(0, 0)
WindowBase::WindowBase(WindowHandle handle)
{
WindowBase::create(handle);
}

View File

@ -115,7 +115,7 @@ std::unique_ptr<WindowImpl> WindowImpl::create(WindowHandle handle)
////////////////////////////////////////////////////////////
WindowImpl::WindowImpl() : m_joystickStatesImpl(std::make_unique<JoystickStatesImpl>()), m_joystickThreshold(0.1f)
WindowImpl::WindowImpl() : m_joystickStatesImpl(std::make_unique<JoystickStatesImpl>())
{
// Get the initial joystick states
JoystickManager::getInstance().update();

View File

@ -298,7 +298,7 @@ private:
std::queue<Event> m_events; //!< Queue of available events
std::unique_ptr<JoystickStatesImpl> m_joystickStatesImpl; //!< Previous state of the joysticks (PImpl)
Vector3f m_sensorValue[Sensor::Count]; //!< Previous value of the sensors
float m_joystickThreshold; //!< Joystick threshold (minimum motion for "move" event to be generated)
float m_joystickThreshold{0.1f}; //!< Joystick threshold (minimum motion for "move" event to be generated)
float m_previousAxes[Joystick::Count][Joystick::AxisCount]; //!< Position of each axis last time a move event triggered, in range [-100, 100]
};

View File

@ -31,14 +31,6 @@ namespace sf
{
namespace priv
{
////////////////////////////////////////////////////////////
CursorImpl::CursorImpl()
{
// Nothing.
}
////////////////////////////////////////////////////////////
bool CursorImpl::loadFromPixels(const std::uint8_t* /* pixels */, Vector2u /* size */, Vector2u /* hotspot */)
{

View File

@ -52,7 +52,7 @@ public:
/// Refer to sf::Cursor::Cursor().
///
////////////////////////////////////////////////////////////
CursorImpl();
CursorImpl() = default;
////////////////////////////////////////////////////////////
/// \brief Deleted copy constructor

View File

@ -159,12 +159,12 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
EAGLContext* m_context; ///< The internal context
GLuint m_framebuffer; ///< Frame buffer associated to the context
GLuint m_colorbuffer; ///< Color render buffer
GLuint m_depthbuffer; ///< Depth render buffer
bool m_vsyncEnabled; ///< Vertical sync activation flag
Clock m_clock; ///< Measures the elapsed time for the fake v-sync implementation
EAGLContext* m_context; ///< The internal context
GLuint m_framebuffer{0}; ///< Frame buffer associated to the context
GLuint m_colorbuffer{0}; ///< Color render buffer
GLuint m_depthbuffer{0}; ///< Depth render buffer
bool m_vsyncEnabled{false}; ///< Vertical sync activation flag
Clock m_clock; ///< Measures the elapsed time for the fake v-sync implementation
};
} // namespace priv

View File

@ -93,13 +93,7 @@ namespace sf
namespace priv
{
////////////////////////////////////////////////////////////
EaglContext::EaglContext(EaglContext* shared) :
m_context(nil),
m_framebuffer(0),
m_colorbuffer(0),
m_depthbuffer(0),
m_vsyncEnabled(false),
m_clock()
EaglContext::EaglContext(EaglContext* shared) : m_context(nil)
{
ensureInit();
@ -114,12 +108,7 @@ m_clock()
////////////////////////////////////////////////////////////
EaglContext::EaglContext(EaglContext* shared, const ContextSettings& settings, const WindowImpl& owner, unsigned int bitsPerPixel) :
m_context(nil),
m_framebuffer(0),
m_colorbuffer(0),
m_depthbuffer(0),
m_vsyncEnabled(false),
m_clock()
m_context(nil)
{
ensureInit();
@ -131,12 +120,7 @@ m_clock()
////////////////////////////////////////////////////////////
EaglContext::EaglContext(EaglContext* /* shared */, const ContextSettings& /* settings */, const Vector2u& /* size */) :
m_context(nil),
m_framebuffer(0),
m_colorbuffer(0),
m_depthbuffer(0),
m_vsyncEnabled(false),
m_clock()
m_context(nil)
{
ensureInit();