Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new border container #3559

Merged
merged 11 commits into from
Dec 31, 2023
Merged

Add a new border container #3559

merged 11 commits into from
Dec 31, 2023

Conversation

Elv13
Copy link
Member

@Elv13 Elv13 commented Feb 5, 2022

This container have 2 main aspect. First, it implement CSS-style slices. So background images stretch properly:

image

note: Ignore the visible artifacts in the image. It's only in the doc because it places raster images in SVG and rescale them incorrectly when the browser scales the SVG.

The second feature is the ability to have side and corner widgets for the border.

Initially, I didn't plan to finish this for this release, but some people shown interest in the chat. There was also some questions in #3489 about how complex titlebars can be handled without 400 lines of ugly hacks. With this container, you can directly take a background image and end up with this:

image

This is the first part of a 2 part series to fix #650 (comment) . I will not do the second part before v4.4. The other half is mostly the productionalized version of @psychon code. The new awful.decoration module will not really add size/corner resize by default. However, it will now be trivial to add rather than stupidly hard with 2 wibox.layout.align and 2 wibox.layout.flex like it is right now.

I thought "it's almost fully implemented, how bad can it be to finish it!": very bad... This container was a corner case rabbit hole. I kind of gave up in December, but finally had the guts to finish it. The DPI property is still not exposed. It will take more rabbit hunting down in the rabbit hole.

About the implementation. I hesitated between putting this in wibox.layout or wibox.container. In the end I picked container because it only have 1 "indexed" widget. This deprecated wibox.container.background.bgimage. That's "weird" because it's deprecating the background support for the background container. However, the shape and bgimage were always pretty much incompatible. Extending the background container with all the new properties would have made the code unmaintainable. I added a couple new properties to the background container to compensate for some of the deprecated corner case which could not be handled by the border container.

edit: I also fix a few CSS support bugs. I added CSS support in the wallpaper PR serie, but it wasn't that well tested

@actionless
Copy link
Member

havent went through the code yet, but description looks nice 👍

Copy link
Member

@Aire-One Aire-One left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to do a second pass on the border container code latter. It's getting too late for all the math 😅

This is very promising regarding titlebars and borders for clients. I can't wait for the second part of the series!

lib/wibox/container/background.lua Outdated Show resolved Hide resolved
lib/wibox/container/background.lua Show resolved Hide resolved
lib/wibox/widget/imagebox.lua Show resolved Hide resolved
tests/examples/wibox/container/border/border_merging1.lua Outdated Show resolved Hide resolved
lib/wibox/container/border.lua Outdated Show resolved Hide resolved
lib/wibox/container/border.lua Outdated Show resolved Hide resolved
lib/wibox/container/border.lua Outdated Show resolved Hide resolved
actionless
actionless previously approved these changes Aug 26, 2023
Copy link
Member

@actionless actionless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't look potentially harmful as it's not changing much of stuff, but rather adding it, so i think it's ok to go if it's still passing the CI

This will be used soon by a nice CSS inspired image slicer
container/layout.

They have a limitation inherited from Cairo of only working on a
single axis. This isn't important for 99% of the use case.
To be used by `wibox.container.border`, which is a specialized imagebox.
Before, the CSS had to be inline. Now that the border container uses
this code, it makes sense to make it more flexible.
The `textbox` already has the equivalent. This will soon be used
by the new `wibox.container.border` widget.
Rather than bloat the `background` container with another 1k lines,
a new container is added. The goal is to implement CSS-style slicing
for the background images. The container also allows to place
generic widgets on each sides and corners of the container.

The main use case for this container is to replace the old
`awful.titlebar` API with `awful.decoration`. That new module will
allow a central client widget to be surrounded by widgets rather than
have 4 separate drawing areas. The border container is designed to
make complex border+titlebar setup trivial.
It is now handled by the `wibox.container.border`. The current
implementation had many unhandled corner case and is less
flexible than the new API.

Some might argue deprecating the background from a background
container is... strange. This is true. However, keeing all
use case within the same codebase would make it too large.

The `gears.shape` support is incompatible with the border
widgets (which are used to implement the background images).
This is a feature request from the chat. Right now, only deprecated
hacks allow this to be implemented. This is a valid use case and
must be supported for HiDPI use cases.
Copy link

codecov bot commented Dec 31, 2023

Codecov Report

Attention: 38 lines in your changes are missing coverage. Please review.

Comparison is base (cb72c0a) 91.01% compared to head (2eab55e) 91.22%.
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3559      +/-   ##
==========================================
+ Coverage   91.01%   91.22%   +0.21%     
==========================================
  Files         901      927      +26     
  Lines       57566    59450    +1884     
==========================================
+ Hits        52392    54233    +1841     
- Misses       5174     5217      +43     
Flag Coverage Δ
gcov 91.22% <97.84%> (+0.21%) ⬆️
luacov 93.87% <97.84%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
lib/wibox/container/init.lua 100.00% <100.00%> (ø)
...amples/wibox/container/background/border_color.lua 100.00% <100.00%> (ø)
...les/wibox/container/background/border_strategy.lua 100.00% <100.00%> (ø)
...amples/wibox/container/background/border_width.lua 100.00% <100.00%> (ø)
...ibox/container/background/stretch_horizontally.lua 100.00% <100.00%> (ø)
.../wibox/container/background/stretch_vertically.lua 100.00% <100.00%> (ø)
...examples/wibox/container/border/border_images1.lua 100.00% <100.00%> (ø)
...xamples/wibox/container/border/border_merging1.lua 100.00% <100.00%> (ø)
...xamples/wibox/container/border/border_widgets1.lua 100.00% <100.00%> (ø)
tests/examples/wibox/container/border/borders1.lua 100.00% <100.00%> (ø)
... and 21 more

... and 6 files with indirect coverage changes

@Elv13
Copy link
Member Author

Elv13 commented Dec 31, 2023

Merging since this was approved and I only rebased/fixed_new_doc_warnings

@Elv13 Elv13 merged commit 1f7ac8f into awesomeWM:master Dec 31, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use full hierarchy for clients drawable
3 participants