awesome icon indicating copy to clipboard operation
awesome copied to clipboard

Modernize the `wibox.layout.grid` module and add border support.

Open Elv13 opened this issue 3 years ago • 1 comments

This is part of a larger branch I have been working on over the last month to implement widget_template everywhere. When it came to the calendar, it has its own "fn_embed" API to implement "templates". I try to prevent regressions when deprecating things. In that case, it is very hard to implement a 1 pixel border using the template (0.5px using wibox.container.margin doesn't look right). The annoying solution is to actually implement border_width in the grid. I gave up on it 5 years ago, but now I rewritten my previous attempt in a much saner way. Rather than try to draw the border, it clip areas where there should be no border and bucket-fill the remaining content.

image

Obviously, table borders are always rather nasty code. This is no exception. There was already a very large number of math code in the grid, now there is more. However, after fighting the corner case, I think it work reasonably well now. Beside the calendar, I can see a lot of place where this code can be useful. A lot of code examples use their own half baked "tables" using the margin container. They are almost never aligned property. Now there is a "correct" way to fix this. This PR doesn't do it. It's large enough already.

The PR also rename a bunch of properties which used abbreviations. It also convert local v, h = w:get_dimentsions() to the row_count and column_count properties, which is much more in line with other APIs.

Elv13 avatar Dec 05 '22 07:12 Elv13

Codecov Report

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

Comparison is base (cb72c0a) 91.01% compared to head (eddb83f) 91.05%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3746      +/-   ##
==========================================
+ Coverage   91.01%   91.05%   +0.04%     
==========================================
  Files         901      909       +8     
  Lines       57566    58202     +636     
==========================================
+ Hits        52392    52998     +606     
- Misses       5174     5204      +30     
Flag Coverage Δ
gcov 91.05% <96.75%> (+0.04%) :arrow_up:
luacov 93.74% <96.75%> (+0.02%) :arrow_up:

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

Files Coverage Δ
tests/examples/awful/popup/alttab.lua 100.00% <100.00%> (ø)
tests/examples/awful/popup/wiboxtypes.lua 100.00% <100.00%> (ø)
tests/examples/awful/screenshot/popup.lua 100.00% <100.00%> (ø)
tests/examples/awful/widget/layoutlist/bar.lua 100.00% <100.00%> (ø)
tests/examples/awful/widget/layoutlist/popup.lua 96.55% <100.00%> (ø)
...sts/examples/sequences/client/tasklist_layout1.lua 96.92% <100.00%> (ø)
tests/examples/wibox/layout/defaults/grid.lua 100.00% <100.00%> (ø)
tests/examples/wibox/layout/grid/add.lua 100.00% <100.00%> (ø)
.../examples/wibox/layout/grid/add_column_border1.lua 100.00% <100.00%> (ø)
...sts/examples/wibox/layout/grid/add_row_border1.lua 100.00% <100.00%> (ø)
... and 20 more

... and 2 files with indirect coverage changes

codecov[bot] avatar Dec 05 '22 07:12 codecov[bot]