1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-29 01:42:32 +01:00

WPrefs: created macro 'wlengthof_nocheck' for the cases were wlengthof cannot be used

Because the macro wlengthof preforms a check of validity of its argument
with static_assert, there is a use case where it fails with a compiler
error. This patch introduces an alternate macro without the check, to be
used only for this specific case.

To be able to use the size of the array, a few of those array declaration
have to be moved before the structure in which their size is used.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-10-26 19:58:41 +01:00
committed by Carlos R. Mafra
parent 7d09b2c04f
commit 6ac27ba842
4 changed files with 99 additions and 82 deletions

View File

@@ -21,6 +21,28 @@
#include "WPrefs.h"
static const struct {
const char *key;
const char *string;
} auto_delay[] = {
{ "ClipAutoexpandDelay", N_("Before auto-expansion") },
{ "ClipAutocollapseDelay", N_("Before auto-collapsing") },
{ "ClipAutoraiseDelay", N_("Before auto-raise") },
{ "ClipAutolowerDelay", N_("Before auto-lowering") }
};
static char *autoDelayPresetValues[5] = { "0", "100", "250", "600", "1000" };
static const struct {
const char *disable_key;
const char *icon_file;
} dock_config[] = {
{ "DisableDock", "dock" },
{ "DisableClip", "clip" },
{ "DisableDrawers", "drawer" }
};
typedef struct _Panel {
WMBox *box;
@@ -33,13 +55,13 @@ typedef struct _Panel {
WMWidget *parent;
WMFrame *autoDelayF[2];
WMLabel *autoDelayL[4];
WMButton *autoDelayB[4][5];
WMTextField *autoDelayT[4];
WMLabel *autoDelayMsL[4];
WMLabel *autoDelayL[wlengthof_nocheck(auto_delay)];
WMButton *autoDelayB[wlengthof_nocheck(auto_delay)][wlengthof_nocheck(autoDelayPresetValues)];
WMTextField *autoDelayT[wlengthof_nocheck(auto_delay)];
WMLabel *autoDelayMsL[wlengthof_nocheck(auto_delay)];
WMFrame *dockF;
WMButton *docksB[3];
WMButton *docksB[wlengthof_nocheck(dock_config)];
} _Panel;
#define ICON_FILE "dockclipdrawersection"
@@ -48,28 +70,6 @@ typedef struct _Panel {
#define DELAY_ICON "timer%i"
#define DELAY_ICON_S "timer%is"
static const struct {
const char *key;
const char *string;
} auto_delay[] = {
{ "ClipAutoexpandDelay", N_("Before auto-expansion") },
{ "ClipAutocollapseDelay", N_("Before auto-collapsing") },
{ "ClipAutoraiseDelay", N_("Before auto-raise") },
{ "ClipAutolowerDelay", N_("Before auto-lowering") }
};
static char *autoDelayPresetValues[5] = { "0", "100", "250", "600", "1000" };
static const struct {
const char *disable_key;
const char *icon_file;
} dock_config[] = {
{ "DisableDock", "dock" },
{ "DisableClip", "clip" },
{ "DisableDrawers", "drawer" }
};
static void showData(_Panel *panel);
static void storeData(_Panel *panel);