This patch implements support for icons in user-defined menus into Openbox
authorKadlcik Libor <KadlSoft@seznam.cz>
Tue, 25 Mar 2008 20:58:12 +0000 (21:58 +0100)
committerMikael Magnusson <mikachu@comhem.se>
Mon, 28 Apr 2008 21:57:15 +0000 (23:57 +0200)
commitf3f3be131d1b6c596b3390eeefdd5f0f830b5166
treeb665ca8a210682170666163399e540295b79a418
parenta7bbdf7d6199d1289f5ecc1b4e25632d88d75387
This patch implements support for icons in user-defined menus into Openbox

Image loading is done using the Imlib2 library.
I chose Imlib2 because it's pretty fast, it's easy to use, supports many file
formats (tested xpm, gif, jpeg, png) and doesn't introduce too much bloat (it
depends :)).

I ported the patch to 3.4.7-pre3 and added some enhancements. Caching is much
better now, and icons can be disabled at compile time using --disable-imlib2
option.

What's new?
Syntax of configuration files (namely rc.xml and menu.xml) has been changed
slightly to allow users to associate icons to menu entries. This is done by
specifying path to icon file in the new "icon" attribute in "<item>" element,
e.g:
<item label="Vim" icon="/usr/share/pixmaps/vim-32.xpm">
  <action name="Execute"><execute>x-terminal-emulator -T Vim -e
vim</execute></action>
</item>

If user doesn't want to display any icons in his user-defined menus, he/she can
disable icons in rc.xml, inside "<menu>" section:
<menu>
 ...
  <showIcons>no</showIcons>
 ...
</menu>
Default value is "yes".
(New boolean variable "config_menu_user_show_icons" has been added to source
code.)

An icon is loaded (using menu_item_attach_icon()) when a new entry of menu is
created. Fortunately, I haven't notice any performance problems because of this
:).
12 files changed:
Makefile.am
configure.ac
openbox/config.c
openbox/config.h
openbox/imageload.c [new file with mode: 0644]
openbox/imageload.h [new file with mode: 0644]
openbox/menu.c
render/image.c
render/image.h
render/imagecache.c
render/imagecache.h
render/render.h