Change some stuff to const. Minor config tweaks.

SVN revision: 22284
This commit is contained in:
Kim Woelders 2006-04-21 22:52:59 +00:00
parent 0a4c0153e0
commit 6eb1fbcb72
27 changed files with 82 additions and 63 deletions

View File

@ -203,6 +203,12 @@ typedef struct
}
IpcItem;
typedef struct
{
int num;
const IpcItem *lst;
} IpcItemList;
typedef struct
{
Window win;

View File

@ -1445,7 +1445,7 @@ static const IpcItem AclassIpcArray[] = {
/*
* Module descriptor
*/
EModule ModAclass = {
const EModule ModAclass = {
"aclass", "ac",
AclassSighan,
{N_IPC_FUNCS, AclassIpcArray}

View File

@ -2642,7 +2642,7 @@ static const CfgItem BackgroundsCfgItems[] = {
/*
* Module descriptor
*/
EModule ModBackgrounds = {
const EModule ModBackgrounds = {
"backgrounds", "bg",
BackgroundsSighan,
{N_IPC_FUNCS, BackgroundsIpcArray},

View File

@ -1192,7 +1192,7 @@ static const CfgItem ButtonsCfgItems[] = {
/*
* Module descriptor
*/
EModule ModButtons = {
const EModule ModButtons = {
"buttons", "btn",
ButtonsSighan,
{N_IPC_FUNCS, ButtonsIpcArray},

View File

@ -372,7 +372,7 @@ static const IpcItem CursorIpcArray[] = {
/*
* Module descriptor
*/
EModule ModCursors = {
const EModule ModCursors = {
"cursor", "csr",
CursorSighan,
{N_IPC_FUNCS, CursorIpcArray}

View File

@ -2945,7 +2945,7 @@ static const CfgItem DesksCfgItems[] = {
/*
* Module descriptor
*/
EModule ModDesktops = {
const EModule ModDesktops = {
"desktops", "desk",
DesksSighan,
{N_IPC_FUNCS, DesksIpcArray},

View File

@ -2726,7 +2726,7 @@ static const CfgItem CompMgrCfgItems[] = {
CFG_ITEM_BOOL(Conf_compmgr, use_name_pixmap, 0),
CFG_ITEM_BOOL(Conf_compmgr, fading.enable, 1),
CFG_ITEM_INT(Conf_compmgr, fading.dt_us, 10000),
CFG_ITEM_INT(Conf_compmgr, fading.step, 0x10000000),
CFG_ITEM_HEX(Conf_compmgr, fading.step, 0x10000000),
CFG_ITEM_INT(Conf_compmgr, override_redirect.mode, 1),
CFG_ITEM_INT(Conf_compmgr, override_redirect.opacity, 90),
};
@ -2735,7 +2735,7 @@ static const CfgItem CompMgrCfgItems[] = {
/*
* Module descriptor
*/
EModule ModCompMgr = {
const EModule ModCompMgr = {
"compmgr", "cm",
ECompMgrSighan,
{N_IPC_FUNCS, CompMgrIpcArray},

View File

@ -195,6 +195,12 @@ e16_db_int_set(ECfgFile * ecf, const char *key, int value)
fprintf(ecf->fs, "%s = %d\n", key, value);
}
static void
e16_db_hex_set(ECfgFile * ecf, const char *key, unsigned int value)
{
fprintf(ecf->fs, "%s = %#x\n", key, value);
}
static void
e16_db_float_set(ECfgFile * ecf, const char *key, float value)
{
@ -239,6 +245,7 @@ CfgItemLoad(E_DB_File * edf, const char *prefix, const CfgItem * ci)
*((char *)ci->ptr) = my_int;
break;
case ITEM_TYPE_INT:
case ITEM_TYPE_HEX:
if (!edf || !e16_db_int_get(edf, name, &my_int))
my_int = ci->dflt;
*((int *)ci->ptr) = my_int;
@ -281,6 +288,9 @@ CfgItemSave(E_DB_File * edf, const char *prefix, const CfgItem * ci)
case ITEM_TYPE_INT:
e16_db_int_set(edf, name, *((int *)ci->ptr));
break;
case ITEM_TYPE_HEX:
e16_db_hex_set(edf, name, *((unsigned int *)ci->ptr));
break;
case ITEM_TYPE_FLOAT:
e16_db_float_set(edf, name, *((float *)ci->ptr));
break;
@ -413,6 +423,9 @@ CfgItemToString(const CfgItem * ci, char *buf, int len)
case ITEM_TYPE_INT:
Esnprintf(buf, len, "%d", *((int *)ci->ptr));
break;
case ITEM_TYPE_HEX:
Esnprintf(buf, len, "%#x", *((unsigned int *)ci->ptr));
break;
case ITEM_TYPE_FLOAT:
Esnprintf(buf, len, "%.3f", *((float *)ci->ptr));
break;

View File

@ -32,16 +32,24 @@ typedef struct
void (*func) (void *item, const char *value);
} CfgItem;
typedef struct
{
int num;
const CfgItem *lst;
} CfgItemList;
typedef enum
{
ITEM_TYPE_BOOL,
ITEM_TYPE_INT,
ITEM_TYPE_HEX,
ITEM_TYPE_FLOAT,
ITEM_TYPE_STRING
} cfg_item_type_e;
#define CFG_ITEM_BOOL(conf, name, dflt) { #name, &conf.name, ITEM_TYPE_BOOL, dflt, NULL }
#define CFG_ITEM_INT(conf, name, dflt) { #name, &conf.name, ITEM_TYPE_INT, dflt, NULL }
#define CFG_ITEM_HEX(conf, name, dflt) { #name, &conf.name, ITEM_TYPE_HEX, dflt, NULL }
#define CFG_ITEM_STR(conf, name) { #name, &conf.name, ITEM_TYPE_STRING, 0, NULL }
#define CFG_FUNC_BOOL(conf, name, dflt, func) { #name, &conf.name, ITEM_TYPE_BOOL, dflt, func }

View File

@ -30,16 +30,8 @@ typedef struct
const char *name;
const char *nick;
void (*Signal) (int sig, void *prm);
struct
{
int num;
const IpcItem *lst;
} ipc;
struct
{
int num;
const CfgItem *lst;
} cfg;
IpcItemList ipc;
CfgItemList cfg;
} EModule;
typedef enum

View File

@ -2252,7 +2252,7 @@ static const IpcItem EwinsIpcArray[] = {
/*
* Module descriptor
*/
EModule ModEwins = {
const const EModule ModEwins = {
"ewins", NULL,
EwinsSighan,
{N_IPC_FUNCS, EwinsIpcArray}

View File

@ -1023,7 +1023,7 @@ static const CfgItem FocusCfgItems[] = {
/*
* Module descriptor
*/
EModule ModFocus = {
const EModule ModFocus = {
"focus", NULL,
FocusSighan,
{N_IPC_FUNCS, FocusIpcArray},

View File

@ -1083,7 +1083,7 @@ static const CfgItem FxCfgItems[] = {
/*
* Module descriptor
*/
EModule ModEffects = {
const EModule ModEffects = {
"effects", "efx",
FxSighan,
{N_IPC_FUNCS, FxIpcArray},

View File

@ -1494,7 +1494,7 @@ static const CfgItem GroupsCfgItems[] = {
};
#define N_CFG_ITEMS (sizeof(GroupsCfgItems)/sizeof(CfgItem))
EModule ModGroups = {
const EModule ModGroups = {
"groups", "grp",
GroupsSighan,
{N_IPC_FUNCS, GroupsIpcArray},

View File

@ -1616,7 +1616,7 @@ static const IpcItem ImageclassIpcArray[] = {
/*
* Module descriptor
*/
EModule ModImageclass = {
const EModule ModImageclass = {
"imageclass", "ic",
ImageclassSighan,
{N_IPC_FUNCS, ImageclassIpcArray}

View File

@ -2610,7 +2610,7 @@ static const CfgItem IconboxesCfgItems[] = {
/*
* Module descriptor
*/
EModule ModIconboxes = {
const EModule ModIconboxes = {
"iconboxes", "ibox",
IconboxesSighan,
{N_IPC_FUNCS, IconboxesIpcArray},

View File

@ -2136,19 +2136,19 @@ static const CfgItem MenusCfgItems[] = {
CFG_ITEM_BOOL(Conf.menus, warp, 1),
CFG_ITEM_BOOL(Conf.menus, show_icons, 1),
CFG_ITEM_INT(Conf.menus, icon_size, 16),
CFG_ITEM_INT(Conf.menus, key.left, XK_Left),
CFG_ITEM_INT(Conf.menus, key.right, XK_Right),
CFG_ITEM_INT(Conf.menus, key.up, XK_Up),
CFG_ITEM_INT(Conf.menus, key.down, XK_Down),
CFG_ITEM_INT(Conf.menus, key.escape, XK_Escape),
CFG_ITEM_INT(Conf.menus, key.ret, XK_Return),
CFG_ITEM_HEX(Conf.menus, key.left, XK_Left),
CFG_ITEM_HEX(Conf.menus, key.right, XK_Right),
CFG_ITEM_HEX(Conf.menus, key.up, XK_Up),
CFG_ITEM_HEX(Conf.menus, key.down, XK_Down),
CFG_ITEM_HEX(Conf.menus, key.escape, XK_Escape),
CFG_ITEM_HEX(Conf.menus, key.ret, XK_Return),
};
#define N_CFG_ITEMS (sizeof(MenusCfgItems)/sizeof(CfgItem))
/*
* Module descriptor
*/
EModule ModMenus = {
const EModule ModMenus = {
"menus", "menu",
MenusSighan,
{N_IPC_FUNCS, MenusIpcArray},

View File

@ -30,35 +30,35 @@
**********************************************************************/
/* Use static module list for now */
extern EModule ModAclass;
extern EModule ModBackgrounds;
extern EModule ModButtons;
extern const EModule ModAclass;
extern const EModule ModBackgrounds;
extern const EModule ModButtons;
#if USE_COMPOSITE
extern EModule ModCompMgr;
extern const EModule ModCompMgr;
#endif
extern EModule ModCursors;
extern EModule ModDesktops;
extern EModule ModEffects;
extern EModule ModEwins;
extern EModule ModFocus;
extern EModule ModGroups;
extern EModule ModImageclass;
extern EModule ModIconboxes;
extern EModule ModMenus;
extern EModule ModMisc;
extern EModule ModPagers;
extern EModule ModSlideouts;
extern EModule ModSound;
extern EModule ModTextclass;
extern EModule ModTheme;
extern EModule ModTooltips;
extern const EModule ModCursors;
extern const EModule ModDesktops;
extern const EModule ModEffects;
extern const EModule ModEwins;
extern const EModule ModFocus;
extern const EModule ModGroups;
extern const EModule ModImageclass;
extern const EModule ModIconboxes;
extern const EModule ModMenus;
extern const EModule ModMisc;
extern const EModule ModPagers;
extern const EModule ModSlideouts;
extern const EModule ModSound;
extern const EModule ModTextclass;
extern const EModule ModTheme;
extern const EModule ModTooltips;
#ifdef ENABLE_THEME_TRANSPARENCY
extern EModule ModTransparency;
extern const EModule ModTransparency;
#endif
extern EModule ModWarplist;
extern EModule ModWindowMatch;
extern const EModule ModWarplist;
extern const EModule ModWindowMatch;
const EModule *p_modules[] = {
&ModAclass,
@ -227,7 +227,7 @@ static const IpcItem MiscIpcArray[] = {
#define N_IPC_FUNCS (sizeof(MiscIpcArray)/sizeof(IpcItem))
/* Stuff not elsewhere */
EModule ModMisc = {
const const EModule ModMisc = {
"misc", NULL,
NULL,
{N_IPC_FUNCS, MiscIpcArray}

View File

@ -333,7 +333,7 @@ static const CfgItem TransCfgItems[] = {
/*
* Module descriptor
*/
EModule ModTransparency = {
const EModule ModTransparency = {
"transparency", "tr",
TransparencySighan,
{N_IPC_FUNCS, TransIpcArray},

View File

@ -2068,7 +2068,7 @@ static const CfgItem PagersCfgItems[] = {
/*
* Module descriptor
*/
EModule ModPagers = {
const EModule ModPagers = {
"pagers", "pg",
PagersSighan,
{N_IPC_FUNCS, PagersIpcArray},

View File

@ -523,7 +523,7 @@ static const IpcItem SlideoutsIpcArray[] = {
/*
* Module descriptor
*/
EModule ModSlideouts = {
const EModule ModSlideouts = {
"slideouts", "slideout",
SlideoutsSighan,
{N_IPC_FUNCS, SlideoutsIpcArray},

View File

@ -559,7 +559,7 @@ static const CfgItem SoundCfgItems[] = {
/*
* Module descriptor
*/
EModule ModSound = {
const EModule ModSound = {
"sound", "audio",
SoundSighan,
{N_IPC_FUNCS, SoundIpcArray},

View File

@ -642,7 +642,7 @@ static const IpcItem TextclassIpcArray[] = {
/*
* Module descriptor
*/
EModule ModTextclass = {
const EModule ModTextclass = {
"textclass", "tc",
TextclassSighan,
{N_IPC_FUNCS, TextclassIpcArray}

View File

@ -507,7 +507,7 @@ static const CfgItem ThemeCfgItems[] = {
/*
* Module descriptor
*/
EModule ModTheme = {
const EModule ModTheme = {
"theme", "th",
ThemesSighan,
{N_IPC_FUNCS, ThemeIpcArray},

View File

@ -919,7 +919,7 @@ static const CfgItem TooltipsCfgItems[] = {
/*
* Module descriptor
*/
EModule ModTooltips = {
const EModule ModTooltips = {
"tooltips", "tt",
TooltipsSighan,
{N_IPC_FUNCS, TooltipsIpcArray},

View File

@ -484,7 +484,7 @@ static const CfgItem WarplistCfgItems[] = {
};
#define N_CFG_ITEMS (sizeof(WarplistCfgItems)/sizeof(CfgItem))
EModule ModWarplist = {
const EModule ModWarplist = {
"warplist", "warp",
WarplistSighan,
{0, NULL},

View File

@ -920,7 +920,7 @@ static const IpcItem WindowMatchIpcArray[] = {
/*
* Module descriptor
*/
EModule ModWindowMatch = {
const EModule ModWindowMatch = {
"winmatch", NULL,
WindowMatchSighan,
{N_IPC_FUNCS, WindowMatchIpcArray}