Group decoration related variables in a struct in AbstractClient
This commit is contained in:
parent
f4246ba7e2
commit
9ae2b505fa
2 changed files with 20 additions and 18 deletions
|
@ -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<Decoration::DecoratedClientImpl> AbstractClient::decoratedClient() const
|
||||
{
|
||||
return m_decoratedClient;
|
||||
return m_decoration.client;
|
||||
}
|
||||
|
||||
void AbstractClient::setDecoratedClient(QPointer< Decoration::DecoratedClientImpl > client)
|
||||
{
|
||||
m_decoratedClient = client;
|
||||
m_decoration.client = client;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Decoration::DecoratedClientImpl> decoratedClient() const;
|
||||
void setDecoratedClient(QPointer<Decoration::DecoratedClientImpl> 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<Decoration::DecoratedClientImpl> m_decoratedClient;
|
||||
QElapsedTimer m_decorationDoubleClickTimer;
|
||||
struct {
|
||||
KDecoration2::Decoration *decoration = nullptr;
|
||||
QPointer<Decoration::DecoratedClientImpl> client;
|
||||
QElapsedTimer doubleClickTimer;
|
||||
} m_decoration;
|
||||
|
||||
|
||||
static bool s_haveResizeEffect;
|
||||
|
|
Loading…
Reference in a new issue