mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-01-11 14:40:25 +01:00
[PR #678] [MERGED] Simpler and more precise border production #1051
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/LGUG2Z/komorebi/pull/678
Author: @raggi
Created: 2/20/2024
Status: ✅ Merged
Merged: 2/26/2024
Merged by: @LGUG2Z
Base:
master← Head:raggi/borders📝 Commits (9)
ba52f1akomorebi{,-core}: use window bounds without shadow3b8bc0cfix(cfg,komorebi): remove all uses of invisible borders9d07938fix(komorebi): restore borders, no more DWM border on border windowc87cf61fix(komorebi): account for border offset and width in layout1469d0ffix(komorebi): account for border decorations on resizead4a899fix(config): set new default border offset and width6b24827fix(komorebi): raise windows and border to top, not topmost6e95084fix(komorebi): close the corner gap around rounded cornersdc88ea4fix(komorebi): don't raise the border window to top📊 Changes
14 files changed (+163 additions, -229 deletions)
View changed files
📝
komorebi-core/src/arrangement.rs(+2 -2)📝
komorebi-core/src/rect.rs(+24 -7)📝
komorebi/src/border.rs(+4 -44)📝
komorebi/src/lib.rs(+1 -2)📝
komorebi/src/monitor.rs(+1 -2)📝
komorebi/src/process_command.rs(+6 -23)📝
komorebi/src/process_event.rs(+5 -20)📝
komorebi/src/static_config.rs(+4 -42)📝
komorebi/src/window.rs(+2 -29)📝
komorebi/src/window_manager.rs(+14 -38)📝
komorebi/src/windows_api.rs(+62 -11)📝
komorebi/src/windows_callbacks.rs(+15 -2)📝
komorebi/src/workspace.rs(+21 -5)📝
schema.json(+2 -2)📄 Description
This includes three changes that could be included independently though each has some side effect that is adjusted by the latter to better align with the overall goal.
I set out to remove the inconsistent gap and miscoloration around windows. This was originating in the interactions with DWM decorations.
First the API that we're using to read window size is shifted to one that returns Window dimensions without including the DWM/theme decorations.
Next in order to fix a number of new regressions vs. the application database, we needed to remove the use of the invisible borders - these were a side effect of the DWM decorations. They're no longer needed, as application Window dimensions are now correct, with one notable interaction with theming (below).
Finally we move away from allowing/using DWM decorations on the border window. While this was giving us a rounded corner, it was causing offset bugs due to the fact that the theme is not symmetrical. This was making it impossible to draw very thin borders correctly, for example few pixel borders.
There is one final caveat noted here, the problem exists already in a different form, but for the same as yet unresolved reasons. Single pixel borders work correctly with this setup but there remain overlapping concerns with the system them. The windows DWM theme adds an active window border as well, and how opaque this border is depends upon the theme (this is present even if the drop shadow is off). That border often produces what appears to be a single semi-transparent pixel border around the window that looks like a "gap" in many scenarios. Most users will want to set border-offset to -1 and then increase the border with by 1 to get a solid active window border color underneath the whole border edge, without bleeding through to the background or similar, that otherwise looks like a gap. This leaves what has the look and feel of a single pixel border in many scenarios except as follows.
As an example the Epic launcher uses a different DWM window style, that adjusts the border behavior. The border there is completely opaque and spills over a single pixel border window, effectively making the active border window invisible. For users trying to do that single pixel border style, it will effectively disappear under those windows. The correct fix for this is to interrogate the DWM border style of the windows we are decorating and adjust for this. As it stands right now I doubt any users are affected by this, as if they're arranging for single pixel borders today, they will be missing borders on many applications that have incorrect sizing and offsetting.
One final thing that is also worth considering for a near future, aside from detecting DWM styles for border edges, is to also use that to apply a small fixup on the window corner radius for those applications. Relatedly, we could also offer a general border radius option, and a really polished fix would work on addressing DWM properties that observe the default Windows 11 corner styles, where the bottom right "resizable border" has a non-cicular inset on the corner curve - we could fill that in, or conform to it (the latter requires doing some more fancy drawing).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.