placement.under_mouse: Fix a rounding error.

When object size contains odd numbers, the result was +1px off.
This commit is contained in:
Emmanuel Lepage Vallee 2016-08-12 17:00:16 -04:00
parent e3c24c8e09
commit 19d4a3f602
1 changed files with 2 additions and 2 deletions

View File

@ -761,8 +761,8 @@ function placement.under_mouse(d, args)
local m_coords = capi.mouse.coords()
local ngeo = geometry_common(d, args)
ngeo.x = m_coords.x - ngeo.width / 2
ngeo.y = m_coords.y - ngeo.height / 2
ngeo.x = math.floor(m_coords.x - ngeo.width / 2)
ngeo.y = math.floor(m_coords.y - ngeo.height / 2)
local bw = d.border_width or 0
ngeo.width = ngeo.width - 2*bw