wibox: Remember the screen that was assigned

If screens overlap, the wibox should still remember which of the possible
screens it is assigned to.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-06-04 16:10:54 +02:00
parent 3d2c877762
commit a7f7cab564
1 changed files with 9 additions and 0 deletions

View File

@ -63,6 +63,11 @@ function wibox:find_widgets(x, y)
end
function wibox:get_screen()
if self.screen_assigned and self.screen_assigned.valid then
return self.screen_assigned
else
self.screen_assigned = nil
end
local sgeos = {}
for s in capi.screen do
@ -78,6 +83,10 @@ function wibox:set_screen(s)
self.x = s.geometry.x
self.y = s.geometry.y
end
-- Remember this screen so things work correctly if screens overlap and
-- (x,y) is not enough to figure out the correct screen.
self.screen_assigned = s
end
for _, k in pairs{ "buttons", "struts", "geometry", "get_xproperty", "set_xproperty" } do