Theme element fallback cleanups

- don't create fallback classes before they are needed.
- use of fallbacks was missing a number of places.
- setting theme to "-" will run entirely on fallbacks.


SVN revision: 34885
This commit is contained in:
Kim Woelders 2008-06-22 13:34:42 +00:00
parent 1421866e20
commit e82903882a
13 changed files with 221 additions and 156 deletions

View File

@ -1125,28 +1125,6 @@ ActionclassesGlobalEvent(XEvent * ev)
return match;
}
static void
AclassSetupFallback(void)
{
ActionClass *ac;
Action *aa;
/* Create a default fallback actionclass for the fallback border */
ac = ActionclassCreate("__FALLBACK_ACTION", 0);
aa = ActionCreate(EVENT_MOUSE_DOWN, 1, 0, 0, 1, 0, NULL, NULL);
ActionclassAddAction(ac, aa);
ActionAddTo(aa, "wop * mo ptr");
aa = ActionCreate(EVENT_MOUSE_DOWN, 1, 0, 0, 2, 0, NULL, NULL);
ActionclassAddAction(ac, aa);
ActionAddTo(aa, "wop * close");
aa = ActionCreate(EVENT_MOUSE_DOWN, 1, 0, 0, 3, 0, NULL, NULL);
ActionclassAddAction(ac, aa);
ActionAddTo(aa, "wop * sz ptr");
}
/*
* Actions module
*/
@ -1157,7 +1135,6 @@ AclassSighan(int sig, void *prm __UNUSED__)
switch (sig)
{
case ESIGNAL_INIT:
AclassSetupFallback();
AclassConfigLoadConfig("bindings.cfg");
AclassConfigLoadUser();
break;

View File

@ -48,6 +48,7 @@ static Ecore_List *border_list = NULL;
static void BorderDestroy(Border * b);
static void BorderWinpartHandleEvents(Win win, XEvent * ev, void *prm);
static void BorderFrameHandleEvents(Win win, XEvent * ev, void *prm);
static Border *BorderGetFallback(void);
static void
BorderWinpartRealise(EWin * ewin, int i)
@ -452,7 +453,7 @@ EwinBorderSelect(EWin * ewin)
b = BorderFind("DEFAULT");
if (!b)
b = BorderFind("__FALLBACK_BORDER");
b = BorderGetFallback();
done:
ewin->normal_border = ewin->border = b;
@ -661,6 +662,8 @@ _BorderMatchName(const void *data, const void *match)
Border *
BorderFind(const char *name)
{
if (!name)
return NULL;
return (Border *) ecore_list_find(border_list, _BorderMatchName, name);
}
@ -1206,6 +1209,9 @@ BorderCreateFiller(int left, int right, int top, int bottom)
Border *b;
b = BorderCreate("__FILLER");
if (!b)
return b;
b->throwaway = 1;
b->border.left = left;
@ -1213,6 +1219,8 @@ BorderCreateFiller(int left, int right, int top, int bottom)
b->border.top = top;
b->border.bottom = bottom;
ImageclassGetBlack(); /* Creates the __BLACK ImageClass */
if (top)
BorderWinpartAdd(b, "__BLACK", NULL, NULL, NULL, 1, FLAG_BUTTON, 0,
1, 99999, 1, 99999,
@ -1247,8 +1255,38 @@ BordersGetList(int *pnum)
return (Border **) ecore_list_items_get(border_list, pnum);
}
void
BordersSetupFallback(void)
static ActionClass *
BorderGetFallbackAclass(void)
{
ActionClass *ac;
Action *aa;
ac = ActionclassFind("__fb_bd_ac");
if (ac)
return ac;
/* Create fallback actionclass for the fallback border */
ac = ActionclassCreate("__fb_bd_ac", 0);
if (!ac)
return ac;
aa = ActionCreate(EVENT_MOUSE_DOWN, 1, 0, 0, 1, 0, NULL, NULL);
ActionclassAddAction(ac, aa);
ActionAddTo(aa, "wop * mo ptr");
aa = ActionCreate(EVENT_MOUSE_DOWN, 1, 0, 0, 2, 0, NULL, NULL);
ActionclassAddAction(ac, aa);
ActionAddTo(aa, "wop * close");
aa = ActionCreate(EVENT_MOUSE_DOWN, 1, 0, 0, 3, 0, NULL, NULL);
ActionclassAddAction(ac, aa);
ActionAddTo(aa, "wop * sz ptr");
return ac;
}
static Border *
BorderGetFallback(void)
{
/*
* This function creates simple internal data members to be used in
@ -1257,29 +1295,35 @@ BordersSetupFallback(void)
* least E won't barf on us then.
*/
Border *b;
ImageClass *ic;
ActionClass *ac;
ac = ActionclassFind("__FALLBACK_ACTION");
ic = ImageclassFind("__FALLBACK_ICLASS", 0);
b = BorderFind("__fb_bd");
if (b)
return b;
/* create a fallback border in case no border is found */
b = BorderCreate("__FALLBACK_BORDER");
ac = BorderGetFallbackAclass(); /* Creates the fallback ac */
/* Create fallback border */
b = BorderCreate("__fb_bd");
if (!b)
return b;
b->border.left = 8;
b->border.right = 8;
b->border.top = 8;
b->border.bottom = 8;
BorderWinpartAdd(b, "__FALLBACK_ICLASS", "__FALLBACK_ACTION", NULL, NULL,
BorderWinpartAdd(b, "__fb_ic", "__fb_bd_ac", NULL, NULL,
1, FLAG_BUTTON, 0, 8, 99999, 8, 99999, -1, 0, 0, 0, 0,
-1, 1024, -1, 0, 7, 1);
BorderWinpartAdd(b, "__FALLBACK_ICLASS", "__FALLBACK_ACTION", NULL, NULL,
BorderWinpartAdd(b, "__fb_ic", "__fb_bd_ac", NULL, NULL,
1, FLAG_BUTTON, 0, 8, 99999, 8, 99999, -1, 0, 0, 1024,
-8, -1, 1024, -1, 1024, -1, 1);
BorderWinpartAdd(b, "__FALLBACK_ICLASS", "__FALLBACK_ACTION", NULL, NULL,
BorderWinpartAdd(b, "__fb_ic", "__fb_bd_ac", NULL, NULL,
1, FLAG_BUTTON, 0, 8, 99999, 8, 99999, -1, 0, 0, 0, 8,
-1, 0, 7, 1024, -9, 1);
BorderWinpartAdd(b, "__FALLBACK_ICLASS", "__FALLBACK_ACTION", NULL, NULL,
BorderWinpartAdd(b, "__fb_ic", "__fb_bd_ac", NULL, NULL,
1, FLAG_BUTTON, 0, 8, 99999, 8, 99999, -1, 1024, -8, 0,
8, -1, 1024, -1, 1024, -9, 1);
return b;
}

View File

@ -101,6 +101,5 @@ Border *BorderCreateFiller(int left, int right, int top,
void BordersForeach(void (*func) (Border * b, void *data),
void *data);
Border **BordersGetList(int *pnum);
void BordersSetupFallback(void);
#endif /* _BORDERS_H_ */

View File

@ -619,8 +619,5 @@ ThemeConfigLoad(void)
/* Font mappings no longer needed */
FontConfigUnload();
/* Loose ends... */
BordersSetupFallback();
return 0;
}

View File

@ -531,7 +531,7 @@ ContainerLayoutImageWin(Container * ct)
static void
ContainerDrawScroll(Container * ct)
{
ImageClass *ic;
ImageClass *ic, *ic_sbb;
EImageBorder *pad;
int arrow_mode = ct->arrow_side;
int bs, bw, bx;
@ -543,13 +543,13 @@ ContainerDrawScroll(Container * ct)
if (ct->h < 2 * ct->arrow_thickness + ct->knob_length)
arrow_mode = 3; /* No arrows */
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_VERTICAL", 0);
pad = ImageclassGetPadding(ic);
ic_sbb = ImageclassFind("ICONBOX_SCROLLBAR_BASE_VERTICAL", 1);
pad = ImageclassGetPadding(ic_sbb);
if (arrow_mode < 3)
bs = ct->h - (ct->arrow_thickness * 2);
else
bs = ct->h;
if (ic)
if (pad)
bs -= pad->top + pad->bottom;
bw = (ct->h * bs) / ct->max;
if (bs < 1)
@ -559,7 +559,7 @@ ContainerDrawScroll(Container * ct)
if (bw < 1)
bw = 1;
bx = ((ct->pos * bs) / ct->max);
if (ic)
if (pad)
bx += pad->top;
if ((ct->scrollbar_hide) && (bw == bs))
goto do_hide_sb;
@ -686,15 +686,13 @@ ContainerDrawScroll(Container * ct)
}
}
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_VERTICAL", 0);
if (ic)
ImageclassApply(ic, ct->scroll_win, 0, 0, STATE_NORMAL, ST_ICONBOX);
ImageclassApply(ic_sbb, ct->scroll_win, 0, 0, STATE_NORMAL, ST_ICONBOX);
EMoveResizeWindow(ct->scrollbar_win,
(ct->scroll_thickness - ct->bar_thickness) / 2, bx,
ct->bar_thickness, bw);
ic = ImageclassFind("ICONBOX_SCROLLBAR_KNOB_VERTICAL", 0);
ic = ImageclassFind("ICONBOX_SCROLLBAR_KNOB_VERTICAL", 1);
if (ic)
{
state = STATE_NORMAL;
@ -728,7 +726,7 @@ ContainerDrawScroll(Container * ct)
if (arrow_mode < 3)
{
ic = ImageclassFind("ICONBOX_ARROW_UP", 0);
ic = ImageclassFind("ICONBOX_ARROW_UP", 1);
if (ic)
{
state = STATE_NORMAL;
@ -739,7 +737,7 @@ ContainerDrawScroll(Container * ct)
ImageclassApply(ic, ct->arrow1_win, 0, 0, state, ST_ICONBOX);
}
ic = ImageclassFind("ICONBOX_ARROW_DOWN", 0);
ic = ImageclassFind("ICONBOX_ARROW_DOWN", 1);
if (ic)
{
state = STATE_NORMAL;
@ -756,13 +754,13 @@ ContainerDrawScroll(Container * ct)
if (ct->w < 2 * ct->arrow_thickness + ct->knob_length)
arrow_mode = 3; /* No arrows */
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 0);
pad = ImageclassGetPadding(ic);
ic_sbb = ImageclassFind("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 1);
pad = ImageclassGetPadding(ic_sbb);
if (arrow_mode < 3)
bs = ct->w - (ct->arrow_thickness * 2);
else
bs = ct->w;
if (ic)
if (pad)
bs -= pad->left + pad->right;
bw = (ct->w * bs) / ct->max;
if (bs < 1)
@ -772,7 +770,7 @@ ContainerDrawScroll(Container * ct)
if (bw < 1)
bw = 1;
bx = ((ct->pos * bs) / ct->max);
if (ic)
if (pad)
bx += pad->left;
if ((ct->scrollbar_hide) && (bw == bs))
goto do_hide_sb;
@ -902,11 +900,9 @@ ContainerDrawScroll(Container * ct)
(ct->scroll_thickness - ct->bar_thickness) / 2, bw,
ct->bar_thickness);
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 0);
if (ic)
ImageclassApply(ic, ct->scroll_win, 0, 0, STATE_NORMAL, ST_ICONBOX);
ImageclassApply(ic_sbb, ct->scroll_win, 0, 0, STATE_NORMAL, ST_ICONBOX);
ic = ImageclassFind("ICONBOX_SCROLLBAR_KNOB_HORIZONTAL", 0);
ic = ImageclassFind("ICONBOX_SCROLLBAR_KNOB_HORIZONTAL", 1);
if (ic)
{
state = STATE_NORMAL;
@ -940,7 +936,7 @@ ContainerDrawScroll(Container * ct)
if (arrow_mode < 3)
{
ic = ImageclassFind("ICONBOX_ARROW_LEFT", 0);
ic = ImageclassFind("ICONBOX_ARROW_LEFT", 1);
if (ic)
{
state = STATE_NORMAL;
@ -951,7 +947,7 @@ ContainerDrawScroll(Container * ct)
ImageclassApply(ic, ct->arrow1_win, 0, 0, state, ST_ICONBOX);
}
ic = ImageclassFind("ICONBOX_ARROW_RIGHT", 0);
ic = ImageclassFind("ICONBOX_ARROW_RIGHT", 1);
if (ic)
{
state = STATE_NORMAL;
@ -1297,7 +1293,7 @@ ContainerEventScrollbarWin(Win win __UNUSED__, XEvent * ev, void *prm)
Container *ct = (Container *) prm;
static int px, py, pos0;
int bs, dp;
ImageClass *ic;
ImageClass *ic_sbb;
EImageBorder *pad;
switch (ev->type)
@ -1333,10 +1329,10 @@ ContainerEventScrollbarWin(Win win __UNUSED__, XEvent * ev, void *prm)
if (ct->orientation)
{
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_VERTICAL", 0);
pad = ImageclassGetPadding(ic);
ic_sbb = ImageclassFind("ICONBOX_SCROLLBAR_BASE_VERTICAL", 1);
pad = ImageclassGetPadding(ic_sbb);
bs = ct->h - (ct->arrow_thickness * 2);
if (ic)
if (pad)
bs -= pad->top + pad->bottom;
if (bs < 1)
bs = 1;
@ -1344,10 +1340,10 @@ ContainerEventScrollbarWin(Win win __UNUSED__, XEvent * ev, void *prm)
}
else
{
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 0);
pad = ImageclassGetPadding(ic);
ic_sbb = ImageclassFind("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 1);
pad = ImageclassGetPadding(ic_sbb);
bs = ct->w - (ct->arrow_thickness * 2);
if (ic)
if (pad)
bs -= pad->left + pad->right;
if (bs < 1)
bs = 1;

View File

@ -2204,9 +2204,8 @@ CB_DesktopDisplayRedraw(Dialog * d, int val, void *data)
if (!called)
{
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 0);
if (ic)
ImageclassApply(ic, win, 0, 0, STATE_NORMAL, ST_SOLID);
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 1);
ImageclassApply(ic, win, 0, 0, STATE_NORMAL, ST_SOLID);
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
wins[i] = 0;
called = 1;
@ -2231,9 +2230,8 @@ CB_DesktopDisplayRedraw(Dialog * d, int val, void *data)
}
else
{
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 0);
if (ic)
ImageclassApply(ic, wins[i], 0, 0, STATE_NORMAL, ST_SOLID);
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 1);
ImageclassApply(ic, wins[i], 0, 0, STATE_NORMAL, ST_SOLID);
}
}
}
@ -2445,11 +2443,11 @@ CB_AreaDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
{
ImageClass *ic;
ic = ImageclassFind("SETTINGS_AREA_AREA", 0);
ic = ImageclassFind("SETTINGS_AREA_AREA", 1);
ImageclassApply(ic, win, 0, 0, STATE_NORMAL, ST_SOLID);
awin = ECreateWindow(win, 0, 0, 18, 14, 0);
ic = ImageclassFind("SETTINGS_AREADESK_AREA", 0);
ic = ImageclassFind("SETTINGS_AREADESK_AREA", 1);
ImageclassApply(ic, awin, 0, 0, STATE_NORMAL, ST_SOLID);
called = 1;

View File

@ -939,7 +939,7 @@ DialogItemCallCallback(Dialog * d, DItem * di)
static void
DialogRealizeItem(Dialog * d, DItem * di)
{
const char *def = NULL;
const char *iclass, *tclass;
int iw = 0, ih = 0;
int register_win_callback;
EImage *im;
@ -949,43 +949,60 @@ DialogRealizeItem(Dialog * d, DItem * di)
return;
di->realized = 1;
iclass = tclass = NULL;
if (di->type == DITEM_BUTTON)
{
def = "DIALOG_WIDGET_BUTTON";
iclass = "DIALOG_WIDGET_BUTTON";
tclass = iclass;
}
else if (di->type == DITEM_CHECKBUTTON)
{
def = "DIALOG_WIDGET_CHECK_BUTTON";
iclass = "DIALOG_WIDGET_CHECK_BUTTON";
tclass = iclass;
}
else if (di->type == DITEM_TEXT)
{
def = "DIALOG_WIDGET_TEXT";
tclass = "DIALOG_WIDGET_TEXT";
}
else if (di->type == DITEM_SEPARATOR)
{
def = "DIALOG_WIDGET_SEPARATOR";
}
else if (di->type == DITEM_TABLE)
{
def = "DIALOG_WIDGET_TABLE";
iclass = "DIALOG_WIDGET_SEPARATOR";
}
else if (di->type == DITEM_RADIOBUTTON)
{
def = "DIALOG_WIDGET_RADIO_BUTTON";
iclass = "DIALOG_WIDGET_RADIO_BUTTON";
tclass = iclass;
}
#if 0
else if (di->type == DITEM_SLIDER)
{
iclass = NULL;
}
#endif
else if (di->type == DITEM_AREA)
{
def = "DIALOG_WIDGET_AREA";
}
else
{
def = "DIALOG_WIDGET_BUTTON";
iclass = "DIALOG_WIDGET_AREA";
}
if (!di->iclass)
di->iclass = ImageclassAlloc(def, 1);
if (!di->tclass)
di->tclass = TextclassAlloc(def, 1);
if (!di->iclass && iclass)
{
di->iclass = ImageclassAlloc(iclass, 1);
if (!di->iclass)
{
di->type = DITEM_NONE;
return;
}
}
if (!di->tclass && tclass)
{
di->tclass = TextclassAlloc(tclass, 1);
if (!di->tclass)
{
di->type = DITEM_NONE;
return;
}
}
if (di->type == DITEM_TABLE)
{
@ -1713,7 +1730,7 @@ DialogDrawItem(Dialog * d, DItem * di)
draw_text:
di->state = state;
if (!di->text)
if (!di->text || !di->tclass)
break;
if (!d->redraw)
EXCopyAreaTiled(d->pmm_bg.pmap, None, WinGetPmap(d->win),

View File

@ -84,6 +84,8 @@ struct _imageclass {
static Ecore_List *iclass_list = NULL;
static ImageClass *ImageclassGetFallback(void);
#ifdef ENABLE_THEME_TRANSPARENCY
static EImageColorModifier *icm = NULL;
@ -422,10 +424,10 @@ ImageclassFind(const char *name, int fallback)
if (ic || !fallback)
return ic;
ic = (ImageClass *) ecore_list_find(iclass_list, _ImageclassMatchName,
"__FALLBACK_ICLASS");
return ic;
#if 0
Eprintf("%s: Get fallback (%s)\n", __func__, name);
#endif
return ImageclassGetFallback();
}
#define ISTATE_SET_STATE(which, fallback) \
@ -1313,13 +1315,19 @@ ImageclassApplyCopy(ImageClass * ic, Win win, int w, int h,
}
}
static void
ImageclassSetupFallback(void)
static ImageClass *
ImageclassGetFallback(void)
{
ImageClass *ic;
/* create a fallback imageclass in case no imageclass can be found */
ic = ImageclassCreate("__FALLBACK_ICLASS");
ic = ImageclassFind("__fb_ic", 0);
if (ic)
return ic;
/* Create fallback imageclass */
ic = ImageclassCreate("__fb_ic");
if (!ic)
return ic;
ic->norm.normal = ImagestateCreate(NULL);
ImagestateColorsSetGray(ic->norm.normal, 255, 255, 160, 0, 0);
@ -1348,37 +1356,42 @@ ImageclassSetupFallback(void)
SET_COLOR(&(ic->active.clicked->bg), 230, 190, 210);
ic->active.clicked->bevelstyle = BEVEL_AMIGA;
ic->padding.left = 8;
ic->padding.right = 8;
ic->padding.top = 8;
ic->padding.bottom = 8;
ic->padding.left = 4;
ic->padding.right = 4;
ic->padding.top = 4;
ic->padding.bottom = 4;
ImageclassPopulate(ic);
return ic;
}
ImageClass *
ImageclassGetBlack(void)
{
ImageClass *ic;
ic = ImageclassFind("__BLACK", 0);
if (ic)
return ic;
/* Create all black image class for filler borders */
ic = ImageclassCreate("__BLACK");
if (!ic)
return ic;
ic->norm.normal = ImagestateCreate(NULL);
ImagestateColorsSetGray(ic->norm.normal, 0, 0, 0, 0, 0);
ImageclassPopulate(ic);
return ic;
}
/*
* Imageclass Module
*/
static void
ImageclassSighan(int sig, void *prm __UNUSED__)
{
switch (sig)
{
case ESIGNAL_INIT:
ImageclassSetupFallback();
break;
}
}
static void
ImageclassIpc(const char *params)
{
@ -1549,7 +1562,7 @@ ImageclassIpc(const char *params)
static const IpcItem ImageclassIpcArray[] = {
{
ImageclassIpc,
"imageclass", NULL,
"imageclass", "ic",
"List imageclasses, apply an imageclass",
NULL}
,
@ -1562,7 +1575,7 @@ static const IpcItem ImageclassIpcArray[] = {
extern const EModule ModImageclass;
const EModule ModImageclass = {
"imageclass", "ic",
ImageclassSighan,
NULL,
{N_IPC_FUNCS, ImageclassIpcArray}
,
{0, NULL}

View File

@ -109,6 +109,7 @@ EImageBorder *ImageclassGetPadding(ImageClass * ic);
ImageState *ImageclassGetImageState(ImageClass * ic, int state,
int active, int sticky);
ImageClass *ImageclassCreateSimple(const char *name, const char *image);
ImageClass *ImageclassGetBlack(void);
EImage *ImageclassGetImage(ImageClass * ic, int active, int sticky,
int state);
void ImageclassApplySimple(ImageClass * ic, Win win,

View File

@ -378,13 +378,6 @@ MenuShow(Menu * m, char noshow)
m->ref_count++;
}
static void
MenuStyleSetName(MenuStyle * ms, const char *name)
{
Efree(ms->name);
ms->name = Estrdup(name);
}
static MenuStyle *
MenuStyleCreate(const char *name)
{
@ -398,8 +391,8 @@ MenuStyleCreate(const char *name)
menu_style_list = ecore_list_new();
ecore_list_prepend(menu_style_list, ms);
ms->name = Estrdup(name);
ms->iconpos = ICON_LEFT;
MenuStyleSetName(ms, name);
return ms;
}
@ -437,8 +430,28 @@ _MenuStyleMatchName(const void *data, const void *match)
MenuStyle *
MenuStyleFind(const char *name)
{
return (MenuStyle *) ecore_list_find(menu_style_list, _MenuStyleMatchName,
name);
MenuStyle *ms;
ms = (MenuStyle *) ecore_list_find(menu_style_list, _MenuStyleMatchName,
name);
if (ms)
return ms;
ms = (MenuStyle *) ecore_list_find(menu_style_list, _MenuStyleMatchName,
"__fb_ms");
if (ms)
return ms;
ms = MenuStyleCreate("__fb_ms");
if (!ms)
return ms;
ms->tclass = TextclassFind(NULL, 1);
ms->bg_iclass = ImageclassFind(NULL, 1);
ms->item_iclass = ImageclassFind(NULL, 1);
ms->sub_iclass = ImageclassFind(NULL, 1);
return ms;
}
void
@ -1930,7 +1943,7 @@ MenuConfigLoad(FILE * fs)
sscanf(p3, "%s %n", s3, &len);
ic = NULL;
if (strcmp("NULL", s3))
ic = ImageclassFind(s3, 0);
ic = ImageclassFind(s3, 1);
mm = MenuFind(s2, NULL);
mi = MenuItemCreate(p3 + len, ic, NULL, mm);
MenuAddItem(m, mi);

View File

@ -33,6 +33,8 @@
static Ecore_List *tclass_list = NULL;
static TextClass *TextclassGetFallback(void);
static char *
TextstateFontLookup(const char *name)
{
@ -229,10 +231,10 @@ TextclassFind(const char *name, int fallback)
if (tc || !fallback)
return tc;
tc = (TextClass *) ecore_list_find(tclass_list, _TextclassMatchName,
"__FALLBACK_TCLASS");
return tc;
#if 0
Eprintf("%s: Get fallback (%s)\n", __func__, name);
#endif
return TextclassGetFallback();
}
int
@ -369,28 +371,32 @@ TextclassConfigLoad(FILE * fs)
return err;
}
/*
* Textclass Module
*/
static void
TextclassSighan(int sig, void *prm __UNUSED__)
static TextClass *
TextclassGetFallback(void)
{
TextClass *tc;
switch (sig)
{
case ESIGNAL_INIT:
/* create a fallback textclass in case no textclass is found */
tc = TextclassCreate("__FALLBACK_TCLASS");
tc->norm.normal =
TextstateCreate("-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*");
SET_COLOR(&(tc->norm.normal->fg_col), 0, 0, 0);
TextclassPopulate(tc);
break;
}
tc = TextclassFind("__fb_tc", 0);
if (tc)
return tc;
/* Create fallback textclass */
tc = TextclassCreate("__fb_tc");
if (!tc)
return tc;
tc->norm.normal =
TextstateCreate("-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*");
SET_COLOR(&(tc->norm.normal->fg_col), 0, 0, 0);
TextclassPopulate(tc);
return tc;
}
/*
* Textclass Module
*/
static void
TextclassIpc(const char *params)
{
@ -513,7 +519,7 @@ TextclassIpc(const char *params)
static const IpcItem TextclassIpcArray[] = {
{
TextclassIpc,
"textclass", NULL,
"textclass", "tc",
"List textclasses, apply a textclass",
NULL}
,
@ -526,7 +532,7 @@ static const IpcItem TextclassIpcArray[] = {
extern const EModule ModTextclass;
const EModule ModTextclass = {
"textclass", "tc",
TextclassSighan,
NULL,
{N_IPC_FUNCS, TextclassIpcArray}
,
{0, NULL}

View File

@ -179,6 +179,9 @@ TextImagePut(EImage * im, Win win, Drawable dst, int x, int y,
TextState *
TextclassGetTextState(TextClass * tclass, int state, int active, int sticky)
{
if (!tclass)
return NULL;
if (active)
{
if (!sticky)

View File

@ -373,7 +373,8 @@ ThemeFind(const char *theme)
return ret;
}
ret = ThemeGetDefault();
if (strcmp(theme, "-"))
ret = ThemeGetDefault();
#if ENABLE_THEME_SANITY_CHECKING
badtheme = Estrdup(theme);
#endif
@ -427,7 +428,7 @@ ThemePathFind(void)
Conf.theme.name = (theme) ? fullfileof(theme) : NULL;
Efree(Mode.theme.path);
Mode.theme.path = theme;
Mode.theme.path = (theme) ? theme : Estrdup("-");
}
static void