/**************************************************************************** * * Creates an Icon Window * Loads an icon file and combines icon shape masks after a resize * special thanks to Rich Neitzel <*****@*****.**> * for his patch to handle icon windows * ****************************************************************************/ void CreateIconWindow(struct icon_info *item) { unsigned long valuemask; /* mask for create windows */ XSetWindowAttributes attributes; /* attributes for create windows */ attributes.background_pixel = icon_back_pix; attributes.border_pixel = 0; attributes.colormap = Pcmap; attributes.event_mask = ExposureMask; valuemask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; /* ccreate the icon label */ item->IconWin = XCreateWindow(dpy, icon_win, 0, 0, max_icon_width, max_icon_height + 10, 0, CopyFromParent, CopyFromParent, CopyFromParent, valuemask, &attributes); XSelectInput(dpy, item->IconWin, ICON_EVENTS); XSelectInput(dpy, item->id, PropertyChangeMask); item->wmhints = XGetWMHints(dpy, item->id); if (max_icon_height == 0) return; /* config specified icons have priority */ if ((item->icon_file != NULL) && !(item->extra_flags & DEFAULTICON)) { /* monochrome bitmap */ GetBitmapFile(item); /* color pixmap */ if((item->icon_w == 0) && (item->icon_h == 0)) GetXPMFile(item); } /* next come program specified icon windows and pixmaps*/ if((item->icon_h == 0) && (item->icon_w == 0) && item->wmhints) { if (item->wmhints->flags & IconWindowHint) GetIconWindow(item); else if (item->wmhints->flags & IconPixmapHint) GetIconBitmap(item); } /* if that all fails get the default */ if ((item->icon_file != NULL) && (item->icon_h == 0) && (item->icon_w == 0)) { /* monochrome bitmap */ GetBitmapFile(item); /* color pixmap */ if((item->icon_w == 0) && (item->icon_h == 0)) GetXPMFile(item); } /* create the window to hold the pixmap */ /* if using a non default visual client pixmaps must have a default visual window to be drawn into */ if (IS_ICON_OURS(item)) { if (Pdefault | (item->icon_depth == 1) | IS_PIXMAP_OURS(item)){ item->icon_pixmap_w = XCreateWindow(dpy, icon_win, 0, 0, max(max_icon_width, item->icon_w), max(max_icon_height, item->icon_h), 0, CopyFromParent, CopyFromParent, CopyFromParent, valuemask, &attributes); } else { attributes.background_pixel = 0; attributes.colormap = DefaultColormap(dpy, screen); item->icon_pixmap_w = XCreateWindow(dpy, icon_win, 0, 0, max(max_icon_width,item->icon_w), max(max_icon_height,item->icon_h), 0, DefaultDepth(dpy, screen), InputOutput, DefaultVisual(dpy, screen), valuemask, &attributes); } XSelectInput(dpy, item->icon_pixmap_w, ICON_EVENTS); } #ifdef XPM if (FShapesSupported && item->icon_maskPixmap != None) { int hr; hr = (Pdefault | (item->icon_depth == 1) | IS_PIXMAP_OURS(item)) ? icon_relief/2 : 0; FShapeCombineMask( dpy, item->icon_pixmap_w, FShapeBounding, hr, hr, item->icon_maskPixmap, FShapeSet); } #endif if(item->icon_depth == -1 ) { Pixmap temp = item->iconPixmap; item->iconPixmap = XCreatePixmap(dpy, Root, item->icon_w, item->icon_h, Pdepth); XCopyPlane(dpy, temp, item->iconPixmap, NormalGC, 0, 0, item->icon_w, item->icon_h, 0, 0, 1); } }
EXPORT_C TInt GetIconBitmap(TInt index) { return GetIconBitmap(index, iconId, KNbIcons); }