client: Update existing code to use `c.active`.

This commit is contained in:
Emmanuel Lepage Vallee 2019-11-10 18:39:26 -05:00 committed by Emmanuel Lepage-Vallee
parent 58f3ea740f
commit ba5385dd40
7 changed files with 12 additions and 12 deletions

View File

@ -536,7 +536,7 @@ function client.object.move_to_screen(self, s)
end
s = get_screen(s)
if get_screen(self.screen) ~= s then
local sel_is_focused = self == capi.client.focus
local sel_is_focused = self.active
self.screen = s
screen.focus(s)

View File

@ -443,7 +443,7 @@ local all_titlebars = setmetatable({}, { __mode = 'k' })
-- Get a color for a titlebar, this tests many values from the array and the theme
local function get_color(name, c, args)
local suffix = "_normal"
if capi.client.focus == c then
if c.active then
suffix = "_focus"
end
local function get(array)
@ -707,7 +707,7 @@ function titlebar.widget.button(c, name, selector, action)
end
end
local prefix = "normal"
if capi.client.focus == c then
if c.active then
prefix = "focus"
end
if img ~= "" then

View File

@ -352,7 +352,7 @@ local function tasklist_label(c, args, tb)
end
end
local focused = capi.client.focus == c
local focused = c.active
-- Handle transient_for: the first parent that does not skip the taskbar
-- is considered to be focused, if the real client has skip_taskbar.
if not focused and capi.client.focus and capi.client.focus.skip_taskbar
@ -723,7 +723,7 @@ end
-- @filterfunction awful.tasklist.filter.focused
function tasklist.filter.focused(c, screen)
-- Only print client on the same screen as this widget
return get_screen(c.screen) == get_screen(screen) and capi.client.focus == c
return get_screen(c.screen) == get_screen(screen) and c.active
end
--- Get all the clients in an undefined order.

View File

@ -133,7 +133,7 @@ table.insert(steps, function()
c1, c2 = client.get()[1], client.get()[2]
-- This should still be the case
assert(client.focus == c1)
assert(c1.active)
c2:emit_signal("request::activate", "i_said_so")
@ -143,7 +143,7 @@ end)
-- Check if writing a focus stealing filter works.
table.insert(steps, function()
-- This should still be the case
assert(client.focus == c2)
assert(c2.active)
original_count = #awful.ewmh.generic_activate_filters
@ -158,7 +158,7 @@ end)
table.insert(steps, function()
-- The request should have been denied
assert(client.focus == c2)
assert(c2.active)
-- Test the remove function
awful.ewmh.remove_activate_filter(function() end)
@ -171,7 +171,7 @@ table.insert(steps, function()
c1:emit_signal("request::activate", "i_said_so")
return client.focus == c1
return c1.active
end)
local has_error

View File

@ -64,7 +64,7 @@ local steps = {
client.focus = client.get()[1]
local c = client.focus
assert(c and client.focus == c)
assert(c and c.active)
assert(beautiful.awesome_icon)
local t = awful.tag.add("Test", {clients={c}, icon = beautiful.awesome_icon})

View File

@ -76,7 +76,7 @@ local steps = {
-- Killing the client means the first selected tag counts
function(count)
if count == 1 then
assert(client.focus == c)
assert(c.active)
c:kill()
c = nil
return

View File

@ -56,7 +56,7 @@ local steps = {
assert(#client.get() == 1)
local c = client.get()[1]
assert(not c.urgent, "Client is not urgent anymore.")
assert(c == client.focus, "Client is focused.")
assert(c.active, "Client is focused.")
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent") == false)
assert(awful.tag.getproperty(awful.screen.focused().tags[2], "urgent_count") == 0)
return true