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
Prev Previous commit
Next Next commit
background: Deprecate bgimage.
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).
  • Loading branch information
Elv13 committed Dec 31, 2023
commit e82de8edb4761f28ffb8e003dad76a180af4b49b
19 changes: 17 additions & 2 deletions lib/wibox/container/background.lua
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,13 @@ end

--- How the border width affects the contained widget.
--
--@DOC_wibox_container_background_border_strategy_EXAMPLE@
--
-- @property border_strategy
-- @tparam[opt="none"] string border_strategy
-- @propertyvalue "none" Just apply the border, do not affect the content size (default).
-- @propertyvalue "inner" Squeeze the size of the content by the border width.
-- @propemits true false

function background:set_border_strategy(value)
self._private.border_strategy = value
Expand All @@ -463,12 +466,24 @@ end

--- The background image to use.
--
-- This property is deprecated. The `wibox.container.border` provides a much
-- more fine-grained support for background images. It is now out of the
-- `wibox.container.background` scope. `wibox.layout.stack` can also be used
-- to overlay a widget on top of a `wibox.widget.imagebox`. This solution
-- exposes all availible imagebox properties. Finally, if you wish to use the
-- `function` callback support, implement the `before_draw_children` method
-- on any widget. This gives you the same level of control without all the
-- `bgimage` corner cases.
--
-- If `image` is a function, it will be called with `(context, cr, width, height)`
-- as arguments. Any other arguments passed to this method will be appended.
--
-- @property bgimage
-- @tparam[opt=nil] image|nil bgimage
-- @deprecatedproperty bgimage
-- @tparam string|surface|function bgimage A background image or a function.
-- @see gears.surface
-- @see wibox.container.border
-- @see wibox.widget.imagebox
-- @see wibox.layout.stack

function background:set_bgimage(image, ...)
self._private.bgimage = type(image) == "function" and image or surface.load(image)
Expand Down