DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2340
Version: 1.3-feature


This is hardly finished but a hack was inserted into fltk2.0. The
window->icon() value points at exactly the data, which is an array of
unsigned. array[0] is the width, array[1] is the height, and array[2..n]
are all the pixel values as ARGB. Note that as implemented this does not
port to any other system, a better approach would be to use an fltk Image
and set it as the icon, and use platform-specific code to extract the
image and send it correctly to the system.

      // FLTK2 uses the freedesktop.org new-style icons. This is an
      // array of 32-bit unsigned values: w,h,(w*h)*argb, repeated
      // for multiple sizes of image. Currently only a single image
      // is allowed since otherwise the size of the data cannot be
      // figured out...
      // warning: this code assumes sizeof(unsigned)==4!
      unsigned* data = (unsigned*)(window->icon());
      unsigned size = data[0]*data[1]+2;
      static Atom _NET_WM_ICON = 0;
      if (!_NET_WM_ICON) _NET_WM_ICON =
                           XInternAtom(xdisplay, "_NET_WM_ICON", 0);
      XChangeProperty(xdisplay, x->xid, _NET_WM_ICON,
                      XA_CARDINAL, 32, PropModeReplace,
                      (uchar*)data, size);


Link: http://www.fltk.org/str.php?L2340
Version: 1.3-feature

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to