Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Commit 669ba87

Browse files
authored
Merge pull request #126 from taj-ny/itemeffect
add ItemEffect
2 parents b85b778 + 1f08730 commit 669ba87

8 files changed

Lines changed: 35 additions & 16 deletions

File tree

.github/workflows/arch-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
paths-ignore: [ "**.md" ]
77
pull_request:
88
branches: [ main ]
9-
paths: [ "**/arch-linux.yml" ]
9+
paths-ignore: [ "**.md" ]
1010
schedule:
1111
- cron: "0 0 * * *"
1212

.github/workflows/fedora-40.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
paths-ignore: [ "**.md" ]
77
pull_request:
88
branches: [ main ]
9-
paths: [ "**/fedora-40.yml" ]
9+
paths-ignore: [ "**.md" ]
1010
schedule:
1111
- cron: "0 0 * * *"
1212

.github/workflows/nixos-plasma-6-0-5.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
paths-ignore: [ "**.md" ]
77
pull_request:
88
branches: [ main ]
9-
paths: [ "**/nixos-plasma-6-0-5.yml" ]
9+
paths-ignore: [ "**.md" ]
1010
schedule:
1111
- cron: "0 0 * * *"
1212

.github/workflows/nixos-plasma-6-1-5.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
paths-ignore: [ "**.md" ]
77
pull_request:
88
branches: [ main ]
9-
paths: [ "**/nixos-plasma-6-1-5.yml" ]
9+
paths-ignore: [ "**.md" ]
1010
schedule:
1111
- cron: "0 0 * * *"
1212

.github/workflows/nixos-unstable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
paths-ignore: [ "**.md" ]
77
pull_request:
88
branches: [ main ]
9-
paths: [ "**/nixos-unstable.yml" ]
9+
paths-ignore: [ "**.md" ]
1010
schedule:
1111
- cron: "0 0 * * *"
1212

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ find_package(KWin REQUIRED COMPONENTS
6666
kwineffects
6767
)
6868

69-
if(${KWin_VERSION} VERSION_LESS_EQUAL 6.0.5)
70-
add_compile_definitions(KWIN_6_0)
71-
elseif(${KWin_VERSION} VERSION_LESS_EQUAL 6.1.5)
72-
add_compile_definitions(KWIN_6_1)
69+
if(${KWin_VERSION} VERSION_GREATER_EQUAL 6.0.90)
70+
add_compile_definitions(KWIN_6_1_OR_GREATER)
71+
endif()
72+
if(${KWin_VERSION} VERSION_GREATER_EQUAL 6.1.90)
73+
add_compile_definitions(KWIN_6_2_OR_GREATER)
7374
endif()
7475

7576
find_package(KDecoration2 REQUIRED)

src/blur.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
#include "wayland/display.h"
2323
#include "wayland/surface.h"
2424

25+
#ifdef KWIN_6_2_OR_GREATER
26+
#include "scene/decorationitem.h"
27+
#include "scene/surfaceitem.h"
28+
#include "scene/windowitem.h"
29+
#endif
30+
2531
#include <QGuiApplication>
2632
#include <QImage>
2733
#include <QMatrix4x4>
@@ -288,6 +294,9 @@ void BlurEffect::updateBlurRegion(EffectWindow *w, bool geometryChanged)
288294
BlurEffectData &data = m_windows[w];
289295
data.content = content;
290296
data.frame = frame;
297+
#ifdef KWIN_6_2_OR_GREATER
298+
data.windowEffect = ItemEffect(w->windowItem());
299+
#endif
291300
} else if (!geometryChanged) { // Blur may disappear if this method is called when window geometry changes
292301
if (auto it = m_windows.find(w); it != m_windows.end()) {
293302
effects->makeOpenGLContextCurrent();
@@ -437,10 +446,10 @@ bool BlurEffect::enabledByDefault()
437446

438447
bool BlurEffect::supported()
439448
{
440-
#ifdef KWIN_6_0
441-
return effects->isOpenGLCompositing() && GLFramebuffer::supported() && GLFramebuffer::blitSupported();
442-
#else
449+
#ifdef KWIN_6_1_OR_GREATER
443450
return effects->openglContext() && (effects->openglContext()->supportsBlits() || effects->waylandDisplay());
451+
#else
452+
return effects->isOpenGLCompositing() && GLFramebuffer::supported() && GLFramebuffer::blitSupported();
444453
#endif
445454
}
446455

@@ -1097,10 +1106,10 @@ GLTexture *BlurEffect::wallpaper(EffectWindow *desktop, const qreal &scale, cons
10971106
const RenderViewport renderViewport(desktop->frameGeometry(), scale, renderTarget);
10981107
WindowPaintData data;
10991108

1100-
#ifdef KWIN_6_0
1109+
#ifndef KWIN_6_1_OR_GREATER
11011110
QMatrix4x4 projectionMatrix;
1102-
projectionMatrix.ortho(geometry);
1103-
data.setProjectionMatrix(projectionMatrix);
1111+
projectionMatrix.ortho(geometry);
1112+
data.setProjectionMatrix(projectionMatrix);
11041113
#endif
11051114

11061115
GLFramebuffer::pushFramebuffer(desktopFramebuffer.get());
@@ -1146,7 +1155,7 @@ GLTexture *BlurEffect::createFakeBlurTextureWayland(const Output *output, const
11461155
auto *shader = ShaderManager::instance()->pushShader(ShaderTrait::MapTexture | ShaderTrait::TransformColorspace);
11471156
shader->setColorspaceUniforms(
11481157
ColorDescription::sRGB, renderTarget.colorDescription()
1149-
#if !(defined(KWIN_6_1) || defined(KWIN_6_0))
1158+
#ifdef KWIN_6_2_OR_GREATER
11501159
, RenderingIntent::RelativeColorimetricWithBPC
11511160
#endif
11521161
);

src/blur.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@
99

1010
#include "effect/effect.h"
1111
#include "opengl/glutils.h"
12+
#ifdef KWIN_6_2_OR_GREATER
13+
#include "scene/item.h"
14+
#endif
15+
1216
#include "settings.h"
1317
#include "window.h"
1418

1519
#include <QList>
1620

1721
#include <unordered_map>
1822

23+
1924
namespace KWin
2025
{
2126

@@ -40,6 +45,10 @@ struct BlurEffectData
4045
/// The render data per screen. Screens can have different color spaces.
4146
std::unordered_map<Output *, BlurRenderData> render;
4247

48+
#ifdef KWIN_6_2_OR_GREATER
49+
ItemEffect windowEffect;
50+
#endif
51+
4352
bool hasWindowBehind;
4453
};
4554

0 commit comments

Comments
 (0)