There is another problem with X11 icon:
window.icon((char *)p); does not support transparency.
The reason is simple: transparency information is carried by the other pixmax
,the variable "mask" in your program and it is not transmitted to window.icon().
To get icon with transparency you have to use Xlib functions:
XGetWMHints() and XSetWMHints() to get X11 to communicate both pixmap to the
window manager.
See the previously posted message fore more details:
http://fltk.org/newsgroups.php?gfltk.general+v:24241
Jacques Senecal
> >Jacques Senecal.
> >
> >
>
> Thanks, that prevents the crash but the icon is not shown in the window.
> I have this now:
>
> #include <fltk/x11.h>
> #include <fltk/run.h>
> #include <fltk/Window.h>
> #include <X11/xpm.h>
> #include "../icons/viewer.xpm"
>
> #include <iostream>
>
> int main( int argc, char** argv )
> {
>
>
> fltk::Window window( 120, 220 );
>
>
> window.show();
>
> Pixmap p, mask;
>
> if ( XpmCreatePixmapFromData(fltk::xdisplay,
> DefaultRootWindow(fltk::xdisplay),
> viewer_xpm,
> &p, &mask, NULL) == XpmSuccess )
> {
> // uncomment to crash program
> window.icon((char *)p);
> std::cerr << "set icon" << std::endl;
> }
>
> fltk::run();
> return 0;
> }
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk