Port decoration renderers to Decoration::damaged signal
This commit is contained in:
parent
fa66c3d238
commit
7f32594692
10 changed files with 8 additions and 29 deletions
|
@ -258,16 +258,6 @@ std::unique_ptr<KDecoration2::DecorationSettingsPrivate> DecorationBridge::setti
|
|||
return std::unique_ptr<SettingsImpl>(new SettingsImpl(parent));
|
||||
}
|
||||
|
||||
void DecorationBridge::update(KDecoration2::Decoration *decoration, const QRect &geometry)
|
||||
{
|
||||
// TODO: remove check once all compositors implement it
|
||||
if (AbstractClient *c = Workspace::self()->findAbstractClient([decoration] (const AbstractClient *client) { return client->decoration() == decoration; })) {
|
||||
if (Renderer *renderer = c->decoratedClient()->renderer()) {
|
||||
renderer->schedule(geometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KDecoration2::Decoration *DecorationBridge::createDecoration(AbstractClient *client)
|
||||
{
|
||||
if (m_noPlugin) {
|
||||
|
|
|
@ -46,7 +46,6 @@ public:
|
|||
|
||||
std::unique_ptr<KDecoration2::DecoratedClientPrivate> createClient(KDecoration2::DecoratedClient *client, KDecoration2::Decoration *decoration) override;
|
||||
std::unique_ptr<KDecoration2::DecorationSettingsPrivate> settings(KDecoration2::DecorationSettings *parent) override;
|
||||
void update(KDecoration2::Decoration *decoration, const QRect &geometry) override;
|
||||
|
||||
bool needsBlur() const {
|
||||
return m_blur;
|
||||
|
|
|
@ -33,6 +33,7 @@ Renderer::Renderer(DecoratedClientImpl *client)
|
|||
schedule(m_client->client()->rect());
|
||||
m_imageSizesDirty = true;
|
||||
};
|
||||
connect(client->decoration(), &KDecoration2::Decoration::damaged, this, &Renderer::schedule);
|
||||
connect(client->client(), &AbstractClient::screenScaleChanged, this, markImageSizesDirty);
|
||||
connect(client->decoration(), &KDecoration2::Decoration::bordersChanged, this, markImageSizesDirty);
|
||||
connect(client->decoratedClient(), &KDecoration2::DecoratedClient::sizeChanged, this, markImageSizesDirty);
|
||||
|
@ -40,7 +41,7 @@ Renderer::Renderer(DecoratedClientImpl *client)
|
|||
|
||||
Renderer::~Renderer() = default;
|
||||
|
||||
void Renderer::schedule(const QRect &rect)
|
||||
void Renderer::schedule(const QRegion &rect)
|
||||
{
|
||||
m_scheduled = m_scheduled.united(rect);
|
||||
emit renderScheduled(rect);
|
||||
|
|
|
@ -30,7 +30,7 @@ class KWIN_EXPORT Renderer : public QObject
|
|||
public:
|
||||
~Renderer() override;
|
||||
|
||||
void schedule(const QRect &rect);
|
||||
void schedule(const QRegion ®ion);
|
||||
|
||||
/**
|
||||
* Reparents this Renderer to the @p deleted.
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
virtual void reparent(Deleted *deleted);
|
||||
|
||||
Q_SIGNALS:
|
||||
void renderScheduled(const QRect &geo);
|
||||
void renderScheduled(const QRegion &geo);
|
||||
|
||||
protected:
|
||||
explicit Renderer(DecoratedClientImpl *client);
|
||||
|
|
|
@ -53,17 +53,6 @@ std::unique_ptr<DecoratedClientPrivate> PreviewBridge::createClient(DecoratedCli
|
|||
return ptr;
|
||||
}
|
||||
|
||||
void PreviewBridge::update(Decoration *decoration, const QRect &geometry)
|
||||
{
|
||||
Q_UNUSED(geometry)
|
||||
auto it = std::find_if(m_previewItems.constBegin(), m_previewItems.constEnd(), [decoration](PreviewItem *item) {
|
||||
return item->decoration() == decoration;
|
||||
});
|
||||
if (it != m_previewItems.constEnd()) {
|
||||
(*it)->update();
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<DecorationSettingsPrivate> PreviewBridge::settings(DecorationSettings *parent)
|
||||
{
|
||||
auto ptr = std::unique_ptr<PreviewSettings>(new PreviewSettings(parent));
|
||||
|
|
|
@ -35,7 +35,6 @@ public:
|
|||
explicit PreviewBridge(QObject *parent = nullptr);
|
||||
~PreviewBridge() override;
|
||||
std::unique_ptr<DecoratedClientPrivate> createClient(DecoratedClient *client, Decoration *decoration) override;
|
||||
void update(Decoration* decoration, const QRect& geometry) override;
|
||||
std::unique_ptr<DecorationSettingsPrivate> settings(DecorationSettings *parent) override;
|
||||
|
||||
PreviewClient *lastCreatedClient() {
|
||||
|
|
|
@ -85,6 +85,7 @@ void PreviewItem::setDecoration(Decoration *deco)
|
|||
connect(m_decoration, &Decoration::bordersChanged, this, &PreviewItem::syncSize);
|
||||
connect(m_decoration, &Decoration::shadowChanged, this, &PreviewItem::syncSize);
|
||||
connect(m_decoration, &Decoration::shadowChanged, this, &PreviewItem::shadowChanged);
|
||||
connect(m_decoration, &Decoration::damaged, this, [this]() { update(); });
|
||||
emit decorationChanged(m_decoration);
|
||||
}
|
||||
|
||||
|
|
|
@ -2492,7 +2492,7 @@ SceneOpenGLDecorationRenderer::SceneOpenGLDecorationRenderer(Decoration::Decorat
|
|||
: Renderer(client)
|
||||
, m_texture()
|
||||
{
|
||||
connect(this, &Renderer::renderScheduled, client->client(), static_cast<void (AbstractClient::*)(const QRect&)>(&AbstractClient::addRepaint));
|
||||
connect(this, &Renderer::renderScheduled, client->client(), static_cast<void (AbstractClient::*)(const QRegion&)>(&AbstractClient::addRepaint));
|
||||
}
|
||||
|
||||
SceneOpenGLDecorationRenderer::~SceneOpenGLDecorationRenderer()
|
||||
|
|
|
@ -692,7 +692,7 @@ bool SceneQPainterShadow::prepareBackend()
|
|||
SceneQPainterDecorationRenderer::SceneQPainterDecorationRenderer(Decoration::DecoratedClientImpl *client)
|
||||
: Renderer(client)
|
||||
{
|
||||
connect(this, &Renderer::renderScheduled, client->client(), static_cast<void (AbstractClient::*)(const QRect&)>(&AbstractClient::addRepaint));
|
||||
connect(this, &Renderer::renderScheduled, client->client(), static_cast<void (AbstractClient::*)(const QRegion&)>(&AbstractClient::addRepaint));
|
||||
}
|
||||
|
||||
SceneQPainterDecorationRenderer::~SceneQPainterDecorationRenderer() = default;
|
||||
|
|
|
@ -1007,7 +1007,7 @@ SceneXRenderDecorationRenderer::SceneXRenderDecorationRenderer(Decoration::Decor
|
|||
: Renderer(client)
|
||||
, m_gc(XCB_NONE)
|
||||
{
|
||||
connect(this, &Renderer::renderScheduled, client->client(), static_cast<void (AbstractClient::*)(const QRect&)>(&AbstractClient::addRepaint));
|
||||
connect(this, &Renderer::renderScheduled, client->client(), static_cast<void (AbstractClient::*)(const QRegion&)>(&AbstractClient::addRepaint));
|
||||
for (int i = 0; i < int(DecorationPart::Count); ++i) {
|
||||
m_pixmaps[i] = XCB_PIXMAP_NONE;
|
||||
m_pictures[i] = nullptr;
|
||||
|
|
Loading…
Reference in a new issue