Previously, the background container "just" used the shape and drew a
line around it. This means that half the line will be inside of the
shape and half of it will be outside. Thus, this hides the actual shape
that is used.
This commit changes that so that the line is added outside of the shape.
It does this via some tricks:
- In :before_draw_children(), :push_group() is used to redirect drawing
of the child widget to a temporary surface.
- In :after_draw_children(), the border is added to this group.
+ For this, another temporary surface is created. It will be used as a
mask.
+ The inside of the shape on this mask is cleared, everything else is
filled. Thus, the mask now contains everything "not content".
+ Everything inside the mask is filled with the background color.
- Also in :after_draw_children(), the group is drawn to the actual
target surface.
+ Again, this needs a mask.
+ This time, we draw the shape to the mask with twice the border width.
Thus, half of this line will be outside of the shape.
+ Then, the shape itself is also filled so that the mask contains the
shape and the border.
+ This mask is then used to copy the right parts of the temporary
surface were the child widget and border was drawn to the actual
target surface that will be visible on screen.
This approach has some upsides. Because we no longer have "half the
border" above content, colors with some transparency work fine for the
border. Also, this should avoid issues with anti-aliasing, because e.g.
the border is not just drawn with the border width, but also further out
to everything else so that the background cannot "bleed through".
Fixes: https://github.com/awesomeWM/awesome/issues/2516
Signed-off-by: Uli Schlachter <psychon@znc.in>
This gets rid of the following output when running the unit tests:
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got an empty table
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got an empty table from: ./spec/beautiful/tests/Bad_1.lua
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a function from: ./spec/beautiful/tests/Bad_2.lua
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a number from: ./spec/beautiful/tests/Bad_3.lua
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a nil from: ./spec/beautiful/tests/Bad_4.lua
2019-01-26 18:31:44 E: awesome: Error during a protected call: ./spec/beautiful/tests/Bad_5.lua:2: attempt to index local 'var' (a nil value)
stack traceback:
./spec/beautiful/tests/Bad_5.lua:2: in main chunk
[C]: in function 'dofile'
[C]: in function 'xpcall'
lib/gears/protected_call.lua:36: in function <lib/gears/protected_call.lua:35>
(...tail calls...)
lib/beautiful/init.lua:224: in function 'init'
spec/beautiful/init_spec.lua:56: in function <spec/beautiful/init_spec.lua:25>
[C]: in function 'xpcall'
/usr/share/lua/5.2/busted/core.lua:178: in function 'safe'
/usr/share/lua/5.2/busted/init.lua:40: in function 'executor'
...
/usr/share/lua/5.2/busted/core.lua:312: in function 'execute'
/usr/share/lua/5.2/busted/block.lua:155: in function 'execute'
/usr/share/lua/5.2/busted/init.lua:7: in function 'executor'
/usr/share/lua/5.2/busted/core.lua:312: in function </usr/share/lua/5.2/busted/core.lua:312>
[C]: in function 'xpcall'
/usr/share/lua/5.2/busted/core.lua:178: in function 'safe'
/usr/share/lua/5.2/busted/core.lua:312: in function 'execute'
/usr/share/lua/5.2/busted/execute.lua:58: in function 'execute'
/usr/share/lua/5.2/busted/runner.lua:174: in function </usr/share/lua/5.2/busted/runner.lua:11>
/usr/bin/busted:3: in main chunk
[C]: in ?
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a nil from: ./spec/beautiful/tests/Bad_5.lua
2019-01-26 18:31:44 E: awesome: Error during a protected call: cannot open ./spec/beautiful/tests/NO_FILE: No such file or directory
stack traceback:
[C]: in function 'dofile'
[C]: in function 'xpcall'
lib/gears/protected_call.lua:36: in function <lib/gears/protected_call.lua:35>
(...tail calls...)
lib/beautiful/init.lua:224: in function 'init'
spec/beautiful/init_spec.lua:57: in function <spec/beautiful/init_spec.lua:25>
[C]: in function 'xpcall'
/usr/share/lua/5.2/busted/core.lua:178: in function 'safe'
/usr/share/lua/5.2/busted/init.lua:40: in function 'executor'
/usr/share/lua/5.2/busted/core.lua:312: in function </usr/share/lua/5.2/busted/core.lua:312>
...
/usr/share/lua/5.2/busted/core.lua:312: in function 'execute'
/usr/share/lua/5.2/busted/block.lua:155: in function 'execute'
/usr/share/lua/5.2/busted/init.lua:7: in function 'executor'
/usr/share/lua/5.2/busted/core.lua:312: in function </usr/share/lua/5.2/busted/core.lua:312>
[C]: in function 'xpcall'
/usr/share/lua/5.2/busted/core.lua:178: in function 'safe'
/usr/share/lua/5.2/busted/core.lua:312: in function 'execute'
/usr/share/lua/5.2/busted/execute.lua:58: in function 'execute'
/usr/share/lua/5.2/busted/runner.lua:174: in function </usr/share/lua/5.2/busted/runner.lua:11>
/usr/bin/busted:3: in main chunk
[C]: in ?
2019-01-26 18:31:44 E: awesome: beautiful: error loading theme: got a nil from: ./spec/beautiful/tests/NO_FILE
Signed-off-by: Uli Schlachter <psychon@znc.in>
These events are generated when the mouse pointer moves between our
window and one of its child windows. For our purposes, this never counts
as an enter or leave, so just ignore these events completely.
Fixes: https://github.com/awesomeWM/awesome/issues/2560
Signed-off-by: Uli Schlachter <psychon@znc.in>
This module is half way between the tooltip and the raw wibox.
It supports the following features:
* Auto resize to its widget size
* Support parent objects and placement
Fix#1683
If the `layouts` are set during initialization, `t.layout` will
return `floating` if `t.layouts` is added before `t.layout`. By
using the raw layout, the fallback doesn't kicks in.