icewm icon indicating copy to clipboard operation
icewm copied to clipboard

SVG Icons

Open tenplus1 opened this issue 6 years ago • 8 comments

Most ison sets contain SVG icons but for some reason icewm refuses to display these and can only handle png images. Any chance of working svg support ?

tenplus1 avatar Jun 02 '18 09:06 tenplus1

Yes, I looked at this. Unfortunately, many of the SVG libraries are massive and intertwined with other things. It seems the lightest is libsvg-cairo. But then, needing cairo, it might as well be used for rendering as well. Also, it is a short step from their to pango. It would have to be optional for those that don't want the bloat.

bbidulock avatar Jun 02 '18 23:06 bbidulock

How about if svg libs already exist then make use of them, otherwise it's not a dependency.

tenplus1 avatar Jun 03 '18 07:06 tenplus1

You could also configure --enable-gdk-pixbuf. See commit cbe949d1fe5570d5265d2a7e016b86e5b9ecdb1d.

gijsbers avatar Jun 03 '18 07:06 gijsbers

--enable-gdk-pixbuf is not enough. librsvg has to also be loaded to provide the back-end svg pixbuf loader, otherwise, loading svg files will just fail.

Now, librsvg is heavy itself, it load cairo, pango, libcroco, glib2, gdk-pixbuf2, and is quite large by itself. Also, with all this bloat loaded, you could add gtk2 with not much extra cost. (Then you might as well use metacity2) Even still you do not get server side compositing and totally waste cairo's Xrender back-end, because gdk-pixbuf2 only does client-side compositing without alpha blending. Imlib2 isn't any better (client-side compositing only, but at least has alpha-blending).

So, if loading cairo, why not use cairo directly? It supports an Xrender backend that performs server-side compositing and alpha blending, which is rather important when scaling down large .png icons: getting the alpha blended scaled-down transparency edges correct. So, libsvg-cairo would accomplish this much better and allow the cairo to be used directly and avoid the bloat and crippling effects of gdk-pixbuf2.

bbidulock avatar Jun 03 '18 20:06 bbidulock

Yes, libraries could be dlloaded, but IceWM is just not wired that way right now. It uses macros set at ./configure time to determine availability of libraries. The autoconf macros already detect what is available and uses them when available. Do this at load time is a bit different story. Not sure which you meant, @tenplus1

glib2 is not such an onerous requirement anymore (since gpg requires it). It is even part of "core" under ArchLinux. Now, glib2 implements the entire XDG icon theme specification, and so it could be looking up icons by name instead of full path and filename with extension. One can even set one's preferences with regard to SVG when performing icon lookups. Everybody else implements XDG icon theme, not sure why IceWM never did: probably because development stopped before the spec was released. When building the xde-menu tool for IceWM, I had to do the XDG icon lookup myself, and then place the full path, filename and extension of the result in icon field in the menu file. Most other window managers it is sufficient just to put the icon name.

bbidulock avatar Jun 03 '18 20:06 bbidulock

If you build with:

cmake -DCONFIG_GDK_PIXBUF_XLIB=on -DCONFIG_LIBRSVG=on -DCONFIG_LIBXPM=off -DCONFIG_LIBPNG=off ..

you should get an IceWM that supports svg.

bbidulock avatar Jun 05 '18 22:06 bbidulock

@tenplus1 can you close this issue if it has been resolved?

bbidulock avatar Sep 21 '18 20:09 bbidulock

I confirm this indeed works. Note that it must be -DCONFIG_XPM=off

and not -DCONFIG_LIBXPM=off

Thyname avatar Sep 04 '19 22:09 Thyname