Enable using ImageClass as menu icon
Before 00c261652e
the menu item icon
was always an ImageClass name.
After changing this to be a file name some themes defining menus
(e.g. Ganymede with button tweaks) did not work as intended wrt. button
menus.
So now we accept both.
This commit is contained in:
parent
ca5040e643
commit
2f0b4464fc
15
src/iclass.c
15
src/iclass.c
|
@ -640,6 +640,21 @@ ImageclassGetImage(ImageClass * ic, int active, int sticky, int state)
|
|||
return im;
|
||||
}
|
||||
|
||||
char *
|
||||
ImageclassGetFile(ImageClass * ic)
|
||||
{
|
||||
ImageState *is;
|
||||
|
||||
if (!ic)
|
||||
return NULL;
|
||||
|
||||
is = ImageclassGetImageState(ic, STATE_NORMAL, 0, 0);
|
||||
if (!is || !is->im_file)
|
||||
return NULL;
|
||||
|
||||
return ThemeFileFind(is->im_file, FILE_TYPE_IMAGE);
|
||||
}
|
||||
|
||||
EImage *
|
||||
ImageclassGetImageBlended(ImageClass * ic, Win win __UNUSED__, int w, int h,
|
||||
int active, int sticky, int state)
|
||||
|
|
|
@ -65,6 +65,7 @@ ImageState *ImageclassGetImageState(ImageClass * ic, int state,
|
|||
int active, int sticky);
|
||||
ImageClass *ImageclassCreateSimple(const char *name, const char *image);
|
||||
ImageClass *ImageclassGetBlack(void);
|
||||
char *ImageclassGetFile(ImageClass * ic);
|
||||
EImage *ImageclassGetImage(ImageClass * ic, int active, int sticky,
|
||||
int state);
|
||||
void ImageclassApplySimple(ImageClass * ic, Win win,
|
||||
|
|
11
src/menus.c
11
src/menus.c
|
@ -686,6 +686,7 @@ MenuRealize(Menu * m)
|
|||
{
|
||||
int i, maxh, maxw, nmaxy;
|
||||
int maxx1, maxx2, w, h, x, y, r, mmw, mmh;
|
||||
char *s;
|
||||
EImage *im;
|
||||
EImageBorder *pad, *pad_item, *pad_sub;
|
||||
char has_i, has_s;
|
||||
|
@ -741,6 +742,16 @@ MenuRealize(Menu * m)
|
|||
if (m->items[i]->icon && Conf.menus.show_icons)
|
||||
{
|
||||
im = EImageLoad(m->items[i]->icon);
|
||||
if (!im)
|
||||
{
|
||||
s = ImageclassGetFile(ImageclassFind(m->items[i]->icon, 0));
|
||||
im = EImageLoad(s);
|
||||
if (im)
|
||||
{
|
||||
Efree(m->items[i]->icon);
|
||||
m->items[i]->icon = s;
|
||||
}
|
||||
}
|
||||
if (im)
|
||||
{
|
||||
w = h = 0;
|
||||
|
|
Loading…
Reference in New Issue