home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / dv_x / dvix.zip / SETICON.C < prev    next >
C/C++ Source or Header  |  1992-12-07  |  1KB  |  48 lines

  1. /*
  2.  * SetIcon.c defines icon for X application
  3.  *
  4.  * usage: SetIcon(theDisplay, theWindow);
  5.  *
  6.  * do a global replace on "icon" and "mask"
  7.  * GBP
  8.  * Nov 16, 1992
  9.  */
  10.  
  11. #include <X11/Xlib.h>
  12. #include <X11/Xutil.h> 
  13.  
  14. #include "icon.bit"
  15. #include "mask.bit"
  16.  
  17. SetIcon(dsp, wnd)
  18.     Display    *dsp;
  19.     Window    wnd;
  20. {
  21.  
  22.     Pixmap      icon_bmp, icon_mask_bmp;
  23.     XWMHints      xwmh;
  24.  
  25. /* create icon bitmap */    
  26.     if ((icon_bmp=XCreateBitmapFromData(dsp,wnd,
  27.                                         icon_bits,
  28.                                         icon_width,
  29.                                         icon_height))==None)
  30.         printf("Error on icon creation\n");
  31.  
  32. /* create mask bitmap */
  33.     if ((icon_mask_bmp=XCreateBitmapFromData(dsp,wnd,
  34.                                         mask_bits,
  35.                                         mask_width,
  36.                                         mask_height))==None)
  37.         printf("Error on icon mask creation\n");
  38.  
  39. /* define the WM attributes */
  40.     xwmh.flags = IconPixmapHint |
  41.                  IconMaskHint;
  42.     xwmh.icon_pixmap = icon_bmp;
  43.     xwmh.icon_mask   = icon_mask_bmp;
  44.  
  45. /* set the Wm attribrutes */
  46.     XSetWMHints(dsp,wnd,&xwmh);
  47.