aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2011-08-11 07:48:08 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-08-11 07:48:08 (GMT)
commit1da473bab9fa7b18ae925f8e084465c4c81bc3c9 (patch)
tree955cf93c2fb168e0e146835b5313f535f16448a3
parent822c02e96a88a90540fa622afa5ab196b9ba5a7c (diff)
downloadfluxbox-1da473bab9fa7b18ae925f8e084465c4c81bc3c9.zip
fluxbox-1da473bab9fa7b18ae925f8e084465c4c81bc3c9.tar.bz2
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.
-rw-r--r--src/Ewmh.cc16
1 files 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) {
198 Display* dpy = FbTk::App::instance()->display(); 198 Display* dpy = FbTk::App::instance()->display();
199 int scrn = winclient.screen().screenNumber(); 199 int scrn = winclient.screen().screenNumber();
200 200
201 // the icon will not be used by the client but by
202 // 'menu', 'iconbar', 'titlebar'. all these entities
203 // are created based upon the rootwindow and
204 // the default depth. if we would use winclient.depth()
205 // and winclient.drawable() here we might get into trouble
206 // (xfce4-terminal, skype .. 32bit visuals vs 24bit fluxbox
207 // entities)
208 Drawable parent = winclient.screen().rootWindow().drawable();
209 unsigned int depth = DefaultDepth(dpy, scrn);
210
201 // pick the smallest icon size atm 211 // pick the smallest icon size atm
202 // TODO: find a better criteria 212 // TODO: find a better criteria
203 width = icon_data.begin()->first.first; 213 width = icon_data.begin()->first.first;
204 height = icon_data.begin()->first.second; 214 height = icon_data.begin()->first.second;
205 215
206 // tmp image for the pixmap 216 // tmp image for the pixmap
207 XImage* img_pm = XCreateImage(dpy, DefaultVisual(dpy, scrn), winclient.depth(), 217 XImage* img_pm = XCreateImage(dpy, DefaultVisual(dpy, scrn), depth,
208 ZPixmap, 218 ZPixmap,
209 0, NULL, width, height, 32, 0); 219 0, NULL, width, height, 32, 0);
210 if (!img_pm) { 220 if (!img_pm) {
@@ -280,8 +290,8 @@ void extractNetWmIcon(Atom net_wm_icon, WinClient& winclient) {
280 290
281 // the final icon 291 // the final icon
282 FbTk::PixmapWithMask icon; 292 FbTk::PixmapWithMask icon;
283 icon.pixmap() = FbTk::FbPixmap(winclient.drawable(), width, height, winclient.depth()); 293 icon.pixmap() = FbTk::FbPixmap(parent, width, height, depth);
284 icon.mask() = FbTk::FbPixmap(winclient.drawable(), width, height, 1); 294 icon.mask() = FbTk::FbPixmap(parent, width, height, 1);
285 295
286 FbTk::GContext gc_pm(icon.pixmap()); 296 FbTk::GContext gc_pm(icon.pixmap());
287 FbTk::GContext gc_mask(icon.mask()); 297 FbTk::GContext gc_mask(icon.mask());