Re: [PATCH] Implement _NET_WM_ICON support for retrieving the application icon

"Thomas Leonard" <[email protected]>
Newsgroups gmane.comp.desktop.rox.devel
Message-ID <[email protected]>
2008/5/22 Bernhard Walle <[email protected]>:
> This patch tries first to retrieve the application icon from the
> _NET_WM_ICON property. If that fails, it uses Motif hints as before.
>
> Some toolkits (like Java/Swing) don't set Motif hints for icons at all.
>
> See http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html#id2523482 for
> a description of that standard.

> +       if (XGetWindowProperty(xdisplay, w, gdk_x11_atom_to_xatom(xa__NET_WM_ICON), 0, G_MAXLONG,
> +                       FALSE, AnyPropertyType,  &type, &format, &length,
> +                       &rest, (guchar **)&data) != Success || length <= 2)
> +               return NULL;
> +
> +       gint width = data[0];
> +       gint height = data[1];
> +
> +       p = g_malloc(width * height * sizeof(guint32));
> +       memcpy(p, data + 2, width * height * sizeof(guint32));
> +       XFree(data);

Might be worth checking that width and height are sensible here
(within length), or a buggy app could probably crash us here...


-- 
Dr Thomas Leonard	http://rox.sourceforge.net
GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.