]> git.tdb.fi Git - libs/gui.git/commitdiff
Use default member initializers and defaulted default constructors
authorMikko Rasa <tdb@tdb.fi>
Sun, 27 Nov 2022 10:51:13 +0000 (12:51 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 27 Nov 2022 14:20:17 +0000 (16:20 +0200)
56 files changed:
source/graphics/android/display.cpp
source/graphics/android/display_platform.h
source/graphics/android/window.cpp
source/graphics/android/window_platform.h
source/graphics/bmploader.cpp
source/graphics/bmploader.h
source/graphics/cgl/glcontext.cpp
source/graphics/cocoa/display.cpp
source/graphics/devil/devilloader.h
source/graphics/display.h
source/graphics/display_private.h
source/graphics/egl_android/glcontext.cpp
source/graphics/errordialog.h
source/graphics/glcontext.cpp
source/graphics/glcontext.h
source/graphics/glx/glcontext.cpp
source/graphics/image.cpp
source/graphics/image.h
source/graphics/imageloader.cpp
source/graphics/imageloader.h
source/graphics/jpeg/jpegloader.h
source/graphics/monitor.cpp [deleted file]
source/graphics/monitor.h
source/graphics/png/pngloader.cpp
source/graphics/png/pngloader.h
source/graphics/quartz/quartzloader.h
source/graphics/videomode.cpp
source/graphics/videomode.h
source/graphics/vkxlib/vulkancontext.cpp
source/graphics/vkxlib/vulkancontext_platform.h
source/graphics/vulkancontext.h
source/graphics/wgl/glcontext.cpp
source/graphics/window.cpp
source/graphics/window.h
source/graphics/window_private.h
source/graphics/windows/display.cpp
source/graphics/windows/window.cpp
source/graphics/windows/window_platform.h
source/graphics/x11/display.cpp
source/graphics/x11/window.cpp
source/graphics/x11/window_platform.h
source/input/binarycontrol.cpp
source/input/binarycontrol.h
source/input/bindings.h
source/input/control.cpp
source/input/control.h
source/input/device.h
source/input/gamecontroller.h
source/input/gesturedetector.cpp
source/input/gesturedetector.h
source/input/linux/gamecontroller.cpp
source/input/linux/gamecontroller_platform.h
source/input/smoothcontrol.cpp
source/input/smoothcontrol.h
source/input/windows/gamecontroller.cpp
source/input/windows/gamecontroller_platform.h

index d62c877ba9e52bd6ca6e7cf64404a0265a25c9c6..a44687e06db029c2e006c37a9542c3bc65b47f1c 100644 (file)
@@ -8,17 +8,13 @@ using namespace std;
 namespace Msp {
 namespace Graphics {
 
-Display::Display(const string &):
-       primary_monitor(0),
-       focus_window(0)
+Display::Display(const string &)
 {
        Android::MainThread *thread = reinterpret_cast<Android::MainThread *>(Application::get_data());
        if(!thread->is_starting_up())
                throw logic_error("Display must be created during startup");
 
        priv = new Private;
-       priv->input_queue = 0;
-       priv->native_window = 0;
 
        thread->signal_native_window_created.connect(sigc::mem_fun(priv, &PlatformDisplayPrivate::native_window_created));
        thread->signal_native_window_resized.connect(sigc::mem_fun(priv, &PlatformDisplayPrivate::native_window_resized));
index 32c1bed43e1a5712af38462906daebaa5bd6d6ad..207f6ef6722606bd7198c6b17052fe212ac1b290 100644 (file)
@@ -14,10 +14,10 @@ typedef void *DisplayHandle;
 
 struct PlatformDisplayPrivate: public sigc::trackable
 {
-       AInputQueue *input_queue;
+       AInputQueue *input_queue = 0;
        std::list<Window::Event> events;
        Mutex event_mutex;
-       WindowHandle native_window;
+       WindowHandle native_window = 0;
        Mutex window_mutex;
 
        void push_event(AndroidEventType);
index 301af2a0533b112476c06b10412daa12594a457c..d3260ca830402cc1cd583e4e94ef8812b391c20b 100644 (file)
@@ -10,7 +10,6 @@ namespace Graphics {
 
 void Window::platform_init()
 {
-       priv->window = 0;
 }
 
 void Window::platform_cleanup()
index 3ed8f847ad5d177dc87dc2049baa70f6fc6b8552..633444b147a98b49b825073585c8b7c5648c96af 100644 (file)
@@ -26,7 +26,7 @@ struct PlatformWindowPrivate
 struct PlatformEvent
 {
        AndroidEventType type;
-       AInputEvent *aevent;
+       AInputEvent *aevent = 0;
 };
 
 } // namespace Graphics
index 8a6c7a00872275211f2f17cfb48f62d8283c3d5b..b85cce16b1d28392e1b4ad72c2b9724204405c2c 100644 (file)
@@ -29,8 +29,7 @@ namespace Graphics {
 
 BmpLoader::BmpLoader(IO::Base &i, unsigned sb):
        io(i),
-       sig_bytes(sb),
-       invert_row_order(false)
+       sig_bytes(sb)
 {
        // Image data location is stored at offset 10 and can't be skipped
        if(sig_bytes>10)
index 60d4a2e5251d7208bba3aa332a284665f589d5a0..926516d8ca080d0eecfffc2b80f664537a6fa873 100644 (file)
@@ -10,8 +10,8 @@ class BmpLoader: public ImageLoader
 {
 private:
        IO::Base &io;
-       unsigned sig_bytes;
-       bool invert_row_order;
+       unsigned sig_bytes = 0;
+       bool invert_row_order = false;
 
 public:
        BmpLoader(IO::Base &, unsigned = 0);
index d05364e62e2cb3b912d2686f986da1070dc31c84..c1a3a0e7bc451224a2c54b056d8b691256dc3ed4 100644 (file)
@@ -14,7 +14,7 @@ typedef CocoaGLContext *ContextHandle;
 
 struct GLContext::Private
 {
-       ContextHandle context;
+       ContextHandle context = 0;
 };
 
 void GLContext::platform_init(const GLOptions &opts)
index 367691e222a37ff724af1cd3b87250bf27c027dc..bf0c562721f0ccaac525c1daee71fc4822431f3c 100644 (file)
@@ -9,9 +9,7 @@ namespace Msp {
 namespace Graphics {
 
 Display::Display(const string &):
-       primary_monitor(0),
-       priv(new Private),
-       focus_window(0)
+       priv(new Private)
 {
        static ErrorDialog err_dlg(0);
 
index 2a8e28d784bca8d3a9ff92bc53a2a9fa5e80f753..beab02fe7c95c8b7fec9a3ce18a224f58cfc62ff 100644 (file)
@@ -10,7 +10,7 @@ class DevilLoader: public ImageLoader
 {
 private:
        IO::Base &io;
-       unsigned id;
+       unsigned id = 0;
 
 public:
        DevilLoader(IO::Seekable &);
index 092abbe1404afa2fe303883ed49cce9f5cfbe478..da3eafa65ca8c462c754ccfe168e26abb699076c 100644 (file)
@@ -24,11 +24,11 @@ public:
 
 private:
        std::list<Monitor> monitors;
-       Monitor *primary_monitor;
+       Monitor *primary_monitor = 0;
        std::list<VideoMode> modes;
-       Private *priv;
-       ErrorDialog *err_dialog;
-       Window *focus_window;
+       Private *priv = 0;
+       ErrorDialog *err_dialog = 0;
+       Window *focus_window = 0;
 
 public:
        Display(const std::string &disp_name = std::string());
index d5f0bf014bdfe9431957c3c5286e147cb5c52cdf..71fc0941438d061a592ed064f07c4793e850495c 100644 (file)
@@ -12,7 +12,7 @@ namespace Graphics {
 
 struct Display::Private: PlatformDisplayPrivate
 {
-       DisplayHandle display;
+       DisplayHandle display = 0;
        std::map<WindowHandle, Window *> windows;
 };
 
index 26a4063964ab937c436a2e11dd1c5e81c90dd2b6..ebdb8015dd5413868b2b8895aac8c456537fb7d0 100644 (file)
@@ -13,10 +13,10 @@ namespace Graphics {
 
 struct GLContext::Private
 {
-       EGLDisplay display;
-       EGLConfig config;
-       EGLSurface surface;
-       EGLContext context;
+       EGLDisplay display = EGL_NO_DISPLAY;
+       EGLConfig config = EGL_NO_CONFIG;
+       EGLSurface surface = EGL_NO_SURFACE;
+       EGLContext context = EGL_NO_CONTEXT;
 
        void attach(WindowHandle);
        void detach();
index 562883c64446057f3efc44669bc8742398d966a5..e0c423cc04005f3aec1a08bd278fc5f965db6dd2 100644 (file)
@@ -11,7 +11,7 @@ class Display;
 class ErrorDialog: public Debug::ErrorReporter
 {
 private:
-       Display *display;
+       Display *display = 0;
 
 public:
        ErrorDialog(Display *d): display(d) { }
index 16c1a5590663078c035162cabb56bca1af40ea4e..a66ca307b726a59a7ca1a025137b377fc401bd7c 100644 (file)
@@ -8,18 +8,6 @@ using namespace std;
 namespace Msp {
 namespace Graphics {
 
-GLOptions::GLOptions():
-       alpha(false),
-       stencil(false),
-       doublebuffer(true),
-       multisample(0),
-       forward_compatible(false),
-       core_profile(false),
-       gl_version_major(DEFAULT_VERSION),
-       gl_version_minor(DEFAULT_VERSION)
-{ }
-
-
 unsupported_gl_mode::unsupported_gl_mode(const GLOptions &opts):
        runtime_error(format("{ .alpha=%s, .stencil=%s, .doublebuffer=%s, .multisample=%d, .forward_compatible=%s, .core_profile=%s, .gl_version=%s }",
                opts.alpha, opts.stencil, opts.doublebuffer, opts.multisample, opts.forward_compatible, opts.core_profile, format_version(opts)))
index 986dd91e9642cb68832a3d5021d9b66cc9ff7d5a..7f08f0e4026423e7d1b3b7c3dd657eae0ff781b1 100644 (file)
@@ -17,16 +17,14 @@ struct GLOptions
                LATEST_VERSION = 0xFFFFFFFF
        };
 
-       bool alpha;
-       bool stencil;
-       bool doublebuffer;
-       unsigned multisample;
-       bool forward_compatible;
-       bool core_profile;
-       unsigned gl_version_major;
-       unsigned gl_version_minor;
-
-       GLOptions();
+       bool alpha = false;
+       bool stencil = false;
+       bool doublebuffer = true;
+       unsigned multisample = 0;
+       bool forward_compatible = false;
+       bool core_profile = false;
+       unsigned gl_version_major = DEFAULT_VERSION;
+       unsigned gl_version_minor = DEFAULT_VERSION;
 };
 
 
@@ -47,7 +45,7 @@ private:
 
        Display &display;
        Window &window;
-       Private *priv;
+       Private *priv = 0;
 
 public:
        GLContext(Window &wnd, const GLOptions &opts = GLOptions());
index 6859e3e1b3ab105fb314ac12690beef83c622fbc..699f856f35d06ce239f7576e7b499500f3b6fc6a 100644 (file)
@@ -17,10 +17,10 @@ typedef GLXContext ContextHandle;
 
 struct GLContext::Private
 {
-       ContextHandle context;
+       ContextHandle context = 0;
        // We need to create a window with the chosen visual
-       WindowHandle subwnd;
-       GLXWindow glxwnd;
+       WindowHandle subwnd = None;
+       GLXWindow glxwnd = None;
 };
 
 
index 2903d499f75cfcb815a02f48de869b875bff54ef..5b2eb1ac3f6decbe74b5c774c246a9e58c6c0aa1 100644 (file)
@@ -10,14 +10,6 @@ using namespace std;
 namespace Msp {
 namespace Graphics {
 
-Image::Data::Data():
-       fmt(RGB),
-       width(0),
-       height(0),
-       owned_pixels(0),
-       pixels(0)
-{ }
-
 Image::Data::Data(const Data &other):
        fmt(other.fmt),
        width(other.width),
index 51147cefdcf341a882a426933efe52576721d155..d9f5870bdea53aea092be5c4d5a7e4ca5c90b4d8 100644 (file)
@@ -16,14 +16,14 @@ class Image
 public:
        struct Data
        {
-               PixelFormat fmt;
-               unsigned width;
-               unsigned height;
-               unsigned stride;
-               char *owned_pixels;
-               char *pixels;
-
-               Data();
+               PixelFormat fmt = RGB;
+               unsigned width = 0;
+               unsigned height = 0;
+               unsigned stride = 0;
+               char *owned_pixels = 0;
+               char *pixels = 0;
+
+               Data() = default;
                Data(const Data &);
                Data &operator=(const Data &);
                ~Data();
index 0746f6fdef5c3bfe07ed486567622996a30033ea..fe88f4034f049cdc4b2f072938f9b6549d75d6f2 100644 (file)
@@ -22,11 +22,6 @@ using namespace std;
 namespace Msp {
 namespace Graphics {
 
-ImageLoader::ImageLoader():
-       source(0),
-       state(INITIAL)
-{ }
-
 ImageLoader::~ImageLoader()
 {
        delete source;
@@ -141,10 +136,6 @@ bool ImageLoader::signature_size_compare(RegisterBase *r1, RegisterBase *r2)
 }
 
 
-ImageLoader::Registry::Registry():
-       changed(false)
-{ }
-
 ImageLoader::Registry::~Registry()
 {
        for(auto l: loaders)
index 9645f116ffd4228a1098c425339fe7a0f39f3ec3..65f3c5679e2b41b66fd4d964a7a5f9a4aa2762b9 100644 (file)
@@ -54,18 +54,17 @@ protected:
        struct Registry
        {
                std::list<RegisterBase *> loaders;
-               bool changed;
+               bool changed = false;
 
-               Registry();
                ~Registry();
        };
 
 private:
-       IO::Base *source;
-       State state;
+       IO::Base *source = 0;
+       State state = INITIAL;
 
 protected:
-       ImageLoader();
+       ImageLoader() = default;
 public:
        virtual ~ImageLoader();
 
index 793951acc6784fa16a012e3a1d12c1192ac203b2..4773168aace6848f7e26605c4fb716418acf2d24 100644 (file)
@@ -11,7 +11,7 @@ class JpegLoader: public ImageLoader
 private:
        struct Private;
 
-       Private *priv;
+       Private *priv = 0;
 
 public:
        JpegLoader(IO::Seekable &);
diff --git a/source/graphics/monitor.cpp b/source/graphics/monitor.cpp
deleted file mode 100644 (file)
index d1bdd43..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "monitor.h"
-
-using namespace std;
-
-namespace Msp {
-namespace Graphics {
-
-Monitor::Monitor():
-       index(0),
-       next_left(0),
-       next_right(0)
-{ }
-
-
-Monitor::Settings::Settings():
-       mode(0),
-       rotation(ROTATE_NORMAL),
-       x(0),
-       y(0)
-{ }
-
-} // namespace Graphics
-} // namespace Msp
index fefd9867f8f78e2962696fe26f07f654c3f1982c..0fc9798568348e1eedd745eac9c8212e3f41fd4e 100644 (file)
@@ -12,22 +12,19 @@ struct Monitor
 {
        struct Settings
        {
-               const VideoMode *mode;
-               VideoRotation rotation;
-               int x, y;
-
-               Settings();
+               const VideoMode *mode = 0;
+               VideoRotation rotation = ROTATE_NORMAL;
+               int x = 0;
+               int y = 0;
        };
 
-       unsigned index;
+       unsigned index = 0;
        std::string name;
        std::list<const VideoMode *> video_modes;
        Settings desktop_settings;
        Settings current_settings;
-       const Monitor *next_left;
-       const Monitor *next_right;
-
-       Monitor();
+       const Monitor *next_left = 0;
+       const Monitor *next_right = 0;
 };
 
 } // namespace Graphics
index aae7015bddf0a49672682e61e1c60ac645a16bdb..850bbf01c2162ae92306762a96d84bcbe626d30f 100644 (file)
@@ -26,10 +26,10 @@ namespace Graphics {
 
 struct PngLoader::Private
 {
-       std::string message;
-       png_struct *png;
-       png_info *info;
-       int interlace;
+       string message;
+       png_struct *png = 0;
+       png_info *info = 0;
+       int interlace = PNG_INTERLACE_NONE;
 };
 
 
index 8023b019f7f17dfbbf9944aa165d50f312b73f37..c21cc5a4474945100a91aa9cfb4f18634fe462cc 100644 (file)
@@ -11,7 +11,7 @@ class PngLoader: public ImageLoader
 private:
        struct Private;
 
-       Private *priv;
+       Private *priv = 0;
 
 public:
        PngLoader(IO::Base &, unsigned = 0);
index 2aa0588d18ef653aadfa8b2ffb82711e5566cde6..c4517ec3b61520a49e7c312449a34b2a14ba4c0b 100644 (file)
@@ -11,7 +11,7 @@ class QuartzLoader: public ImageLoader
 private:
        struct Private;
 
-       Private *priv;
+       Private *priv = 0;
 
 public:
        QuartzLoader(IO::Seekable &);
index dfd002ed83a54798772a8d3b43ee468e7ae00389..d9c20794da611a492bf1e588d599211f84213604 100644 (file)
@@ -9,22 +9,9 @@ unsupported_video_mode::unsupported_video_mode(const VideoMode &mode):
 { }
 
 
-VideoMode::VideoMode():
-       index(0),
-       monitor(0),
-       width(0),
-       height(0),
-       rate(0),
-       rotation(ROTATE_ANY)
-{ }
-
 VideoMode::VideoMode(unsigned w, unsigned h):
-       index(0),
-       monitor(0),
        width(w),
-       height(h),
-       rate(0),
-       rotation(ROTATE_ANY)
+       height(h)
 { }
 
 } // namespace Graphics
index 205245c630ff98e43179ecc1f94dac723a5f57bd..6c83d945185123a055fd967082875f32b9aa484c 100644 (file)
@@ -27,14 +27,14 @@ enum VideoRotation
 
 struct VideoMode
 {
-       unsigned index;
-       const Monitor *monitor;
-       unsigned width;
-       unsigned height;
-       float rate;
-       VideoRotation rotation;
-
-       VideoMode();
+       unsigned index = 0;
+       const Monitor *monitor = 0;
+       unsigned width = 0;
+       unsigned height = 0;
+       float rate = 0.0f;
+       VideoRotation rotation = ROTATE_ANY;
+
+       VideoMode() = default;
        VideoMode(unsigned, unsigned);
 };
 
index 0d332b3d25e0ccaacb751482daefff15f0ed5e62..439ece68a7d8643134b8e45288cacf0ad6f1e5ef 100644 (file)
@@ -61,13 +61,6 @@ string vulkan_error::get_error_message(unsigned code)
        }
 }
 
-VulkanOptions::VulkanOptions():
-       enable_validation(false),
-       enable_debug_report(false),
-       enable_geometry_shader(false),
-       enable_tessellation_shader(false)
-{ }
-
 
 void VulkanContext::platform_init(const VulkanOptions &opts)
 {
@@ -131,8 +124,6 @@ void VulkanContext::platform_init(const VulkanOptions &opts)
                        if(result!=VK_SUCCESS)
                                throw vulkan_error(result, "vkCreateDebugReportCallback");
                }
-               else
-                       priv->debug_report_callback = 0;
 
                VkXlibSurfaceCreateInfoKHR surface_create_info = { };
                surface_create_info.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
@@ -154,7 +145,6 @@ void VulkanContext::platform_init(const VulkanOptions &opts)
                if(result!=VK_SUCCESS)
                        throw vulkan_error(result, "vkEnumeratePhysicalDevices");
 
-               priv->physical_device = 0;
                unsigned gfx_queue_index = 0;
                for(unsigned i=0; i<n_phys_devices; ++i)
                {
@@ -249,14 +239,6 @@ void (*VulkanContext::_get_function(const std::string &name) const)()
 }
 
 
-VulkanContext::Private::Private():
-       instance(0),
-       physical_device(0),
-       device(0),
-       graphics_queue(0),
-       debug_report_callback(0)
-{ }
-
 VkBool32 VulkanContext::Private::debug_report_func(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *, const char *message, void *)
 {
        IO::print(IO::cerr, "%s\n", message);
index 9c08c96102f5bd421e71de3079d7ce26d700d64e..aa82880d05c229555c64f54c05b6256e9cf8e36f 100644 (file)
@@ -10,32 +10,30 @@ namespace Graphics {
 
 struct VulkanFunctions
 {
-       PFN_vkCreateInstance vkCreateInstance;
-       PFN_vkDestroyInstance vkDestroyInstance;
-       PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices;
-       PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties;
-       PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupport;
-       PFN_vkCreateDevice vkCreateDevice;
-       PFN_vkDestroyDevice vkDestroyDevice;
-       PFN_vkGetDeviceQueue vkGetDeviceQueue;
-       PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurface;
-       PFN_vkDestroySurfaceKHR vkDestroySurface;
-       PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallback;
-       PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallback;
+       PFN_vkCreateInstance vkCreateInstance = 0;
+       PFN_vkDestroyInstance vkDestroyInstance = 0;
+       PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices = 0;
+       PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties = 0;
+       PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupport = 0;
+       PFN_vkCreateDevice vkCreateDevice = 0;
+       PFN_vkDestroyDevice vkDestroyDevice = 0;
+       PFN_vkGetDeviceQueue vkGetDeviceQueue = 0;
+       PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurface = 0;
+       PFN_vkDestroySurfaceKHR vkDestroySurface = 0;
+       PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallback = 0;
+       PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallback = 0;
 };
 
 struct VulkanContext::Private
 {
        VulkanFunctions functions;
-       VkInstance instance;
-       VkPhysicalDevice physical_device;
-       VkDevice device;
-       unsigned graphics_queue_family;
-       VkQueue graphics_queue;
-       VkSurfaceKHR surface;
-       VkDebugReportCallbackEXT debug_report_callback;
-
-       Private();
+       VkInstance instance = 0;
+       VkPhysicalDevice physical_device = 0;
+       VkDevice device = 0;
+       unsigned graphics_queue_family = 0;
+       VkQueue graphics_queue = 0;
+       VkSurfaceKHR surface = 0;
+       VkDebugReportCallbackEXT debug_report_callback = 0;
 
        static VkBool32 debug_report_func(VkDebugReportFlagsEXT, VkDebugReportObjectTypeEXT, uint64_t, size_t, int32_t, const char *, const char *, void *);
 };
index d5cc4c3f1e1f176ed97fcc3aff72e46f04c5366b..c59007900a847c7583237f318f4ab8a5482d18a8 100644 (file)
@@ -21,12 +21,10 @@ private:
 
 struct VulkanOptions
 {
-       bool enable_validation;
-       bool enable_debug_report;
-       bool enable_geometry_shader;
-       bool enable_tessellation_shader;
-
-       VulkanOptions();
+       bool enable_validation = false;
+       bool enable_debug_report = false;
+       bool enable_geometry_shader = false;
+       bool enable_tessellation_shader = false;
 };
 
 class VulkanContext
@@ -36,7 +34,7 @@ private:
 
        Display &display;
        Window &window;
-       Private *priv;
+       Private *priv = 0;
 
 public:
        VulkanContext(Window &, const VulkanOptions & = VulkanOptions());
index 5f9ae42bc777486660a9c375a94428df769ce804..2791fed5e7cc8e01444cbbdccd6c2dec1f62cc0a 100644 (file)
@@ -26,7 +26,7 @@ typedef HGLRC ContextHandle;
 
 struct GLContext::Private
 {
-       ContextHandle context;
+       ContextHandle context = 0;
 };
 
 
index dde92491ee1a1ce8d3035ec7d3bbeaf2dc0ba3ca..79cfb7d99833029a0827064c5f74bde8fd3f8899 100644 (file)
@@ -8,19 +8,6 @@ using namespace std;
 namespace Msp {
 namespace Graphics {
 
-WindowOptions::WindowOptions():
-       x(0),
-       y(0),
-       user_position(false),
-       width(640),
-       height(480),
-       fullscreen(false),
-       fullscreen_monitor(0),
-       fullscreen_exclusive(true),
-       resizable(false)
-{ }
-
-
 Window::Window(Display &dpy, unsigned w, unsigned h, bool fs):
        display(dpy)
 {
@@ -40,11 +27,6 @@ Window::Window(Display &dpy, const WindowOptions &opts):
 
 void Window::init()
 {
-       visible = false;
-       kbd_autorepeat = true;
-       touch_input = false;
-       resizing = false;
-       moving = false;
        priv = new Private;
 
        if(options.fullscreen && !options.fullscreen_monitor)
index 325f8c97d6bbcb2b2bb1bdf7b3767fbb8255ef32..09ab25b1b42e3d9bebb86e659bbe62228a0b74f2 100644 (file)
@@ -12,17 +12,15 @@ struct Monitor;
 
 struct WindowOptions
 {
-       int x;
-       int y;
-       bool user_position;
-       unsigned width;
-       unsigned height;
-       bool fullscreen;
-       const Monitor *fullscreen_monitor;
-       bool fullscreen_exclusive;
-       bool resizable;
-
-       WindowOptions();
+       int x = 0;
+       int y = 0;
+       bool user_position = false;
+       unsigned width = 640;
+       unsigned height = 480;
+       bool fullscreen = false;
+       const Monitor *fullscreen_monitor = 0;
+       bool fullscreen_exclusive = true;
+       bool resizable = false;
 };
 
 class Window
@@ -47,12 +45,12 @@ public:
 protected:
        Display &display;
        WindowOptions options;
-       bool visible;
-       bool kbd_autorepeat;
-       bool touch_input;
-       bool resizing;
-       bool moving;
-       Private *priv;
+       bool visible = false;
+       bool kbd_autorepeat = true;
+       bool touch_input = false;
+       bool resizing = false;
+       bool moving = false;
+       Private *priv = 0;
 
 public:
        Window(Display &, unsigned w, unsigned h, bool fs = false);
index 2257b1cfbbed2939bd3b2c8a6bcb50e5d3c4bcf1..879930fa037b383b2f38ed705005feeb88f259a5 100644 (file)
@@ -9,7 +9,7 @@ namespace Graphics {
 
 struct Window::Private: PlatformWindowPrivate
 {
-       WindowHandle window;
+       WindowHandle window = 0;
 };
 
 struct Window::Event: PlatformEvent
index d71f81bbfb49857f268fca12681785e009f02693..ee08395659a4aef8701d1dcf5162e00d8f1b3508 100644 (file)
@@ -8,9 +8,7 @@ namespace Msp {
 namespace Graphics {
 
 Display::Display(const string &):
-       primary_monitor(0),
-       priv(new Private),
-       focus_window(0)
+       priv(new Private)
 {
        static ErrorDialog err_dlg(0);
 
index a92281de8954545d154f242904b68815d838a39c..b90498bc53dbcf650b6ae1f6c5c31ee3a83bec69 100644 (file)
@@ -85,9 +85,6 @@ void Window::platform_init()
                this);
        if(!priv->window)
                throw system_error("CreateWindowEx");
-
-       priv->cursor_in_client_area = false;
-       priv->cursor_visible = true;
 }
 
 void Window::platform_cleanup()
index 77f45262987caa6c69119dde43a0b4b835b66cd2..35d2ab30be41d0978e73f5a740a98c078e67fab6 100644 (file)
@@ -10,8 +10,8 @@ typedef HWND WindowHandle;
 
 struct PlatformWindowPrivate
 {
-       bool cursor_in_client_area;
-       bool cursor_visible;
+       bool cursor_in_client_area = false;
+       bool cursor_visible = true;
 };
 
 struct PlatformEvent
index 8209deb9848d89538f64feb7abadc9b33c360c6f..9e82627fce095289383efd30e31db52e6812f13f 100644 (file)
@@ -84,9 +84,7 @@ namespace Msp {
 namespace Graphics {
 
 Display::Display(const string &disp_name):
-       primary_monitor(0),
-       priv(new Private),
-       focus_window(0)
+       priv(new Private)
 {
        if(disp_name.empty())
                priv->display = XOpenDisplay(0);
index fb77c324ecec50477fa333de77bd11aa1446f852..e33511e888b17f57a82646416239841f9a8bc26c 100644 (file)
@@ -25,10 +25,6 @@ void Window::platform_init()
        DisplayHandle dpy = display.get_private().display;
 
        priv->wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", true);
-       priv->invisible_cursor = 0;
-       priv->reparented = false;
-       priv->rel_x = 0;
-       priv->rel_y = 0;
 
        XSetWindowAttributes attr;
        attr.override_redirect = options.fullscreen;
index 41cdec8f2f32dc08931d20d00bc332c003d91a01..a72729781cb35faa0faf4cfbbe5a247e4c2f14b7 100644 (file)
@@ -10,11 +10,11 @@ typedef ::Window WindowHandle;
 
 struct PlatformWindowPrivate
 {
-       Atom wm_delete_window;
-       Cursor invisible_cursor;
-       bool reparented;
-       int rel_x;
-       int rel_y;
+       Atom wm_delete_window = None;
+       Cursor invisible_cursor = None;
+       bool reparented = false;
+       int rel_x = 0;
+       int rel_y = 0;
 };
 
 struct PlatformEvent
index 09efe40ac74f32500660030088b389076fdc5409..df07fb9eaf47c430d1a204f1dab7ad394d4e1491 100644 (file)
@@ -4,21 +4,12 @@
 namespace Msp {
 namespace Input {
 
-BinaryControl::BinaryControl():
-       state(false),
-       threshold(0.5)
-{ }
-
 BinaryControl::BinaryControl(const ControlSource &s):
-       Control(s),
-       state(false),
-       threshold(0.5)
+       Control(s)
 { }
 
 BinaryControl::BinaryControl(Device &d, ControlSrcType t, unsigned i):
-       Control(d, t, i),
-       state(false),
-       threshold(0.5)
+       Control(d, t, i)
 { }
 
 BinaryControl::~BinaryControl()
index e71f4c30204d5de23df792c0bf507131ef36ebb5..0d71bdc3349e0dc4afedf3a5a9423528ca82977a 100644 (file)
@@ -18,11 +18,11 @@ public:
        sigc::signal<void> signal_release;
 
 private:
-       bool state;
-       float threshold;
+       bool state = false;
+       float threshold = 0.5f;
 
 public:
-       BinaryControl();
+       BinaryControl() = default;
        BinaryControl(const ControlSource &);
        BinaryControl(Device &, ControlSrcType, unsigned);
        ~BinaryControl();
index b5e3a3b225f15aa03f9a795d1a46b67c392c0763..f5a935ddffb1c0934c7772a9ece10de3352dec00 100644 (file)
@@ -69,9 +69,9 @@ public:
                };
 
                std::string control;
-               unsigned device;
-               ControlSrcType type;
-               unsigned index;
+               unsigned device = 0;
+               ControlSrcType type = NONE;
+               unsigned index = 0;
        };
 
 private:
index f82b9c38cd1946ada7cf0d749b0bae8aa7d5309e..fb1d37654b61b812c05bc1092f98158e7df50a16 100644 (file)
@@ -9,12 +9,6 @@ using namespace std;
 namespace Msp {
 namespace Input {
 
-ControlSource::ControlSource():
-       dev(0),
-       type(NONE),
-       index(0)
-{ }
-
 ControlSource::ControlSource(Device &d, ControlSrcType t, unsigned i):
        dev(&d),
        type(t),
@@ -36,30 +30,12 @@ std::string ControlSource::str() const
 }
 
 
-Control::Control():
-       capture_dev(0),
-       activator(0),
-       origin(0),
-       rising_edge(false),
-       falling_edge(false)
-{ }
-
 Control::Control(const ControlSource &s):
-       src(s),
-       capture_dev(0),
-       activator(0),
-       origin(0),
-       rising_edge(false),
-       falling_edge(false)
+       src(s)
 { }
 
 Control::Control(Device &d, ControlSrcType t, unsigned i):
-       src(d, t, i),
-       capture_dev(0),
-       activator(0),
-       origin(0),
-       rising_edge(false),
-       falling_edge(false)
+       src(d, t, i)
 {
        connect_signals();
 }
index 7a4fd0e0a4ddbf6bd384b317f35e475b9719d6f9..dcf7bf341047e71249440ba6114738cce367af96 100644 (file)
@@ -25,11 +25,11 @@ different types of controls in a uniform way.
 */
 struct ControlSource
 {
-       Device *dev;
-       ControlSrcType type;
-       unsigned index;
+       Device *dev = 0;
+       ControlSrcType type = NONE;
+       unsigned index = 0;
 
-       ControlSource();
+       ControlSource() = default;
        ControlSource(Device &, ControlSrcType, unsigned);
        std::string str() const;
 };
@@ -55,13 +55,13 @@ public:
 
 protected:
        ControlSource src;
-       Device *capture_dev;
-       BinaryControl *activator;
-       float origin;
-       bool rising_edge;
-       bool falling_edge;
+       Device *capture_dev = 0;
+       BinaryControl *activator = 0;
+       float origin = 0.0f;
+       bool rising_edge = false;
+       bool falling_edge = false;
 
-       Control();
+       Control() = default;
        Control(const ControlSource &);
        Control(Device &, ControlSrcType, unsigned);
 public:
index 5ef63053ed8e9b59b5ad3442edce6d1f6c28b402..e80029054548fe82c0a985bb2690b23c6773021c 100644 (file)
@@ -57,7 +57,7 @@ public:
        sigc::signal<bool, unsigned, float, float>::accumulated<EventAccumulator> signal_axis_motion;
 
 protected:
-       DeviceType type;
+       DeviceType type = UNSPECIFIED;
        std::string name;
        std::vector<char> buttons;
        std::vector<float> axes;
index 19f98d5c0c075085e41171d9bbb354476916e701..6393ac09358a6b297cc2f0b261e5c94dccd8a5cd 100644 (file)
@@ -13,8 +13,8 @@ class GameController: public Device
 private:
        struct Private;
 
-       Private *priv;
-       IO::EventDispatcher *event_disp;
+       Private *priv = 0;
+       IO::EventDispatcher *event_disp = 0;
 
        static bool detect_done;
        static unsigned n_detected_controllers;
index f6678e8156a2ab8af4a4cf613a39a3d07d5e1f75..1b577893c30e313ca4ca3997a73c06b1502fd26e 100644 (file)
@@ -11,10 +11,7 @@ namespace Input {
 
 GestureDetector::GestureDetector(Touchscreen &ts):
        Device(UNSPECIFIED),
-       touchscreen(ts),
-       current_gesture(GESTURE_NONE),
-       pending_tap(GESTURE_NONE),
-       invalid_gesture(false)
+       touchscreen(ts)
 {
        name = "Gesture";
 
index 5f7c4afc4f729ee0322db88c0ff44611e02ee458..7f9726c8295ce5d223b93f241dd013f3918cabd9 100644 (file)
@@ -49,11 +49,11 @@ private:
 
        Touchscreen &touchscreen;
        TouchPoint points[MAX_POINTS];
-       Gesture current_gesture;
-       Gesture pending_tap;
-       bool invalid_gesture;
-       float threshold_x_sq;
-       float threshold_y_sq;
+       Gesture current_gesture = GESTURE_NONE;
+       Gesture pending_tap = GESTURE_NONE;
+       bool invalid_gesture = false;
+       float threshold_x_sq = 1.0f;
+       float threshold_y_sq = 1.0f;
 
 public:
        GestureDetector(Touchscreen &);
index c6b17c8541bc3c22703cb7b808b7099480cbed50..06008bcf90b0adcd2abd89d6e05eac457b049992 100644 (file)
@@ -16,8 +16,7 @@ namespace Input {
 vector<string> GameController::Private::detected_controllers;
 
 GameController::GameController(unsigned index):
-       Device(GAME_CONTROLLER),
-       event_disp(0)
+       Device(GAME_CONTROLLER)
 {
        if(!detect_done)
                detect();
index 58313b69d6e19ed92de701595b919f099d4dba2f..86768751af3e185dd548e21162e41c07720ab039 100644 (file)
@@ -33,7 +33,7 @@ public:
 
 struct GameController::Private
 {
-       JsDevice *dev;
+       JsDevice *dev = 0;
 
        static std::vector<std::string> detected_controllers;
 };
index c9d0a3c5d69b8b3b0cce4e7720ca9a4303c6c0bb..988509bf99a4990a3972381c33d2734d1447f275 100644 (file)
@@ -6,27 +6,12 @@ using namespace std;
 namespace Msp {
 namespace Input {
 
-SmoothControl::SmoothControl():
-       value(0),
-       paired_ctrl(0),
-       dead_zone(0.1),
-       threshold(0.9)
-{ }
-
 SmoothControl::SmoothControl(const ControlSource &s):
-       Control(s),
-       value(0),
-       paired_ctrl(0),
-       dead_zone(0.1),
-       threshold(0.9)
+       Control(s)
 { }
 
 SmoothControl::SmoothControl(Device &d, ControlSrcType t, unsigned i):
-       Control(d, t, i),
-       value(0),
-       paired_ctrl(0),
-       dead_zone(0.1),
-       threshold(0.9)
+       Control(d, t, i)
 { }
 
 SmoothControl::~SmoothControl()
index 11744ddc7fc6f4e4248580bd5b77e141a91745ca..5f7182404bc5cb11bf12bdebd5cb3b1dc7259ef1 100644 (file)
@@ -20,13 +20,13 @@ public:
        sigc::signal<void, float> signal_motion;
 
 private:
-       float value;
-       SmoothControl *paired_ctrl;
-       float dead_zone;
-       float threshold;
+       float value = 0.0f;
+       SmoothControl *paired_ctrl = 0;
+       float dead_zone = 0.1f;
+       float threshold = 0.9f;
 
 public:
-       SmoothControl();
+       SmoothControl() = default;
        SmoothControl(const ControlSource &);
        SmoothControl(Device &, ControlSrcType, unsigned);
        ~SmoothControl();
index 9c6853a41bd15095cbc23d69ba651ce26459f6ec..df29666cc73904d9dd83d437e50d58d94a6aa97d 100644 (file)
@@ -101,13 +101,6 @@ void GameController::tick(const Time::TimeDelta &)
 }
 
 
-GameController::Private::Private():
-       index(0),
-       last_packet_number(0),
-       event_pipe(0),
-       timer_slot(0)
-{ }
-
 bool GameController::Private::generate_event()
 {
        event_pipe->put(1);
@@ -144,8 +137,7 @@ void GameController::Private::update_state(GameController &ctrl, const XINPUT_ST
 GameControllerTimerThread *GameControllerTimerThread::thread = 0;
 
 GameControllerTimerThread::GameControllerTimerThread():
-       Thread("GameController"),
-       n_users(0)
+       Thread("GameController")
 {
        launch();
 }
index 928ad6770dd3b917f50d823dea17ac2862cbe275..d6ee6c27d4bc2f252acf3bc26d1fb4187f37d30b 100644 (file)
@@ -14,7 +14,7 @@ class GameControllerTimerThread: public Msp::Thread
 {
 private:
        Time::Timer timer;
-       unsigned n_users;
+       unsigned n_users = 0;
 
        static GameControllerTimerThread *thread;
 
@@ -31,15 +31,13 @@ private:
 
 struct GameController::Private
 {
-       unsigned index;
-       unsigned last_packet_number;
-       IO::Pipe *event_pipe;
-       Time::Timer::Slot *timer_slot;
+       unsigned index = 0;
+       unsigned last_packet_number = 0;
+       IO::Pipe *event_pipe = 0;
+       Time::Timer::Slot *timer_slot = 0;
 
        static std::vector<unsigned> detected_controllers;
 
-       Private();
-
        bool generate_event();
 
        void update_state(GameController &, const XINPUT_STATE &, bool);