Fix adjust misspelling

Co-authored-by: Aire-One <Aire-One@users.noreply.github.com>
This commit is contained in:
James Reed 2020-07-26 11:44:29 -06:00
parent 49a3859c8e
commit e2b00c71e7
No known key found for this signature in database
GPG Key ID: 0BE2BD33C5E8125E
6 changed files with 58 additions and 19 deletions

View File

@ -325,7 +325,7 @@ end
--- Apply some modifications before applying the new geometry. --- Apply some modifications before applying the new geometry.
-- @tparam table new_geo The new geometry -- @tparam table new_geo The new geometry
-- @tparam table args The common arguments -- @tparam table args The common arguments
-- @tparam boolean force Always ajust the geometry, even in pretent mode. This -- @tparam boolean force Always adjust the geometry, even in pretent mode. This
-- should only be used when returning the final geometry as it would otherwise -- should only be used when returning the final geometry as it would otherwise
-- mess the pipeline. -- mess the pipeline.
-- @treturn table|nil The new geometry -- @treturn table|nil The new geometry

View File

@ -36,7 +36,7 @@ data.padding = {}
-- @tparam table geo A geometry (width, height, x, y) table. -- @tparam table geo A geometry (width, height, x, y) table.
-- @tparam table delta A delta table (top, bottom, x, y). -- @tparam table delta A delta table (top, bottom, x, y).
-- @treturn table A geometry (width, height, x, y) table. -- @treturn table A geometry (width, height, x, y) table.
local function apply_geometry_ajustments(geo, delta) local function apply_geometry_adjustments(geo, delta)
return { return {
x = geo.x + (delta.left or 0), x = geo.x + (delta.left or 0),
y = geo.y + (delta.top or 0), y = geo.y + (delta.top or 0),
@ -388,11 +388,11 @@ function screen.object.get_bounding_geometry(self, args)
if (not args.parent) and (not args.bounding_rect) and args.honor_padding then if (not args.parent) and (not args.bounding_rect) and args.honor_padding then
local padding = self.padding local padding = self.padding
geo = apply_geometry_ajustments(geo, padding) geo = apply_geometry_adjustments(geo, padding)
end end
if args.margins then if args.margins then
geo = apply_geometry_ajustments(geo, geo = apply_geometry_adjustments(geo,
type(args.margins) == "table" and args.margins or { type(args.margins) == "table" and args.margins or {
left = args.margins, right = args.margins, left = args.margins, right = args.margins,
top = args.margins, bottom = args.margins, top = args.margins, bottom = args.margins,

View File

@ -1,7 +1,7 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
--- A layout filling all the available space. Each widget is assigned a --- A layout filling all the available space. Each widget is assigned a
-- ratio (percentage) of the total space. Multiple methods are available to -- ratio (percentage) of the total space. Multiple methods are available to
-- ajust this ratio. -- adjust this ratio.
-- --
--@DOC_wibox_layout_defaults_ratio_EXAMPLE@ --@DOC_wibox_layout_defaults_ratio_EXAMPLE@
-- @author Emmanuel Lepage Vallee -- @author Emmanuel Lepage Vallee
@ -56,10 +56,10 @@ local function gen_sum(self, i_s, i_e)
end end
-- The ratios are expressed as percentages. For this to work, the sum of all -- The ratios are expressed as percentages. For this to work, the sum of all
-- ratio must be 1. This function attempt to ajust them. Space can be taken -- ratio must be 1. This function attempt to adjust them. Space can be taken
-- from or added to a ratio when widgets are being added or removed. If a -- from or added to a ratio when widgets are being added or removed. If a
-- specific ratio must be enforced for a widget, it has to be done with the -- specific ratio must be enforced for a widget, it has to be done with the
-- `ajust_ratio` method after each insertion or deletion -- `adjust_ratio` method after each insertion or deletion
local function normalize(self) local function normalize(self)
local count = #self._private.widgets local count = #self._private.widgets
if count == 0 then return end if count == 0 then return end
@ -229,7 +229,7 @@ end
-- do nothing. -- do nothing.
-- --
-- @method inc_widget_ratio -- @method inc_widget_ratio
-- @tparam widget widget The widget to ajust -- @tparam widget widget The widget to adjust
-- @tparam number increment An floating point value between -1 and 1 where the -- @tparam number increment An floating point value between -1 and 1 where the
-- end result is within 0 and 1 -- end result is within 0 and 1
function ratio:inc_widget_ratio(widget, increment) function ratio:inc_widget_ratio(widget, increment)
@ -282,7 +282,7 @@ end
--- Set the ratio of `widget` to `percent`. --- Set the ratio of `widget` to `percent`.
-- --
-- @method set_widget_ratio -- @method set_widget_ratio
-- @tparam widget widget The widget to ajust. -- @tparam widget widget The widget to adjust.
-- @tparam number percent A floating point value between 0 and 1. -- @tparam number percent A floating point value between 0 and 1.
function ratio:set_widget_ratio(widget, percent) function ratio:set_widget_ratio(widget, percent)
local index = self:index(widget) local index = self:index(widget)
@ -293,14 +293,14 @@ end
--- Update all widgets to match a set of a ratio. --- Update all widgets to match a set of a ratio.
-- The sum of before, itself and after must be 1 or nothing will be done. -- The sum of before, itself and after must be 1 or nothing will be done.
-- --
--@DOC_wibox_layout_ratio_ajust_ratio_EXAMPLE@ --@DOC_wibox_layout_ratio_adjust_ratio_EXAMPLE@
-- --
-- @method ajust_ratio -- @method adjust_ratio
-- @tparam number index The index of the widget to change -- @tparam number index The index of the widget to change
-- @tparam number before The sum of the ratio before the widget -- @tparam number before The sum of the ratio before the widget
-- @tparam number itself The ratio for "widget" -- @tparam number itself The ratio for "widget"
-- @tparam number after The sum of the ratio after the widget -- @tparam number after The sum of the ratio after the widget
function ratio:ajust_ratio(index, before, itself, after) function ratio:adjust_ratio(index, before, itself, after)
if not self._private.widgets[index] or not before or not itself or not after then if not self._private.widgets[index] or not before or not itself or not after then
return return
end end
@ -334,17 +334,56 @@ function ratio:ajust_ratio(index, before, itself, after)
self:emit_signal("widget::layout_changed") self:emit_signal("widget::layout_changed")
end end
--- Update all widgets to match a set of a ratio.
--
-- This method is kept for backwards compatibility, please use `:adjust_ratio` instead.
-- @see wibox.layout.ratio.adjust_ratio
-- @deprecated wibox.layout.ratio.ajust_ratio
-- @tparam number index The index of the widget to change
-- @tparam number index The index of the widget to change
-- @tparam number before The sum of the ratio before the widget
-- @tparam number before The sum of the ratio before the widget
-- @tparam number itself The ratio for "widget"
-- @tparam number itself The ratio for "widget"
-- @tparam number after The sum of the ratio after the widget
-- @tparam number after The sum of the ratio after the widget
function ratio:ajust_ratio(...)
require('gears.debug').deprecate(
"Use `:adjust_ratio` rather than `:ajust_ratio`",
{ deprecated_in = 5 }
)
return self:adjust_ratio(...)
end
--- Update all widgets to match a set of a ratio. --- Update all widgets to match a set of a ratio.
-- --
-- @method ajust_widget_ratio -- @method adjust_widget_ratio
-- @tparam widget widget The widget to ajust -- @tparam widget widget The widget to adjust
-- @tparam number before The sum of the ratio before the widget -- @tparam number before The sum of the ratio before the widget
-- @tparam number itself The ratio for "widget" -- @tparam number itself The ratio for "widget"
-- @tparam number after The sum of the ratio after the widget -- @tparam number after The sum of the ratio after the widget
function ratio:ajust_widget_ratio(widget, before, itself, after) function ratio:adjust_widget_ratio(widget, before, itself, after)
local index = self:index(widget) local index = self:index(widget)
self:ajust_ratio(index, before, itself, after) self:adjust_ratio(index, before, itself, after)
end
--- Update all widgets to match a set of a ratio.
--
-- This method is kept for backwards compatibility, please use `:adjust_widget_ratio` instead.
-- @see wibox.layout.ratio.adjust_widget_ratio
-- @deprecated wibox.layout.ratio.ajust_widget_ratio
-- @tparam widget widget The widget to adjust
-- @tparam number before The sum of the ratio before the widget
-- @tparam number before The sum of the ratio before the widget
-- @tparam number itself The ratio for "widget"
-- @tparam number itself The ratio for "widget"
-- @tparam number after The sum of the ratio after the widget
-- @tparam number after The sum of the ratio after the widget
function ratio:ajust_widget_ratio(...)
require('gears.debug').deprecate(
"Use `:adjust_widget_ratio` rather than `:ajust_widget_ratio`",
{ deprecated_in = 5 }
)
return self:adjust_widget_ratio(...)
end end
--- Add some widgets to the given fixed layout. --- Add some widgets to the given fixed layout.

View File

@ -42,7 +42,7 @@ local function stripe_pat(col, angle, line_width, spacing)
--FIXME spacing need to be in "w", not "hy" --FIXME spacing need to be in "w", not "hy"
local w, h = math.ceil(a + (line_width - 1)), math.ceil(o + (line_width - 1)) local w, h = math.ceil(a + (line_width - 1)), math.ceil(o + (line_width - 1))
-- ajust_size(self, w, h) --FIXME need a "force_size" method -- adjust_size(self, w, h) --FIXME need a "force_size" method
-- Create the pattern -- Create the pattern
local img2 = cairo.SvgSurface.create(nil, w, h) local img2 = cairo.SvgSurface.create(nil, w, h)

View File

@ -9,7 +9,7 @@ local w = wibox.widget {
layout = wibox.layout.ratio.horizontal layout = wibox.layout.ratio.horizontal
} }
w:ajust_ratio(2, 0.44, 0.33, 0.22) w:adjust_ratio(2, 0.44, 0.33, 0.22)
return w --DOC_HIDE return w --DOC_HIDE

View File

@ -38,7 +38,7 @@ for i=1, 5 do
local w = create() --DOC_HIDE local w = create() --DOC_HIDE
for _=1, i do --DOC_HIDE for _=1, i do --DOC_HIDE
w:ajust_ratio(2, unpack(values[i])) w:adjust_ratio(2, unpack(values[i]))
end --DOC_HIDE end --DOC_HIDE
ret:add(w) --DOC_HIDE ret:add(w) --DOC_HIDE