Skip to content

Commit

Permalink
Update lib/wibox/container/border.lua
Browse files Browse the repository at this point in the history
Co-authored-by: Aire-One <[email protected]>
  • Loading branch information
Elv13 and Aire-One committed Dec 31, 2023
1 parent ac3976c commit 84a9e54
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
35 changes: 19 additions & 16 deletions lib/wibox/container/border.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
-- symmetric on both axis.
--
-- Note that because of legacy reasons, `wibox.container.background` also has
-- good support for borders. If you only need simple shaped strokes, the,
-- the `background` container is a much better choice. This module is better
-- good support for borders. If you only need simple shaped strokes, the
-- `background` container is a much better choice. This module is better
-- suited for background images and border widgets.
--
-- Advanced usage
Expand All @@ -23,7 +23,7 @@
--
-- This example demonstrates how to use this module to create a client
-- border with a top titlebar and borders. It does so by embedding a
-- `wibox.container.border` into another `wibox.container.border. The outer
-- `wibox.container.border` into another `wibox.container.border`. The outer
-- container acts as the border around the central area while the inner one
-- spans the top area and contains the titlebar itself. The outer border
-- widgets area can be used to implement border resize.
Expand Down Expand Up @@ -82,7 +82,7 @@ local function fit_common(widget, ctx, max_w, max_h)
end

local function uses_slice(self)
return (self._private.border_widgets or self._private.border_image_widgets) == nil
return not (self._private.border_widgets or self._private.border_image_widgets)
end

local function get_widget(self, ctx, component)
Expand Down Expand Up @@ -577,7 +577,7 @@ end
--- The widget to display inside of the border.
--
-- @property widget
-- @tparam widget widget
-- @tparam[opt=nil] widget|nil widget

module.set_widget = base.set_widget_common

Expand All @@ -595,6 +595,7 @@ end

--- Reset this layout. The widget will be removed and the rotation reset.
-- @method reset
-- @noreturn
-- @interface container
function module:reset()
self:set_widget(nil)
Expand All @@ -605,7 +606,7 @@ end
-- When using this property, the `borders` also **needs** to be specified.
--
-- @property border_image
-- @tparam string|gears.surface border_image
-- @tparam[opt=nil] string|image|nil border_image
-- @see borders
-- @see border_images

Expand Down Expand Up @@ -671,7 +672,7 @@ end
-- @DOC_wibox_container_border_stylesheet1_EXAMPLE@
--
-- @property border_image_stylesheet
-- @tparam string border_image_stylesheet CSS data or file path.
-- @tparam[opt=""] string border_image_stylesheet CSS data or file path.
-- @see wibox.widget.imagebox.stylesheet

function module:set_border_image_stylesheet(value)
Expand Down Expand Up @@ -713,15 +714,15 @@ end
-- @DOC_wibox_container_border_border_images1_EXAMPLE@
--
-- @property border_images
-- @tparam[opt=nil] table|gears.surface|nil border_images
-- @tparam[opt=nil] string|gears.surface border_images.top_left
-- @tparam[opt=nil] string|gears.surface border_images.top
-- @tparam[opt=nil] string|gears.surface border_images.top_right
-- @tparam[opt=nil] string|gears.surface border_images.right
-- @tparam[opt=nil] string|gears.surface border_images.bottom_right
-- @tparam[opt=nil] string|gears.surface border_images.bottom
-- @tparam[opt=nil] string|gears.surface border_images.bottom_left
-- @tparam[opt=nil] string|gears.surface border_images.left
-- @tparam[opt=nil] table|image|nil border_images
-- @tparam[opt=nil] string|image|nil border_images.top_left
-- @tparam[opt=nil] string|image|nil border_images.top
-- @tparam[opt=nil] string|image|nil border_images.top_right
-- @tparam[opt=nil] string|image|nil border_images.right
-- @tparam[opt=nil] string|image|nil border_images.bottom_right
-- @tparam[opt=nil] string|image|nil border_images.bottom
-- @tparam[opt=nil] string|image|nil border_images.bottom_left
-- @tparam[opt=nil] string|image|nil border_images.left
-- @propemits true false
-- @see border_image

Expand Down Expand Up @@ -754,6 +755,7 @@ end
-- @tparam[opt=0] number borders.left
-- @tparam[opt=0] number borders.right
-- @tparam[opt=0] number borders.bottom
-- @negativeallowed false

function module:set_borders(value)

Expand Down Expand Up @@ -920,6 +922,7 @@ end
-- @property paddings
-- @tparam[opt=0] number|table paddings
-- @propemits true false
-- @negativeallowed false
-- @see wibox.container.margin

function module:set_paddings(value)
Expand Down
16 changes: 10 additions & 6 deletions lib/wibox/widget/imagebox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ end
--
-- @property source_width
-- @tparam number source_width
-- @propertydefault This depends on the source image.
-- @negativeallowed false
-- @see image
-- @see source_height

Expand All @@ -381,6 +383,8 @@ end
--
-- @property source_height
-- @tparam number source_height
-- @propertydefault This depends on the source image.
-- @negativeallowed false
-- @see image
-- @see source_width

Expand Down Expand Up @@ -642,9 +646,9 @@ end
-- @propertyvalue "auto" Honor the `resize` variable and preserve the aspect ratio.
-- @propertyvalue "none" Do not resize at all.
-- @propertyvalue "fit" Resize to the widget width.
-- @propertyvalue "repeat"` Repeat the image side by side.
-- @propertyvalue "reflect"` Like `repeat`, but alternate the reflection.
-- @propertyvalue "pad"` Take the last column of pixels and repeat them.
-- @propertyvalue "repeat" Repeat the image side by side.
-- @propertyvalue "reflect" Like `repeat`, but alternate the reflection.
-- @propertyvalue "pad" Take the last column of pixels and repeat them.
-- @propemits true false
-- @see vertical_fit_policy
-- @see resize
Expand All @@ -666,9 +670,9 @@ end
-- @propertyvalue "none" Do not resize at all.
-- @propertyvalue "fit" Resize to the widget height.
-- @propertyvalue "fit" Resize to the widget width.
-- @propertyvalue "repeat"` Repeat the image side by side.
-- @propertyvalue "reflect"` Like `repeat`, but alternate the reflection.
-- @propertyvalue "pad"` Take the last column of pixels and repeat them.
-- @propertyvalue "repeat" Repeat the image side by side.
-- @propertyvalue "reflect" Like `repeat`, but alternate the reflection.
-- @propertyvalue "pad" Take the last column of pixels and repeat them.
-- @propemits true false
-- @see horizontal_fit_policy
-- @see resize
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/wibox/container/border/border_merging1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ for _, side in ipairs { "top", "bottom", "left", "right" } do
widget = wibox.widget.textbox
},
border_merging = {
-- This is the equaivalent "left = true,". "side" is the loop
-- This is the equaivalent "side = true,". "side" is the loop
-- variable.
[side] = true
},
Expand Down

0 comments on commit 84a9e54

Please sign in to comment.