diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-02-27 11:32:15 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-02-27 17:03:41 +0000 |
commit | c4bd9198b4a0fac809903dd2c09276c2c3c1b22e (patch) | |
tree | 83325fe11d258c922ede480e0ad3de3df45032fa /src/client/qwaylandwindow_p.h | |
parent | 72999738489b5251d025c954a77c93e8e1fdfd9d (diff) |
Init variables where they are declared when possible (clang-tidy)
clang-tidy -p compile_commands.json $file \
-checks='-*,modernize-use-default-member-init,readability-redundant-member-init' \
-config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' \
-header-filter='qtwayland' \
-fix
Afterwards I ran search and replace on the diff to clean up some whitespace errors:
- Replaced '(\n\+[^:\n]*)(:\s+\+\s+)' with '$1: '
- Replaced '(\n\+[^,\n]*)(,\s+\+\s+)' with '$1, '
- Replaced '\n\+\s*\n' with '\n'
I also had to do some manual edits, because for some reason, this particular
clang-tidy check doesn't trigger for some files.
Change-Id: I3b3909bac4bf20108bbe8ad1e01bcc54236dae1b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/client/qwaylandwindow_p.h')
-rw-r--r-- | src/client/qwaylandwindow_p.h | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index fca96f30d..a74f18827 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -81,9 +81,6 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowConfigure { public: QWaylandWindowConfigure() - : width(0) - , height(0) - , edges(0) { } void clear() @@ -92,9 +89,9 @@ public: bool isEmpty() const { return !height || !width; } - int width; - int height; - uint32_t edges; + int width = 0; + int height = 0; + uint32_t edges = 0; }; class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow, public QtWayland::wl_surface @@ -214,39 +211,39 @@ protected: void surface_leave(struct ::wl_output *output) override; QVector<QWaylandScreen *> mScreens; //As seen by wl_surface.enter/leave events. Chronological order. - QWaylandDisplay *mDisplay; - QWaylandShellSurface *mShellSurface; - QWaylandSubSurface *mSubSurfaceWindow; + QWaylandDisplay *mDisplay = nullptr; + QWaylandShellSurface *mShellSurface = nullptr; + QWaylandSubSurface *mSubSurfaceWindow = nullptr; QVector<QWaylandSubSurface *> mChildren; - QWaylandAbstractDecoration *mWindowDecoration; - bool mMouseEventsInContentArea; - Qt::MouseButtons mMousePressedInContentArea; + QWaylandAbstractDecoration *mWindowDecoration = nullptr; + bool mMouseEventsInContentArea = false; + Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton; WId mWindowId; - bool mWaitingForFrameSync; + bool mWaitingForFrameSync = false; struct ::wl_callback *mFrameCallback = nullptr; QWaitCondition mFrameSyncWait; QMutex mResizeLock; QWaylandWindowConfigure mConfigure; - bool mRequestResizeSent; - bool mCanResize; - bool mResizeDirty; + bool mRequestResizeSent = false; + bool mCanResize = true; + bool mResizeDirty = false; bool mResizeAfterSwap; QVariantMap m_properties; - bool mSentInitialResize; + bool mSentInitialResize = false; QPoint mOffset; - int mScale; + int mScale = 1; QIcon mWindowIcon; - Qt::WindowStates mState; + Qt::WindowStates mState = Qt::WindowNoState; Qt::WindowFlags mFlags; QRegion mMask; - QWaylandShmBackingStore *mBackingStore; + QWaylandShmBackingStore *mBackingStore = nullptr; private slots: void handleScreenRemoved(QScreen *qScreen); @@ -266,7 +263,7 @@ private: void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreenChanged(); - bool mUpdateRequested; + bool mUpdateRequested = false; static const wl_callback_listener callbackListener; static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time); |