Simplify some imageclass functions (w,h are always window size).

SVN revision: 31677
This commit is contained in:
Kim Woelders 2007-09-10 20:26:53 +00:00
parent 04e41a0c8a
commit 3c88e36613
17 changed files with 52 additions and 94 deletions

View File

@ -110,7 +110,7 @@ BorderWinpartITclassApply(EWin * ewin, int i, int force)
ewb->is = is;
ewb->ts = ts;
ITApply(ewb->win, ewin->border->part[i].iclass, is, ewb->w, ewb->h,
ITApply(ewb->win, ewin->border->part[i].iclass, is,
ewb->state, ewin->state.active, EoIsSticky(ewin),
ST_BORDER, ewin->border->part[i].tclass, ts, txt);
}
@ -394,7 +394,6 @@ EwinBorderCalcSizes(EWin * ewin, int propagate)
for (i = 0; i < ewin->border->num_winparts; i++)
{
reshape |= BorderWinpartDraw(ewin, i);
ewin->bits[i].no_expose = 1;
}
#if 0 /* Debug */
@ -553,7 +552,6 @@ EwinBorderSetTo(EWin * ewin, const Border * b)
ewin->bits[i].ch = -99;
ewin->bits[i].state = 0;
ewin->bits[i].expose = 0;
ewin->bits[i].no_expose = 0;
ewin->bits[i].left = 0;
ewin->bits[i].is = NULL;
}

View File

@ -81,7 +81,6 @@ struct _ewinbit
int cx, cy, cw, ch;
int state;
char expose;
char no_expose;
char left;
ImageState *is;
TextState *ts;

View File

@ -261,7 +261,7 @@ ButtonCalc(Button * b)
static void
ButtonDraw(Button * b)
{
ITApply(EoGetWin(b), b->iclass, NULL, EoGetW(b), EoGetH(b),
ITApply(EoGetWin(b), b->iclass, NULL,
b->state, 0, 0, ST_BUTTON, b->tclass, NULL, b->label);
EoShapeUpdate(b, 0);
}

View File

@ -689,8 +689,7 @@ ContainerDrawScroll(Container * ct)
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_VERTICAL", 0);
if (ic)
ImageclassApply(ic, ct->scroll_win, -1, -1, 0, 0, STATE_NORMAL,
ST_ICONBOX);
ImageclassApply(ic, ct->scroll_win, 0, 0, STATE_NORMAL, ST_ICONBOX);
EMoveResizeWindow(ct->scrollbar_win,
(ct->scroll_thickness - ct->bar_thickness) / 2, bx,
@ -704,8 +703,7 @@ ContainerDrawScroll(Container * ct)
state = STATE_HILITED;
if (ct->scrollbar_clicked)
state = STATE_CLICKED;
ImageclassApply(ic, ct->scrollbar_win, -1, -1, 0, 0, state,
ST_ICONBOX);
ImageclassApply(ic, ct->scrollbar_win, 0, 0, state, ST_ICONBOX);
}
ic = ImageclassFind("ICONBOX_SCROLLKNOB_VERTICAL", 0);
@ -721,7 +719,7 @@ ContainerDrawScroll(Container * ct)
state = STATE_HILITED;
if (ct->scrollbar_clicked)
state = STATE_CLICKED;
ImageclassApply(ic, ct->scrollbarknob_win, -1, -1, 0, 0, state,
ImageclassApply(ic, ct->scrollbarknob_win, 0, 0, state,
ST_ICONBOX);
}
else
@ -739,8 +737,7 @@ ContainerDrawScroll(Container * ct)
state = STATE_HILITED;
if (ct->arrow1_clicked)
state = STATE_CLICKED;
ImageclassApply(ic, ct->arrow1_win, -1, -1, 0, 0, state,
ST_ICONBOX);
ImageclassApply(ic, ct->arrow1_win, 0, 0, state, ST_ICONBOX);
}
ic = ImageclassFind("ICONBOX_ARROW_DOWN", 0);
@ -751,8 +748,7 @@ ContainerDrawScroll(Container * ct)
state = STATE_HILITED;
if (ct->arrow2_clicked)
state = STATE_CLICKED;
ImageclassApply(ic, ct->arrow2_win, -1, -1, 0, 0, state,
ST_ICONBOX);
ImageclassApply(ic, ct->arrow2_win, 0, 0, state, ST_ICONBOX);
}
}
break;
@ -909,8 +905,7 @@ ContainerDrawScroll(Container * ct)
ic = ImageclassFind("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 0);
if (ic)
ImageclassApply(ic, ct->scroll_win, -1, -1, 0, 0, STATE_NORMAL,
ST_ICONBOX);
ImageclassApply(ic, ct->scroll_win, 0, 0, STATE_NORMAL, ST_ICONBOX);
ic = ImageclassFind("ICONBOX_SCROLLBAR_KNOB_HORIZONTAL", 0);
if (ic)
@ -920,8 +915,7 @@ ContainerDrawScroll(Container * ct)
state = STATE_HILITED;
if (ct->scrollbar_clicked)
state = STATE_CLICKED;
ImageclassApply(ic, ct->scrollbar_win, -1, -1, 0, 0, state,
ST_ICONBOX);
ImageclassApply(ic, ct->scrollbar_win, 0, 0, state, ST_ICONBOX);
}
ic = ImageclassFind("ICONBOX_SCROLLKNOB_HORIZONTAL", 0);
@ -937,7 +931,7 @@ ContainerDrawScroll(Container * ct)
state = STATE_HILITED;
if (ct->scrollbar_clicked)
state = STATE_CLICKED;
ImageclassApply(ic, ct->scrollbarknob_win, -1, -1, 0, 0, state,
ImageclassApply(ic, ct->scrollbarknob_win, 0, 0, state,
ST_ICONBOX);
}
else
@ -955,8 +949,7 @@ ContainerDrawScroll(Container * ct)
state = STATE_HILITED;
if (ct->arrow1_clicked)
state = STATE_CLICKED;
ImageclassApply(ic, ct->arrow1_win, -1, -1, 0, 0, state,
ST_ICONBOX);
ImageclassApply(ic, ct->arrow1_win, 0, 0, state, ST_ICONBOX);
}
ic = ImageclassFind("ICONBOX_ARROW_RIGHT", 0);
@ -967,8 +960,7 @@ ContainerDrawScroll(Container * ct)
state = STATE_HILITED;
if (ct->arrow2_clicked)
state = STATE_CLICKED;
ImageclassApply(ic, ct->arrow2_win, -1, -1, 0, 0, state,
ST_ICONBOX);
ImageclassApply(ic, ct->arrow2_win, 0, 0, state, ST_ICONBOX);
}
}
break;
@ -1121,7 +1113,7 @@ ContainerDraw(Container * ct)
{
EMoveResizeWindow(ct->cover_win, ib_xlt, ib_ylt, ib_ww, ib_hh);
EMapWindow(ct->cover_win);
ImageclassApply(ib_ic_cover, ct->cover_win, -1, -1, 0, 0, STATE_NORMAL,
ImageclassApply(ib_ic_cover, ct->cover_win, 0, 0, STATE_NORMAL,
ST_ICONBOX);
}
else

View File

@ -125,8 +125,7 @@ CoordsShow(EWin * ewin)
EobjMap(eo, 0);
}
ITApply(eo->win, ic, NULL, cw, ch, STATE_NORMAL, 1, 0, ST_SOLID,
tc, NULL, s);
ITApply(eo->win, ic, NULL, STATE_NORMAL, 1, 0, ST_SOLID, tc, NULL, s);
if (md) /* Assuming that shape change only happens when size changes too */
EobjShapeUpdate(eo, 0);

View File

@ -2235,7 +2235,7 @@ CB_DesktopDisplayRedraw(Dialog * d, int val, void *data)
{
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 0);
if (ic)
ImageclassApply(ic, win, w, h, 0, 0, STATE_NORMAL, ST_SOLID);
ImageclassApply(ic, win, 0, 0, STATE_NORMAL, ST_SOLID);
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
wins[i] = 0;
called = 1;
@ -2262,8 +2262,7 @@ CB_DesktopDisplayRedraw(Dialog * d, int val, void *data)
{
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 0);
if (ic)
ImageclassApply(ic, wins[i], 64, 48, 0, 0, STATE_NORMAL,
ST_SOLID);
ImageclassApply(ic, wins[i], 0, 0, STATE_NORMAL, ST_SOLID);
}
}
}
@ -2478,7 +2477,7 @@ CB_AreaDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
ic = ImageclassFind("SETTINGS_AREA_AREA", 0);
if (ic)
ImageclassApply(ic, win, w, h, 0, 0, STATE_NORMAL, ST_SOLID);
ImageclassApply(ic, win, 0, 0, STATE_NORMAL, ST_SOLID);
awin = ECreateWindow(win, 0, 0, 18, 14, 0);
ic = ImageclassFind("SETTINGS_AREADESK_AREA", 0);
if (ic)

View File

@ -423,8 +423,7 @@ DialogDrawButton(Dialog * d __UNUSED__, DButton * db)
EImageBorder *pad;
int h;
ImageclassApply(db->iclass, db->win, db->w, db->h, 0, 0, state,
ST_WIDGET);
ImageclassApply(db->iclass, db->win, 0, 0, state, ST_WIDGET);
pad = ImageclassGetPadding(ic);
h = db->h - (pad->top + pad->bottom);
@ -440,7 +439,7 @@ DialogDrawButton(Dialog * d __UNUSED__, DButton * db)
}
else
{
ITApply(db->win, db->iclass, NULL, db->w, db->h, state, 0, 0,
ITApply(db->win, db->iclass, NULL, state, 0, 0,
ST_WIDGET, db->tclass, NULL, db->text);
}
}
@ -1641,14 +1640,11 @@ DialogDrawItem(Dialog * d, DItem * di)
if (di->item.slider.base_win)
ImageclassApply(di->item.slider.ic_base,
di->item.slider.base_win,
di->item.slider.base_w, di->item.slider.base_h,
0, 0, STATE_NORMAL, ST_WIDGET);
if (di->item.slider.border_win)
ImageclassApply(di->item.slider.ic_border,
di->item.slider.border_win,
di->item.slider.border_w,
di->item.slider.border_h, 0, 0, STATE_NORMAL,
ST_WIDGET);
0, 0, STATE_NORMAL, ST_WIDGET);
state = STATE_NORMAL;
if ((di->hilited) && (di->clicked))
state = STATE_CLICKED;
@ -1658,9 +1654,7 @@ DialogDrawItem(Dialog * d, DItem * di)
state = STATE_CLICKED;
if (di->item.slider.knob_win)
ImageclassApply(di->item.slider.ic_knob,
di->item.slider.knob_win,
di->item.slider.knob_w, di->item.slider.knob_h,
0, 0, state, ST_WIDGET);
di->item.slider.knob_win, 0, 0, state, ST_WIDGET);
break;
case DITEM_BUTTON:
@ -1671,15 +1665,14 @@ DialogDrawItem(Dialog * d, DItem * di)
state = STATE_HILITED;
else if (!(di->hilited) && (di->clicked))
state = STATE_CLICKED;
ITApply(di->win, di->iclass, NULL, di->w, di->h, state, 0, 0,
ITApply(di->win, di->iclass, NULL, state, 0, 0,
ST_WIDGET, di->tclass, NULL, di->text);
break;
case DITEM_AREA:
if (!d->redraw)
break;
ImageclassApply(di->iclass, di->win, di->w, di->h, 0, 0,
STATE_NORMAL, ST_DIALOG);
ImageclassApply(di->iclass, di->win, 0, 0, STATE_NORMAL, ST_DIALOG);
if (di->item.area.init_func)
di->item.area.init_func(di, 0, NULL);
break;
@ -1688,11 +1681,9 @@ DialogDrawItem(Dialog * d, DItem * di)
if (!d->redraw)
break;
if (di->item.separator.horizontal)
ImageclassApply(di->iclass, di->win, di->w, di->h, 0, 0,
STATE_NORMAL, ST_WIDGET);
ImageclassApply(di->iclass, di->win, 0, 0, STATE_NORMAL, ST_WIDGET);
else
ImageclassApply(di->iclass, di->win, di->w, di->h, 0, 0,
STATE_CLICKED, ST_WIDGET);
ImageclassApply(di->iclass, di->win, 0, 0, STATE_CLICKED, ST_WIDGET);
break;
case DITEM_TEXT:
@ -1710,8 +1701,6 @@ DialogDrawItem(Dialog * d, DItem * di)
else if (!(di->hilited) && (di->clicked))
state = STATE_CLICKED;
ImageclassApply(di->iclass, di->item.check_button.check_win,
di->item.check_button.check_orig_w,
di->item.check_button.check_orig_h,
DialogItemCheckButtonGetState(di), 0, state, ST_WIDGET);
if (!d->redraw &&
(TextclassGetTextState(di->tclass, di->state, 0, 0) ==
@ -1731,8 +1720,6 @@ DialogDrawItem(Dialog * d, DItem * di)
else if (!(di->hilited) && (di->clicked))
state = STATE_CLICKED;
ImageclassApply(di->iclass, di->item.radio_button.radio_win,
di->item.radio_button.radio_orig_w,
di->item.radio_button.radio_orig_h,
di->item.radio_button.onoff, 0, state, ST_WIDGET);
if (!d->redraw &&
(TextclassGetTextState(di->tclass, di->state, 0, 0) ==

View File

@ -144,6 +144,5 @@ DockIt(EWin * ewin)
XMapWindow(disp, ewin->icccm.icon_win);
}
ImageclassApply(ic, EoGetWin(ewin), ewin->client.w, ewin->client.h,
0, 0, STATE_NORMAL, ST_BUTTON);
ImageclassApply(ic, EoGetWin(ewin), 0, 0, STATE_NORMAL, ST_BUTTON);
}

View File

@ -170,9 +170,7 @@ HiwinRenderIclassInit(Hiwin * phi __UNUSED__)
static void
HiwinRenderIclassDraw(Hiwin * phi)
{
ImageclassApply(hiwin_ic, EoGetWin(phi), EoGetW(phi), EoGetH(phi), 0, 0,
STATE_NORMAL, ST_PAGER);
EClearWindow(EoGetWin(phi));
ImageclassApply(hiwin_ic, EoGetWin(phi), 0, 0, STATE_NORMAL, ST_PAGER);
}
static void

View File

@ -1163,16 +1163,17 @@ ImagestateDrawBevel(ImageState * is, Drawable win, GC gc, int w, int h)
}
void
ITApply(Win win, ImageClass * ic, ImageState * is, int w, int h,
ITApply(Win win, ImageClass * ic, ImageState * is,
int state, int active, int sticky, int image_type,
TextClass * tc, TextState * ts, const char *text)
{
int w, h;
if (win == NoWin || !ic)
return;
/* FIXME - Why? */
if (w <= 0 || h <= 0)
EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL);
w = WinGetW(win);
h = WinGetH(win);
if (w <= 0 || h <= 0)
return;
@ -1254,11 +1255,10 @@ ITApply(Win win, ImageClass * ic, ImageState * is, int w, int h,
}
void
ImageclassApply(ImageClass * ic, Win win, int w, int h, int active,
int sticky, int state, int image_type)
ImageclassApply(ImageClass * ic, Win win, int active, int sticky, int state,
int image_type)
{
ITApply(win, ic, NULL, w, h, state, active, sticky, image_type,
NULL, NULL, NULL);
ITApply(win, ic, NULL, state, active, sticky, image_type, NULL, NULL, NULL);
}
void
@ -1534,7 +1534,7 @@ ImageclassIpc(const char *params)
else
st = STATE_NORMAL;
ImageclassApply(ic, win, w, h, 0, 0, st, ST_SOLID);
ImageclassApply(ic, win, 0, 0, st, ST_SOLID);
EDestroyWin(win);
}
else if (!strcmp(param2, "apply_copy"))

View File

@ -108,7 +108,7 @@ EImage *ImageclassGetImage(ImageClass * ic, int active, int sticky,
Pixmap ImageclassApplySimple(ImageClass * ic, Win win,
Drawable draw, int state, int x,
int y, int w, int h);
void ImageclassApply(ImageClass * ic, Win win, int w, int h,
void ImageclassApply(ImageClass * ic, Win win,
int active, int sticky, int state,
int image_type);
void ImageclassApplyCopy(ImageClass * ic, Win win, int w,
@ -119,9 +119,8 @@ EImage *ImageclassGetImageBlended(ImageClass * ic, Win win,
int w, int h, int active,
int sticky, int state,
int image_type);
void ITApply(Win win, ImageClass * ic, ImageState * is, int w,
int h, int state, int active, int sticky,
int image_type, TextClass * tc,
TextState * ts, const char *text);
void ITApply(Win win, ImageClass * ic, ImageState * is,
int state, int active, int sticky, int image_type,
TextClass * tc, TextState * ts, const char *text);
#endif /* _ICLASS_H */

View File

@ -694,7 +694,6 @@ MenuRealize(Menu * m)
{
int i, maxh, maxw, nmaxy;
int maxx1, maxx2, w, h, x, y, r, mmw, mmh;
int iw, ih;
EImage *im;
EImageBorder *pad, *pad_item, *pad_sub;
char has_i, has_s;
@ -854,12 +853,8 @@ MenuRealize(Menu * m)
}
if (m->items[i]->icon_iclass && Conf.menus.show_icons)
{
iw = 0;
ih = 0;
EGetGeometry(m->items[i]->icon_win, NULL, NULL, NULL, &iw, &ih,
NULL, NULL);
ImageclassApply(m->items[i]->icon_iclass, m->items[i]->icon_win,
iw, ih, 0, 0, STATE_NORMAL, ST_MENU_ITEM);
0, 0, STATE_NORMAL, ST_MENU_ITEM);
}
if (x + maxw > mmw)
mmw = x + maxw;

View File

@ -697,8 +697,7 @@ _PagerEwinMoveResize(EWin * ewin, int resize __UNUSED__)
{
DeskGetArea(p->dsk, &cx, &cy);
EMoveResizeWindow(p->sel_win, cx * p->dw, cy * p->dh, p->dw, p->dh);
ImageclassApply(ic, p->sel_win, p->dw, p->dh, 0, 0, STATE_NORMAL,
ST_PAGER);
ImageclassApply(ic, p->sel_win, 0, 0, STATE_NORMAL, ST_PAGER);
}
}
@ -1064,8 +1063,7 @@ _PagerUpdateSel(Pager * p, void *prm __UNUSED__)
EMapWindow(p->sel_win);
ic = ImageclassFind("PAGER_SEL", 0);
if (ic)
ImageclassApply(ic, p->sel_win, p->dw, p->dh, 0, 0,
STATE_NORMAL, ST_PAGER);
ImageclassApply(ic, p->sel_win, 0, 0, STATE_NORMAL, ST_PAGER);
}
}

View File

@ -152,7 +152,7 @@ ProgressbarSet(Progressbar * p, int progress)
Esnprintf(s, sizeof(s), "%i%%", p->value);
EobjResize(p->p_win, w, p->h);
ImageclassApply(p->ic, p->p_win->win, w, p->h, 1, 0, STATE_NORMAL, ST_SOLID);
ImageclassApply(p->ic, p->p_win->win, 1, 0, STATE_NORMAL, ST_SOLID);
EobjShapeUpdate(p->p_win, 0);
pad = ImageclassGetPadding(p->ic);
@ -172,11 +172,9 @@ ProgressbarShow(Progressbar * p)
{
EImageBorder *pad;
ImageclassApply(p->ic, p->win->win, p->w - (p->h * 5), p->h, 0, 0,
STATE_NORMAL, ST_SOLID);
ImageclassApply(p->ic, p->n_win->win, (p->h * 5), p->h, 0, 0,
STATE_CLICKED, ST_SOLID);
ImageclassApply(p->ic, p->p_win->win, 1, p->h, 1, 0, STATE_NORMAL, ST_SOLID);
ImageclassApply(p->ic, p->win->win, 0, 0, STATE_NORMAL, ST_SOLID);
ImageclassApply(p->ic, p->n_win->win, 0, 0, STATE_CLICKED, ST_SOLID);
ImageclassApply(p->ic, p->p_win->win, 1, 0, STATE_NORMAL, ST_SOLID);
EobjMap(p->win, 0);
EobjMap(p->n_win, 0);

View File

@ -100,8 +100,8 @@ StartupWindowsCreate(void)
EMapRaised(b1);
EMapRaised(b2);
ImageclassApply(ic, b1, bw, bh, 0, 0, 0, ST_SOLID);
ImageclassApply(ic, b2, bw, bh, 0, 0, 0, ST_SOLID);
ImageclassApply(ic, b1, 0, 0, 0, ST_SOLID);
ImageclassApply(ic, b2, 0, 0, 0, ST_SOLID);
}
BackgroundSet(bg, win1, VRoot.w, VRoot.h);

View File

@ -435,8 +435,7 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
iy = (h - ih) / 2;
EMoveResizeWindow(tt->iwin, ix, iy, iw, ih);
EMapWindow(tt->iwin);
ImageclassApply(tt->tooltippic, tt->iwin, iw, ih, 0, 0, STATE_NORMAL,
ST_SOLID);
ImageclassApply(tt->tooltippic, tt->iwin, 0, 0, STATE_NORMAL, ST_SOLID);
}
else
EUnmapWindow(tt->iwin);
@ -569,8 +568,7 @@ TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
eo = tt->win[i];
if (!eo)
continue;
ImageclassApply(tt->iclass[i], eo->win, EobjGetW(eo), EobjGetH(eo),
0, 0, STATE_NORMAL, ST_TOOLTIP);
ImageclassApply(tt->iclass[i], eo->win, 0, 0, STATE_NORMAL, ST_TOOLTIP);
EobjShapeUpdate(eo, 0);
EobjMap(eo, 0);
}

View File

@ -223,8 +223,7 @@ WarpFocusWinPaint(WarpFocusWin * fw)
state = (i == warpFocusIndex) ? STATE_CLICKED : STATE_NORMAL;
ImageclassApply(fw->ic, wi->win, fw->mw, fw->mh, 0, 0, state,
ST_WARPLIST);
ImageclassApply(fw->ic, wi->win, 0, 0, state, ST_WARPLIST);
iw = 0;
if (Conf.warplist.icon_mode != 0)