awful.tag: Rename nmaster to master_count

This commit is contained in:
Emmanuel Lepage Vallee 2016-04-11 00:50:46 -04:00
parent e8908e2c62
commit f9add1c49a
7 changed files with 29 additions and 24 deletions

View File

@ -766,7 +766,7 @@ function client.idx(c)
end end
local t = c.screen.selected_tag local t = c.screen.selected_tag
local nmaster = t.nmaster local nmaster = t.master_count
-- This will happen for floating or maximized clients -- This will happen for floating or maximized clients
if not idx then return nil end if not idx then return nil end

View File

@ -220,7 +220,7 @@ end
capi.screen.add_signal("arrange") capi.screen.add_signal("arrange")
capi.tag.connect_signal("property::master_width_factor", arrange_tag) capi.tag.connect_signal("property::master_width_factor", arrange_tag)
capi.tag.connect_signal("property::nmaster", arrange_tag) capi.tag.connect_signal("property::master_count", arrange_tag)
capi.tag.connect_signal("property::column_count", arrange_tag) capi.tag.connect_signal("property::column_count", arrange_tag)
capi.tag.connect_signal("property::layout", arrange_tag) capi.tag.connect_signal("property::layout", arrange_tag)
capi.tag.connect_signal("property::windowfact", arrange_tag) capi.tag.connect_signal("property::windowfact", arrange_tag)

View File

@ -30,7 +30,7 @@ local function do_corner(p, orientation)
local column = {} local column = {}
local row = {} local row = {}
-- Use the nmaster field of the tag in a cheaty way -- Use the nmaster field of the tag in a cheaty way
local row_privileged = ((cls[1].screen.selected_tag.nmaster % 2) == 0) local row_privileged = ((cls[1].screen.selected_tag.master_count % 2) == 0)
local master_factor = cls[1].screen.selected_tag.master_width_factor local master_factor = cls[1].screen.selected_tag.master_width_factor
master.width = master_factor * wa.width master.width = master_factor * wa.width

View File

@ -209,7 +209,7 @@ local function do_tile(param, orientation)
local gs = param.geometries local gs = param.geometries
local cls = param.clients local cls = param.clients
local nmaster = math.min(t.nmaster, #cls) local nmaster = math.min(t.master_count, #cls)
local nother = math.max(#cls - nmaster,0) local nother = math.max(#cls - nmaster,0)
local mwfact = t.master_width_factor local mwfact = t.master_width_factor

View File

@ -535,7 +535,7 @@ end
-- --
-- @property master_width_factor -- @property master_width_factor
-- @param number Between 0 and 1 -- @param number Between 0 and 1
-- @see nmaster -- @see master_count
-- @see column_count -- @see column_count
-- @see master_fill_policy -- @see master_fill_policy
-- @see gap -- @see gap
@ -750,7 +750,7 @@ end
-- --
-- **Signal:** -- **Signal:**
-- --
-- * *property::gap* -- * *property::useless_gap*
-- --
-- @property gap -- @property gap
-- @param number The value has to be greater than zero. -- @param number The value has to be greater than zero.
@ -863,45 +863,48 @@ end
-- --
-- **Signal:** -- **Signal:**
-- --
-- * *property::nmaster* -- * *property::nmaster* (deprecated)
-- * *property::master_count* (deprecated)
-- --
-- @property nmaster -- @property master_count
-- @param integer nmaster Only positive values are accepted -- @param integer nmaster Only positive values are accepted
function tag.object.set_nmaster(t, nmaster) function tag.object.set_master_count(t, nmaster)
if nmaster >= 0 then if nmaster >= 0 then
tag.setproperty(t, "nmaster", nmaster) tag.setproperty(t, "nmaster", nmaster)
tag.setproperty(t, "master_count", nmaster)
end end
end end
function tag.object.get_nmaster(t) function tag.object.get_master_count(t)
return tag.getproperty(t, "nmaster") or 1 return tag.getproperty(t, "master_count") or 1
end end
--- ---
-- @deprecated awful.tag.setnmaster -- @deprecated awful.tag.setnmaster
-- @see nmaster -- @see master_count
-- @param nmaster The number of master windows. -- @param nmaster The number of master windows.
-- @param[opt] t The tag. -- @param[opt] t The tag.
function tag.setnmaster(nmaster, t) function tag.setnmaster(nmaster, t)
util.deprecate("Use t.nmaster = nmaster instead of awful.tag.setnmaster") util.deprecate("Use t.master_count = nmaster instead of awful.tag.setnmaster")
tag.object.set_nmaster(t or ascreen.focused().selected_tag, nmaster) tag.object.set_master_count(t or ascreen.focused().selected_tag, nmaster)
end end
--- Get the number of master windows. --- Get the number of master windows.
-- @deprecated awful.tag.getnmaster -- @deprecated awful.tag.getnmaster
-- @see nmaster -- @see master_count
-- @param[opt] t The tag. -- @param[opt] t The tag.
function tag.getnmaster(t) function tag.getnmaster(t)
util.deprecate("Use t.nmaster instead of awful.tag.setnmaster") util.deprecate("Use t.master_count instead of awful.tag.setnmaster")
t = t or ascreen.focused().selected_tag t = t or ascreen.focused().selected_tag
return tag.getproperty(t, "nmaster") or 1 return tag.getproperty(t, "master_count") or 1
end end
--- Increase the number of master windows. --- Increase the number of master windows.
-- @function awful.tag.incnmaster -- @function awful.tag.incnmaster
-- @see master_count
-- @param add Value to add to number of master windows. -- @param add Value to add to number of master windows.
-- @param[opt] t The tag to modify, if null tag.selected() is used. -- @param[opt] t The tag to modify, if null tag.selected() is used.
-- @tparam[opt=false] boolean sensible Limit nmaster based on the number of -- @tparam[opt=false] boolean sensible Limit nmaster based on the number of
@ -913,7 +916,7 @@ function tag.incnmaster(add, t, sensible)
local screen = get_screen(tag.getproperty(t, "screen")) local screen = get_screen(tag.getproperty(t, "screen"))
local ntiled = #screen.tiled_clients local ntiled = #screen.tiled_clients
local nmaster = tag.object.get_nmaster(t) local nmaster = tag.object.get_master_count(t)
if nmaster > ntiled then if nmaster > ntiled then
nmaster = ntiled nmaster = ntiled
end end
@ -922,9 +925,9 @@ function tag.incnmaster(add, t, sensible)
if newnmaster > ntiled then if newnmaster > ntiled then
newnmaster = ntiled newnmaster = ntiled
end end
tag.object.set_nmaster(t, newnmaster) tag.object.set_master_count(t, newnmaster)
else else
tag.object.set_nmaster(t, tag.object.get_nmaster(t) + add) tag.object.set_master_count(t, tag.object.get_master_count(t) + add)
end end
end end
@ -1021,7 +1024,7 @@ function tag.incncol(add, t, sensible)
if sensible then if sensible then
local screen = get_screen(tag.getproperty(t, "screen")) local screen = get_screen(tag.getproperty(t, "screen"))
local ntiled = #screen.tiled_clients local ntiled = #screen.tiled_clients
local nmaster = tag.object.get_nmaster(t) local nmaster = tag.object.get_master_count(t)
local nsecondary = ntiled - nmaster local nsecondary = ntiled - nmaster
local ncol = tag.object.get_column_count(t) local ncol = tag.object.get_column_count(t)
@ -1318,6 +1321,7 @@ capi.tag.add_signal("property::master_fill_policy")
capi.tag.add_signal("property::ncol") capi.tag.add_signal("property::ncol")
capi.tag.add_signal("property::column_count") capi.tag.add_signal("property::column_count")
capi.tag.add_signal("property::nmaster") capi.tag.add_signal("property::nmaster")
capi.tag.add_signal("property::master_count")
capi.tag.add_signal("property::windowfact") capi.tag.add_signal("property::windowfact")
capi.tag.add_signal("property::screen") capi.tag.add_signal("property::screen")
capi.tag.add_signal("property::index") capi.tag.add_signal("property::index")

View File

@ -13,6 +13,7 @@ local function new_tag(_, args)
ret:add_signal("property::mwfact") ret:add_signal("property::mwfact")
ret:add_signal("property::ncol") ret:add_signal("property::ncol")
ret:add_signal("property::column_count") ret:add_signal("property::column_count")
ret:add_signal("property::master_count")
ret:add_signal("property::nmaster") ret:add_signal("property::nmaster")
ret:add_signal("property::index") ret:add_signal("property::index")
ret:add_signal("property::useless_gap") ret:add_signal("property::useless_gap")

View File

@ -93,8 +93,8 @@ function()
assert(t.master_width_factor == 0.55) assert(t.master_width_factor == 0.55)
-- Now, test the nmaster -- Now, test the master_count
assert(t.nmaster == 1) assert(t.master_count == 1)
get_callback({modkey, "Shift"}, "h")() get_callback({modkey, "Shift"}, "h")()
@ -105,7 +105,7 @@ end,
function() function()
local _, t = get_c_and_t() local _, t = get_c_and_t()
assert(t.nmaster == 2) assert(t.master_count == 2)
-- Now, test the column_count -- Now, test the column_count
assert(t.column_count == 1) assert(t.column_count == 1)