From 42aea011d273fb4269f17d7c438954abf2e2ceb6 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 16 Sep 2015 10:39:12 +0200 Subject: [PATCH] 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. --- lib/awful/placement.lua | 5 +++-- lib/awful/tooltip.lua | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/awful/placement.lua b/lib/awful/placement.lua index ae7539b5..8c903466 100644 --- a/lib/awful/placement.lua +++ b/lib/awful/placement.lua @@ -105,11 +105,12 @@ end --- Place the client so no part of it will be outside the screen (workarea). -- @client c The client. +-- @tparam[opt=client's screen] integer screen The screen. -- @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 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 screen_geometry = capi.screen[screen].workarea diff --git a/lib/awful/tooltip.lua b/lib/awful/tooltip.lua index 3d7bee6e..7a410f33 100644 --- a/lib/awful/tooltip.lua +++ b/lib/awful/tooltip.lua @@ -74,7 +74,7 @@ local data = setmetatable({}, { __mode = 'k' }) -- @tparam tooltip self A tooltip object. local function place(self) a_placement.next_to_mouse(self.wibox) - a_placement.no_offscreen(self.wibox) + a_placement.no_offscreen(self.wibox, mouse.screen) end -- Place the tooltip under the mouse.