home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Enlightenment / enl_BETA-0.13.src.tar.gz / enl_BETA-0.13.src.tar / enl-0.13 / root.c < prev    next >
C/C++ Source or Header  |  1997-11-17  |  1KB  |  45 lines

  1. #include "enlightenment.h"
  2.  
  3. void SetRoot(void) {
  4.     Image *root_im;
  5.     unsigned int w,h,dummyui;
  6.     Pixmap pmap;
  7.     Window wdummy;
  8.     int im_w,im_h,dummy;
  9.  
  10.     Do_ChangeMouseCursor("default");
  11.     if (!desk.background[desk.current][0]) 
  12.         return;
  13.     strcpy(cfg.root_pname,desk.background[desk.current]);
  14.     root_im=LoadImage(imd,cfg.root_pname,NULL);
  15.     XGetGeometry(disp,root,&wdummy,&dummy,&dummy,&w,&h,&dummyui,&dummyui);
  16.     if (desk.bg_width[desk.current]==0) 
  17.         im_w=root_im->rgb_width;
  18.     else if (desk.bg_width[desk.current]==-1) 
  19.         im_w=w;
  20.     else 
  21.         im_w=desk.bg_width[desk.current];
  22.     if (desk.bg_height[desk.current]==0) 
  23.         im_h=root_im->rgb_height;
  24.     else if (desk.bg_height[desk.current]==-1) 
  25.         im_h=h;
  26.     else 
  27.         im_w=desk.bg_height[desk.current];
  28.     ImlibRender(imd,root_im,im_w,im_h);
  29.     pmap=ImlibMoveImageToPixmap(imd,root_im);
  30.     if (desk.di[desk.current].root_pmap) 
  31.         ImlibFreePixmap(imd,desk.di[desk.current].root_pmap);
  32.     ImlibRender(imd,root_im,(desk.di[desk.current].root_width*im_w)/w,
  33.             (desk.di[desk.current].root_height*im_h)/h);
  34.     desk.di[desk.current].root_pmap=ImlibMoveImageToPixmap(imd,root_im);
  35.     XSetWindowBackgroundPixmap(disp,desk.di[desk.current].root_win,
  36.             desk.di[desk.current].root_pmap);
  37.     XClearWindow(disp,desk.di[desk.current].root_win);
  38.     root_pm=pmap;
  39.     desk.bg_pmap[desk.current]=pmap;
  40.     ImlibDestroyImage(imd,root_im);
  41.     XSetWindowBackgroundPixmap(disp,root,pmap);
  42.     XClearWindow(disp,root);
  43.     XSync(disp,False);
  44. }
  45.