Bug 482294

Summary: KWindowEffects::enableBlurBehind() region is no longer relative to the top-left corner of the client area on Plasma6 Wayland
Product: [Plasma] kwin Reporter: Paul McAuley <kde>
Component: effects-variousAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR Keywords: qt6, regression
Version: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 6.0.1
Sentry Crash Report:
Attachments: Illustration on Plasma6 of BlurBehind not being applied to the client top-left (scaling 100%)

Description Paul McAuley 2024-03-03 12:03:56 UTC
Created attachment 166346 [details]
Illustration on Plasma6 of BlurBehind not being applied to the client top-left (scaling 100%)

I am in the middle of porting an Application Style from Plasma 5 to Plasma 6 (https://github.com/paulmcauley/klassy/tree/plasma6.0). In Plasma 5 my Application Style could blur the tools area as in the screenshot at https://github.com/paulmcauley/klassy/raw/plasma6.0/screenshots/button_icon_menu.png?raw=true . This blur is applied by using the following function:
KWindowEffects::enableBlurBehind(mw->windowHandle(), true, rect);
( https://github.com/paulmcauley/klassy/blob/861b93c30b6a0457427c488805a78f0ac770103d/kstyle/breezestyle.cpp#L1436 )

Note that I need to specify the rect parameter as a QRegion, which the API documentation states "The region is relative to the top-left corner of the client area". ( https://api.kde.org/frameworks/kwindowsystem/html/namespaceKWindowEffects.html#a23a8c1dd33fb9a4a9fa0bbde4ae830cb )

My problem is that on Plasma 6 Wayland the blurred region is not in the correct position, and looks like the attached screenshot. Looking at debug output, the height of the region is specified in this instance as 46 pixels, but the actual blurred height in the client is smaller. The unblurred gap is equivalent to the titlebar height, with the blurred region now 46 pixels from the top of the decoration, suggesting that the BlurBehind effect region is now relative to the decoration top-left rather than the client top-left. (Note that on Plasma 6 X11 this problem does not occur, it only is a problem on Wayland).

Note also that this bug also applies to the style of both Qt5 apps (linked to KF5 version of KWindowSystem as in the Dolphin screenshot) and Qt6 apps (linked to KF6 version of KWindowSystem) hence I suspect it may be a wider problem than just in KWindowSystem.

Operating System: openSUSE Tumbleweed 20240227
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.6-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz
Memory: 15.5 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Manufacturer: Google
Product Name: Pantheon
System Version: 1.0
Comment 1 Vlad Zahorodnii 2024-03-04 09:07:06 UTC
Can you provide a demo application showing the issue please?
Comment 2 Paul McAuley 2024-03-04 22:42:37 UTC
(In reply to Vlad Zahorodnii from comment #1)
> Can you provide a demo application showing the issue please?

Sure. First install the latest Klassy plasma6.0 branch as follows:

git clone https://github.com/paulmcauley/klassy.git
cd klassy
git checkout plasma6.0
./install.sh

Then enable both the Klassy window decoration and Klassy application style in system settings. Set your colour scheme to one which contains header colours, such as Breeze Light or Breeze Dark. Then go to the Window Decoration settings, click on the pencil icon when hovered over Klassy and then click "Presets..." button at the top-right. Load the "Glassy Klassy" preset.

If you open an application with headers such as the latest Dolphin (Qt5), Kate (Qt5), Konsole (Qt6) or Kmail (Qt6) you will see the issue with blur missing halfway down the header, as in the screenshot I attached previously.

I have also just made some changes, so the line which contains the call to KWindowEffects::enableBlurBehind() is now at:
https://github.com/paulmcauley/klassy/blob/120332dfd4dd830359dd170020adcd5fd57ce229/kstyle/breezestyle.cpp#L1726

You can also install from the Plasma5.27 branch on Plasma 5.27 to see the headers showing blur as they should be.
Comment 3 Paul McAuley 2024-03-04 22:51:40 UTC
(you should also disable any spacer buttons in the Window Decoration settings before installing Klassy otherwise it will crash - I have not yet updated it to deal with this new feature)
Comment 4 Bug Janitor Service 2024-03-05 11:31:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5359
Comment 5 Vlad Zahorodnii 2024-03-05 13:46:20 UTC
Git commit 8736e44e1a4373f8549d969868e7aa49bdcb152f by Vlad Zahorodnii.
Committed on 05/03/2024 at 13:34.
Pushed by vladz into branch 'master'.

effect: Fix EffectWindow::contentsRect()

It should specify the client rect inside the frame.

2556378dfa866f99561d09dcd7ac113804972567 incorrectly assumed that the
buffer geometry includes the decoration.

M  +1    -1    src/effect/effectwindow.cpp

https://invent.kde.org/plasma/kwin/-/commit/8736e44e1a4373f8549d969868e7aa49bdcb152f
Comment 6 Vlad Zahorodnii 2024-03-05 14:10:03 UTC
Git commit fdcc9be2ce11b04dc423eeb896edcb06571dbc4f by Vlad Zahorodnii.
Committed on 05/03/2024 at 13:57.
Pushed by vladz into branch 'Plasma/6.0'.

effect: Fix EffectWindow::contentsRect()

It should specify the client rect inside the frame.

2556378dfa866f99561d09dcd7ac113804972567 incorrectly assumed that the
buffer geometry includes the decoration.


(cherry picked from commit 8736e44e1a4373f8549d969868e7aa49bdcb152f)

M  +1    -1    src/effect/effectwindow.cpp

https://invent.kde.org/plasma/kwin/-/commit/fdcc9be2ce11b04dc423eeb896edcb06571dbc4f