Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 #include "config.h"
  2 
  3 #include <stdio.h>
  4 #include <stdlib.h>
  5 #include <unistd.h>
  6 #include <X11/Xlib.h>
  7 #include <X11/Intrinsic.h>
  8 #include <X11/xpm.h>
  9 #include <Xm/Xm.h>
 10 
 11 #include "icons.h"
 12 #include "xpm/home.xpm"
 13 #include "xpm/prev.xpm"
 14 #include "xpm/next.xpm"
 15 #include "xpm/movie.xpm"
 16 #include "xpm/snap.xpm"
 17 #include "xpm/mute.xpm"
 18 #include "xpm/exit.xpm"
 19 #include "xpm/tv.xpm"
 20 
 21 static void
 22 add_pixmap(Display *dpy, unsigned long bg,
 23            char *imgname, char *maskname, char **data)
 24 {
 25     XImage *image,*shape;
 26     XpmAttributes attr;
 27     unsigned int x,y;
 28 
 29     memset(&attr,0,sizeof(attr));
 30     XpmCreateImageFromData(dpy,data,&image,&shape,&attr);
 31 
 32     if (maskname) {
 33         XmInstallImage(image,imgname);
 34         if (shape)
 35             XmInstallImage(shape,maskname);
 36         return;
 37     }
 38 
 39     if (shape) {
 40         for (y = 0; y < attr.height; y++)
 41             for (x = 0; x < attr.width; x++)
 42                 if (!XGetPixel(shape, x, y))
 43                     XPutPixel(image, x, y, bg);
 44     }
 45     XmInstallImage(image,imgname);
 46 }
 47 
 48 void
 49 x11_icons_init(Display *dpy, unsigned long bg)
 50 {
 51     add_pixmap(dpy, bg,  "home",   NULL,      home_xpm);
 52     add_pixmap(dpy, bg,  "prev",   NULL,      prev_xpm);
 53     add_pixmap(dpy, bg,  "next",   NULL,      next_xpm);
 54     add_pixmap(dpy, bg,  "movie",  NULL,      movie_xpm);
 55     add_pixmap(dpy, bg,  "snap",   NULL,      snap_xpm);
 56     add_pixmap(dpy, bg,  "mute",   NULL,      mute_xpm);
 57     add_pixmap(dpy, bg,  "exit",   NULL,      exit_xpm);
 58     add_pixmap(dpy, bg,  "TVimg",  "TVmask",  tv_xpm);
 59 }
 60 
  This page was automatically generated by the LXR engine.