From 7f48cb9658ec3b30a437398c91222d5ad8236210 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 7 Jun 2007 18:25:51 +0000 Subject: [PATCH] fix a XXX for drawing icons --- gui.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/gui.c b/gui.c index 67975c2..3435093 100644 --- a/gui.c +++ b/gui.c @@ -20,8 +20,8 @@ static RrAppearance *a_icon; /* you can edit these */ #define MAX_TASK_WIDTH 500 -#define ICONWIDTH 16 -#define ICONHEIGHT 16 +#define PADDING 2 +#define ICON_SIZE ((tb->h)-(2*PADDING)) static void set_icon_geometry(screen *sc, taskbar *tb, task *tk); @@ -49,14 +49,13 @@ void gui_init(screen *sc) /* We don't allow different fonts for various window states... */ font = RrFontOpen(sc->rr, "Candara, sans", 10, RR_FONTWEIGHT_NORMAL, RR_FONTSLANT_NORMAL); - /* this appearance will be used to draw icons, we don't - * set the type of the texture to RGBA here, because we toggle - * that so obrender doesn't try to draw an icon when the app - * doesn't have one */ - /* XXX don't do that */ + /* this appearance will be used to draw icons */ a_icon = RrAppearanceNew(sc->rr, 1); USE(a_icon); SURF(grad) = RR_SURFACE_PARENTREL; + SURF(parentx) = PADDING; + SURF(parenty) = PADDING; + a_icon->texture[0].type = RR_TEXTURE_RGBA; /* this is the appearance for the background of the panel */ background = RrAppearanceNew(sc->rr, 0); @@ -168,8 +167,6 @@ void gui_create_taskbar(screen *sc, taskbar *tb) XMapWindow(sc->dd, tb->win); } -#define PADDING 2 -#define ICON_SIZE ((tb->h)-(2*PADDING)) void gui_draw_task(screen *sc, taskbar *tb, task *tk, int redraw) { RrAppearance *a; @@ -197,12 +194,8 @@ void gui_draw_task(screen *sc, taskbar *tb, task *tk, int redraw) i = icon_get_best(tk->icons, tk->nicons, ICON_SIZE, ICON_SIZE); if (i) { - RrTexture *c = &a_icon->texture[0]; - RrTextureRGBA *d = &c->data.rgba; - c->type = RR_TEXTURE_RGBA; + RrTextureRGBA *d = &a_icon->texture[0].data.rgba; a_icon->surface.parent = b; - a_icon->surface.parentx = PADDING; - a_icon->surface.parenty = PADDING; d->width = i->width; d->height = i->height; d->alpha = tk->iconified ? 0x80 : tk->shaded ? 0xB0 : 0xff; -- 2.39.2