]> Dogcows Code - chaz/openbox/commitdiff
set the default icon onto windows which don't provide one
authorDana Jansens <danakj@orodu.net>
Tue, 24 Apr 2007 15:56:37 +0000 (15:56 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 24 Apr 2007 15:56:37 +0000 (15:56 +0000)
openbox/client.c

index 0ff67ac51fc2c970f64c29280378dbca3d3f0b1d..2f4e177241b3a186595a8d09d0532bd508bda899 100644 (file)
@@ -1887,7 +1887,25 @@ void client_update_icons(ObClient *self)
         }
     }
 
-    if (self->frame)
+    /* set the default icon onto the window
+       in theory, this could be a race, but if a window doesn't set an icon
+       or removes it entirely, it's not very likely it is going to set one
+       right away afterwards */
+    if (self->nicons == 0) {
+        RrPixel32 *icon = ob_rr_theme->def_win_icon;
+
+        data = g_new(guint32, 48*48+2);
+        data[0] = data[1] =  48;
+        for (i = 0; i < 48*48; ++i)
+            data[i+2] = (((icon[i] >> RrDefaultAlphaOffset) & 0xff) << 24) +
+                (((icon[i] >> RrDefaultRedOffset) & 0xff) << 16) +
+                (((icon[i] >> RrDefaultGreenOffset) & 0xff) << 8) +
+                (((icon[i] >> RrDefaultBlueOffset) & 0xff) << 0);
+        PROP_SETA32(self->window, net_wm_icon, cardinal, data, 48*48+2);
+        g_free(data);
+    } else if (self->frame)
+        /* don't draw the icon empty if we're just setting one now anyways,
+           we'll get the property change any second */
         frame_adjust_icon(self->frame);
 }
 
This page took 0.032987 seconds and 4 git commands to generate.