Skip to content

Commit

Permalink
Move awful.util.deprecate and awful.util.deprecate_class to gears.debug
Browse files Browse the repository at this point in the history
Change all awful.util function calls to gears.debug function calls
Update all old deprecate calls to have deprecated_in=4
  • Loading branch information
Veratil committed Mar 16, 2017
1 parent f57e3eb commit 7687275
Show file tree
Hide file tree
Showing 23 changed files with 208 additions and 179 deletions.
38 changes: 19 additions & 19 deletions lib/awful/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
---------------------------------------------------------------------------

-- Grab environment we need
local util = require("awful.util")
local gdebug = require("gears.debug")
local spawn = require("awful.spawn")
local set_shape = require("awful.client.shape").update.all
local object = require("gears.object")
Expand Down Expand Up @@ -70,7 +70,7 @@ client.focus = require("awful.client.focus")
-- If it is a function, it will be called with the client and its first
-- tag as arguments.
function client.jumpto(c, merge)
util.deprecate("Use c:jump_to(merge) instead of awful.client.jumpto")
gdebug.deprecate("Use c:jump_to(merge) instead of awful.client.jumpto", {deprecated_in=4})
client.object.jump_to(c, merge)
end

Expand Down Expand Up @@ -317,7 +317,7 @@ end
-- @client[opt] c The client, otherwise focused one is used.
-- @see client.relative_move
function client.moveresize(x, y, w, h, c)
util.deprecate("Use c:relative_move(x, y, w, h) instead of awful.client.moveresize")
gdebug.deprecate("Use c:relative_move(x, y, w, h) instead of awful.client.moveresize", {deprecated_in=4})
client.object.relative_move(c or capi.client.focus, x, y, w, h)
end

Expand All @@ -343,7 +343,7 @@ end
-- @client[opt] c The client to move, otherwise the focused one is used.
-- @see client.move_to_tag
function client.movetotag(target, c)
util.deprecate("Use c:move_to_tag(target) instead of awful.client.movetotag")
gdebug.deprecate("Use c:move_to_tag(target) instead of awful.client.movetotag", {deprecated_in=4})
client.object.move_to_tag(c or capi.client.focus, target)
end

Expand All @@ -368,7 +368,7 @@ end
-- @client[opt] c The client to toggle, otherwise the focused one is used.
-- @see client.toggle_tag
function client.toggletag(target, c)
util.deprecate("Use c:toggle_tag(target) instead of awful.client.toggletag")
gdebug.deprecate("Use c:toggle_tag(target) instead of awful.client.toggletag", {deprecated_in=4})
client.object.toggle_tag(c or capi.client.focus, target)
end

Expand Down Expand Up @@ -404,7 +404,7 @@ end
-- @see screen
-- @see client.move_to_screen
function client.movetoscreen(c, s)
util.deprecate("Use c:move_to_screen(s) instead of awful.client.movetoscreen")
gdebug.deprecate("Use c:move_to_screen(s) instead of awful.client.movetoscreen", {deprecated_in=4})
client.object.move_to_screen(c or capi.client.focus, s)
end

Expand Down Expand Up @@ -506,31 +506,31 @@ end
-- @deprecated awful.client.mark
-- @client c The client to mark, the focused one if not specified.
function client.mark(c)
util.deprecate("Use c.marked = true instead of awful.client.mark")
gdebug.deprecate("Use c.marked = true instead of awful.client.mark", {deprecated_in=4})
client.object.set_marked(c or capi.client.focus, true)
end

--- Unmark a client and then call 'unmarked' hook.
-- @deprecated awful.client.unmark
-- @client c The client to unmark, or the focused one if not specified.
function client.unmark(c)
util.deprecate("Use c.marked = false instead of awful.client.unmark")
gdebug.deprecate("Use c.marked = false instead of awful.client.unmark", {deprecated_in=4})
client.object.set_marked(c or capi.client.focus, false)
end

--- Check if a client is marked.
-- @deprecated awful.client.ismarked
-- @client c The client to check, or the focused one otherwise.
function client.ismarked(c)
util.deprecate("Use c.marked instead of awful.client.ismarked")
gdebug.deprecate("Use c.marked instead of awful.client.ismarked", {deprecated_in=4})
return client.object.get_marked(c or capi.client.focus)
end

--- Toggle a client as marked.
-- @deprecated awful.client.togglemarked
-- @client c The client to toggle mark.
function client.togglemarked(c)
util.deprecate("Use c.marked = not c.marked instead of awful.client.togglemarked")
gdebug.deprecate("Use c.marked = not c.marked instead of awful.client.togglemarked", {deprecated_in=4})
c = c or capi.client.focus
if c then
c.marked = not c.marked
Expand Down Expand Up @@ -559,7 +559,7 @@ end
-- @client c A client.
-- @param s True or false.
function client.floating.set(c, s)
util.deprecate("Use c.floating = true instead of awful.client.floating.set")
gdebug.deprecate("Use c.floating = true instead of awful.client.floating.set", {deprecated_in=4})
client.object.set_floating(c, s)
end

Expand Down Expand Up @@ -603,7 +603,7 @@ capi.client.connect_signal("property::geometry", store_floating_geometry)
-- @see is_fixed
-- @see size_hints_honor
function client.isfixed(c)
util.deprecate("Use c.is_fixed instead of awful.client.isfixed")
gdebug.deprecate("Use c.is_fixed instead of awful.client.isfixed", {deprecated_in=4})
c = c or capi.client.focus
return client.object.is_fixed(c)
end
Expand Down Expand Up @@ -642,7 +642,7 @@ end
-- did not set them manually. For example, windows with a type different than
-- normal.
function client.floating.get(c)
util.deprecate("Use c.floating instead of awful.client.floating.get")
gdebug.deprecate("Use c.floating instead of awful.client.floating.get", {deprecated_in=4})
return client.object.get_floating(c)
end

Expand Down Expand Up @@ -935,7 +935,7 @@ end
-- @treturn bool
-- @deprecated awful.client.dockable.get
function client.dockable.get(c)
util.deprecate("Use c.dockable instead of awful.client.dockable.get")
gdebug.deprecate("Use c.dockable instead of awful.client.dockable.get", {deprecated_in=4})
return client.object.get_dockable(c)
end

Expand Down Expand Up @@ -978,7 +978,7 @@ end
-- @param value True or false.
-- @deprecated awful.client.dockable.set
function client.dockable.set(c, value)
util.deprecate("Use c.dockable = value instead of awful.client.dockable.set")
gdebug.deprecate("Use c.dockable = value instead of awful.client.dockable.set", {deprecated_in=4})
client.property.set(c, "dockable", value)
end

Expand Down Expand Up @@ -1111,8 +1111,8 @@ end
-- a matching parent client is found.
-- @treturn client.client|nil The matching parent client or nil.
function client.get_transient_for_matching(c, matcher)
util.deprecate("Use c:get_transient_for_matching(matcher) instead of"..
"awful.client.get_transient_for_matching")
gdebug.deprecate("Use c:get_transient_for_matching(matcher) instead of"..
"awful.client.get_transient_for_matching", {deprecated_in=4})

return client.object.get_transient_for_matching(c, matcher)
end
Expand Down Expand Up @@ -1140,8 +1140,8 @@ end
-- @client c2 The parent client to check.
-- @treturn client.client|nil The parent client or nil.
function client.is_transient_for(c, c2)
util.deprecate("Use c:is_transient_for(c2) instead of"..
"awful.client.is_transient_for")
gdebug.deprecate("Use c:is_transient_for(c2) instead of"..
"awful.client.is_transient_for", {deprecated_in=4})
return client.object.is_transient_for(c, c2)
end

Expand Down
11 changes: 6 additions & 5 deletions lib/awful/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
-- TODO: This is a hack for backwards-compatibility with 3.5, remove!
local util = require("awful.util")
local gtimer = require("gears.timer")
local gdebug = require("gears.debug")
function timer(...) -- luacheck: ignore
util.deprecate("gears.timer")
gdebug.deprecate("gears.timer", {deprecated_in=4})
return gtimer(...)
end

Expand All @@ -19,18 +20,18 @@ end
local spawn = require("awful.spawn")

util.spawn = function(...)
util.deprecate("awful.spawn")
gdebug.deprecate("awful.spawn", {deprecated_in=4})
return spawn.spawn(...)
end

util.spawn_with_shell = function(...)
util.deprecate("awful.spawn.with_shell")
gdebug.deprecate("awful.spawn.with_shell", {deprecated_in=4})
return spawn.with_shell(...)
end

util.pread = function()
util.deprecate("Use io.popen() directly or look at awful.spawn.easy_async() "
.. "for an asynchronous alternative")
gdebug.deprecate("Use io.popen() directly or look at awful.spawn.easy_async() "
.. "for an asynchronous alternative", {deprecated_in=4})
return ""
end

Expand Down
16 changes: 8 additions & 8 deletions lib/awful/mouse/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
-- Grab environment we need
local layout = require("awful.layout")
local aplace = require("awful.placement")
local util = require("awful.util")
local gdebug = require("gears.debug")
local type = type
local ipairs = ipairs
local capi =
Expand Down Expand Up @@ -62,7 +62,7 @@ mouse.wibox = {}
-- @return The client object under the pointer, if one can be found.
-- @see current_client
function mouse.client_under_pointer()
util.deprecate("Use mouse.current_client instead of awful.mouse.client_under_pointer()")
gdebug.deprecate("Use mouse.current_client instead of awful.mouse.client_under_pointer()", {deprecated_in=4})

return mouse.object.get_current_client()
end
Expand All @@ -74,8 +74,8 @@ end
-- @param finished_cb Deprecated, do not use
function mouse.client.move(c, snap, finished_cb) --luacheck: no unused args
if finished_cb then
util.deprecate("The mouse.client.move `finished_cb` argument is no longer"..
" used, please use awful.mouse.resize.add_leave_callback(f, 'mouse.move')")
gdebug.deprecate("The mouse.client.move `finished_cb` argument is no longer"..
" used, please use awful.mouse.resize.add_leave_callback(f, 'mouse.move')", {deprecated_in=4})
end

c = c or capi.client.focus
Expand Down Expand Up @@ -111,8 +111,8 @@ mouse.client.dragtotag = { }
-- @deprecated awful.mouse.client.dragtotag.border
-- @param c The client to move
function mouse.client.dragtotag.border(c)
util.deprecate("Use awful.mouse.snap.drag_to_tag_enabled = true instead "..
"of awful.mouse.client.dragtotag.border(c). It will now be enabled.")
gdebug.deprecate("Use awful.mouse.snap.drag_to_tag_enabled = true instead "..
"of awful.mouse.client.dragtotag.border(c). It will now be enabled.", {deprecated_in=4})

-- Enable drag to border
mouse.snap.drag_to_tag_enabled = true
Expand Down Expand Up @@ -159,9 +159,9 @@ end
-- @treturn number x The horizontal position
-- @treturn number y The vertical position
function mouse.client.corner(c, corner)
util.deprecate(
gdebug.deprecate(
"Use awful.placement.closest_corner(mouse) or awful.placement[corner](mouse)"..
" instead of awful.mouse.client.corner"
" instead of awful.mouse.client.corner", {deprecated_in=4}
)

c = c or capi.client.focus
Expand Down
7 changes: 4 additions & 3 deletions lib/awful/placement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ local client = require("awful.client")
local layout = require("awful.layout")
local a_screen = require("awful.screen")
local grect = require("gears.geometry").rectangle
local util = require("awful.util")
local gdebug = require("gears.debug")
local gtable = require("gears.table")
local cairo = require( "lgi" ).cairo
local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility with Lua 5.1)
Expand Down Expand Up @@ -951,9 +951,10 @@ end
-- @treturn table The new geometry
function placement.next_to_mouse(d, args)
if type(args) == "number" then
util.deprecate(
gdebug.deprecate(
"awful.placement.next_to_mouse offset argument is deprecated"..
" use awful.placement.next_to_mouse(c, {offset={x=...}})"
" use awful.placement.next_to_mouse(c, {offset={x=...}})",
{deprecated_in=4}
)
args = nil
end
Expand Down
11 changes: 5 additions & 6 deletions lib/awful/prompt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ local capi =
}
local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility with Lua 5.1)
local keygrabber = require("awful.keygrabber")
local util = require("awful.util")
local beautiful = require("beautiful")
local akey = require("awful.key")
local debug = require('gears.debug')
local gdebug = require('gears.debug')
local gtable = require("gears.table")
local gcolor = require("gears.color")
local gstring = require("gears.string")
Expand Down Expand Up @@ -479,9 +478,9 @@ function prompt.run(args, textbox, exe_callback, completion_callback,
local hooks = {}

local deprecated = function(name)
util.deprecate(string.format(
gdebug.deprecate(string.format(
'awful.prompt.run: the argument %s is deprecated, please use args.%s instead',
name, name), {raw=true})
name, name), {raw=true, deprecated_in=4})
end
if textbox then deprecated('textbox') end
if exe_callback then deprecated('exe_callback') end
Expand Down Expand Up @@ -523,10 +522,10 @@ function prompt.run(args, textbox, exe_callback, completion_callback,
hooks[key] = hooks[key] or {}
hooks[key][#hooks[key]+1] = v
else
debug.print_warning("The hook's 3rd parameter has to be a function.")
gdebug.print_warning("The hook's 3rd parameter has to be a function.")
end
else
debug.print_warning("The hook has to have 3 parameters.")
gdebug.print_warning("The hook has to have 3 parameters.")
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/awful/screen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local capi =
client = client,
awesome = awesome,
}
local util = require("awful.util")
local gdebug = require("gears.debug")
local gmath = require("gears.math")
local object = require("gears.object")
local grect = require("gears.geometry").rectangle
Expand Down Expand Up @@ -52,7 +52,7 @@ end
-- @return The squared distance of the screen to the provided point.
-- @see screen.get_square_distance
function screen.getdistance_sq(s, x, y)
util.deprecate("Use s:get_square_distance(x, y) instead of awful.screen.getdistance_sq")
gdebug.deprecate("Use s:get_square_distance(x, y) instead of awful.screen.getdistance_sq", {deprecated_in=4})
return screen.object.get_square_distance(s, x, y)
end

Expand Down Expand Up @@ -184,7 +184,7 @@ end
-- @treturn table A table with left, right, top and bottom number values.
-- @see padding
function screen.padding(_screen, padding)
util.deprecate("Use _screen.padding = value instead of awful.screen.padding")
gdebug.deprecate("Use _screen.padding = value instead of awful.screen.padding", {deprecated_in=4})
if padding then
screen.object.set_padding(_screen, padding)
end
Expand Down
Loading

0 comments on commit 7687275

Please sign in to comment.