diff --git a/src/buttons.c b/src/buttons.c index ad938193..00b33982 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2012 Kim Woelders + * Copyright (C) 2004-2013 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -282,7 +282,7 @@ ButtonShow(Button * b) EoMap(b, 0); } -void +EObj * ButtonSwallowInto(Button * b, EObj * eo) { b->internal = 1; @@ -294,6 +294,7 @@ ButtonSwallowInto(Button * b, EObj * eo) ButtonCalc(b); ButtonDraw(b); EMapWindow(EoGetWin(b)); + return EoObj(b); } void diff --git a/src/buttons.h b/src/buttons.h index 6f57e3fb..79148258 100644 --- a/src/buttons.h +++ b/src/buttons.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2008 Kim Woelders + * Copyright (C) 2004-2013 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -44,7 +44,7 @@ void ButtonShow(Button * b); void ButtonHide(Button * b); void ButtonMoveToCoord(Button * b, int x, int y); void ButtonMoveRelative(Button * b, int dx, int dy); -void ButtonSwallowInto(Button * b, EObj * eo); +EObj *ButtonSwallowInto(Button * b, EObj * eo); void ButtonSetCallback(Button * b, ButtonCbFunc * func, EObj * eo); int ButtonDoShowDefault(const Button * b); diff --git a/src/slideout.c b/src/slideout.c index 0c69f836..92c3be3c 100644 --- a/src/slideout.c +++ b/src/slideout.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2012 Kim Woelders + * Copyright (C) 2004-2013 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -335,17 +335,20 @@ SlideoutButtonCallback(EObj * seo, XEvent * ev, ActionClass * ac) } static void -SlideoutAddButton(Slideout * s, Button * b) +SlideoutAddButton(Slideout * s, const char *bname) { - EObj *eob = (EObj *) b; + Button *b; - if (!s || !b) + if (!s) + return; + + b = ButtonFind(bname); + if (!b) return; s->num_objs++; s->objs = EREALLOC(EObj *, s->objs, s->num_objs); - s->objs[s->num_objs - 1] = eob; - ButtonSwallowInto(b, EoObj(s)); + s->objs[s->num_objs - 1] = ButtonSwallowInto(b, EoObj(s)); ButtonSetCallback(b, SlideoutButtonCallback, EoObj(s)); SlideoutCalcSize(s); } @@ -429,7 +432,7 @@ SlideoutsConfigLoad(FILE * fs) slideout = SlideoutCreate(name, (char)atoi(s2)); break; case CONFIG_BUTTON: - SlideoutAddButton(slideout, ButtonFind(s2)); + SlideoutAddButton(slideout, s2); break; default: ConfigParseError("Slideout", s);