Skip to content

Commit

Permalink
Build on Plasma 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jinliu committed Feb 29, 2024
1 parent c6cb720 commit c91a199
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build
sudo cmake --install build
```

## Thanks

`ShakeDetector.{cpp,h}`: from KDE KWin project (https://invent.kde.org/plasma/kwin/)
1 change: 1 addition & 0 deletions src/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Description": "Spotlight on the pointer when it is quickly moved back and forth",
"EnabledByDefault": false,
"License": "GPL",
"Id": "spotlight.jinliu.github.com",
"Name": "Spotlight"
},
"X-KDE-ConfigModule": "kwin_spotlight_config"
Expand Down
16 changes: 5 additions & 11 deletions src/spotlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ SpotlightEffect::SpotlightEffect()
m_outAnimation.setEndValue(1.0);
m_outAnimation.setDuration(m_animationTime);
m_outAnimation.start();
qDebug() << "SpotlightEffect::deactivated";
});

m_outAnimation.setEasingCurve(QEasingCurve::InOutCubic);
Expand All @@ -62,13 +61,15 @@ SpotlightEffect::~SpotlightEffect()

bool SpotlightEffect::supported()
{
// qDebug() << "SpotlightEffect::supported()" << effects->isOpenGLCompositing();
return effects->isOpenGLCompositing();
return
#ifdef KWIN_6_1
effects->isWayland() &&
#endif
effects->isOpenGLCompositing();
}

void SpotlightEffect::reconfigure(ReconfigureFlags flags)
{
qDebug() << "SpotlightEffect::reconfigure()";
SpotlightConfig::self()->read();

m_animationTime = animationTime(SpotlightConfig::animationTime());
Expand Down Expand Up @@ -104,8 +105,6 @@ void SpotlightEffect::reconfigure(ReconfigureFlags flags)
m_spotlightTexture = GLTexture::upload(image);
m_spotlightTexture->setWrapMode(GL_CLAMP_TO_EDGE);
m_spotlightTexture->setFilter(GL_LINEAR);

qDebug() << "SpotlightEffect::reconfigure() success";
}

bool SpotlightEffect::isActive() const
Expand All @@ -121,7 +120,6 @@ void SpotlightEffect::pointerEvent(MouseEvent *event)

if (const auto shakeFactor = m_shakeDetector.update(event)) {
if (!m_isActive) {
qDebug() << "SpotlightEffect::activated";
m_isActive = true;
updateMaxScale();
qreal start = 1.0;
Expand Down Expand Up @@ -155,8 +153,6 @@ void SpotlightEffect::paintScreen(const RenderTarget &renderTarget, const Render

QRectF screenGeometry = screen->geometry();

// qDebug() << "SpotlightEffect::paintScreen() cursorPos" << center << "screenGeometry" << screenGeometry;

center -= screenGeometry.topLeft();

qreal scale = 1 / (m_animationValue * m_maxScale + 1 - m_animationValue);
Expand All @@ -175,8 +171,6 @@ void SpotlightEffect::paintScreen(const RenderTarget &renderTarget, const Render
const bool clipping = region != infiniteRegion();
const QRegion clipRegion = clipping ? viewport.mapToRenderTarget(region) : infiniteRegion();

// qDebug() << "SpotlightEffect::paintScreen() center" << center << "scale" << 1 / scale << "source" << source << "fullscreen" << fullscreen << "clipping" << clipping << "clipRegion" << clipRegion;

if (clipping) {
glEnable(GL_SCISSOR_TEST);
}
Expand Down

0 comments on commit c91a199

Please sign in to comment.