gtk: various blur-related fixes #10727
Conversation
Since both X11 and Wayland need to keep track of the actual size of the blur region, I've taken the liberty to extract that piece of code into our common winproto structure. Works just fine. Part of ghostty-org#10720
d728922 to
a9f4c28
Compare
|
So trying to find a satisfactory way to implement rounded corners actually drove me somewhat insane. I had to jerry-rig my own cursed nested-Niri white-noise-backed test setup in order to determine exactly where the blur regions are.
@YaLTeR thoughts? :P And with a solid border (the color doesn't really matter) |
|
Applying it just to the terminal widget is unfortunately really, really complicated. GTK 4 doesn't allow you to get the absolute position of a widget AFAICT, only relative to the parent widget, so you have to manually compute the offsets yourself. Our widget tree is really quite complicated so that isn't really feasible... The simplest way would be to just apply the blur to the entire window, even if it's somewhat wasteful on the compositor side |
0da3904 to
5f637d2
Compare
5f637d2 to
254b38b
Compare
|
Refined the rounding logic a bit more and this is fully ready on the Wayland side. Still have no way to test on X11. |
|
Also idk if this is relevant but quitting Ghostty results in a bunch of leak reports: |
|
Ah looks like I forgot to deinit some of these. Shucks |
mitchellh
left a comment
There was a problem hiding this comment.
I approve, just my one comment.
| .wayland_protocols = .{ | ||
| .url = "https://deps.files.ghostty.org/wayland-protocols-258d8f88f2c8c25a830c6316f87d23ce1a0f12d9.tar.gz", | ||
| .hash = "N-V-__8AAKw-DAAaV8bOAAGqA0-oD7o-HNIlPFYKRXSPT03S", | ||
| .url = "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/1.47/wayland-protocols-1.47.tar.gz", |
There was a problem hiding this comment.
Freedesktop has terrible reliability, so when this is good to go let me know and I'll fix this before we merge.
I approve otherwise.
There was a problem hiding this comment.
I think it's a good idea to push the zip to S3 in any case since the ext-bg-effect commit will likely be merged regardless of the other two
|
And another thing: when the window is in a maximized or tiled state, the corners aren't rounded:
(in CSS this is defined here I believe) (yeah, this should really be handled in GTK itself at some point...) |
|
GTK implementing something that will never land in GNOME? Imagine that! If that happened half of the Wayland winproto implementation straight up wouldn't need to exist! ...Aaanyway, I thought I could be a bit clever and simply read the |
I wouldn't assume that background effects would never land in GNOME |
|
Right, but before that happens I shall lean more on the pessimistic side :p I'll work on more specific criteria for disabling rounded corners now. Thanks for testing this too btw! |
In an ideal world one can simply read what --window-radius is set to within libadwaita. Unfortunately, we do not live in that world.
|
As for the transparent "border", I believe that's actually the box shadow that libadwaita applies globally, so I don't think we should change any of it. Comes with the territory. |
|
Thanks, looks good now! |
... Why is Plasma Wayland having problems as well...? @YaLTeR I think there's genuinely an issue here. I suspect that the KDE blur protocol implemented by KWin assumes device coordinates sans the CSD padding, while the impl in Niri assumes surface coordinates with the CSD padding (aka same semantics as ext-bg-effect). As there's pretty much no "real" specification of the KDE blur protocol I would probably recommend aligning Niri's impl to be the same as KDE's so that existing apps at least render correctly. Right now this PR looks correct under Niri but is terribly wrong under KDE. |
|
But the latest KDE code is exactly the same between ext-background-effect and KDE blur? Actually, seems the KDE blur protocol got axed from KDE, so maybe I need to reconsider implementing it in niri |
|
Interesting... Is this part of any current Plasma release? If they're removing the custom protocol anyways, I think it's a better idea to keep the original behavior just for the old protocol so people on older Plasma/KWin versions will enjoy the same behavior, while Niri users and people using more recent Plasma releases can get the benefits of this PR. |











Fixes #10721
Fixes #10720
I recommend reviewing this per-commit as there's a lot of refactoring to go over. I do want to fix the "korner bug" but that would require a bit more reading on my part.
This hasn't been tested on X11. If you're able, please see if this still works on KWin X11. I'm currently in the countryside celebrating Chinese New Year, and I'm not really in the mood of downloading half a gig worth of KDE libraries x)