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; IpcItem;
typedef struct
{
int num;
const IpcItem *lst;
} IpcItemList;
typedef struct typedef struct
{ {
Window win; Window win;

View File

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

View File

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

View File

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

View File

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

View File

@ -2945,7 +2945,7 @@ static const CfgItem DesksCfgItems[] = {
/* /*
* Module descriptor * Module descriptor
*/ */
EModule ModDesktops = { const EModule ModDesktops = {
"desktops", "desk", "desktops", "desk",
DesksSighan, DesksSighan,
{N_IPC_FUNCS, DesksIpcArray}, {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, use_name_pixmap, 0),
CFG_ITEM_BOOL(Conf_compmgr, fading.enable, 1), CFG_ITEM_BOOL(Conf_compmgr, fading.enable, 1),
CFG_ITEM_INT(Conf_compmgr, fading.dt_us, 10000), 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.mode, 1),
CFG_ITEM_INT(Conf_compmgr, override_redirect.opacity, 90), CFG_ITEM_INT(Conf_compmgr, override_redirect.opacity, 90),
}; };
@ -2735,7 +2735,7 @@ static const CfgItem CompMgrCfgItems[] = {
/* /*
* Module descriptor * Module descriptor
*/ */
EModule ModCompMgr = { const EModule ModCompMgr = {
"compmgr", "cm", "compmgr", "cm",
ECompMgrSighan, ECompMgrSighan,
{N_IPC_FUNCS, CompMgrIpcArray}, {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); 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 static void
e16_db_float_set(ECfgFile * ecf, const char *key, float value) 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; *((char *)ci->ptr) = my_int;
break; break;
case ITEM_TYPE_INT: case ITEM_TYPE_INT:
case ITEM_TYPE_HEX:
if (!edf || !e16_db_int_get(edf, name, &my_int)) if (!edf || !e16_db_int_get(edf, name, &my_int))
my_int = ci->dflt; my_int = ci->dflt;
*((int *)ci->ptr) = my_int; *((int *)ci->ptr) = my_int;
@ -281,6 +288,9 @@ CfgItemSave(E_DB_File * edf, const char *prefix, const CfgItem * ci)
case ITEM_TYPE_INT: case ITEM_TYPE_INT:
e16_db_int_set(edf, name, *((int *)ci->ptr)); e16_db_int_set(edf, name, *((int *)ci->ptr));
break; break;
case ITEM_TYPE_HEX:
e16_db_hex_set(edf, name, *((unsigned int *)ci->ptr));
break;
case ITEM_TYPE_FLOAT: case ITEM_TYPE_FLOAT:
e16_db_float_set(edf, name, *((float *)ci->ptr)); e16_db_float_set(edf, name, *((float *)ci->ptr));
break; break;
@ -413,6 +423,9 @@ CfgItemToString(const CfgItem * ci, char *buf, int len)
case ITEM_TYPE_INT: case ITEM_TYPE_INT:
Esnprintf(buf, len, "%d", *((int *)ci->ptr)); Esnprintf(buf, len, "%d", *((int *)ci->ptr));
break; break;
case ITEM_TYPE_HEX:
Esnprintf(buf, len, "%#x", *((unsigned int *)ci->ptr));
break;
case ITEM_TYPE_FLOAT: case ITEM_TYPE_FLOAT:
Esnprintf(buf, len, "%.3f", *((float *)ci->ptr)); Esnprintf(buf, len, "%.3f", *((float *)ci->ptr));
break; break;

View File

@ -32,16 +32,24 @@ typedef struct
void (*func) (void *item, const char *value); void (*func) (void *item, const char *value);
} CfgItem; } CfgItem;
typedef struct
{
int num;
const CfgItem *lst;
} CfgItemList;
typedef enum typedef enum
{ {
ITEM_TYPE_BOOL, ITEM_TYPE_BOOL,
ITEM_TYPE_INT, ITEM_TYPE_INT,
ITEM_TYPE_HEX,
ITEM_TYPE_FLOAT, ITEM_TYPE_FLOAT,
ITEM_TYPE_STRING ITEM_TYPE_STRING
} cfg_item_type_e; } cfg_item_type_e;
#define CFG_ITEM_BOOL(conf, name, dflt) { #name, &conf.name, ITEM_TYPE_BOOL, dflt, NULL } #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_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_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 } #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 *name;
const char *nick; const char *nick;
void (*Signal) (int sig, void *prm); void (*Signal) (int sig, void *prm);
struct IpcItemList ipc;
{ CfgItemList cfg;
int num;
const IpcItem *lst;
} ipc;
struct
{
int num;
const CfgItem *lst;
} cfg;
} EModule; } EModule;
typedef enum typedef enum

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2610,7 +2610,7 @@ static const CfgItem IconboxesCfgItems[] = {
/* /*
* Module descriptor * Module descriptor
*/ */
EModule ModIconboxes = { const EModule ModIconboxes = {
"iconboxes", "ibox", "iconboxes", "ibox",
IconboxesSighan, IconboxesSighan,
{N_IPC_FUNCS, IconboxesIpcArray}, {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, warp, 1),
CFG_ITEM_BOOL(Conf.menus, show_icons, 1), CFG_ITEM_BOOL(Conf.menus, show_icons, 1),
CFG_ITEM_INT(Conf.menus, icon_size, 16), CFG_ITEM_INT(Conf.menus, icon_size, 16),
CFG_ITEM_INT(Conf.menus, key.left, XK_Left), CFG_ITEM_HEX(Conf.menus, key.left, XK_Left),
CFG_ITEM_INT(Conf.menus, key.right, XK_Right), CFG_ITEM_HEX(Conf.menus, key.right, XK_Right),
CFG_ITEM_INT(Conf.menus, key.up, XK_Up), CFG_ITEM_HEX(Conf.menus, key.up, XK_Up),
CFG_ITEM_INT(Conf.menus, key.down, XK_Down), CFG_ITEM_HEX(Conf.menus, key.down, XK_Down),
CFG_ITEM_INT(Conf.menus, key.escape, XK_Escape), CFG_ITEM_HEX(Conf.menus, key.escape, XK_Escape),
CFG_ITEM_INT(Conf.menus, key.ret, XK_Return), CFG_ITEM_HEX(Conf.menus, key.ret, XK_Return),
}; };
#define N_CFG_ITEMS (sizeof(MenusCfgItems)/sizeof(CfgItem)) #define N_CFG_ITEMS (sizeof(MenusCfgItems)/sizeof(CfgItem))
/* /*
* Module descriptor * Module descriptor
*/ */
EModule ModMenus = { const EModule ModMenus = {
"menus", "menu", "menus", "menu",
MenusSighan, MenusSighan,
{N_IPC_FUNCS, MenusIpcArray}, {N_IPC_FUNCS, MenusIpcArray},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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