placement.no_offscreen: add optional screen argument

This is used by `tooltip.place` then to tie the tooltip to the screen of
the mouse.  Without this, a tooltip from the tasklist might get moved to
the screen above the tasklist, if it gets considered to be on that
screen given its coordinates.

Closes https://github.com/awesomeWM/awesome/pull/437.
This commit is contained in:
Daniel Hahler 2015-09-16 10:39:12 +02:00
parent 2330040eb5
commit 42aea011d2
2 changed files with 4 additions and 3 deletions

View File

@ -105,11 +105,12 @@ end
--- Place the client so no part of it will be outside the screen (workarea). --- Place the client so no part of it will be outside the screen (workarea).
-- @client c The client. -- @client c The client.
-- @tparam[opt=client's screen] integer screen The screen.
-- @treturn table The new client geometry. -- @treturn table The new client geometry.
function placement.no_offscreen(c) function placement.no_offscreen(c, screen)
local c = c or capi.client.focus local c = c or capi.client.focus
local geometry = c:geometry() local geometry = c:geometry()
local screen = c.screen or a_screen.getbycoord(geometry.x, geometry.y) local screen = screen or c.screen or a_screen.getbycoord(geometry.x, geometry.y)
local border = c.border_width local border = c.border_width
local screen_geometry = capi.screen[screen].workarea local screen_geometry = capi.screen[screen].workarea

View File

@ -74,7 +74,7 @@ local data = setmetatable({}, { __mode = 'k' })
-- @tparam tooltip self A tooltip object. -- @tparam tooltip self A tooltip object.
local function place(self) local function place(self)
a_placement.next_to_mouse(self.wibox) a_placement.next_to_mouse(self.wibox)
a_placement.no_offscreen(self.wibox) a_placement.no_offscreen(self.wibox, mouse.screen)
end end
-- Place the tooltip under the mouse. -- Place the tooltip under the mouse.