fix(awful: widget: only_on_screen): update for screen API changes from #2293 (#2304)

This commit is contained in:
Yauhen Kirylau 2018-07-23 00:33:59 +02:00 committed by Emmanuel Lepage Vallée
parent 6c27f4295b
commit 94d3918d14
2 changed files with 9 additions and 5 deletions

View File

@ -25,10 +25,12 @@ local function should_display_on(self, s)
if not self._private.widget then
return false
end
local success, own_s = pcall(function()
return capi.screen[self._private.screen]
end)
return success and own_s == s
local own_s = self._private.screen
if type(own_s) == "number" and (own_s < 1 or own_s > capi.screen.count()) then
-- Invalid screen number
return false
end
return capi.screen[self._private.screen] == s
end
-- Layout this layout

View File

@ -2,7 +2,9 @@ local gears_obj = require("gears.object")
local screen, meta = awesome._shim_fake_class()
screen.count = 1
function screen.count()
return 1
end
local function create_screen(args)
local s = gears_obj()