Move createDecoration() and destroyDecoration() from AbstractClient to InternalClient
They are used only by InternalClient. AbstractClient doesn't need to handle the destruction of DecorationBridge because its lifetime matches kwin's lifetime.
This commit is contained in:
parent
acb0683e0d
commit
be32a1b1f5
6 changed files with 20 additions and 22 deletions
|
@ -72,8 +72,6 @@ AbstractClient::AbstractClient()
|
|||
|
||||
connect(this, &AbstractClient::paletteChanged, this, &AbstractClient::triggerDecorationRepaint);
|
||||
|
||||
connect(Decoration::DecorationBridge::self(), &QObject::destroyed, this, &AbstractClient::destroyDecoration);
|
||||
|
||||
// If the user manually moved the window, don't restore it after the keyboard closes
|
||||
connect(this, &AbstractClient::clientFinishUserMovedResized, this, [this] () {
|
||||
m_keyboardGeometryRestore = QRect();
|
||||
|
@ -2308,21 +2306,6 @@ void AbstractClient::endInteractiveMoveResize()
|
|||
updateCursor();
|
||||
}
|
||||
|
||||
void AbstractClient::createDecoration(const QRect &oldGeometry)
|
||||
{
|
||||
setDecoration(QSharedPointer<KDecoration2::Decoration>(Decoration::DecorationBridge::self()->createDecoration(this)));
|
||||
moveResize(oldGeometry);
|
||||
|
||||
Q_EMIT geometryShapeChanged(this, oldGeometry);
|
||||
}
|
||||
|
||||
void AbstractClient::destroyDecoration()
|
||||
{
|
||||
const QSize clientSize = frameSizeToClientSize(moveResizeGeometry().size());
|
||||
setDecoration(nullptr);
|
||||
resize(clientSize);
|
||||
}
|
||||
|
||||
void AbstractClient::setDecoration(QSharedPointer<KDecoration2::Decoration> decoration)
|
||||
{
|
||||
if (m_decoration.decoration.data() == decoration) {
|
||||
|
|
|
@ -1198,8 +1198,6 @@ protected:
|
|||
}
|
||||
|
||||
void setDecoration(QSharedPointer<KDecoration2::Decoration> decoration);
|
||||
virtual void createDecoration(const QRect &oldGeometry);
|
||||
virtual void destroyDecoration();
|
||||
void startDecorationDoubleClickTimer();
|
||||
void invalidateDecorationDoubleClickTimer();
|
||||
void updateDecorationInputShape();
|
||||
|
|
|
@ -308,6 +308,21 @@ void InternalClient::setNoBorder(bool set)
|
|||
updateDecoration(true);
|
||||
}
|
||||
|
||||
void InternalClient::createDecoration(const QRect &oldGeometry)
|
||||
{
|
||||
setDecoration(QSharedPointer<KDecoration2::Decoration>(Decoration::DecorationBridge::self()->createDecoration(this)));
|
||||
moveResize(oldGeometry);
|
||||
|
||||
Q_EMIT geometryShapeChanged(this, oldGeometry);
|
||||
}
|
||||
|
||||
void InternalClient::destroyDecoration()
|
||||
{
|
||||
const QSize clientSize = frameSizeToClientSize(moveResizeGeometry().size());
|
||||
setDecoration(nullptr);
|
||||
resize(clientSize);
|
||||
}
|
||||
|
||||
void InternalClient::updateDecoration(bool check_workspace_pos, bool force)
|
||||
{
|
||||
if (!force && isDecorated() == !noBorder()) {
|
||||
|
|
|
@ -81,6 +81,8 @@ private:
|
|||
void syncGeometryToInternalWindow();
|
||||
void updateInternalWindowGeometry();
|
||||
void updateDecoration(bool check_workspace_pos, bool force = false);
|
||||
void createDecoration(const QRect &oldGeometry);
|
||||
void destroyDecoration();
|
||||
|
||||
QWindow *m_internalWindow = nullptr;
|
||||
QString m_captionNormal;
|
||||
|
|
|
@ -400,7 +400,6 @@ private:
|
|||
void establishCommandWindowGrab(uint8_t button);
|
||||
void establishCommandAllGrab(uint8_t button);
|
||||
void resizeDecoration();
|
||||
void createDecoration(const QRect &oldgeom) override;
|
||||
|
||||
void pingWindow();
|
||||
void killProcess(bool ask, xcb_timestamp_t timestamp = XCB_TIME_CURRENT_TIME);
|
||||
|
@ -410,7 +409,6 @@ private:
|
|||
|
||||
void embedClient(xcb_window_t w, xcb_visualid_t visualid, xcb_colormap_t colormap, uint8_t depth);
|
||||
void detectNoBorder();
|
||||
void destroyDecoration() override;
|
||||
void updateFrameExtents();
|
||||
void setClientFrameExtents(const NETStrut &strut);
|
||||
|
||||
|
@ -444,6 +442,8 @@ private:
|
|||
void maybeCreateX11DecorationRenderer();
|
||||
void maybeDestroyX11DecorationRenderer();
|
||||
void updateDecoration(bool check_workspace_pos, bool force = false);
|
||||
void createDecoration(const QRect &oldgeom);
|
||||
void destroyDecoration();
|
||||
|
||||
Xcb::Window m_client;
|
||||
Xcb::Window m_wrapper;
|
||||
|
|
|
@ -340,7 +340,7 @@ void XdgSurfaceClient::destroyClient()
|
|||
Q_EMIT windowClosed(this, deleted);
|
||||
StackingUpdatesBlocker blocker(workspace());
|
||||
RuleBook::self()->discardUsed(this, true);
|
||||
destroyDecoration();
|
||||
setDecoration(nullptr);
|
||||
cleanGrouping();
|
||||
waylandServer()->removeClient(this);
|
||||
deleted->unrefWindow();
|
||||
|
|
Loading…
Reference in a new issue