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).
This commit is contained in:
Emmanuel Lepage Vallee 2022-02-05 15:15:57 -08:00
parent 57b766ccf9
commit e82de8edb4
1 changed files with 17 additions and 2 deletions

View File

@ -450,10 +450,13 @@ end
--- How the border width affects the contained widget. --- How the border width affects the contained widget.
-- --
--@DOC_wibox_container_background_border_strategy_EXAMPLE@
--
-- @property border_strategy -- @property border_strategy
-- @tparam[opt="none"] string border_strategy -- @tparam[opt="none"] string border_strategy
-- @propertyvalue "none" Just apply the border, do not affect the content size (default). -- @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. -- @propertyvalue "inner" Squeeze the size of the content by the border width.
-- @propemits true false
function background:set_border_strategy(value) function background:set_border_strategy(value)
self._private.border_strategy = value self._private.border_strategy = value
@ -463,12 +466,24 @@ end
--- The background image to use. --- 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)` -- 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. -- as arguments. Any other arguments passed to this method will be appended.
-- --
-- @property bgimage -- @deprecatedproperty bgimage
-- @tparam[opt=nil] image|nil bgimage -- @tparam string|surface|function bgimage A background image or a function.
-- @see gears.surface -- @see gears.surface
-- @see wibox.container.border
-- @see wibox.widget.imagebox
-- @see wibox.layout.stack
function background:set_bgimage(image, ...) function background:set_bgimage(image, ...)
self._private.bgimage = type(image) == "function" and image or surface.load(image) self._private.bgimage = type(image) == "function" and image or surface.load(image)