From da53940dd9b740bfbeb84d8a01107a9c7ab41c8b Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 10 Dec 2009 10:11:24 +0100 Subject: [PATCH] systray: fix screen number retrieval Signed-off-by: Julien Danjou --- objects/widgets/systray.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/objects/widgets/systray.c b/objects/widgets/systray.c index ecfef64e..3133172b 100644 --- a/objects/widgets/systray.c +++ b/objects/widgets/systray.c @@ -25,6 +25,7 @@ #include "objects/widget.h" #include "screen.h" #include "objects/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++)