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>
This commit is contained in:
Johan Klokkhammer Helsing 2018-02-27 11:32:15 +01:00 committed by Johan Helsing
parent ef99cac249
commit 9147c0e688
52 changed files with 113 additions and 252 deletions

View File

@ -49,10 +49,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate() QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate()
: QObjectPrivate()
, waylandIntegration(nullptr)
, version(-1)
, active(false)
{ {
// Keep the possibility to use a custom waylandIntegration as a plugin, // Keep the possibility to use a custom waylandIntegration as a plugin,
// but also add the possibility to run it as a QML component. // but also add the possibility to run it as a QML component.

View File

@ -65,16 +65,15 @@ public:
static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id, static void handleRegistryGlobal(void *data, ::wl_registry *registry, uint32_t id,
const QString &interface, uint32_t version); const QString &interface, uint32_t version);
QtWaylandClient::QWaylandIntegration *waylandIntegration; QtWaylandClient::QWaylandIntegration *waylandIntegration = nullptr;
int version; int version = -1;
bool active; bool active = false;
}; };
class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate
{ {
public: public:
QWaylandClientExtensionTemplatePrivate() QWaylandClientExtensionTemplatePrivate()
: QWaylandClientExtensionPrivate()
{ } { }
}; };

View File

@ -44,7 +44,6 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient { namespace QtWaylandClient {
QWaylandServerBuffer::QWaylandServerBuffer() QWaylandServerBuffer::QWaylandServerBuffer()
: m_user_data(nullptr)
{ {
} }

View File

@ -89,7 +89,7 @@ protected:
QSize m_size; QSize m_size;
private: private:
void *m_user_data; void *m_user_data = nullptr;
}; };
class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegration class Q_WAYLAND_CLIENT_EXPORT QWaylandServerBufferIntegration

View File

@ -153,14 +153,12 @@ private:
QColor m_foregroundColor; QColor m_foregroundColor;
QColor m_backgroundColor; QColor m_backgroundColor;
QStaticText m_windowTitle; QStaticText m_windowTitle;
Button m_clicking; Button m_clicking = None;
}; };
QWaylandBradientDecoration::QWaylandBradientDecoration() QWaylandBradientDecoration::QWaylandBradientDecoration()
: QWaylandAbstractDecoration()
, m_clicking(None)
{ {
QPalette palette; QPalette palette;
m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText); m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText);

View File

@ -60,21 +60,17 @@ public:
QWaylandAbstractDecorationPrivate(); QWaylandAbstractDecorationPrivate();
~QWaylandAbstractDecorationPrivate(); ~QWaylandAbstractDecorationPrivate();
QWindow *m_window; QWindow *m_window = nullptr;
QWaylandWindow *m_wayland_window; QWaylandWindow *m_wayland_window = nullptr;
bool m_isDirty; bool m_isDirty = true;
QImage m_decorationContentImage; QImage m_decorationContentImage;
Qt::MouseButtons m_mouseButtons; Qt::MouseButtons m_mouseButtons = Qt::NoButton;
}; };
QWaylandAbstractDecorationPrivate::QWaylandAbstractDecorationPrivate() QWaylandAbstractDecorationPrivate::QWaylandAbstractDecorationPrivate()
: m_window(nullptr) : m_decorationContentImage(nullptr)
, m_wayland_window(nullptr)
, m_isDirty(true)
, m_decorationContentImage(nullptr)
, m_mouseButtons(Qt::NoButton)
{ {
} }

View File

@ -47,8 +47,6 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient { namespace QtWaylandClient {
QWaylandBuffer::QWaylandBuffer() QWaylandBuffer::QWaylandBuffer()
: mBuffer(nullptr)
, mBusy(false)
{ {
} }

View File

@ -77,10 +77,10 @@ public:
bool busy() const { return mBusy; } bool busy() const { return mBusy; }
protected: protected:
struct wl_buffer *mBuffer; struct wl_buffer *mBuffer = nullptr;
private: private:
bool mBusy; bool mBusy = false;
static void release(void *data, wl_buffer *); static void release(void *data, wl_buffer *);
static const wl_buffer_listener listener; static const wl_buffer_listener listener;

View File

@ -66,11 +66,6 @@ QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWayl
: QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat())) : QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat()))
, m_display(manager->display()) , m_display(manager->display())
, m_inputDevice(inputDevice) , m_inputDevice(inputDevice)
, m_enterSerial(0)
, m_dragWindow(nullptr)
, m_dragPoint()
, m_dragOffer()
, m_selectionOffer()
{ {
} }

View File

@ -117,9 +117,9 @@ private:
QPoint calculateDragPosition(int x, int y, QWindow *wnd) const; QPoint calculateDragPosition(int x, int y, QWindow *wnd) const;
#endif #endif
QWaylandDisplay *m_display; QWaylandDisplay *m_display = nullptr;
QWaylandInputDevice *m_inputDevice; QWaylandInputDevice *m_inputDevice = nullptr;
uint32_t m_enterSerial; uint32_t m_enterSerial = 0;
QPointer<QWindow> m_dragWindow; QPointer<QWindow> m_dragWindow;
QPoint m_dragPoint; QPoint m_dragPoint;
QScopedPointer<QWaylandDataOffer> m_dragOffer; QScopedPointer<QWaylandDataOffer> m_dragOffer;

View File

@ -87,8 +87,7 @@ void QWaylandDataOffer::data_offer_offer(const QString &mime_type)
} }
QWaylandMimeData::QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display) QWaylandMimeData::QWaylandMimeData(QWaylandDataOffer *dataOffer, QWaylandDisplay *display)
: QInternalMimeData() : m_dataOffer(dataOffer)
, m_dataOffer(dataOffer)
, m_display(display) , m_display(display)
{ {
} }

View File

@ -124,20 +124,6 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co
QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
: mWaylandIntegration(waylandIntegration) : mWaylandIntegration(waylandIntegration)
#if QT_CONFIG(wayland_datadevice)
, mDndSelectionHandler(nullptr)
#endif
, mWindowExtension(nullptr)
, mSubCompositor(nullptr)
, mTouchExtension(nullptr)
, mQtKeyExtension(nullptr)
, mTextInputManager(nullptr)
, mHardwareIntegration(nullptr)
, mLastInputSerial(0)
, mLastInputDevice(nullptr)
, mLastInputWindow(nullptr)
, mLastKeyboardFocus(nullptr)
, mSyncCallback(nullptr)
{ {
qRegisterMetaType<uint32_t>("uint32_t"); qRegisterMetaType<uint32_t>("uint32_t");

View File

@ -217,12 +217,12 @@ private:
int mWritableNotificationFd; int mWritableNotificationFd;
QList<RegistryGlobal> mGlobals; QList<RegistryGlobal> mGlobals;
int mCompositorVersion; int mCompositorVersion;
uint32_t mLastInputSerial; uint32_t mLastInputSerial = 0;
QWaylandInputDevice *mLastInputDevice; QWaylandInputDevice *mLastInputDevice = nullptr;
QPointer<QWaylandWindow> mLastInputWindow; QPointer<QWaylandWindow> mLastInputWindow;
QPointer<QWaylandWindow> mLastKeyboardFocus; QPointer<QWaylandWindow> mLastKeyboardFocus;
QVector<QWaylandWindow *> mActiveWindows; QVector<QWaylandWindow *> mActiveWindows;
struct wl_callback *mSyncCallback; struct wl_callback *mSyncCallback = nullptr;
static const wl_callback_listener syncCallbackListener; static const wl_callback_listener syncCallbackListener;
void registry_global(uint32_t id, const QString &interface, uint32_t version) override; void registry_global(uint32_t id, const QString &interface, uint32_t version) override;

View File

@ -71,15 +71,6 @@ const Qt::InputMethodQueries supportedQueries = Qt::ImEnabled |
QWaylandTextInput::QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input) QWaylandTextInput::QWaylandTextInput(QWaylandDisplay *display, struct ::zwp_text_input_v2 *text_input)
: QtWayland::zwp_text_input_v2(text_input) : QtWayland::zwp_text_input_v2(text_input)
, m_display(display) , m_display(display)
, m_builder()
, m_serial(0)
, m_surface(nullptr)
, m_preeditCommit()
, m_inputPanelVisible(false)
, m_keyboardRectangle()
, m_locale()
, m_inputDirection(Qt::LayoutDirectionAuto)
, m_resetCallback(nullptr)
{ {
} }
@ -391,9 +382,7 @@ Qt::KeyboardModifiers QWaylandTextInput::modifiersToQtModifiers(uint32_t modifie
} }
QWaylandInputContext::QWaylandInputContext(QWaylandDisplay *display) QWaylandInputContext::QWaylandInputContext(QWaylandDisplay *display)
: QPlatformInputContext() : mDisplay(display)
, mDisplay(display)
, mCurrentWindow()
{ {
} }

View File

@ -112,17 +112,17 @@ private:
QVector<Qt::KeyboardModifier> m_modifiersMap; QVector<Qt::KeyboardModifier> m_modifiersMap;
uint32_t m_serial; uint32_t m_serial = 0;
struct ::wl_surface *m_surface; struct ::wl_surface *m_surface = nullptr;
QString m_preeditCommit; QString m_preeditCommit;
bool m_inputPanelVisible; bool m_inputPanelVisible = false;
QRectF m_keyboardRectangle; QRectF m_keyboardRectangle;
QLocale m_locale; QLocale m_locale;
Qt::LayoutDirection m_inputDirection; Qt::LayoutDirection m_inputDirection = Qt::LayoutDirectionAuto;
struct ::wl_callback *m_resetCallback; struct ::wl_callback *m_resetCallback = nullptr;
static const wl_callback_listener callbackListener; static const wl_callback_listener callbackListener;
static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time); static void resetCallback(void *data, struct wl_callback *wl_callback, uint32_t time);
}; };

View File

@ -200,8 +200,7 @@ QWaylandInputDevice::Touch::~Touch()
} }
QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id)
: QObject() : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 4))
, QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 4))
, mQDisplay(display) , mQDisplay(display)
, mDisplay(display->wl_display()) , mDisplay(display->wl_display())
, mVersion(qMin(version, 4)) , mVersion(qMin(version, 4))

View File

@ -121,16 +121,11 @@ public:
}; };
QWaylandIntegration::QWaylandIntegration() QWaylandIntegration::QWaylandIntegration()
: mClientBufferIntegration(nullptr) : mFontDb(new QGenericUnixFontDatabase())
, mInputDeviceIntegration(nullptr)
, mFontDb(new QGenericUnixFontDatabase())
, mNativeInterface(new QWaylandNativeInterface(this)) , mNativeInterface(new QWaylandNativeInterface(this))
#if QT_CONFIG(accessibility) #if QT_CONFIG(accessibility)
, mAccessibility(new QPlatformAccessibility()) , mAccessibility(new QPlatformAccessibility())
#endif #endif
, mClientBufferIntegrationInitialized(false)
, mServerBufferIntegrationInitialized(false)
, mShellIntegrationInitialized(false)
{ {
initializeInputDeviceIntegration(); initializeInputDeviceIntegration();
mDisplay.reset(new QWaylandDisplay(this)); mDisplay.reset(new QWaylandDisplay(this));

View File

@ -147,9 +147,9 @@ private:
QScopedPointer<QPlatformAccessibility> mAccessibility; QScopedPointer<QPlatformAccessibility> mAccessibility;
#endif #endif
bool mFailed = false; bool mFailed = false;
bool mClientBufferIntegrationInitialized; bool mClientBufferIntegrationInitialized = false;
bool mServerBufferIntegrationInitialized; bool mServerBufferIntegrationInitialized = false;
bool mShellIntegrationInitialized; bool mShellIntegrationInitialized = false;
friend class QWaylandDisplay; friend class QWaylandDisplay;
}; };

View File

@ -53,20 +53,10 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient { namespace QtWaylandClient {
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id) QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id)
: QPlatformScreen() : QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2))
, QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2))
, m_outputId(id) , m_outputId(id)
, mWaylandDisplay(waylandDisplay) , mWaylandDisplay(waylandDisplay)
, mScale(1)
, mDepth(32)
, mRefreshRate(60000)
, mTransform(-1)
, mFormat(QImage::Format_ARGB32_Premultiplied)
, mOutputName(QStringLiteral("Screen%1").arg(id)) , mOutputName(QStringLiteral("Screen%1").arg(id))
, m_orientation(Qt::PrimaryOrientation)
#if QT_CONFIG(cursor)
, mWaylandCursor(nullptr)
#endif
{ {
} }

View File

@ -116,21 +116,21 @@ private:
void output_done() override; void output_done() override;
int m_outputId; int m_outputId;
QWaylandDisplay *mWaylandDisplay; QWaylandDisplay *mWaylandDisplay = nullptr;
QString mManufacturer; QString mManufacturer;
QString mModel; QString mModel;
QRect mGeometry; QRect mGeometry;
int mScale; int mScale = 1;
int mDepth; int mDepth = 32;
int mRefreshRate; int mRefreshRate = 60000;
int mTransform; int mTransform = -1;
QImage::Format mFormat; QImage::Format mFormat = QImage::Format_ARGB32_Premultiplied;
QSize mPhysicalSize; QSize mPhysicalSize;
QString mOutputName; QString mOutputName;
Qt::ScreenOrientation m_orientation; Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation;
#if QT_CONFIG(cursor) #if QT_CONFIG(cursor)
QWaylandCursor *mWaylandCursor; QWaylandCursor *mWaylandCursor = nullptr;
#endif #endif
}; };

View File

@ -72,9 +72,6 @@ Q_LOGGING_CATEGORY(logCategory, "qt.qpa.wayland.backingstore")
QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
const QSize &size, QImage::Format format, int scale) const QSize &size, QImage::Format format, int scale)
: QWaylandBuffer()
, mShmPool(nullptr)
, mMarginsImage(nullptr)
{ {
int stride = size.width() * 4; int stride = size.width() * 4;
int alloc = stride * size.height(); int alloc = stride * size.height();
@ -161,9 +158,6 @@ QImage *QWaylandShmBuffer::imageInsideMargins(const QMargins &marginsIn)
QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window)
: QPlatformBackingStore(window) : QPlatformBackingStore(window)
, mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display())
, mFrontBuffer(nullptr)
, mBackBuffer(nullptr)
, mPainting(false)
{ {
} }

View File

@ -79,9 +79,9 @@ public:
QImage *imageInsideMargins(const QMargins &margins); QImage *imageInsideMargins(const QMargins &margins);
private: private:
QImage mImage; QImage mImage;
struct wl_shm_pool *mShmPool; struct wl_shm_pool *mShmPool = nullptr;
QMargins mMargins; QMargins mMargins;
QImage *mMarginsImage; QImage *mMarginsImage = nullptr;
}; };
class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore
@ -115,11 +115,11 @@ private:
void updateDecorations(); void updateDecorations();
QWaylandShmBuffer *getBuffer(const QSize &size); QWaylandShmBuffer *getBuffer(const QSize &size);
QWaylandDisplay *mDisplay; QWaylandDisplay *mDisplay = nullptr;
QLinkedList<QWaylandShmBuffer *> mBuffers; QLinkedList<QWaylandShmBuffer *> mBuffers;
QWaylandShmBuffer *mFrontBuffer; QWaylandShmBuffer *mFrontBuffer = nullptr;
QWaylandShmBuffer *mBackBuffer; QWaylandShmBuffer *mBackBuffer = nullptr;
bool mPainting; bool mPainting = false;
QMutex mMutex; QMutex mMutex;
QSize mRequestedSize; QSize mRequestedSize;

View File

@ -51,7 +51,6 @@ QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *p
: QtWayland::wl_subsurface(sub_surface) : QtWayland::wl_subsurface(sub_surface)
, m_window(window) , m_window(window)
, m_parent(parent) , m_parent(parent)
, m_synchronized(false)
{ {
m_parent->mChildren << this; m_parent->mChildren << this;
setDeSync(); setDeSync();

View File

@ -88,7 +88,7 @@ private:
void set_desync(); void set_desync();
QWaylandWindow *m_window; QWaylandWindow *m_window;
QWaylandWindow *m_parent; QWaylandWindow *m_parent;
bool m_synchronized; bool m_synchronized = false;
QMutex m_syncLock; QMutex m_syncLock;
}; };

View File

@ -78,25 +78,9 @@ namespace QtWaylandClient {
QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr; QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr;
QWaylandWindow::QWaylandWindow(QWindow *window) QWaylandWindow::QWaylandWindow(QWindow *window)
: QObject() : QPlatformWindow(window)
, QPlatformWindow(window)
, mDisplay(waylandScreen()->display()) , mDisplay(waylandScreen()->display())
, mShellSurface(nullptr)
, mSubSurfaceWindow(nullptr)
, mWindowDecoration(nullptr)
, mMouseEventsInContentArea(false)
, mMousePressedInContentArea(Qt::NoButton)
, mWaitingForFrameSync(false)
, mRequestResizeSent(false)
, mCanResize(true)
, mResizeDirty(false)
, mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP")) , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP"))
, mSentInitialResize(false)
, mScale(1)
, mState(Qt::WindowNoState)
, mMask()
, mBackingStore(nullptr)
, mUpdateRequested(false)
{ {
static WId id = 1; static WId id = 1;
mWindowId = id++; mWindowId = id++;

View File

@ -81,9 +81,6 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindowConfigure
{ {
public: public:
QWaylandWindowConfigure() QWaylandWindowConfigure()
: width(0)
, height(0)
, edges(0)
{ } { }
void clear() void clear()
@ -92,9 +89,9 @@ public:
bool isEmpty() const bool isEmpty() const
{ return !height || !width; } { return !height || !width; }
int width; int width = 0;
int height; int height = 0;
uint32_t edges; uint32_t edges = 0;
}; };
class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow, public QtWayland::wl_surface 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; void surface_leave(struct ::wl_output *output) override;
QVector<QWaylandScreen *> mScreens; //As seen by wl_surface.enter/leave events. Chronological order. QVector<QWaylandScreen *> mScreens; //As seen by wl_surface.enter/leave events. Chronological order.
QWaylandDisplay *mDisplay; QWaylandDisplay *mDisplay = nullptr;
QWaylandShellSurface *mShellSurface; QWaylandShellSurface *mShellSurface = nullptr;
QWaylandSubSurface *mSubSurfaceWindow; QWaylandSubSurface *mSubSurfaceWindow = nullptr;
QVector<QWaylandSubSurface *> mChildren; QVector<QWaylandSubSurface *> mChildren;
QWaylandAbstractDecoration *mWindowDecoration; QWaylandAbstractDecoration *mWindowDecoration = nullptr;
bool mMouseEventsInContentArea; bool mMouseEventsInContentArea = false;
Qt::MouseButtons mMousePressedInContentArea; Qt::MouseButtons mMousePressedInContentArea = Qt::NoButton;
WId mWindowId; WId mWindowId;
bool mWaitingForFrameSync; bool mWaitingForFrameSync = false;
struct ::wl_callback *mFrameCallback = nullptr; struct ::wl_callback *mFrameCallback = nullptr;
QWaitCondition mFrameSyncWait; QWaitCondition mFrameSyncWait;
QMutex mResizeLock; QMutex mResizeLock;
QWaylandWindowConfigure mConfigure; QWaylandWindowConfigure mConfigure;
bool mRequestResizeSent; bool mRequestResizeSent = false;
bool mCanResize; bool mCanResize = true;
bool mResizeDirty; bool mResizeDirty = false;
bool mResizeAfterSwap; bool mResizeAfterSwap;
QVariantMap m_properties; QVariantMap m_properties;
bool mSentInitialResize; bool mSentInitialResize = false;
QPoint mOffset; QPoint mOffset;
int mScale; int mScale = 1;
QIcon mWindowIcon; QIcon mWindowIcon;
Qt::WindowStates mState; Qt::WindowStates mState = Qt::WindowNoState;
Qt::WindowFlags mFlags; Qt::WindowFlags mFlags;
QRegion mMask; QRegion mMask;
QWaylandShmBackingStore *mBackingStore; QWaylandShmBackingStore *mBackingStore = nullptr;
private slots: private slots:
void handleScreenRemoved(QScreen *qScreen); void handleScreenRemoved(QScreen *qScreen);
@ -266,7 +263,7 @@ private:
void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e);
void handleScreenChanged(); void handleScreenChanged();
bool mUpdateRequested; bool mUpdateRequested = false;
static const wl_callback_listener callbackListener; static const wl_callback_listener callbackListener;
static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time); static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time);

View File

@ -60,16 +60,14 @@ namespace QtWaylandClient {
class QWaylandWindowManagerIntegrationPrivate { class QWaylandWindowManagerIntegrationPrivate {
public: public:
QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay); QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay);
bool m_blockPropertyUpdates; bool m_blockPropertyUpdates = false;
QWaylandDisplay *m_waylandDisplay; QWaylandDisplay *m_waylandDisplay;
QHash<QWindow*, QVariantMap> m_queuedProperties; QHash<QWindow*, QVariantMap> m_queuedProperties;
bool m_showIsFullScreen; bool m_showIsFullScreen = false;
}; };
QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay) QWaylandWindowManagerIntegrationPrivate::QWaylandWindowManagerIntegrationPrivate(QWaylandDisplay *waylandDisplay)
: m_blockPropertyUpdates(false) : m_waylandDisplay(waylandDisplay)
, m_waylandDisplay(waylandDisplay)
, m_showIsFullScreen(false)
{ {
} }

View File

@ -55,7 +55,6 @@ QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay *
} }
QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display) QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display)
: m_wlShell(nullptr)
{ {
Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) {
if (global.interface == QLatin1String("wl_shell")) { if (global.interface == QLatin1String("wl_shell")) {

View File

@ -70,7 +70,7 @@ public:
private: private:
QWaylandWlShellIntegration(QWaylandDisplay* display); QWaylandWlShellIntegration(QWaylandDisplay* display);
QtWayland::wl_shell *m_wlShell; QtWayland::wl_shell *m_wlShell = nullptr;
}; };
} }

View File

@ -56,9 +56,6 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(struct ::wl_shell_surface *shell_
: QWaylandShellSurface(window) : QWaylandShellSurface(window)
, QtWayland::wl_shell_surface(shell_surface) , QtWayland::wl_shell_surface(shell_surface)
, m_window(window) , m_window(window)
, m_maximized(false)
, m_fullscreen(false)
, m_extendedWindow(nullptr)
{ {
if (window->display()->windowExtension()) if (window->display()->windowExtension())
m_extendedWindow = new QWaylandExtendedSurface(window); m_extendedWindow = new QWaylandExtendedSurface(window);

View File

@ -105,10 +105,10 @@ private:
void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial); void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, uint serial);
QWaylandWindow *m_window; QWaylandWindow *m_window;
bool m_maximized; bool m_maximized = false;
bool m_fullscreen; bool m_fullscreen = false;
QSize m_size; QSize m_size;
QWaylandExtendedSurface *m_extendedWindow; QWaylandExtendedSurface *m_extendedWindow = nullptr;
void shell_surface_ping(uint32_t serial) override; void shell_surface_ping(uint32_t serial) override;
void shell_surface_configure(uint32_t edges, void shell_surface_configure(uint32_t edges,

View File

@ -50,7 +50,6 @@ namespace QtWaylandClient {
QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window) QWaylandXdgPopup::QWaylandXdgPopup(struct ::xdg_popup *popup, QWaylandWindow *window)
: QWaylandShellSurface(window) : QWaylandShellSurface(window)
, QtWayland::xdg_popup(popup) , QtWayland::xdg_popup(popup)
, m_extendedWindow(nullptr)
, m_window(window) , m_window(window)
{ {
if (window->display()->windowExtension()) if (window->display()->windowExtension())

View File

@ -80,7 +80,7 @@ protected:
void xdg_popup_popup_done() override; void xdg_popup_popup_done() override;
private: private:
QWaylandExtendedSurface *m_extendedWindow; QWaylandExtendedSurface *m_extendedWindow = nullptr;
QWaylandWindow *m_window; QWaylandWindow *m_window;
}; };

View File

@ -54,13 +54,11 @@ namespace QtWaylandClient {
QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell) QWaylandXdgShell::QWaylandXdgShell(struct ::xdg_shell *shell)
: QtWayland::xdg_shell(shell) : QtWayland::xdg_shell(shell)
, m_popupSerial(0)
{ {
} }
QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id) QWaylandXdgShell::QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id)
: QtWayland::xdg_shell(registry, id, 1) : QtWayland::xdg_shell(registry, id, 1)
, m_popupSerial(0)
{ {
use_unstable_version(QtWayland::xdg_shell::version_current); use_unstable_version(QtWayland::xdg_shell::version_current);
} }

View File

@ -85,7 +85,7 @@ private:
void xdg_shell_ping(uint32_t serial) override; void xdg_shell_ping(uint32_t serial) override;
QVector<QWaylandWindow *> m_popups; QVector<QWaylandWindow *> m_popups;
uint m_popupSerial; uint m_popupSerial = 0;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -57,7 +57,6 @@ QWaylandXdgShellIntegration *QWaylandXdgShellIntegration::create(QWaylandDisplay
} }
QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display) QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display)
: m_xdgShell(nullptr)
{ {
Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) { Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) {
if (global.interface == QLatin1String("xdg_shell")) { if (global.interface == QLatin1String("xdg_shell")) {

View File

@ -72,7 +72,7 @@ public:
private: private:
QWaylandXdgShellIntegration(QWaylandDisplay *display); QWaylandXdgShellIntegration(QWaylandDisplay *display);
QWaylandXdgShell *m_xdgShell; QWaylandXdgShell *m_xdgShell = nullptr;
}; };
} }

View File

@ -117,9 +117,6 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur
, zxdg_surface_v6(surface) , zxdg_surface_v6(surface)
, m_shell(shell) , m_shell(shell)
, m_window(window) , m_window(window)
, m_toplevel(nullptr)
, m_popup(nullptr)
, m_configured(false)
{ {
} }

View File

@ -125,9 +125,9 @@ private:
QWaylandXdgShellV6 *m_shell; QWaylandXdgShellV6 *m_shell;
QWaylandWindow *m_window; QWaylandWindow *m_window;
Toplevel *m_toplevel; Toplevel *m_toplevel = nullptr;
Popup *m_popup; Popup *m_popup = nullptr;
bool m_configured; bool m_configured = false;
QRegion m_exposeRegion; QRegion m_exposeRegion;
}; };

View File

@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient { namespace QtWaylandClient {
QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *display) QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *display)
: m_xdgShell(nullptr)
{ {
for (QWaylandDisplay::RegistryGlobal global : display->globals()) { for (QWaylandDisplay::RegistryGlobal global : display->globals()) {
if (global.interface == QLatin1String("zxdg_shell_v6")) { if (global.interface == QLatin1String("zxdg_shell_v6")) {

View File

@ -71,7 +71,7 @@ public:
private: private:
QWaylandXdgShellV6Integration(QWaylandDisplay *display); QWaylandXdgShellV6Integration(QWaylandDisplay *display);
QWaylandXdgShellV6 *m_xdgShell; QWaylandXdgShellV6 *m_xdgShell = nullptr;
}; };
} }

View File

@ -57,11 +57,6 @@ QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *
, QtWayland::xdg_surface(shell->get_xdg_surface(window->object())) , QtWayland::xdg_surface(shell->get_xdg_surface(window->object()))
, m_window(window) , m_window(window)
, m_shell(shell) , m_shell(shell)
, m_maximized(false)
, m_minimized(false)
, m_fullscreen(false)
, m_active(false)
, m_extendedWindow(nullptr)
{ {
if (window->display()->windowExtension()) if (window->display()->windowExtension())
m_extendedWindow = new QWaylandExtendedSurface(window); m_extendedWindow = new QWaylandExtendedSurface(window);

View File

@ -112,13 +112,13 @@ private:
private: private:
QWaylandWindow *m_window; QWaylandWindow *m_window;
QWaylandXdgShell* m_shell; QWaylandXdgShell* m_shell;
bool m_maximized; bool m_maximized = false;
bool m_minimized; bool m_minimized = false;
bool m_fullscreen; bool m_fullscreen = false;
bool m_active; bool m_active = false;
QSize m_normalSize; QSize m_normalSize;
QMargins m_margins; QMargins m_margins;
QWaylandExtendedSurface *m_extendedWindow; QWaylandExtendedSurface *m_extendedWindow = nullptr;
void xdg_surface_configure(int32_t width, void xdg_surface_configure(int32_t width,
int32_t height, int32_t height,

View File

@ -50,16 +50,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QWaylandInputMethodEventBuilder::QWaylandInputMethodEventBuilder()
: m_anchor(0)
, m_cursor(0)
, m_deleteBefore(0)
, m_deleteAfter(0)
, m_preeditCursor(0)
, m_preeditStyles()
{
}
QWaylandInputMethodEventBuilder::~QWaylandInputMethodEventBuilder() QWaylandInputMethodEventBuilder::~QWaylandInputMethodEventBuilder()
{ {
} }

View File

@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
class QWaylandInputMethodEventBuilder class QWaylandInputMethodEventBuilder
{ {
public: public:
QWaylandInputMethodEventBuilder(); QWaylandInputMethodEventBuilder() = default;
~QWaylandInputMethodEventBuilder(); ~QWaylandInputMethodEventBuilder();
void reset(); void reset();
@ -66,12 +66,12 @@ public:
private: private:
QPair<int, int> replacementForDeleteSurrounding(); QPair<int, int> replacementForDeleteSurrounding();
int32_t m_anchor; int32_t m_anchor = 0;
int32_t m_cursor; int32_t m_cursor = 0;
uint32_t m_deleteBefore; uint32_t m_deleteBefore = 0;
uint32_t m_deleteAfter; uint32_t m_deleteAfter = 0;
int32_t m_preeditCursor; int32_t m_preeditCursor = 0;
QList<QInputMethodEvent::Attribute> m_preeditStyles; QList<QInputMethodEvent::Attribute> m_preeditStyles;
}; };

View File

@ -48,14 +48,6 @@ class TestWindow : public QWindow
{ {
public: public:
TestWindow() TestWindow()
: focusInEventCount(0)
, focusOutEventCount(0)
, keyPressEventCount(0)
, keyReleaseEventCount(0)
, mousePressEventCount(0)
, mouseReleaseEventCount(0)
, touchEventCount(0)
, keyCode(0)
{ {
setSurfaceType(QSurface::RasterSurface); setSurfaceType(QSurface::RasterSurface);
setGeometry(0, 0, 32, 32); setGeometry(0, 0, 32, 32);
@ -103,15 +95,15 @@ public:
QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); }
int focusInEventCount; int focusInEventCount = 0;
int focusOutEventCount; int focusOutEventCount = 0;
int keyPressEventCount; int keyPressEventCount = 0;
int keyReleaseEventCount; int keyReleaseEventCount = 0;
int mousePressEventCount; int mousePressEventCount = 0;
int mouseReleaseEventCount; int mouseReleaseEventCount = 0;
int touchEventCount; int touchEventCount = 0;
uint keyCode; uint keyCode = 0;
QPoint mousePressPos; QPoint mousePressPos;
}; };
@ -404,7 +396,6 @@ class DndWindow : public QWindow
public: public:
DndWindow(QWindow *parent = nullptr) DndWindow(QWindow *parent = nullptr)
: QWindow(parent) : QWindow(parent)
, dragStarted(false)
{ {
QImage cursorImage(64,64,QImage::Format_ARGB32); QImage cursorImage(64,64,QImage::Format_ARGB32);
cursorImage.fill(Qt::blue); cursorImage.fill(Qt::blue);
@ -412,7 +403,7 @@ public:
} }
~DndWindow(){} ~DndWindow(){}
QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); } QPoint frameOffset() const { return QPoint(frameMargins().left(), frameMargins().top()); }
bool dragStarted; bool dragStarted = false;
protected: protected:
void mousePressEvent(QMouseEvent *event) override void mousePressEvent(QMouseEvent *event) override

View File

@ -37,9 +37,6 @@
#include <stdio.h> #include <stdio.h>
MockCompositor::MockCompositor() MockCompositor::MockCompositor()
: m_alive(true)
, m_ready(false)
, m_compositor(0)
{ {
pthread_create(&m_thread, 0, run, this); pthread_create(&m_thread, 0, run, this);

View File

@ -212,13 +212,13 @@ private:
static void *run(void *data); static void *run(void *data);
bool m_alive; bool m_alive = true;
bool m_ready; bool m_ready = false;
pthread_t m_thread; pthread_t m_thread;
QMutex m_mutex; QMutex m_mutex;
QWaitCondition m_waitCondition; QWaitCondition m_waitCondition;
Impl::Compositor *m_compositor; Impl::Compositor *m_compositor = nullptr;
QList<Command> m_commandQueue; QList<Command> m_commandQueue;
}; };

View File

@ -232,10 +232,7 @@ void Seat::seat_get_touch(Resource *resource, uint32_t id)
} }
Keyboard::Keyboard(Compositor *compositor) Keyboard::Keyboard(Compositor *compositor)
: wl_keyboard() : m_compositor(compositor)
, m_compositor(compositor)
, m_focusResource(nullptr)
, m_focus(nullptr)
{ {
} }
@ -286,10 +283,7 @@ void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource)
} }
Pointer::Pointer(Compositor *compositor) Pointer::Pointer(Compositor *compositor)
: wl_pointer() : m_compositor(compositor)
, m_compositor(compositor)
, m_focusResource(nullptr)
, m_focus(nullptr)
{ {
} }
@ -393,10 +387,7 @@ DataOffer::DataOffer()
} }
DataDevice::DataDevice(Compositor *compositor) DataDevice::DataDevice(Compositor *compositor)
: wl_data_device() : m_compositor(compositor)
, m_compositor(compositor)
, m_dataOffer(nullptr)
, m_focus(nullptr)
{ {
} }

View File

@ -85,8 +85,8 @@ protected:
private: private:
Compositor *m_compositor; Compositor *m_compositor;
Resource *m_focusResource; Resource *m_focusResource = nullptr;
Surface *m_focus; Surface *m_focus = nullptr;
}; };
class Pointer : public QtWaylandServer::wl_pointer class Pointer : public QtWaylandServer::wl_pointer
@ -108,8 +108,8 @@ protected:
private: private:
Compositor *m_compositor; Compositor *m_compositor;
Resource *m_focusResource; Resource *m_focusResource = nullptr;
Surface *m_focus; Surface *m_focus = nullptr;
}; };
class Touch : public QtWaylandServer::wl_touch class Touch : public QtWaylandServer::wl_touch
@ -146,8 +146,8 @@ protected:
private: private:
Compositor *m_compositor; Compositor *m_compositor;
QtWaylandServer::wl_data_offer *m_dataOffer; QtWaylandServer::wl_data_offer *m_dataOffer = nullptr;
Surface* m_focus; Surface* m_focus = nullptr;
}; };
class DataDeviceManager : public QtWaylandServer::wl_data_device_manager class DataDeviceManager : public QtWaylandServer::wl_data_device_manager

View File

@ -62,10 +62,8 @@ void Compositor::sendSurfaceLeave(void *data, const QList<QVariant> &parameters)
Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor) Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor)
: QtWaylandServer::wl_surface(client, id, v) : QtWaylandServer::wl_surface(client, id, v)
, m_buffer(nullptr)
, m_compositor(compositor) , m_compositor(compositor)
, m_mockSurface(new MockSurface(this)) , m_mockSurface(new MockSurface(this))
, m_mapped(false)
{ {
} }

View File

@ -63,12 +63,12 @@ protected:
uint32_t callback) override; uint32_t callback) override;
void surface_commit(Resource *resource) override; void surface_commit(Resource *resource) override;
private: private:
wl_resource *m_buffer; wl_resource *m_buffer = nullptr;
Compositor *m_compositor; Compositor *m_compositor;
QSharedPointer<MockSurface> m_mockSurface; QSharedPointer<MockSurface> m_mockSurface;
QList<wl_resource *> m_frameCallbackList; QList<wl_resource *> m_frameCallbackList;
bool m_mapped; bool m_mapped = false;
}; };
} }