client: Change the `relative_move` behavior.

The old behavior would move the client when `nil` was passed by
an almost arbitrary value. It would most of the time go off screen.

While this is a behavior change, what it replaces was so broken I
doubt anybody actually used `nil` in `relative_move`.
This commit is contained in:
Emmanuel Lepage Vallee 2021-10-27 17:58:16 -07:00
parent 8c9e270477
commit 7d6892992c
2 changed files with 10 additions and 8 deletions

View File

@ -74,6 +74,8 @@ This document was last updated at commit v4.3-197-g9085ed631.
* Setting `awful.rules.rules` now append the rules to the existing set.
Clearing the rules was never officially supported. If you *really* want the
old behavior, use `awful.rules.rules = {}; awful.rules.rules = my_new_rules`.
* `client:relative_move()` now default `nil` values to zero. The previous
behavior made no sense.
<a name="v43"></a>
# Awesome window manager framework version 4.3 changes

View File

@ -523,16 +523,16 @@ end
--
-- @method relative_move
-- @see geometry
-- @tparam[opt=c.x] number x The relative x coordinate.
-- @tparam[opt=c.y] number y The relative y coordinate.
-- @tparam[opt=c.width] number w The relative width.
-- @tparam[opt=c.height] number h The relative height.
-- @tparam[opt=0] number x The relative x coordinate.
-- @tparam[opt=0] number y The relative y coordinate.
-- @tparam[opt=0] number w The relative width.
-- @tparam[opt=0] number h The relative height.
function client.object.relative_move(self, x, y, w, h)
local geometry = self:geometry()
geometry['x'] = geometry['x'] + (x or geometry.x)
geometry['y'] = geometry['y'] + (y or geometry.y)
geometry['width'] = geometry['width'] + (w or geometry.width)
geometry['height'] = geometry['height'] + (h or geometry.height)
geometry['x'] = geometry['x'] + (x or 0)
geometry['y'] = geometry['y'] + (y or 0)
geometry['width'] = geometry['width'] + (w or 0)
geometry['height'] = geometry['height'] + (h or 0)
self:geometry(geometry)
end