Merge pull request #1637 from psychon/deprecation_warnings
Fix some deprecation warnings
This commit is contained in:
commit
d3ca6aa301
|
@ -12,6 +12,7 @@ local spawn = require("awful.spawn")
|
||||||
local set_shape = require("awful.client.shape").update.all
|
local set_shape = require("awful.client.shape").update.all
|
||||||
local object = require("gears.object")
|
local object = require("gears.object")
|
||||||
local grect = require("gears.geometry").rectangle
|
local grect = require("gears.geometry").rectangle
|
||||||
|
local gmath = require("gears.math")
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local type = type
|
local type = type
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
|
@ -178,7 +179,7 @@ function client.next(i, sel, stacked)
|
||||||
for idx, c in ipairs(cls) do
|
for idx, c in ipairs(cls) do
|
||||||
if c == sel then
|
if c == sel then
|
||||||
-- Cycle
|
-- Cycle
|
||||||
return cls[util.cycle(#cls, idx + i)]
|
return cls[gmath.cycle(#cls, idx + i)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1090,7 +1091,7 @@ end
|
||||||
function client.run_or_raise(cmd, matcher, merge)
|
function client.run_or_raise(cmd, matcher, merge)
|
||||||
local clients = capi.client.get()
|
local clients = capi.client.get()
|
||||||
local findex = util.table.hasitem(clients, capi.client.focus) or 1
|
local findex = util.table.hasitem(clients, capi.client.focus) or 1
|
||||||
local start = util.cycle(#clients, findex + 1)
|
local start = gmath.cycle(#clients, findex + 1)
|
||||||
|
|
||||||
local c = client.iterate(matcher, start)()
|
local c = client.iterate(matcher, start)()
|
||||||
if c then
|
if c then
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
-- Grab environment we need
|
-- Grab environment we need
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
local type = type
|
local type = type
|
||||||
local util = require("awful.util")
|
|
||||||
local capi = {
|
local capi = {
|
||||||
screen = screen,
|
screen = screen,
|
||||||
mouse = mouse,
|
mouse = mouse,
|
||||||
|
@ -21,6 +20,7 @@ local tag = require("awful.tag")
|
||||||
local client = require("awful.client")
|
local client = require("awful.client")
|
||||||
local ascreen = require("awful.screen")
|
local ascreen = require("awful.screen")
|
||||||
local timer = require("gears.timer")
|
local timer = require("gears.timer")
|
||||||
|
local gmath = require("gears.math")
|
||||||
|
|
||||||
local function get_screen(s)
|
local function get_screen(s)
|
||||||
return s and capi.screen[s]
|
return s and capi.screen[s]
|
||||||
|
@ -121,7 +121,7 @@ function layout.inc(i, s, layouts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if curindex then
|
if curindex then
|
||||||
local newindex = util.cycle(#layouts, curindex + i)
|
local newindex = gmath.cycle(#layouts, curindex + i)
|
||||||
layout.set(layouts[newindex], t)
|
layout.set(layouts[newindex], t)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
local capi = {screen = screen, mouse = mouse}
|
local capi = {screen = screen, mouse = mouse}
|
||||||
local util = require("awful.util")
|
local gmath = require("gears.math")
|
||||||
local tag = require("awful.tag")
|
local tag = require("awful.tag")
|
||||||
local resize = require("awful.mouse.resize")
|
local resize = require("awful.mouse.resize")
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ function module.drag_to_tag(c)
|
||||||
if dir then
|
if dir then
|
||||||
|
|
||||||
if dir == "right" then
|
if dir == "right" then
|
||||||
local newtag = tags[util.cycle(#tags, idx + 1)]
|
local newtag = tags[gmath.cycle(#tags, idx + 1)]
|
||||||
c:move_to_tag(newtag)
|
c:move_to_tag(newtag)
|
||||||
tag.viewnext()
|
tag.viewnext()
|
||||||
elseif dir == "left" then
|
elseif dir == "left" then
|
||||||
local newtag = tags[util.cycle(#tags, idx - 1)]
|
local newtag = tags[gmath.cycle(#tags, idx - 1)]
|
||||||
c:move_to_tag(newtag)
|
c:move_to_tag(newtag)
|
||||||
tag.viewprev()
|
tag.viewprev()
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,7 @@ local capi =
|
||||||
awesome = awesome,
|
awesome = awesome,
|
||||||
}
|
}
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
|
local gmath = require("gears.math")
|
||||||
local object = require("gears.object")
|
local object = require("gears.object")
|
||||||
local grect = require("gears.geometry").rectangle
|
local grect = require("gears.geometry").rectangle
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ end
|
||||||
-- @tparam int offset Value to add to the current focused screen index. 1 to
|
-- @tparam int offset Value to add to the current focused screen index. 1 to
|
||||||
-- focus the next one, -1 to focus the previous one.
|
-- focus the next one, -1 to focus the previous one.
|
||||||
function screen.focus_relative(offset)
|
function screen.focus_relative(offset)
|
||||||
return screen.focus(util.cycle(capi.screen.count(),
|
return screen.focus(gmath.cycle(capi.screen.count(),
|
||||||
screen.focused().index + offset))
|
screen.focused().index + offset))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
local ascreen = require("awful.screen")
|
local ascreen = require("awful.screen")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
|
local gmath = require("gears.math")
|
||||||
local object = require("gears.object")
|
local object = require("gears.object")
|
||||||
local timer = require("gears.timer")
|
local timer = require("gears.timer")
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
|
@ -1198,7 +1199,7 @@ function tag.viewidx(i, screen)
|
||||||
tag.viewnone(screen)
|
tag.viewnone(screen)
|
||||||
for k, t in ipairs(showntags) do
|
for k, t in ipairs(showntags) do
|
||||||
if t == sel then
|
if t == sel then
|
||||||
showntags[util.cycle(#showntags, k + i)].selected = true
|
showntags[gmath.cycle(#showntags, k + i)].selected = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
screen:emit_signal("tag::history::update")
|
screen:emit_signal("tag::history::update")
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
local error = error
|
local error = error
|
||||||
local type = type
|
local type = type
|
||||||
local util = require("awful.util")
|
local gmath = require("gears.math")
|
||||||
local abutton = require("awful.button")
|
local abutton = require("awful.button")
|
||||||
local aclient = require("awful.client")
|
local aclient = require("awful.client")
|
||||||
local atooltip = require("awful.tooltip")
|
local atooltip = require("awful.tooltip")
|
||||||
|
@ -464,7 +464,7 @@ end
|
||||||
local function new(c, args)
|
local function new(c, args)
|
||||||
args = args or {}
|
args = args or {}
|
||||||
local position = args.position or "top"
|
local position = args.position or "top"
|
||||||
local size = args.size or util.round(beautiful.get_font_height(args.font) * 1.5)
|
local size = args.size or gmath.round(beautiful.get_font_height(args.font) * 1.5)
|
||||||
local d = get_titlebar_function(c, position)(c, size)
|
local d = get_titlebar_function(c, position)(c, size)
|
||||||
|
|
||||||
-- Make sure that there is never more than one titlebar for any given client
|
-- Make sure that there is never more than one titlebar for any given client
|
||||||
|
|
|
@ -512,7 +512,7 @@ function util.table.iterate(t, filter, start)
|
||||||
return function ()
|
return function ()
|
||||||
while count < length do
|
while count < length do
|
||||||
local item = t[index]
|
local item = t[index]
|
||||||
index = util.cycle(#t, index + 1)
|
index = gmath.cycle(#t, index + 1)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
if filter(item) then return item end
|
if filter(item) then return item end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,6 +25,7 @@ local capi = {
|
||||||
mouse = mouse,
|
mouse = mouse,
|
||||||
screen = screen
|
screen = screen
|
||||||
}
|
}
|
||||||
|
local gmath = require("gears.math")
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local common = require("awful.widget.common")
|
local common = require("awful.widget.common")
|
||||||
local theme = require("beautiful")
|
local theme = require("beautiful")
|
||||||
|
@ -417,7 +418,7 @@ function menubar.show(scr)
|
||||||
local geometry = menubar.geometry
|
local geometry = menubar.geometry
|
||||||
instance.geometry = {x = geometry.x or scrgeom.x,
|
instance.geometry = {x = geometry.x or scrgeom.x,
|
||||||
y = geometry.y or scrgeom.y,
|
y = geometry.y or scrgeom.y,
|
||||||
height = geometry.height or awful.util.round(theme.get_font_height() * 1.5),
|
height = geometry.height or gmath.round(theme.get_font_height() * 1.5),
|
||||||
width = geometry.width or scrgeom.width}
|
width = geometry.width or scrgeom.width}
|
||||||
instance.wibox:geometry(instance.geometry)
|
instance.wibox:geometry(instance.geometry)
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ local fixed = require("wibox.layout.fixed")
|
||||||
local table = table
|
local table = table
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
|
local gmath = require("gears.math")
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
|
|
||||||
local flex = {}
|
local flex = {}
|
||||||
|
@ -69,10 +70,10 @@ function flex:layout(_, width, height)
|
||||||
for _, v in pairs(self._private.widgets) do
|
for _, v in pairs(self._private.widgets) do
|
||||||
local x, y, w, h
|
local x, y, w, h
|
||||||
if self._private.dir == "y" then
|
if self._private.dir == "y" then
|
||||||
x, y = 0, util.round(pos)
|
x, y = 0, gmath.round(pos)
|
||||||
w, h = width, floor(space_per_item)
|
w, h = width, floor(space_per_item)
|
||||||
else
|
else
|
||||||
x, y = util.round(pos), 0
|
x, y = gmath.round(pos), 0
|
||||||
w, h = floor(space_per_item), height
|
w, h = floor(space_per_item), height
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ local flex = require("wibox.layout.flex" )
|
||||||
local table = table
|
local table = table
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
|
local gmath = require("gears.math")
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
|
|
||||||
local ratio = {}
|
local ratio = {}
|
||||||
|
@ -87,11 +88,11 @@ function ratio:layout(_, width, height)
|
||||||
|
|
||||||
if self._private.dir == "y" then
|
if self._private.dir == "y" then
|
||||||
space = height * self._private.ratios[k]
|
space = height * self._private.ratios[k]
|
||||||
x, y = 0, util.round(pos)
|
x, y = 0, gmath.round(pos)
|
||||||
w, h = width, floor(space)
|
w, h = width, floor(space)
|
||||||
else
|
else
|
||||||
space = width * self._private.ratios[k]
|
space = width * self._private.ratios[k]
|
||||||
x, y = util.round(pos), 0
|
x, y = gmath.round(pos), 0
|
||||||
w, h = floor(space), height
|
w, h = floor(space), height
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -101,8 +102,8 @@ function ratio:layout(_, width, height)
|
||||||
|
|
||||||
-- Make sure all widgets fit in the layout, if they aren't, something
|
-- Make sure all widgets fit in the layout, if they aren't, something
|
||||||
-- went wrong
|
-- went wrong
|
||||||
if (self._private.dir == "y" and util.round(pos) >= height) or
|
if (self._private.dir == "y" and gmath.round(pos) >= height) or
|
||||||
(self._private.dir ~= "y" and util.round(pos) >= width) then
|
(self._private.dir ~= "y" and gmath.round(pos) >= width) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local test_client = require("_client")
|
local test_client = require("_client")
|
||||||
local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility with Lua 5.1)
|
local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility with Lua 5.1)
|
||||||
|
@ -8,7 +9,7 @@ local callback_called = false
|
||||||
-- Magic table to store tests
|
-- Magic table to store tests
|
||||||
local tests = {}
|
local tests = {}
|
||||||
|
|
||||||
local tb_height = awful.util.round(beautiful.get_font_height() * 1.5)
|
local tb_height = gears.math.round(beautiful.get_font_height() * 1.5)
|
||||||
-- local border_width = beautiful.border_width
|
-- local border_width = beautiful.border_width
|
||||||
|
|
||||||
-- Detect "manage" race conditions
|
-- Detect "manage" race conditions
|
||||||
|
|
Loading…
Reference in New Issue