Merge pull request #508 from psychon/systray_only_in_wibox

systray: Make sure the widget is only placed in a wibox
This commit is contained in:
Daniel Hahler 2015-10-13 11:34:22 +02:00
commit c0fd79a318
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,10 @@ function systray:draw(context, cr, width, height)
local bg = beautiful.bg_systray or beautiful.bg_normal or "#000000" local bg = beautiful.bg_systray or beautiful.bg_normal or "#000000"
local spacing = beautiful.systray_icon_spacing or 0 local spacing = beautiful.systray_icon_spacing or 0
if context and not context.wibox then
error("The systray widget can only be placed inside a wibox.")
end
-- Figure out if the cairo context is rotated -- Figure out if the cairo context is rotated
local dir_x, dir_y = cr:user_to_device_distance(1, 0) local dir_x, dir_y = cr:user_to_device_distance(1, 0)
local is_rotated = abs(dir_x) < abs(dir_y) local is_rotated = abs(dir_x) < abs(dir_y)