Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blur fix #73

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/YetAnotherMagicLampEffect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ YetAnotherMagicLampEffect::YetAnotherMagicLampEffect()
this, &YetAnotherMagicLampEffect::slotWindowDeleted);
connect(KWin::effects, &KWin::EffectsHandler::activeFullScreenEffectChanged,
this, &YetAnotherMagicLampEffect::slotActiveFullScreenEffectChanged);

setVertexSnappingMode(KWin::RenderGeometry::VertexSnappingMode::None);
}

YetAnotherMagicLampEffect::~YetAnotherMagicLampEffect()
Expand Down Expand Up @@ -124,15 +126,24 @@ void YetAnotherMagicLampEffect::reconfigure(ReconfigureFlags flags)

void YetAnotherMagicLampEffect::prePaintScreen(KWin::ScreenPrePaintData& data, std::chrono::milliseconds presentTime)
{
for (AnimationData& data : m_animations) {
data.model.advance(presentTime);
}

data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;

KWin::effects->prePaintScreen(data, presentTime);
}

void YetAnotherMagicLampEffect::prePaintWindow(KWin::EffectWindow* w, KWin::WindowPrePaintData& data, std::chrono::milliseconds presentTime)
{
// Schedule window for transformation if the animation is still in
// progress
auto animationIt = m_animations.find(w);
if (animationIt != m_animations.end()) {
(*animationIt).model.advance(presentTime);
data.setTransformed();
}

KWin::effects->prePaintWindow(w, data, presentTime);
}

void YetAnotherMagicLampEffect::postPaintScreen()
{
for (auto it = m_animations.begin(); it != m_animations.end();) {
Expand Down Expand Up @@ -204,10 +215,10 @@ void YetAnotherMagicLampEffect::slotWindowMinimized(KWin::EffectWindow* w)
}

AnimationData& data = m_animations[w];
data.visibleRef = KWin::EffectWindowVisibleRef(w, KWin::EffectWindow::PAINT_DISABLED_BY_MINIMIZE);
data.model.setWindow(w);
data.model.setParameters(m_modelParameters);
data.model.start(Model::AnimationKind::Minimize);
data.visibleRef = KWin::EffectWindowVisibleRef(w, KWin::EffectWindow::PAINT_DISABLED_BY_MINIMIZE);

redirect(w);

Expand All @@ -226,6 +237,7 @@ void YetAnotherMagicLampEffect::slotWindowUnminimized(KWin::EffectWindow* w)
}

AnimationData& data = m_animations[w];
data.visibleRef = KWin::EffectWindowVisibleRef(w, KWin::EffectWindow::PAINT_DISABLED_BY_MINIMIZE);
data.model.setWindow(w);
data.model.setParameters(m_modelParameters);
data.model.start(Model::AnimationKind::Unminimize);
Expand Down
1 change: 1 addition & 0 deletions src/YetAnotherMagicLampEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class YetAnotherMagicLampEffect : public KWin::OffscreenEffect {
void reconfigure(ReconfigureFlags flags) override;

void prePaintScreen(KWin::ScreenPrePaintData& data, std::chrono::milliseconds presentTime) override;
void prePaintWindow(KWin::EffectWindow* w, KWin::WindowPrePaintData& data, std::chrono::milliseconds presentTime) override;
void postPaintScreen() override;

void paintWindow(KWin::EffectWindow* w, int mask, QRegion region, KWin::WindowPaintData& data) override;
Expand Down