Exemplo n.º 1
0
void XImlib2Image::configure()
{
    x = iconParent->getX();
    y = iconParent->getY();

    DesktopIconConfig * dIconConfig =
        dynamic_cast<DesktopIconConfig *>(iconConfig);
	
    DesktopConfig * dConfig =
		    dynamic_cast<DesktopConfig *>(config);

    transparency = dConfig->getTransparency();

    width = dIconConfig->getWidth();
    height = dIconConfig->getHeight();
    
    glowing = false;
    glowChange = true;

    colorMod = imlib_create_color_modifier();
    
    fillStyle = dIconConfig->getFillStyle();
    
    XDesktopContainer * xContainer =
		    dynamic_cast<XDesktopContainer *>(container);  
	
    rootWindow = xContainer->getRootWindow();
    widthOfScreen = xContainer->widthOfScreen();
    heightOfScreen = xContainer->heightOfScreen();
    display = xContainer->getDisplay();
    visual = imlib_context_get_visual();
    cmap = imlib_context_get_colormap();
    screen = DefaultScreen(display);
    depth =  DefaultDepth(display,screen);
}
Exemplo n.º 2
0
void XImlib2Shadow::moveWindow(int xCord, int yCord)
{
    XDesktopContainer * xContainer =
        dynamic_cast<XDesktopContainer *>(container);
    XIcon * xIcon = dynamic_cast<XIcon *>(iconParent);

    if (xCord >= 0 &&
        yCord >= 0 &&
        xCord < xContainer->widthOfScreen() &&
        yCord < xContainer->heightOfScreen() )
    {
        x = xCord;
        y = yCord;
        XMoveWindow( xContainer->getDisplay() , window, x, y );
    }
}
Exemplo n.º 3
0
void XImlib2Background::SetMultiImage(Imlib_Image image)
{
      Pixmap pmap = None, mask = None;
      GC gc;
      XGCValues gcv;
      XColor xcolor;
      int w, h, x, y, widthOfScreen, heightOfScreen, screen, depth;
      char *bgcolor = NULL;
      Colormap colormap;
      Display* display;
      Window rootWindow;
      string mode;
      
      DesktopConfig * dConfig =
		    dynamic_cast<DesktopConfig *>(config);
       
      XDesktopContainer * xContainer =
                    dynamic_cast<XDesktopContainer *>(container);
      
      display = xContainer->getDisplay();
      rootWindow = xContainer->getRootWindow();	
      screen = DefaultScreen(display);
      depth =  DefaultDepth(display, screen);
      colormap = DefaultColormap(display, screen);
      widthOfScreen = xContainer->widthOfScreen();
      heightOfScreen = xContainer->heightOfScreen();
      mode = dConfig->getModeBackground();
      
      pixmap = XCreatePixmap(display, rootWindow , widthOfScreen, heightOfScreen, depth);
      
      string color = dConfig->getColorBackground();
      
      if(color != "None"){
      	gcv.foreground = gcv.background = BlackPixel(display, screen);
      
      	bgcolor = (char*)dConfig->getColorBackground().c_str();
      
      	if (bgcolor && XParseColor(display, colormap , bgcolor, &xcolor) && XAllocColor(display,  colormap, &xcolor)) {
	      gcv.foreground = gcv.background = xcolor.pixel;
      	  }
        }
      
      gc = XCreateGC(display, pixmap, (GCForeground | GCBackground), &gcv);
      
        if(image){
		
		imlib_context_set_image(image);
		
		if (mode == "SCALE") {
			w = widthOfScreen;
			h = heightOfScreen;
		} else if (mode == "MIRROR") {
			w = imlib_image_get_width() * 2;
			h = imlib_image_get_height() * 2;
		} else if (mode == "FIT") {
			double x_ratio, y_ratio;
			x_ratio = ((double) widthOfScreen) / ((double)  imlib_image_get_width());
			y_ratio = ((double) heightOfScreen) / ((double) imlib_image_get_height());
			if (x_ratio > y_ratio) {
				x_ratio = y_ratio;
			}
			w = (int) (imlib_image_get_width() * x_ratio);
			h = (int) (imlib_image_get_height() * x_ratio);
		} else {
			w = imlib_image_get_width();
			h = imlib_image_get_height();
		}
      	
		if (mode == "SCALE") {
			XFillRectangle(display, pixmap, gc, 0, 0, w, h);
		}
		if (mode == "CENTER" || mode == "FIT") {
			XFillRectangle(display, pixmap, gc, 0, 0, widthOfScreen, heightOfScreen);
			x = (widthOfScreen - w) >> 1;
			y = (heightOfScreen - h) >> 1;
		} else {