wibox: Fix mouse event handling

If you managed to press mouse button 4 exactly between two entries in the
taglist, the taglist would jump by two tags instead of just one. This is because
the mouse event was forwarded to both taglist items.

This happened because the calculation in wibox' find_widgets() was wrong. If you
have a widget at (1, 1) with a size of 1x1, then (1, 1) is the only point that
this widget covers. However, the math also included the pixels (2, 1), (1, 2)
and (2, 2) in the widget's extents. This is obviously wrong.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-10-30 19:56:07 +02:00
parent ae5a3160d4
commit 8882cf360a
1 changed files with 2 additions and 2 deletions

View File

@ -73,8 +73,8 @@ function find_widgets(wibox, x, y)
-- Find all widgets that contain the point -- Find all widgets that contain the point
for k, v in pairs(wibox._widget_geometries) do for k, v in pairs(wibox._widget_geometries) do
local match = true local match = true
if v.x > x or v.x + v.width < x then match = false end if v.x > x or v.x + v.width <= x then match = false end
if v.y > y or v.y + v.height < y then match = false end if v.y > y or v.y + v.height <= y then match = false end
if match then if match then
table.insert(matches, v) table.insert(matches, v)
end end