From 84acfc46521e756c4f44754cf7ebd69bc6b70f71 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 10 Dec 2009 10:10:20 +0100 Subject: [PATCH] systray: fix screen number retrieval Signed-off-by: Julien Danjou --- widgets/systray.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/widgets/systray.c b/widgets/systray.c index 19fd6a233..27cba124c 100644 --- a/widgets/systray.c +++ b/widgets/systray.c @@ -25,6 +25,7 @@ #include "widget.h" #include "screen.h" #include "wibox.h" +#include "luaa.h" #include "globalconf.h" #include "common/xembed.h" #include "common/atoms.h" @@ -41,9 +42,11 @@ typedef struct static area_t systray_extents(lua_State *L, widget_t *widget) { - int screen = screen_virttophys(luaL_optnumber(L, -1, 1)); + int screen = luaL_optnumber(L, -1, 1) - 1; + luaA_checkscreen(screen); + area_t geometry; - int phys_screen = screen_virttophys(screen), n = 0; + int phys_screen = screen_virttophys(screen), n = 0; systray_data_t *d = widget->data; for(int i = 0; i < globalconf.embedded.len; i++)