From e2b00c71e763f26772bf6a67d02aa2ef7246efd7 Mon Sep 17 00:00:00 2001 From: James Reed Date: Sun, 26 Jul 2020 11:44:29 -0600 Subject: [PATCH] Fix adjust misspelling Co-authored-by: Aire-One --- lib/awful/placement.lua | 2 +- lib/awful/screen.lua | 6 +- lib/wibox/layout/ratio.lua | 63 +++++++++++++++---- tests/examples/screen/template.lua | 2 +- .../examples/wibox/layout/defaults/ratio.lua | 2 +- .../{ajust_ratio.lua => adjust_ratio.lua} | 2 +- 6 files changed, 58 insertions(+), 19 deletions(-) rename tests/examples/wibox/layout/ratio/{ajust_ratio.lua => adjust_ratio.lua} (96%) diff --git a/lib/awful/placement.lua b/lib/awful/placement.lua index 234818f2..c7599e8a 100644 --- a/lib/awful/placement.lua +++ b/lib/awful/placement.lua @@ -325,7 +325,7 @@ end --- Apply some modifications before applying the new geometry. -- @tparam table new_geo The new geometry -- @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 -- mess the pipeline. -- @treturn table|nil The new geometry diff --git a/lib/awful/screen.lua b/lib/awful/screen.lua index 06ec0735..142f3cf4 100644 --- a/lib/awful/screen.lua +++ b/lib/awful/screen.lua @@ -36,7 +36,7 @@ data.padding = {} -- @tparam table geo A geometry (width, height, x, y) table. -- @tparam table delta A delta table (top, bottom, x, y). -- @treturn table A geometry (width, height, x, y) table. -local function apply_geometry_ajustments(geo, delta) +local function apply_geometry_adjustments(geo, delta) return { x = geo.x + (delta.left 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 local padding = self.padding - geo = apply_geometry_ajustments(geo, padding) + geo = apply_geometry_adjustments(geo, padding) end if args.margins then - geo = apply_geometry_ajustments(geo, + geo = apply_geometry_adjustments(geo, type(args.margins) == "table" and args.margins or { left = args.margins, right = args.margins, top = args.margins, bottom = args.margins, diff --git a/lib/wibox/layout/ratio.lua b/lib/wibox/layout/ratio.lua index 20335e6d..6f331a07 100644 --- a/lib/wibox/layout/ratio.lua +++ b/lib/wibox/layout/ratio.lua @@ -1,7 +1,7 @@ --------------------------------------------------------------------------- --- A layout filling all the available space. Each widget is assigned a -- ratio (percentage) of the total space. Multiple methods are available to --- ajust this ratio. +-- adjust this ratio. -- --@DOC_wibox_layout_defaults_ratio_EXAMPLE@ -- @author Emmanuel Lepage Vallee @@ -56,10 +56,10 @@ local function gen_sum(self, i_s, i_e) end -- 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 -- 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 count = #self._private.widgets if count == 0 then return end @@ -229,7 +229,7 @@ end -- do nothing. -- -- @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 -- end result is within 0 and 1 function ratio:inc_widget_ratio(widget, increment) @@ -282,7 +282,7 @@ end --- Set the ratio of `widget` to `percent`. -- -- @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. function ratio:set_widget_ratio(widget, percent) local index = self:index(widget) @@ -293,14 +293,14 @@ end --- 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. -- ---@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 before The sum of the ratio before the widget -- @tparam number itself The ratio for "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 return end @@ -334,17 +334,56 @@ function ratio:ajust_ratio(index, before, itself, after) self:emit_signal("widget::layout_changed") 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. -- --- @method ajust_widget_ratio --- @tparam widget widget The widget to ajust +-- @method adjust_widget_ratio +-- @tparam widget widget The widget to adjust -- @tparam number before The sum of the ratio before the widget -- @tparam number itself The ratio for "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) - 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 --- Add some widgets to the given fixed layout. diff --git a/tests/examples/screen/template.lua b/tests/examples/screen/template.lua index 655fbb20..b0f53f0d 100644 --- a/tests/examples/screen/template.lua +++ b/tests/examples/screen/template.lua @@ -42,7 +42,7 @@ local function stripe_pat(col, angle, line_width, spacing) --FIXME spacing need to be in "w", not "hy" 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 local img2 = cairo.SvgSurface.create(nil, w, h) diff --git a/tests/examples/wibox/layout/defaults/ratio.lua b/tests/examples/wibox/layout/defaults/ratio.lua index 04779b7c..3a283818 100644 --- a/tests/examples/wibox/layout/defaults/ratio.lua +++ b/tests/examples/wibox/layout/defaults/ratio.lua @@ -9,7 +9,7 @@ local w = wibox.widget { 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 diff --git a/tests/examples/wibox/layout/ratio/ajust_ratio.lua b/tests/examples/wibox/layout/ratio/adjust_ratio.lua similarity index 96% rename from tests/examples/wibox/layout/ratio/ajust_ratio.lua rename to tests/examples/wibox/layout/ratio/adjust_ratio.lua index f51188b9..396ed387 100644 --- a/tests/examples/wibox/layout/ratio/ajust_ratio.lua +++ b/tests/examples/wibox/layout/ratio/adjust_ratio.lua @@ -38,7 +38,7 @@ for i=1, 5 do local w = create() --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 ret:add(w) --DOC_HIDE