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:
Uli Schlachter 2016-02-27 09:24:19 +01:00
parent 5fd47e508f
commit d56b5c031b
8 changed files with 20 additions and 21 deletions

View File

@ -21,7 +21,7 @@ local timer = require("gears.timer")
local function check_focus(obj)
-- When no visible client has the focus...
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
c:emit_signal("request::activate", "autofocus.check_focus",
{raise=false})
@ -43,8 +43,8 @@ local function check_focus_tag(t)
if not s then return end
s = screen[s]
check_focus({ screen = s })
if client.focus and client.focus.screen ~= s.index then
local c = aclient.focus.history.get(s.index, 0, aclient.focus.filter)
if client.focus and screen[client.focus.screen] ~= s then
local c = aclient.focus.history.get(s, 0, aclient.focus.filter)
if c then
c:emit_signal("request::activate", "autofocus.check_focus_tag",
{raise=false})

View File

@ -64,8 +64,7 @@ local delayed_arrange = {}
-- @param screen The screen.
-- @return The layout function.
function layout.get(screen)
screen = get_screen(screen)
local t = tag.selected(screen and screen.index)
local t = tag.selected(screen)
return tag.getproperty(t, "layout") or layout.suit.floating
end
@ -80,7 +79,7 @@ function layout.inc(i, s, layouts)
layouts, i, s = i, s, layouts
end
s = get_screen(s)
local t = tag.selected(s and s.index)
local t = tag.selected(s)
layouts = layouts or layout.layouts
if t then
local curlayout = layout.get(s)
@ -131,7 +130,7 @@ end
-- "geometries" table with client as keys and geometry as value
function layout.parameters(t, 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
@ -141,7 +140,7 @@ function layout.parameters(t, screen)
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
local padding = ascreen.padding(screen) or {}
@ -243,10 +242,10 @@ capi.tag.connect_signal("tagged", arrange_tag)
for s = 1, capi.screen.count() do
capi.screen[s]:connect_signal("property::workarea", function(screen)
layout.arrange(screen.index)
layout.arrange(screen)
end)
capi.screen[s]:connect_signal("padding", function (screen)
layout.arrange(screen.index)
layout.arrange(screen)
end)
end

View File

@ -150,7 +150,7 @@ end
function placement.no_overlap(c)
local geometry = get_area(c)
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 areas = { screen.workarea }
for _, cl in pairs(cls) do

View File

@ -101,7 +101,7 @@ function screen.focus(_screen)
-- move cursor without triggering signals mouse::enter and mouse::leave
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
c:emit_signal("request::activate", "screen.focus", {raise=false})
end

View File

@ -50,7 +50,7 @@ tag.history.limit = 20
function tag.move(new_index, target_tag)
target_tag = target_tag or tag.selected()
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
return
@ -218,7 +218,7 @@ end
--- Update the tag history.
-- @param obj Screen object.
function tag.history.update(obj)
local s = get_screen(obj.index)
local s = get_screen(obj)
local curtags = tag.selectedlist(s)
-- create history table
if not data.history[s] then
@ -524,7 +524,7 @@ function tag.incnmaster(add, t, sensible)
if sensible then
client = client or require("awful.client")
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)
if nmaster > ntiled then
@ -583,7 +583,7 @@ function tag.incncol(add, t, sensible)
if sensible then
client = client or require("awful.client")
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 nsecondary = ntiled - nmaster

View File

@ -25,7 +25,7 @@ local boxes = nil
local function update(w, 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:set_image(name and beautiful["layout_" .. name])
end

View File

@ -274,7 +274,7 @@ function tasklist.filter.currenttags(c, screen)
if get_screen(c.screen) ~= screen then return false end
-- Include sticky client too
if c.sticky then return true end
local tags = tag.gettags(screen.index)
local tags = tag.gettags(screen)
for _, t in ipairs(tags) do
if t.selected then
local ctags = c:tags()
@ -300,7 +300,7 @@ function tasklist.filter.minimizedcurrenttags(c, screen)
if not c.minimized then return false end
-- Include sticky client
if c.sticky then return true end
local tags = tag.gettags(screen.index)
local tags = tag.gettags(screen)
for _, t in ipairs(tags) do
-- Select only minimized clients
if t.selected then

View File

@ -593,7 +593,7 @@ function naughty.notify(args)
-- calculate the width
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
end
@ -604,7 +604,7 @@ function naughty.notify(args)
-- calculate the height
if not height then
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
height = icon_h + 2 * margin
else