+// must be RGBA8888
+void BC_WindowBase::set_net_icon(VFrame *data)
+{
+ int width = data->get_w(), height = data->get_h();
+ int size = 2 + width * height;
+ unsigned long *icon_data = new unsigned long[size];
+ unsigned long *lp = icon_data;
+ *lp++ = width; *lp++ = height;
+ uint8_t **rows = data->get_rows();
+ for( int y=0; y<height; ++y ) {
+ unsigned *up = (unsigned *)rows[y];
+ for( int x=0; x<width; ++x )
+ *lp++ = *(unsigned *)up++;
+ }
+ Atom NetWMIcon = XInternAtom(display, "_NET_WM_ICON", True);
+ XChangeProperty(top_level->display, top_level->win, NetWMIcon,
+ XA_CARDINAL, 32, PropModeReplace, (unsigned char *)icon_data, size);
+ delete [] icon_data;
+}
+