Simplify.

SVN revision: 16032
This commit is contained in:
Kim Woelders 2005-08-04 22:05:31 +00:00
parent 9f7bb47878
commit 5e1121f7a6
5 changed files with 62 additions and 38 deletions

View File

@ -1548,6 +1548,9 @@ ImageClass *ImageclassCreateSimple(const char *name, const char *image);
ImageClass *ImageclassFind(const char *name, int fallback);
Imlib_Image *ImageclassGetImage(ImageClass * ic, int active, int sticky,
int state);
Pixmap ImageclassApplySimple(ImageClass * ic, Window win,
Drawable draw, int state, int x,
int y, int w, int h);
void ImageclassApply(ImageClass * ic, Window win, int w, int h,
int active, int sticky, int state,
char expose, int image_type);

View File

@ -1735,6 +1735,7 @@ BG_RedrawView(void)
int x;
Pixmap pmap;
GC gc;
ImageClass *ic_button;
bglist = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND);
if (!bglist)
@ -1746,6 +1747,8 @@ BG_RedrawView(void)
pmap = ECreatePixmap(win, w, h, VRoot.depth);
gc = ECreateGC(pmap, 0, NULL);
ic_button = ImageclassFind("DIALOG_BUTTON", 0);
XSetForeground(disp, gc, BlackPixel(disp, VRoot.scr));
XFillRectangle(disp, pmap, gc, 0, 0, w, h);
ESetWindowBackgroundPixmap(win, pmap);
@ -1756,24 +1759,13 @@ BG_RedrawView(void)
{
if (((x + 64 + 8) >= 0) && (x < w))
{
ImageClass *ic;
Imlib_Image *im;
ic = ImageclassFind("DIALOG_BUTTON", 0);
if (ic)
{
PmapMask pmm;
if (i == tmp_bg_selected)
ImageclassApplyCopy(ic, pmap, 64 + 8, 48 + 8, 0, 0,
STATE_CLICKED, &pmm, 0, ST_UNKNWN);
else
ImageclassApplyCopy(ic, pmap, 64 + 8, 48 + 8, 0, 0,
STATE_NORMAL, &pmm, 0, ST_UNKNWN);
XCopyArea(disp, pmm.pmap, pmap, gc, 0, 0, 64 + 8, 48 + 8, x,
0);
FreePmapMask(&pmm);
}
if (ic_button)
ImageclassApplySimple(ic_button, win, pmap,
(i == tmp_bg_selected) ?
STATE_CLICKED : STATE_NORMAL,
x, 0, 64 + 8, 48 + 8);
if (!strcmp(BackgroundGetName(bglist[i]), "NONE"))
{

View File

@ -1932,27 +1932,30 @@ CB_ConfigureAreas(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
static void
CB_AreaDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
{
char s[64];
static char called = 0;
DItem *di;
static Window win, awin;
int w, h;
static int prev_ax = 0, prev_ay = 0;
static char called = 0;
static Window awin;
char s[64];
DItem *di;
Window win;
int w, h;
if (val == 1)
called = 0;
if ((val != 1) && ((prev_ax == tmp_area_x) && (prev_ay == tmp_area_y)))
return;
prev_ax = tmp_area_x;
prev_ay = tmp_area_y;
di = (DItem *) data;
win = DialogItemAreaGetWindow(di);
DialogItemAreaGetSize(di, &w, &h);
if (!called)
{
ImageClass *ic;
PmapMask pmm;
ic = ImageclassFind("SETTINGS_AREA_AREA", 0);
if (ic)
@ -1961,10 +1964,12 @@ CB_AreaDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
ic = ImageclassFind("SETTINGS_AREADESK_AREA", 0);
if (ic)
{
ImageclassApplyCopy(ic, awin, 18, 14, 0, 0, STATE_NORMAL, &pmm, 0,
ST_UNKNWN);
ESetWindowBackgroundPixmap(awin, pmm.pmap);
FreePmapMask(&pmm);
Pixmap pmap;
pmap = ImageclassApplySimple(ic, awin, None, STATE_NORMAL,
0, 0, 18, 14);
ESetWindowBackgroundPixmap(awin, pmap);
EFreePixmap(pmap);
}
EClearWindow(awin);
called = 1;

View File

@ -687,6 +687,32 @@ ImageclassGetImage(ImageClass * ic, int active, int sticky, int state)
return im;
}
Pixmap
ImageclassApplySimple(ImageClass * ic, Window win, Drawable draw, int state,
int x, int y, int w, int h)
{
Pixmap pmap;
Imlib_Image *im;
im = ImageclassGetImage(ic, 0, 0, state);
if (!im)
return None;
pmap = None;
if (draw == None)
{
pmap = ECreatePixmap(win, w, h, VRoot.depth);
draw = pmap;
x = y = 0;
}
imlib_context_set_image(im);
imlib_context_set_drawable(draw);
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
return pmap;
}
static void
ImagestateMakePmapMask(ImageState * is, Drawable win, PmapMask * pmm,
int make_mask, int w, int h, int image_type)

View File

@ -288,12 +288,17 @@ PagerEwinUpdateMini(Pager * p, EWin * ewin)
if (use_iclass)
{
ImageClass *ic = NULL;
ImageClass *ic;
ic = ImageclassFind("PAGER_WIN", 0);
if (ic)
ImageclassApplyCopy(ic, EoGetWin(ewin), w, h, 0, 0,
STATE_NORMAL, &ewin->mini_pmm, 1, ST_UNKNWN);
{
ewin->mini_pmm.type = 0;
ewin->mini_pmm.mask = None;
ewin->mini_pmm.pmap =
ImageclassApplySimple(ic, p->win, None, STATE_NORMAL,
0, 0, w, h);
}
}
else
{
@ -483,18 +488,11 @@ PagerUpdateBg(Pager * p)
if (!Conf.pagers.snap)
{
ImageClass *ic;
PmapMask pmm;
ic = ImageclassFind("PAGER_BACKGROUND", 0);
if (ic)
ImageclassApplyCopy(ic, pmap, p->dw, p->dh, 0, 0,
STATE_NORMAL, &pmm, 0, ST_UNKNWN);
gc = ECreateGC(pmap, 0, NULL);
if (gc == None)
return;
XCopyArea(disp, pmm.pmap, pmap, gc, 0, 0, p->dw, p->dh, 0, 0);
EFreeGC(gc);
FreePmapMask(&pmm);
ImageclassApplySimple(ic, p->win, pmap, STATE_NORMAL,
0, 0, p->dw, p->dh);
return;
}