kwo pushed a commit to branch master.
commit 1316cfb15ae1326776f79b0378eed63998d2adfd
Author: Kim Woelders <[email protected]>
Date: Sun Jun 9 20:11:08 2013 +0200
Tweak button swallowing in slideouts.
Done to avoid casting Button to EObj.
---
src/buttons.c | 5 +++--
src/buttons.h | 4 ++--
src/slideout.c | 17 ++++++++++-------
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/buttons.c b/src/buttons.c
index ad93819..00b3398 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 6f57e3f..7914825 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 0c69f83..92c3be3 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);
--
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev