Remove Window::addRepaint() and Window::addLayerRepaint()
Conceptually, scheduling repainting in Window doesn't belong there. This change rewires EffectWindow internals so it schedules repaints using the associated WindowItem. Window::addWorkspaceRepaint() has not been removed yet because Window::elevate() uses it.
This commit is contained in:
parent
8cc5e04238
commit
ea1fadfe8d
7 changed files with 32 additions and 61 deletions
|
@ -1917,27 +1917,17 @@ void EffectWindowImpl::unrefVisible(int reason)
|
|||
|
||||
void EffectWindowImpl::addRepaint(const QRect &r)
|
||||
{
|
||||
m_window->addRepaint(r);
|
||||
}
|
||||
|
||||
void EffectWindowImpl::addRepaint(int x, int y, int w, int h)
|
||||
{
|
||||
m_window->addRepaint(x, y, w, h);
|
||||
m_windowItem->scheduleRepaint(r);
|
||||
}
|
||||
|
||||
void EffectWindowImpl::addRepaintFull()
|
||||
{
|
||||
m_window->addRepaintFull();
|
||||
m_windowItem->scheduleRepaint(m_windowItem->boundingRect());
|
||||
}
|
||||
|
||||
void EffectWindowImpl::addLayerRepaint(const QRect &r)
|
||||
{
|
||||
m_window->addLayerRepaint(r);
|
||||
}
|
||||
|
||||
void EffectWindowImpl::addLayerRepaint(int x, int y, int w, int h)
|
||||
{
|
||||
m_window->addLayerRepaint(x, y, w, h);
|
||||
m_windowItem->scheduleRepaint(m_windowItem->mapFromGlobal(r));
|
||||
}
|
||||
|
||||
const EffectWindowGroup *EffectWindowImpl::group() const
|
||||
|
|
|
@ -382,10 +382,8 @@ public:
|
|||
void unrefVisible(int reason) override;
|
||||
|
||||
void addRepaint(const QRect &r) override;
|
||||
void addRepaint(int x, int y, int w, int h) override;
|
||||
void addRepaintFull() override;
|
||||
void addLayerRepaint(const QRect &r) override;
|
||||
void addLayerRepaint(int x, int y, int w, int h) override;
|
||||
|
||||
void refWindow() override;
|
||||
void unrefWindow() override;
|
||||
|
|
|
@ -219,6 +219,14 @@ QRect Item::mapToGlobal(const QRect &rect) const
|
|||
return rect.translated(rootPosition());
|
||||
}
|
||||
|
||||
QRect Item::mapFromGlobal(const QRect &rect) const
|
||||
{
|
||||
if (rect.isEmpty()) {
|
||||
return QRect();
|
||||
}
|
||||
return rect.translated(-rootPosition());
|
||||
}
|
||||
|
||||
void Item::stackBefore(Item *sibling)
|
||||
{
|
||||
if (Q_UNLIKELY(!sibling)) {
|
||||
|
|
|
@ -78,6 +78,11 @@ public:
|
|||
* system.
|
||||
*/
|
||||
QRect mapToGlobal(const QRect &rect) const;
|
||||
/**
|
||||
* Maps the given @a rect from the scene's coordinate system to the item's coordinate
|
||||
* system.
|
||||
*/
|
||||
QRect mapFromGlobal(const QRect &rect) const;
|
||||
|
||||
/**
|
||||
* Moves this item right before the specified @a sibling in the parent's children list.
|
||||
|
|
|
@ -2350,10 +2350,10 @@ public:
|
|||
~EffectWindow() override;
|
||||
|
||||
Q_SCRIPTABLE virtual void addRepaint(const QRect &r) = 0;
|
||||
Q_SCRIPTABLE virtual void addRepaint(int x, int y, int w, int h) = 0;
|
||||
Q_SCRIPTABLE void addRepaint(int x, int y, int w, int h);
|
||||
Q_SCRIPTABLE virtual void addRepaintFull() = 0;
|
||||
Q_SCRIPTABLE virtual void addLayerRepaint(const QRect &r) = 0;
|
||||
Q_SCRIPTABLE virtual void addLayerRepaint(int x, int y, int w, int h) = 0;
|
||||
Q_SCRIPTABLE void addLayerRepaint(int x, int y, int w, int h);
|
||||
|
||||
virtual void refWindow() = 0;
|
||||
virtual void unrefWindow() = 0;
|
||||
|
@ -4183,6 +4183,20 @@ void Effect::initConfig()
|
|||
T::instance(effects->config());
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
EffectWindow
|
||||
***************************************************************/
|
||||
|
||||
inline void EffectWindow::addRepaint(int x, int y, int w, int h)
|
||||
{
|
||||
addRepaint(QRect(x, y, w, h));
|
||||
}
|
||||
|
||||
inline void EffectWindow::addLayerRepaint(int x, int y, int w, int h)
|
||||
{
|
||||
addLayerRepaint(QRect(x, y, w, h));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Q_DECLARE_METATYPE(KWin::EffectWindow *)
|
||||
Q_DECLARE_METATYPE(KWin::EffectWindowList)
|
||||
|
|
|
@ -365,43 +365,6 @@ void Window::finishCompositing(ReleaseReason releaseReason)
|
|||
deleteItem();
|
||||
}
|
||||
|
||||
void Window::addRepaint(const QRect &rect)
|
||||
{
|
||||
addRepaint(QRegion(rect));
|
||||
}
|
||||
|
||||
void Window::addRepaint(int x, int y, int width, int height)
|
||||
{
|
||||
addRepaint(QRegion(x, y, width, height));
|
||||
}
|
||||
|
||||
void Window::addRepaint(const QRegion ®ion)
|
||||
{
|
||||
if (auto item = windowItem()) {
|
||||
item->scheduleRepaint(region);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::addLayerRepaint(const QRect &rect)
|
||||
{
|
||||
addLayerRepaint(QRegion(rect));
|
||||
}
|
||||
|
||||
void Window::addLayerRepaint(int x, int y, int width, int height)
|
||||
{
|
||||
addLayerRepaint(QRegion(x, y, width, height));
|
||||
}
|
||||
|
||||
void Window::addLayerRepaint(const QRegion ®ion)
|
||||
{
|
||||
addRepaint(region.translated(-pos()));
|
||||
}
|
||||
|
||||
void Window::addRepaintFull()
|
||||
{
|
||||
addLayerRepaint(visibleGeometry());
|
||||
}
|
||||
|
||||
void Window::addWorkspaceRepaint(int x, int y, int w, int h)
|
||||
{
|
||||
addWorkspaceRepaint(QRect(x, y, w, h));
|
||||
|
|
|
@ -719,13 +719,6 @@ public:
|
|||
bool hasAlpha() const;
|
||||
virtual bool setupCompositing();
|
||||
virtual void finishCompositing(ReleaseReason releaseReason = ReleaseReason::Release);
|
||||
Q_INVOKABLE void addRepaint(const QRect &r);
|
||||
Q_INVOKABLE void addRepaint(const QRegion &r);
|
||||
Q_INVOKABLE void addRepaint(int x, int y, int w, int h);
|
||||
Q_INVOKABLE void addLayerRepaint(const QRect &r);
|
||||
Q_INVOKABLE void addLayerRepaint(const QRegion &r);
|
||||
Q_INVOKABLE void addLayerRepaint(int x, int y, int w, int h);
|
||||
Q_INVOKABLE virtual void addRepaintFull();
|
||||
// these call workspace->addRepaint(), but first transform the damage if needed
|
||||
void addWorkspaceRepaint(const QRect &r);
|
||||
void addWorkspaceRepaint(int x, int y, int w, int h);
|
||||
|
|
Loading…
Reference in a new issue