plugins/blur: Fix a crash in BlurEffect::updateBlurRegion()
The updateBlurRegion() creates ItemEffect() objects to block direct scanout. However, it doesn't take into account that the surface item can be null when a window is added. It can happen with Xwayland windows. The blur effect creates ItemEffect objects for the SurfaceItem and the DecorationItem, which is reasonable. But on the other hand, the blur effect still operates per window. So this change simply makes the blur effect register an ItemEffect with the WindowItem. When proper per item effects are supported, this can be changed (the blur effect would need to monitor the wl_surface getting added and removed).
This commit is contained in:
parent
e4f9df54e6
commit
8f40b5b554
2 changed files with 3 additions and 8 deletions
|
@ -266,12 +266,7 @@ void BlurEffect::updateBlurRegion(EffectWindow *w)
|
||||||
BlurEffectData &data = m_windows[w];
|
BlurEffectData &data = m_windows[w];
|
||||||
data.content = content;
|
data.content = content;
|
||||||
data.frame = frame;
|
data.frame = frame;
|
||||||
if (content) {
|
data.windowEffect = ItemEffect(w->windowItem());
|
||||||
data.surfaceEffect = ItemEffect(w->windowItem()->surfaceItem());
|
|
||||||
}
|
|
||||||
if (frame) {
|
|
||||||
data.surfaceEffect = ItemEffect(w->windowItem()->decorationItem());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (auto it = m_windows.find(w); it != m_windows.end()) {
|
if (auto it = m_windows.find(w); it != m_windows.end()) {
|
||||||
effects->makeOpenGLContextCurrent();
|
effects->makeOpenGLContextCurrent();
|
||||||
|
|
|
@ -32,14 +32,14 @@ struct BlurEffectData
|
||||||
{
|
{
|
||||||
/// The region that should be blurred behind the window
|
/// The region that should be blurred behind the window
|
||||||
std::optional<QRegion> content;
|
std::optional<QRegion> content;
|
||||||
ItemEffect surfaceEffect;
|
|
||||||
|
|
||||||
/// The region that should be blurred behind the frame
|
/// The region that should be blurred behind the frame
|
||||||
std::optional<QRegion> frame;
|
std::optional<QRegion> frame;
|
||||||
ItemEffect decorationEffect;
|
|
||||||
|
|
||||||
/// The render data per screen. Screens can have different color spaces.
|
/// The render data per screen. Screens can have different color spaces.
|
||||||
std::unordered_map<Output *, BlurRenderData> render;
|
std::unordered_map<Output *, BlurRenderData> render;
|
||||||
|
|
||||||
|
ItemEffect windowEffect;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BlurEffect : public KWin::Effect
|
class BlurEffect : public KWin::Effect
|
||||||
|
|
Loading…
Reference in a new issue