From 0352abfa88892bc17bdff2022745e3c1b312edd0 Mon Sep 17 00:00:00 2001 From: Kadlcik Libor Date: Tue, 25 Mar 2008 21:58:12 +0100 Subject: 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 "" element, e.g: x-terminal-emulator -T Vim -e vim If user doesn't want to display any icons in his user-defined menus, he/she can disable icons in rc.xml, inside "" section: ... no ... 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 :). --- obrender/render.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'obrender/render.h') diff --git a/obrender/render.h b/obrender/render.h index 7bea1b54..7aa9d698 100644 --- a/obrender/render.h +++ b/obrender/render.h @@ -232,6 +232,8 @@ struct _RrImagePic { gint sum; }; +typedef void (*RrImageDestroyFunc)(RrImage *image); + /*! An RrImage is a sort of meta-image. It can contain multiple versions of an image at different sizes, which may or may not be completely different pictures */ @@ -250,6 +252,10 @@ struct _RrImage { RrImage. */ RrImagePic **resized; gint n_resized; + + /* This function (if not NULL) will be called just before destroying + RrImage. */ + RrImageDestroyFunc destroy_func; }; /* these are the same on all endian machines because it seems to be dependant -- cgit v1.2.3