effects/blur: use effect-local data instead of window data for blur regions
This commit is contained in:
parent
1d8c9c62cf
commit
cc0434d34c
3 changed files with 9 additions and 13 deletions
|
@ -277,7 +277,7 @@ void BlurEffect::reconfigure(ReconfigureFlags flags)
|
|||
effects->addRepaintFull();
|
||||
}
|
||||
|
||||
void BlurEffect::updateBlurRegion(EffectWindow *w) const
|
||||
void BlurEffect::updateBlurRegion(EffectWindow *w)
|
||||
{
|
||||
QRegion region;
|
||||
bool valid = false;
|
||||
|
@ -312,14 +312,10 @@ void BlurEffect::updateBlurRegion(EffectWindow *w) const
|
|||
}
|
||||
}
|
||||
|
||||
// If the specified blur region is empty, enable blur for the whole window.
|
||||
if (region.isEmpty() && valid) {
|
||||
// Set the data to a dummy value.
|
||||
// This is needed to be able to distinguish between the value not
|
||||
// being set, and being set to an empty region.
|
||||
w->setData(WindowBlurBehindRole, 1);
|
||||
if (valid) {
|
||||
blurRegions[w] = region;
|
||||
} else {
|
||||
w->setData(WindowBlurBehindRole, region);
|
||||
blurRegions.remove(w);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,6 +340,7 @@ void BlurEffect::slotWindowAdded(EffectWindow *w)
|
|||
|
||||
void BlurEffect::slotWindowDeleted(EffectWindow *w)
|
||||
{
|
||||
blurRegions.remove(w);
|
||||
auto it = windowBlurChangedConnections.find(w);
|
||||
if (it == windowBlurChangedConnections.end()) {
|
||||
return;
|
||||
|
@ -453,9 +450,8 @@ QRegion BlurEffect::blurRegion(const EffectWindow *w) const
|
|||
{
|
||||
QRegion region;
|
||||
|
||||
const QVariant value = w->data(WindowBlurBehindRole);
|
||||
if (value.isValid()) {
|
||||
const QRegion appRegion = qvariant_cast<QRegion>(value);
|
||||
if (auto it = blurRegions.find(w); it != blurRegions.end()) {
|
||||
const QRegion &appRegion = *it;
|
||||
if (!appRegion.isEmpty()) {
|
||||
if (w->decorationHasAlpha() && decorationSupportsBlurBehind(w)) {
|
||||
region = decorationBlurRegion(w);
|
||||
|
|
|
@ -74,7 +74,7 @@ private:
|
|||
QRegion decorationBlurRegion(const EffectWindow *w) const;
|
||||
bool decorationSupportsBlurBehind(const EffectWindow *w) const;
|
||||
bool shouldBlur(const EffectWindow *w, int mask, const WindowPaintData &data) const;
|
||||
void updateBlurRegion(EffectWindow *w) const;
|
||||
void updateBlurRegion(EffectWindow *w);
|
||||
void doBlur(const QRegion &shape, const QRect &screen, const float opacity, const QMatrix4x4 &screenProjection, bool isDock, QRect windowRect);
|
||||
void uploadRegion(QVector2D *&map, const QRegion ®ion, const int downSampleIterations);
|
||||
void uploadGeometry(GLVertexBuffer *vbo, const QRegion &blurRegion, const QRegion &windowRegion);
|
||||
|
@ -123,6 +123,7 @@ private:
|
|||
QVector<BlurValuesStruct> blurStrengthValues;
|
||||
|
||||
QMap<EffectWindow *, QMetaObject::Connection> windowBlurChangedConnections;
|
||||
QMap<const EffectWindow *, QRegion> blurRegions;
|
||||
|
||||
static KWaylandServer::BlurManagerInterface *s_blurManager;
|
||||
static QTimer *s_blurManagerRemoveTimer;
|
||||
|
|
|
@ -174,7 +174,6 @@ enum DataRole {
|
|||
WindowMinimizedGrabRole,
|
||||
WindowUnminimizedGrabRole,
|
||||
WindowForceBlurRole, ///< For fullscreen effects to enforce blurring of windows,
|
||||
WindowBlurBehindRole, ///< For single windows to blur behind
|
||||
WindowForceBackgroundContrastRole, ///< For fullscreen effects to enforce the background contrast,
|
||||
WindowBackgroundContrastRole, ///< For single windows to enable Background contrast
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue