1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +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

@@ -2381,18 +2381,14 @@ static int setIconTile(WScreen * scr, WDefaultEntry * entry, WTexture ** texture
scr->icon_tile_pixmap = pixmap;
if (scr->def_icon_pixmap) {
XFreePixmap(dpy, scr->def_icon_pixmap);
scr->def_icon_pixmap = None;
}
if (scr->def_ticon_pixmap) {
XFreePixmap(dpy, scr->def_ticon_pixmap);
scr->def_ticon_pixmap = None;
if (scr->def_icon_rimage) {
RReleaseImage(scr->def_icon_rimage);
scr->def_icon_rimage = NULL;
}
if (scr->icon_back_texture) {
if (scr->icon_back_texture)
wTextureDestroy(scr, (WTexture *) scr->icon_back_texture);
}
scr->icon_back_texture = wTextureMakeSolid(scr, &((*texture)->any.color));
if (scr->clip_balloon)

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 */

View File

@@ -229,14 +229,13 @@ typedef struct _WScreen {
struct RImage *icon_tile;
struct RImage *clip_tile;
Pixmap icon_tile_pixmap; /* for app supplied icons */
Pixmap def_icon_pixmap; /* default icons */
Pixmap def_ticon_pixmap;
Pixmap icon_tile_pixmap; /* For app supplied icons */
struct RImage *def_icon_rimage; /* Default RImage icon */
struct WDialogData *dialog_data;
struct W_GeometryView *gview; /* size/position view */
/* state and other informations */