Remove some now unnecessary uses of s.index
Because all our Lua code can now work with screen objects, most of the uses of s.index that the previous patches added for reaching this goal can be removed again. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
5fd47e508f
commit
d56b5c031b
|
@ -21,7 +21,7 @@ local timer = require("gears.timer")
|
||||||
local function check_focus(obj)
|
local function check_focus(obj)
|
||||||
-- When no visible client has the focus...
|
-- When no visible client has the focus...
|
||||||
if not client.focus or not client.focus:isvisible() then
|
if not client.focus or not client.focus:isvisible() then
|
||||||
local c = aclient.focus.history.get(screen[obj.screen].index, 0, aclient.focus.filter)
|
local c = aclient.focus.history.get(screen[obj.screen], 0, aclient.focus.filter)
|
||||||
if c then
|
if c then
|
||||||
c:emit_signal("request::activate", "autofocus.check_focus",
|
c:emit_signal("request::activate", "autofocus.check_focus",
|
||||||
{raise=false})
|
{raise=false})
|
||||||
|
@ -43,8 +43,8 @@ local function check_focus_tag(t)
|
||||||
if not s then return end
|
if not s then return end
|
||||||
s = screen[s]
|
s = screen[s]
|
||||||
check_focus({ screen = s })
|
check_focus({ screen = s })
|
||||||
if client.focus and client.focus.screen ~= s.index then
|
if client.focus and screen[client.focus.screen] ~= s then
|
||||||
local c = aclient.focus.history.get(s.index, 0, aclient.focus.filter)
|
local c = aclient.focus.history.get(s, 0, aclient.focus.filter)
|
||||||
if c then
|
if c then
|
||||||
c:emit_signal("request::activate", "autofocus.check_focus_tag",
|
c:emit_signal("request::activate", "autofocus.check_focus_tag",
|
||||||
{raise=false})
|
{raise=false})
|
||||||
|
|
|
@ -64,8 +64,7 @@ local delayed_arrange = {}
|
||||||
-- @param screen The screen.
|
-- @param screen The screen.
|
||||||
-- @return The layout function.
|
-- @return The layout function.
|
||||||
function layout.get(screen)
|
function layout.get(screen)
|
||||||
screen = get_screen(screen)
|
local t = tag.selected(screen)
|
||||||
local t = tag.selected(screen and screen.index)
|
|
||||||
return tag.getproperty(t, "layout") or layout.suit.floating
|
return tag.getproperty(t, "layout") or layout.suit.floating
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -80,7 +79,7 @@ function layout.inc(i, s, layouts)
|
||||||
layouts, i, s = i, s, layouts
|
layouts, i, s = i, s, layouts
|
||||||
end
|
end
|
||||||
s = get_screen(s)
|
s = get_screen(s)
|
||||||
local t = tag.selected(s and s.index)
|
local t = tag.selected(s)
|
||||||
layouts = layouts or layout.layouts
|
layouts = layouts or layout.layouts
|
||||||
if t then
|
if t then
|
||||||
local curlayout = layout.get(s)
|
local curlayout = layout.get(s)
|
||||||
|
@ -131,7 +130,7 @@ end
|
||||||
-- "geometries" table with client as keys and geometry as value
|
-- "geometries" table with client as keys and geometry as value
|
||||||
function layout.parameters(t, screen)
|
function layout.parameters(t, screen)
|
||||||
screen = get_screen(screen)
|
screen = get_screen(screen)
|
||||||
t = t or tag.selected(screen and screen.index)
|
t = t or tag.selected(screen)
|
||||||
|
|
||||||
if not t then return end
|
if not t then return end
|
||||||
|
|
||||||
|
@ -141,7 +140,7 @@ function layout.parameters(t, screen)
|
||||||
|
|
||||||
p.workarea = screen.workarea
|
p.workarea = screen.workarea
|
||||||
|
|
||||||
local useless_gap = tag.getgap(t, #client.tiled(screen.index))
|
local useless_gap = tag.getgap(t, #client.tiled(screen))
|
||||||
|
|
||||||
-- Handle padding
|
-- Handle padding
|
||||||
local padding = ascreen.padding(screen) or {}
|
local padding = ascreen.padding(screen) or {}
|
||||||
|
@ -243,10 +242,10 @@ capi.tag.connect_signal("tagged", arrange_tag)
|
||||||
|
|
||||||
for s = 1, capi.screen.count() do
|
for s = 1, capi.screen.count() do
|
||||||
capi.screen[s]:connect_signal("property::workarea", function(screen)
|
capi.screen[s]:connect_signal("property::workarea", function(screen)
|
||||||
layout.arrange(screen.index)
|
layout.arrange(screen)
|
||||||
end)
|
end)
|
||||||
capi.screen[s]:connect_signal("padding", function (screen)
|
capi.screen[s]:connect_signal("padding", function (screen)
|
||||||
layout.arrange(screen.index)
|
layout.arrange(screen)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ end
|
||||||
function placement.no_overlap(c)
|
function placement.no_overlap(c)
|
||||||
local geometry = get_area(c)
|
local geometry = get_area(c)
|
||||||
local screen = get_screen(c.screen or a_screen.getbycoord(geometry.x, geometry.y))
|
local screen = get_screen(c.screen or a_screen.getbycoord(geometry.x, geometry.y))
|
||||||
local cls = client.visible(screen.index)
|
local cls = client.visible(screen)
|
||||||
local curlay = layout.get()
|
local curlay = layout.get()
|
||||||
local areas = { screen.workarea }
|
local areas = { screen.workarea }
|
||||||
for _, cl in pairs(cls) do
|
for _, cl in pairs(cls) do
|
||||||
|
|
|
@ -101,7 +101,7 @@ function screen.focus(_screen)
|
||||||
-- move cursor without triggering signals mouse::enter and mouse::leave
|
-- move cursor without triggering signals mouse::enter and mouse::leave
|
||||||
capi.mouse.coords(pos, true)
|
capi.mouse.coords(pos, true)
|
||||||
|
|
||||||
local c = client.focus.history.get(_screen.index, 0)
|
local c = client.focus.history.get(_screen, 0)
|
||||||
if c then
|
if c then
|
||||||
c:emit_signal("request::activate", "screen.focus", {raise=false})
|
c:emit_signal("request::activate", "screen.focus", {raise=false})
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,7 +50,7 @@ tag.history.limit = 20
|
||||||
function tag.move(new_index, target_tag)
|
function tag.move(new_index, target_tag)
|
||||||
target_tag = target_tag or tag.selected()
|
target_tag = target_tag or tag.selected()
|
||||||
local scr = get_screen(tag.getscreen(target_tag))
|
local scr = get_screen(tag.getscreen(target_tag))
|
||||||
local tmp_tags = tag.gettags(scr and scr.index)
|
local tmp_tags = tag.gettags(scr)
|
||||||
|
|
||||||
if (not new_index) or (new_index < 1) or (new_index > #tmp_tags) then
|
if (not new_index) or (new_index < 1) or (new_index > #tmp_tags) then
|
||||||
return
|
return
|
||||||
|
@ -218,7 +218,7 @@ end
|
||||||
--- Update the tag history.
|
--- Update the tag history.
|
||||||
-- @param obj Screen object.
|
-- @param obj Screen object.
|
||||||
function tag.history.update(obj)
|
function tag.history.update(obj)
|
||||||
local s = get_screen(obj.index)
|
local s = get_screen(obj)
|
||||||
local curtags = tag.selectedlist(s)
|
local curtags = tag.selectedlist(s)
|
||||||
-- create history table
|
-- create history table
|
||||||
if not data.history[s] then
|
if not data.history[s] then
|
||||||
|
@ -524,7 +524,7 @@ function tag.incnmaster(add, t, sensible)
|
||||||
if sensible then
|
if sensible then
|
||||||
client = client or require("awful.client")
|
client = client or require("awful.client")
|
||||||
local screen = get_screen(tag.getscreen(t))
|
local screen = get_screen(tag.getscreen(t))
|
||||||
local ntiled = #client.tiled(screen and screen.index)
|
local ntiled = #client.tiled(screen)
|
||||||
|
|
||||||
local nmaster = tag.getnmaster(t)
|
local nmaster = tag.getnmaster(t)
|
||||||
if nmaster > ntiled then
|
if nmaster > ntiled then
|
||||||
|
@ -583,7 +583,7 @@ function tag.incncol(add, t, sensible)
|
||||||
if sensible then
|
if sensible then
|
||||||
client = client or require("awful.client")
|
client = client or require("awful.client")
|
||||||
local screen = get_screen(tag.getscreen(t))
|
local screen = get_screen(tag.getscreen(t))
|
||||||
local ntiled = #client.tiled(screen and screen.index)
|
local ntiled = #client.tiled(screen)
|
||||||
local nmaster = tag.getnmaster(t)
|
local nmaster = tag.getnmaster(t)
|
||||||
local nsecondary = ntiled - nmaster
|
local nsecondary = ntiled - nmaster
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ local boxes = nil
|
||||||
|
|
||||||
local function update(w, screen)
|
local function update(w, screen)
|
||||||
screen = get_screen(screen)
|
screen = get_screen(screen)
|
||||||
local name = layout.getname(layout.get(screen and screen.index))
|
local name = layout.getname(layout.get(screen))
|
||||||
w._layoutbox_tooltip:set_text(name or "[no name]")
|
w._layoutbox_tooltip:set_text(name or "[no name]")
|
||||||
w:set_image(name and beautiful["layout_" .. name])
|
w:set_image(name and beautiful["layout_" .. name])
|
||||||
end
|
end
|
||||||
|
|
|
@ -274,7 +274,7 @@ function tasklist.filter.currenttags(c, screen)
|
||||||
if get_screen(c.screen) ~= screen then return false end
|
if get_screen(c.screen) ~= screen then return false end
|
||||||
-- Include sticky client too
|
-- Include sticky client too
|
||||||
if c.sticky then return true end
|
if c.sticky then return true end
|
||||||
local tags = tag.gettags(screen.index)
|
local tags = tag.gettags(screen)
|
||||||
for _, t in ipairs(tags) do
|
for _, t in ipairs(tags) do
|
||||||
if t.selected then
|
if t.selected then
|
||||||
local ctags = c:tags()
|
local ctags = c:tags()
|
||||||
|
@ -300,7 +300,7 @@ function tasklist.filter.minimizedcurrenttags(c, screen)
|
||||||
if not c.minimized then return false end
|
if not c.minimized then return false end
|
||||||
-- Include sticky client
|
-- Include sticky client
|
||||||
if c.sticky then return true end
|
if c.sticky then return true end
|
||||||
local tags = tag.gettags(screen.index)
|
local tags = tag.gettags(screen)
|
||||||
for _, t in ipairs(tags) do
|
for _, t in ipairs(tags) do
|
||||||
-- Select only minimized clients
|
-- Select only minimized clients
|
||||||
if t.selected then
|
if t.selected then
|
||||||
|
|
|
@ -593,7 +593,7 @@ function naughty.notify(args)
|
||||||
|
|
||||||
-- calculate the width
|
-- calculate the width
|
||||||
if not width then
|
if not width then
|
||||||
local w, _ = textbox:get_preferred_size(s.index)
|
local w, _ = textbox:get_preferred_size(s)
|
||||||
width = w + (iconbox and icon_w + 2 * margin or 0) + 2 * margin
|
width = w + (iconbox and icon_w + 2 * margin or 0) + 2 * margin
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ function naughty.notify(args)
|
||||||
-- calculate the height
|
-- calculate the height
|
||||||
if not height then
|
if not height then
|
||||||
local w = width - (iconbox and icon_w + 2 * margin or 0) - 2 * margin
|
local w = width - (iconbox and icon_w + 2 * margin or 0) - 2 * margin
|
||||||
local h = textbox:get_height_for_width(w, s.index)
|
local h = textbox:get_height_for_width(w, s)
|
||||||
if iconbox and icon_h + 2 * margin > h + 2 * margin then
|
if iconbox and icon_h + 2 * margin > h + 2 * margin then
|
||||||
height = icon_h + 2 * margin
|
height = icon_h + 2 * margin
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue