From 9ae2b505fa7b31412e6fb4c068cc91b92f50170c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 4 Dec 2015 08:12:49 +0100 Subject: [PATCH] Group decoration related variables in a struct in AbstractClient --- abstract_client.cpp | 22 +++++++++++----------- abstract_client.h | 16 +++++++++------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index cc8cb91ca9..00c188ba8e 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -68,7 +68,7 @@ AbstractClient::AbstractClient() AbstractClient::~AbstractClient() { assert(m_blockGeometryUpdates == 0); - Q_ASSERT(m_decoration == nullptr); + Q_ASSERT(m_decoration.decoration == nullptr); } void AbstractClient::updateMouseGrab() @@ -1335,8 +1335,8 @@ void AbstractClient::endMoveResize() void AbstractClient::destroyDecoration() { - delete m_decoration; - m_decoration = nullptr; + delete m_decoration.decoration; + m_decoration.decoration = nullptr; } bool AbstractClient::decorationHasAlpha() const @@ -1393,15 +1393,15 @@ bool AbstractClient::processDecorationButtonPress(QMouseEvent *event, bool ignor // check whether it is a double click if (event->button() == Qt::LeftButton) { - if (m_decorationDoubleClickTimer.isValid() && + if (m_decoration.doubleClickTimer.isValid() && decoration()->titleBar().contains(event->x(), event->y()) && - !m_decorationDoubleClickTimer.hasExpired(QGuiApplication::styleHints()->mouseDoubleClickInterval())) { + !m_decoration.doubleClickTimer.hasExpired(QGuiApplication::styleHints()->mouseDoubleClickInterval())) { Workspace::self()->performWindowOperation(this, options->operationTitlebarDblClick()); dontMoveResize(); - m_decorationDoubleClickTimer.invalidate(); + m_decoration.doubleClickTimer.invalidate(); return false; } - m_decorationDoubleClickTimer.invalidate(); + m_decoration.doubleClickTimer.invalidate(); } if (event->button() == Qt::LeftButton) @@ -1441,7 +1441,7 @@ void AbstractClient::processDecorationButtonRelease(QMouseEvent *event) { if (isDecorated()) { if (!event->isAccepted() && decoration()->titleBar().contains(event->pos()) && event->button() == Qt::LeftButton) { - m_decorationDoubleClickTimer.start(); + m_decoration.doubleClickTimer.start(); } } @@ -1459,7 +1459,7 @@ void AbstractClient::processDecorationButtonRelease(QMouseEvent *event) void AbstractClient::startDecorationDoubleClickTimer() { - m_decorationDoubleClickTimer.start(); + m_decoration.doubleClickTimer.start(); } bool AbstractClient::providesContextHelp() const @@ -1473,12 +1473,12 @@ void AbstractClient::showContextHelp() QPointer AbstractClient::decoratedClient() const { - return m_decoratedClient; + return m_decoration.client; } void AbstractClient::setDecoratedClient(QPointer< Decoration::DecoratedClientImpl > client) { - m_decoratedClient = client; + m_decoration.client = client; } } diff --git a/abstract_client.h b/abstract_client.h index b5f5285e4b..1cd60cd183 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -502,13 +502,13 @@ public: // decoration related KDecoration2::Decoration *decoration() { - return m_decoration; + return m_decoration.decoration; } const KDecoration2::Decoration *decoration() const { - return m_decoration; + return m_decoration.decoration; } bool isDecorated() const { - return m_decoration != nullptr; + return m_decoration.decoration != nullptr; } QPointer decoratedClient() const; void setDecoratedClient(QPointer client); @@ -846,7 +846,7 @@ protected: } void setDecoration(KDecoration2::Decoration *decoration) { - m_decoration = decoration; + m_decoration.decoration = decoration; } virtual void destroyDecoration(); void startDecorationDoubleClickTimer(); @@ -912,9 +912,11 @@ private: QTimer *delayedTimer = nullptr; } m_moveResize; - KDecoration2::Decoration *m_decoration = nullptr; - QPointer m_decoratedClient; - QElapsedTimer m_decorationDoubleClickTimer; + struct { + KDecoration2::Decoration *decoration = nullptr; + QPointer client; + QElapsedTimer doubleClickTimer; + } m_decoration; static bool s_haveResizeEffect;