From f5497b2db61c6bbcba26177d48cc7b697409e713 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Mon, 23 Oct 2023 14:17:38 -0500 Subject: [PATCH] Use more in-class member initializers --- examples/cocoa/CocoaAppDelegate.mm | 8 ++++---- src/SFML/Window/Unix/WindowImplX11.cpp | 1 - src/SFML/Window/Unix/WindowImplX11.hpp | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/cocoa/CocoaAppDelegate.mm b/examples/cocoa/CocoaAppDelegate.mm index a08e5b2c6..c0bd8dc70 100644 --- a/examples/cocoa/CocoaAppDelegate.mm +++ b/examples/cocoa/CocoaAppDelegate.mm @@ -39,7 +39,7 @@ // Our PIMPL struct SFMLmainWindow { - SFMLmainWindow(sf::WindowHandle win) : renderWindow(win), text(font), sprite(logo), background(sf::Color::Blue) + SFMLmainWindow(sf::WindowHandle win) : renderWindow(win) { std::filesystem::path resPath = [[[NSBundle mainBundle] resourcePath] tostdstring]; if (!logo.loadFromFile(resPath / "logo.png")) @@ -59,10 +59,10 @@ struct SFMLmainWindow sf::RenderWindow renderWindow; sf::Font font; - sf::Text text; + sf::Text text{font}; sf::Texture logo; - sf::Sprite sprite; - sf::Color background; + sf::Sprite sprite{logo}; + sf::Color background{sf::Color::Blue}; }; // Private stuff diff --git a/src/SFML/Window/Unix/WindowImplX11.cpp b/src/SFML/Window/Unix/WindowImplX11.cpp index 6c069061c..2dc02b383 100644 --- a/src/SFML/Window/Unix/WindowImplX11.cpp +++ b/src/SFML/Window/Unix/WindowImplX11.cpp @@ -466,7 +466,6 @@ WindowImplX11::WindowImplX11(WindowHandle handle) : m_isExternal(true) //////////////////////////////////////////////////////////// WindowImplX11::WindowImplX11(VideoMode mode, const String& title, unsigned long style, const ContextSettings& settings) : -m_isExternal(false), m_fullscreen((style & Style::Fullscreen) != 0), m_cursorGrabbed(m_fullscreen) { diff --git a/src/SFML/Window/Unix/WindowImplX11.hpp b/src/SFML/Window/Unix/WindowImplX11.hpp index 59281046e..071755fd6 100644 --- a/src/SFML/Window/Unix/WindowImplX11.hpp +++ b/src/SFML/Window/Unix/WindowImplX11.hpp @@ -325,7 +325,7 @@ private: 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 + 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