Merge branch 'force-drawable-screen' of https://github.com/psychon/awesome

This commit is contained in:
Uli Schlachter 2016-12-25 11:09:58 +01:00
commit 0907411997
2 changed files with 14 additions and 5 deletions

View File

@ -30,14 +30,17 @@ local visible_drawables = {}
local function get_widget_context(self)
local geom = self.drawable:geometry()
local sgeos = {}
local s = self._forced_screen
if not s then
local sgeos = {}
for s in capi.screen do
sgeos[s] = s.geometry
for s in capi.screen do
sgeos[s] = s.geometry
end
s = grect.get_by_coord(sgeos, geom.x, geom.y) or capi.screen.primary
end
local s = grect.get_by_coord(sgeos, geom.x, geom.y) or capi.screen.primary
local context = self._widget_context
local dpi = beautiful.xresources.get_dpi(s)
if (not context) or context.screen ~= s or context.dpi ~= dpi then
@ -59,6 +62,7 @@ end
local function do_redraw(self)
if not self.drawable.valid then return end
if self._forced_screen and not self._forced_screen.valid then return end
local surf = surface.load_silently(self.drawable.surface, false)
-- The surface can be nil if the drawable's parent was already finalized
@ -274,6 +278,10 @@ function drawable:set_fg(c)
self._do_complete_repaint()
end
function drawable:_force_screen(s)
self._forced_screen = s
end
function drawable:_inform_visible(visible)
self._visible = visible
if visible then

View File

@ -86,6 +86,7 @@ function wibox:set_screen(s)
-- 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
self._drawable:_force_screen(s)
end
for _, k in pairs{ "buttons", "struts", "geometry", "get_xproperty", "set_xproperty" } do