1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 14:42:29 +01:00

Better default icon management

This patch replaces the Pixmap icons from screen.h with only one
RImage. This image is not processed yet, therefore could be used
for icons with title or without it (replacing def_ticon_pixmap and
def_icon_pixmap variables).

Now the code is better because the Pixmap is generated and saved in
the icon structure.

See that before this patch, the icon->pixmap was set to None!!
With this patch, the icon->pixmap is saved, using the common
method used in the other functions to create Pixmaps, the function
icon_update_pixmap().
This commit is contained in:
Rodolfo García Peñas (kix)
2012-10-23 23:59:57 +02:00
committed by Carlos R. Mafra
parent 4f4b7655de
commit ff9f942c47
3 changed files with 17 additions and 30 deletions

View File

@@ -628,28 +628,20 @@ void wIconUpdate(WIcon *icon)
static void get_pixmap_icon_from_user_icon(WIcon *icon)
{
RImage *image = NULL;
WScreen *scr = icon->core->screen_ptr;
/* If the icon has image, update it and continue */
if (icon->file_image) {
icon_update_pixmap(icon, icon->file_image);
} else {
/* make default icons */
if (!scr->def_icon_pixmap) {
image = get_default_image(scr);
scr->def_icon_pixmap = makeIcon(scr, image, False, False, icon->tile_type, icon->highlighted);
scr->def_ticon_pixmap = makeIcon(scr, image, True, False, icon->tile_type, icon->highlighted);
if (image)
RReleaseImage(image);
}
if (icon->show_title)
XSetWindowBackgroundPixmap(dpy, icon->core->window, scr->def_ticon_pixmap);
else
XSetWindowBackgroundPixmap(dpy, icon->core->window, scr->def_icon_pixmap);
icon->pixmap = None;
return;
}
/* If the icon don't have image, we should use the default image. */
if (!scr->def_icon_rimage)
scr->def_icon_rimage = get_default_image(scr);
/* Now, create the pixmap using the default (saved) image */
icon_update_pixmap(icon, scr->def_icon_rimage);
}
/* This function creates the RImage using the default icon */