window: use std::unique_ptr to manage the effectwindow
This commit is contained in:
parent
3c8d2d6f18
commit
797bcb8bda
6 changed files with 10 additions and 21 deletions
|
@ -47,7 +47,6 @@ Deleted::~Deleted()
|
|||
if (workspace()) {
|
||||
workspace()->removeDeleted(this);
|
||||
}
|
||||
deleteEffectWindow();
|
||||
deleteItem();
|
||||
}
|
||||
|
||||
|
|
|
@ -1990,8 +1990,7 @@ EffectScreen::Transform EffectScreenImpl::transform() const
|
|||
//****************************************
|
||||
|
||||
EffectWindowImpl::EffectWindowImpl(Window *window)
|
||||
: EffectWindow(window)
|
||||
, m_window(window)
|
||||
: m_window(window)
|
||||
, m_windowItem(nullptr)
|
||||
{
|
||||
// Deleted windows are not managed. So, when windowClosed signal is
|
||||
|
|
|
@ -748,9 +748,8 @@ EffectWindow::Private::Private(EffectWindow *q)
|
|||
{
|
||||
}
|
||||
|
||||
EffectWindow::EffectWindow(QObject *parent)
|
||||
: QObject(parent)
|
||||
, d(new Private(this))
|
||||
EffectWindow::EffectWindow()
|
||||
: d(new Private(this))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -2366,7 +2366,7 @@ public:
|
|||
PAINT_DISABLED_BY_ACTIVITY = 1 << 5
|
||||
};
|
||||
|
||||
explicit EffectWindow(QObject *parent = nullptr);
|
||||
explicit EffectWindow();
|
||||
~EffectWindow() override;
|
||||
|
||||
Q_SCRIPTABLE virtual void addRepaint(const QRect &r) = 0;
|
||||
|
|
|
@ -74,7 +74,6 @@ Window::Window()
|
|||
, m_internalId(QUuid::createUuid())
|
||||
, m_client()
|
||||
, is_shape(false)
|
||||
, m_effectWindow(nullptr)
|
||||
, m_clientMachine(new ClientMachine(this))
|
||||
, m_wmClientLeader(XCB_WINDOW_NONE)
|
||||
, m_skipCloseAnimation(false)
|
||||
|
@ -186,7 +185,7 @@ void Window::copyToDeleted(Window *c)
|
|||
m_client.reset(c->m_client, false);
|
||||
ready_for_painting = c->ready_for_painting;
|
||||
is_shape = c->is_shape;
|
||||
m_effectWindow = std::exchange(c->m_effectWindow, nullptr);
|
||||
m_effectWindow = std::move(c->m_effectWindow);
|
||||
if (m_effectWindow != nullptr) {
|
||||
m_effectWindow->setWindow(this);
|
||||
}
|
||||
|
@ -346,7 +345,7 @@ bool Window::setupCompositing()
|
|||
return false;
|
||||
}
|
||||
|
||||
m_effectWindow = new EffectWindowImpl(this);
|
||||
m_effectWindow = std::make_unique<EffectWindowImpl>(this);
|
||||
updateShadow();
|
||||
|
||||
m_windowItem = createItem(scene);
|
||||
|
@ -367,7 +366,7 @@ void Window::finishCompositing(ReleaseReason releaseReason)
|
|||
}
|
||||
}
|
||||
m_shadow.reset();
|
||||
deleteEffectWindow();
|
||||
m_effectWindow.reset();
|
||||
deleteItem();
|
||||
}
|
||||
|
||||
|
@ -400,12 +399,6 @@ void Window::setReadyForPainting()
|
|||
}
|
||||
}
|
||||
|
||||
void Window::deleteEffectWindow()
|
||||
{
|
||||
delete m_effectWindow;
|
||||
m_effectWindow = nullptr;
|
||||
}
|
||||
|
||||
void Window::deleteItem()
|
||||
{
|
||||
delete m_windowItem;
|
||||
|
|
|
@ -1590,7 +1590,6 @@ protected:
|
|||
void getSkipCloseAnimation();
|
||||
void copyToDeleted(Window *c);
|
||||
void disownDataPassedToDeleted();
|
||||
void deleteEffectWindow();
|
||||
void setDepth(int depth);
|
||||
|
||||
Output *m_output = nullptr;
|
||||
|
@ -1919,7 +1918,7 @@ private:
|
|||
QUuid m_internalId;
|
||||
Xcb::Window m_client;
|
||||
bool is_shape;
|
||||
EffectWindowImpl *m_effectWindow;
|
||||
std::unique_ptr<EffectWindowImpl> m_effectWindow;
|
||||
WindowItem *m_windowItem = nullptr;
|
||||
std::unique_ptr<Shadow> m_shadow;
|
||||
QString resource_name;
|
||||
|
@ -2256,12 +2255,12 @@ inline const QRegion &Window::opaqueRegion() const
|
|||
|
||||
inline EffectWindowImpl *Window::effectWindow()
|
||||
{
|
||||
return m_effectWindow;
|
||||
return m_effectWindow.get();
|
||||
}
|
||||
|
||||
inline const EffectWindowImpl *Window::effectWindow() const
|
||||
{
|
||||
return m_effectWindow;
|
||||
return m_effectWindow.get();
|
||||
}
|
||||
|
||||
inline WindowItem *Window::windowItem() const
|
||||
|
|
Loading…
Reference in a new issue