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
QWaylandClientExtensionPrivate::QWaylandClientExtensionPrivate()
: QObjectPrivate()
, waylandIntegration(nullptr)
, version(-1)
, active(false)
{
// Keep the possibility to use a custom waylandIntegration as a plugin,
// 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,
const QString &interface, uint32_t version);
QtWaylandClient::QWaylandIntegration *waylandIntegration;
int version;
bool active;
QtWaylandClient::QWaylandIntegration *waylandIntegration = nullptr;
int version = -1;
bool active = false;
};
class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate
{
public:
QWaylandClientExtensionTemplatePrivate()
: QWaylandClientExtensionPrivate()
{ }
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -77,10 +77,10 @@ public:
bool busy() const { return mBusy; }
protected:
struct wl_buffer *mBuffer;
struct wl_buffer *mBuffer = nullptr;
private:
bool mBusy;
bool mBusy = false;
static void release(void *data, wl_buffer *);
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()))
, m_display(manager->display())
, 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;
#endif
QWaylandDisplay *m_display;
QWaylandInputDevice *m_inputDevice;
uint32_t m_enterSerial;
QWaylandDisplay *m_display = nullptr;
QWaylandInputDevice *m_inputDevice = nullptr;
uint32_t m_enterSerial = 0;
QPointer<QWindow> m_dragWindow;
QPoint m_dragPoint;
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)
: QInternalMimeData()
, m_dataOffer(dataOffer)
: m_dataOffer(dataOffer)
, m_display(display)
{
}

View File

@ -124,20 +124,6 @@ QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration() co
QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *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");

View File

@ -217,12 +217,12 @@ private:
int mWritableNotificationFd;
QList<RegistryGlobal> mGlobals;
int mCompositorVersion;
uint32_t mLastInputSerial;
QWaylandInputDevice *mLastInputDevice;
uint32_t mLastInputSerial = 0;
QWaylandInputDevice *mLastInputDevice = nullptr;
QPointer<QWaylandWindow> mLastInputWindow;
QPointer<QWaylandWindow> mLastKeyboardFocus;
QVector<QWaylandWindow *> mActiveWindows;
struct wl_callback *mSyncCallback;
struct wl_callback *mSyncCallback = nullptr;
static const wl_callback_listener syncCallbackListener;
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)
: QtWayland::zwp_text_input_v2(text_input)
, 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)
: QPlatformInputContext()
, mDisplay(display)
, mCurrentWindow()
: mDisplay(display)
{
}

View File

@ -112,17 +112,17 @@ private:
QVector<Qt::KeyboardModifier> m_modifiersMap;
uint32_t m_serial;
struct ::wl_surface *m_surface;
uint32_t m_serial = 0;
struct ::wl_surface *m_surface = nullptr;
QString m_preeditCommit;
bool m_inputPanelVisible;
bool m_inputPanelVisible = false;
QRectF m_keyboardRectangle;
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 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)
: QObject()
, QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 4))
: QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 4))
, mQDisplay(display)
, mDisplay(display->wl_display())
, mVersion(qMin(version, 4))

View File

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

View File

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

View File

@ -53,20 +53,10 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
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)
, mWaylandDisplay(waylandDisplay)
, mScale(1)
, mDepth(32)
, mRefreshRate(60000)
, mTransform(-1)
, mFormat(QImage::Format_ARGB32_Premultiplied)
, 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;
int m_outputId;
QWaylandDisplay *mWaylandDisplay;
QWaylandDisplay *mWaylandDisplay = nullptr;
QString mManufacturer;
QString mModel;
QRect mGeometry;
int mScale;
int mDepth;
int mRefreshRate;
int mTransform;
QImage::Format mFormat;
int mScale = 1;
int mDepth = 32;
int mRefreshRate = 60000;
int mTransform = -1;
QImage::Format mFormat = QImage::Format_ARGB32_Premultiplied;
QSize mPhysicalSize;
QString mOutputName;
Qt::ScreenOrientation m_orientation;
Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation;
#if QT_CONFIG(cursor)
QWaylandCursor *mWaylandCursor;
QWaylandCursor *mWaylandCursor = nullptr;
#endif
};

View File

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

View File

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

View File

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

View File

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

View File

@ -78,25 +78,9 @@ namespace QtWaylandClient {
QWaylandWindow *QWaylandWindow::mMouseGrab = nullptr;
QWaylandWindow::QWaylandWindow(QWindow *window)
: QObject()
, QPlatformWindow(window)
: QPlatformWindow(window)
, 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"))
, mSentInitialResize(false)
, mScale(1)
, mState(Qt::WindowNoState)
, mMask()
, mBackingStore(nullptr)
, mUpdateRequested(false)
{
static WId id = 1;
mWindowId = id++;

View File

@ -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);

View File

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

View File

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

View File

@ -70,7 +70,7 @@ public:
private:
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)
, QtWayland::wl_shell_surface(shell_surface)
, m_window(window)
, m_maximized(false)
, m_fullscreen(false)
, m_extendedWindow(nullptr)
{
if (window->display()->windowExtension())
m_extendedWindow = new QWaylandExtendedSurface(window);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -72,7 +72,7 @@ public:
private:
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)
, m_shell(shell)
, m_window(window)
, m_toplevel(nullptr)
, m_popup(nullptr)
, m_configured(false)
{
}

View File

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

View File

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

View File

@ -71,7 +71,7 @@ public:
private:
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()))
, m_window(window)
, m_shell(shell)
, m_maximized(false)
, m_minimized(false)
, m_fullscreen(false)
, m_active(false)
, m_extendedWindow(nullptr)
{
if (window->display()->windowExtension())
m_extendedWindow = new QWaylandExtendedSurface(window);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -85,8 +85,8 @@ protected:
private:
Compositor *m_compositor;
Resource *m_focusResource;
Surface *m_focus;
Resource *m_focusResource = nullptr;
Surface *m_focus = nullptr;
};
class Pointer : public QtWaylandServer::wl_pointer
@ -108,8 +108,8 @@ protected:
private:
Compositor *m_compositor;
Resource *m_focusResource;
Surface *m_focus;
Resource *m_focusResource = nullptr;
Surface *m_focus = nullptr;
};
class Touch : public QtWaylandServer::wl_touch
@ -146,8 +146,8 @@ protected:
private:
Compositor *m_compositor;
QtWaylandServer::wl_data_offer *m_dataOffer;
Surface* m_focus;
QtWaylandServer::wl_data_offer *m_dataOffer = nullptr;
Surface* m_focus = nullptr;
};
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)
: QtWaylandServer::wl_surface(client, id, v)
, m_buffer(nullptr)
, m_compositor(compositor)
, m_mockSurface(new MockSurface(this))
, m_mapped(false)
{
}

View File

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