From 1da473bab9fa7b18ae925f8e084465c4c81bc3c9 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Thu, 11 Aug 2011 09:48:08 +0200 Subject: Use _NET_WM_ICON from 32bit apps (xfce4-terminal) correctly The icons coming from _NET_WM_ICON are argb32. fluxbox uses such icons in entities such as 'clientmenu', 'iconbar', 'titlebar'. These entities are not related to the depth of the winclient but to fluxbox's default depth. Using 'winclient.depth()' is a mistake, since fluxbox is unable to copy pixmaps from 32bit to 24/16/15bit. It is not necessary either, because fluxbox should extract the argb32 icon data directly into the pixmap with the correct depth in the first place. This fixes (reopened) bug #1852693. Note: The whole icon code in fluxbox is quite messy, lots of copying and scaling. It might be simpler and fater to just extract the icon when needed , in just the size that is needed. --- src/Ewmh.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 52568a1..291c39b 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -198,13 +198,23 @@ void extractNetWmIcon(Atom net_wm_icon, WinClient& winclient) { Display* dpy = FbTk::App::instance()->display(); int scrn = winclient.screen().screenNumber(); + // the icon will not be used by the client but by + // 'menu', 'iconbar', 'titlebar'. all these entities + // are created based upon the rootwindow and + // the default depth. if we would use winclient.depth() + // and winclient.drawable() here we might get into trouble + // (xfce4-terminal, skype .. 32bit visuals vs 24bit fluxbox + // entities) + Drawable parent = winclient.screen().rootWindow().drawable(); + unsigned int depth = DefaultDepth(dpy, scrn); + // pick the smallest icon size atm // TODO: find a better criteria width = icon_data.begin()->first.first; height = icon_data.begin()->first.second; // tmp image for the pixmap - XImage* img_pm = XCreateImage(dpy, DefaultVisual(dpy, scrn), winclient.depth(), + XImage* img_pm = XCreateImage(dpy, DefaultVisual(dpy, scrn), depth, ZPixmap, 0, NULL, width, height, 32, 0); if (!img_pm) { @@ -280,8 +290,8 @@ void extractNetWmIcon(Atom net_wm_icon, WinClient& winclient) { // the final icon FbTk::PixmapWithMask icon; - icon.pixmap() = FbTk::FbPixmap(winclient.drawable(), width, height, winclient.depth()); - icon.mask() = FbTk::FbPixmap(winclient.drawable(), width, height, 1); + icon.pixmap() = FbTk::FbPixmap(parent, width, height, depth); + icon.mask() = FbTk::FbPixmap(parent, width, height, 1); FbTk::GContext gc_pm(icon.pixmap()); FbTk::GContext gc_mask(icon.mask()); -- cgit v0.11.2