kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=2f0b4464fce23a663217e85b5428c13eecb2a83c
commit 2f0b4464fce23a663217e85b5428c13eecb2a83c Author: Kim Woelders <[email protected]> Date: Sun Feb 4 08:48:58 2018 +0100 Enable using ImageClass as menu icon Before 00c261652ed39824fa21d884c1687c196969ecfa 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. --- src/iclass.c | 15 +++++++++++++++ src/iclass.h | 1 + src/menus.c | 11 +++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/iclass.c b/src/iclass.c index 557dcafd..92fe7f59 100644 --- a/src/iclass.c +++ b/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) diff --git a/src/iclass.h b/src/iclass.h index 132d0c71..896fa378 100644 --- a/src/iclass.h +++ b/src/iclass.h @@ -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, diff --git a/src/menus.c b/src/menus.c index a22fc336..fbc58af8 100644 --- a/src/menus.c +++ b/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; --
