Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h comms.c config.c desktops.c hints.c ipc.c settings.c x.c
Log Message:
Imlib2 - Improve on backgrounds.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -3 -r1.148 -r1.149
--- E.h 15 Nov 2003 22:27:16 -0000 1.148
+++ E.h 22 Nov 2003 00:15:39 -0000 1.149
@@ -1146,33 +1146,26 @@
}
Container;
+typedef struct
+{
+ char *file;
+ char *real_file;
+ Imlib_Image *im;
+ char keep_aspect;
+ int xjust, yjust;
+ int xperc, yperc;
+}
+BgPart;
+
typedef struct _background
{
char *name;
Pixmap pmap;
time_t last_viewed;
- struct _bg
- {
- XColor solid;
- char *file;
- char *real_file;
- Imlib_Image *im;
- char tile;
- char keep_aspect;
- int xjust, yjust;
- int xperc, yperc;
- }
- bg;
- struct _top
- {
- char *file;
- char *real_file;
- Imlib_Image *im;
- char keep_aspect;
- int xjust, yjust;
- int xperc, yperc;
- }
- top;
+ XColor bg_solid;
+ char bg_tile;
+ BgPart bg;
+ BgPart top;
ColorModifierClass *cmclass;
char keepim;
unsigned int ref_count;
@@ -1775,7 +1768,6 @@
int h);
void GrabX(void);
void UngrabX(void);
-void SetBG(Window win, Pixmap pmap, int color);
void GetWinXY(Window win, int *x, int *y);
void GetWinWH(Window win, unsigned int *w, unsigned int *h);
int GetWinDepth(Window win);
@@ -2270,6 +2262,7 @@
void HintsDelWindowHints(EWin * ewin);
void HintsProcessPropertyChange(EWin * ewin, Atom atom_change);
void HintsProcessClientMessage(XClientMessageEvent * event);
+void HintsSetRootInfo(Window win, Pixmap pmap, int color);
/* sound.c functions */
Sample *LoadWav(char *file);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/comms.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- comms.c 15 Nov 2003 22:27:17 -0000 1.33
+++ comms.c 22 Nov 2003 00:15:39 -0000 1.34
@@ -995,11 +995,11 @@
Esnprintf(buf, sizeof(buf), "(null)");
if (bg)
{
- EGetColor(&(bg->bg.solid), &r, &g, &b);
+ EGetColor(&(bg->bg_solid), &r, &g, &b);
if ((bg->bg.file) && (bg->top.file))
Esnprintf(buf, sizeof(buf),
"%s %i %i %i %s %i %i %i %i %i %i %s %i %i %i %i %i",
- bg->name, r, g, b, bg->bg.file, bg->bg.tile,
+ bg->name, r, g, b, bg->bg.file, bg->bg_tile,
bg->bg.keep_aspect, bg->bg.xjust, bg->bg.yjust,
bg->bg.xperc, bg->bg.yperc, bg->top.file,
bg->top.keep_aspect, bg->top.xjust, bg->top.yjust,
@@ -1007,7 +1007,7 @@
else if ((!(bg->bg.file)) && (bg->top.file))
Esnprintf(buf, sizeof(buf),
"%s %i %i %i %s %i %i %i %i %i %i %s %i %i %i %i %i",
- bg->name, r, g, b, "(null)", bg->bg.tile,
+ bg->name, r, g, b, "(null)", bg->bg_tile,
bg->bg.keep_aspect, bg->bg.xjust, bg->bg.yjust,
bg->bg.xperc, bg->bg.yperc, bg->top.file,
bg->top.keep_aspect, bg->top.xjust, bg->top.yjust,
@@ -1015,7 +1015,7 @@
else if ((bg->bg.file) && (!(bg->top.file)))
Esnprintf(buf, sizeof(buf),
"%s %i %i %i %s %i %i %i %i %i %i %s %i %i %i %i %i",
- bg->name, r, g, b, bg->bg.file, bg->bg.tile,
+ bg->name, r, g, b, bg->bg.file, bg->bg_tile,
bg->bg.keep_aspect, bg->bg.xjust, bg->bg.yjust,
bg->bg.xperc, bg->bg.yperc, "(null)",
bg->top.keep_aspect, bg->top.xjust, bg->top.yjust,
@@ -1023,7 +1023,7 @@
else if ((!(bg->bg.file)) && (!(bg->top.file)))
Esnprintf(buf, sizeof(buf),
"%s %i %i %i %s %i %i %i %i %i %i %s %i %i %i %i %i",
- bg->name, r, g, b, "(null)", bg->bg.tile,
+ bg->name, r, g, b, "(null)", bg->bg_tile,
bg->bg.keep_aspect, bg->bg.xjust, bg->bg.yjust,
bg->bg.xperc, bg->bg.yperc, "(null)",
bg->top.keep_aspect, bg->top.xjust, bg->top.yjust,
@@ -1063,13 +1063,13 @@
if (strcmp("(null)", w))
topf = duplicate(w);
- if (xclr.red != bg->bg.solid.red)
+ if (xclr.red != bg->bg_solid.red)
updated = 1;
- if (xclr.green != bg->bg.solid.green)
+ if (xclr.green != bg->bg_solid.green)
updated = 1;
- if (xclr.blue != bg->bg.solid.blue)
+ if (xclr.blue != bg->bg_solid.blue)
updated = 1;
- bg->bg.solid = xclr;
+ bg->bg_solid = xclr;
if ((bg->bg.file) && (bgf))
{
if (strcmp(bg->bg.file, bgf))
@@ -1080,7 +1080,7 @@
if (bg->bg.file)
Efree(bg->bg.file);
bg->bg.file = bgf;
- if ((int)tile != bg->bg.tile)
+ if ((int)tile != bg->bg_tile)
updated = 1;
if ((int)keep_aspect != bg->bg.keep_aspect)
updated = 1;
@@ -1092,7 +1092,7 @@
updated = 1;
if (yperc != bg->bg.yperc)
updated = 1;
- bg->bg.tile = (char)tile;
+ bg->bg_tile = (char)tile;
bg->bg.keep_aspect = (char)keep_aspect;
bg->bg.xjust = xjust;
bg->bg.yjust = yjust;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- config.c 15 Nov 2003 22:27:17 -0000 1.72
+++ config.c 22 Nov 2003 00:15:39 -0000 1.73
@@ -1846,7 +1846,7 @@
sscanf(s, "%4000s %d %d %d", s1, &i1, &i2, &i3);
ESetColor(&xclr, i1, i2, i3);
if (ignore)
- bg->bg.solid = xclr;
+ bg->bg_solid = xclr;
break;
case BG_BG1:
sscanf(s, "%4000s %4000s %d %d %d %d %d %d", s1, s2, &i1, &i2,
@@ -1867,7 +1867,7 @@
bg->top.file = NULL;
}
bg->bg.file = duplicate(s2);
- bg->bg.tile = i1;
+ bg->bg_tile = i1;
bg->bg.keep_aspect = i2;
bg->bg.xjust = i3;
bg->bg.yjust = i4;
@@ -4150,7 +4150,7 @@
{
fprintf(autosavefile, "5 999\n");
fprintf(autosavefile, "100 %s\n", bglist[i]->name);
- EGetColor(&(bglist[i]->bg.solid), &r, &g, &b);
+ EGetColor(&(bglist[i]->bg_solid), &r, &g, &b);
fprintf(autosavefile, "560 %d %d %d\n", r, g, b);
if ((bglist[i]->bg.file) && (!bglist[i]->bg.real_file))
bglist[i]->bg.real_file = FindFile(bglist[i]->bg.file);
@@ -4159,7 +4159,7 @@
if ((bglist[i]->bg.file) && (bglist[i]->bg.real_file))
{
fprintf(autosavefile, "561 %s %d %d %d %d %d %d\n",
- bglist[i]->bg.real_file, bglist[i]->bg.tile,
+ bglist[i]->bg.real_file, bglist[i]->bg_tile,
bglist[i]->bg.keep_aspect, bglist[i]->bg.xjust,
bglist[i]->bg.yjust, bglist[i]->bg.xperc,
bglist[i]->bg.yperc);
@@ -4167,7 +4167,7 @@
else if (bglist[i]->bg.file)
{
fprintf(autosavefile, "561 %s %d %d %d %d %d %d\n",
- bglist[i]->bg.file, bglist[i]->bg.tile,
+ bglist[i]->bg.file, bglist[i]->bg_tile,
bglist[i]->bg.keep_aspect, bglist[i]->bg.xjust,
bglist[i]->bg.yjust, bglist[i]->bg.xperc,
bglist[i]->bg.yperc);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- desktops.c 15 Nov 2003 22:27:17 -0000 1.47
+++ desktops.c 22 Nov 2003 00:15:40 -0000 1.48
@@ -39,8 +39,8 @@
int r, g, b;
int n1, n2, n3, n4, n5, f1, f2, f3, f4, f5, f6;
- EGetColor(&(bg->bg.solid), &r, &g, &b);
- n1 = (r << 24) | (g << 16) | (b << 8) | (bg->bg.tile << 7)
+ EGetColor(&(bg->bg_solid), &r, &g, &b);
+ n1 = (r << 24) | (g << 16) | (b << 8) | (bg->bg_tile << 7)
| (bg->bg.keep_aspect << 6) | (bg->top.keep_aspect << 5);
n2 = (bg->bg.xjust << 16) | (bg->bg.yjust);
n3 = (bg->bg.xperc << 16) | (bg->bg.yperc);
@@ -296,7 +296,7 @@
}
static void
-FreeBGimages(Background * bg)
+FreeBGimages(Background * bg, int free_pmap)
{
if (bg->bg.im)
{
@@ -310,9 +310,11 @@
imlib_free_image();
bg->top.im = NULL;
}
- if (bg->pmap)
- imlib_free_pixmap_and_mask(bg->pmap);
- bg->pmap = 0;
+ if (free_pmap && bg->pmap)
+ {
+ imlib_free_pixmap_and_mask(bg->pmap);
+ bg->pmap = 0;
+ }
}
void
@@ -325,7 +327,7 @@
else
{
bg->keepim = 0;
- FreeBGimages(bg);
+ FreeBGimages(bg, 0);
}
}
@@ -340,7 +342,7 @@
Efree(bg->bg.real_file);
bg->bg.real_file = NULL;
- FreeBGimages(bg);
+ FreeBGimages(bg, 1);
bg->keepim = 0;
}
@@ -392,15 +394,15 @@
d->pmap = 0;
d->last_viewed = 0;
- ESetColor(&(d->bg.solid), 160, 160, 160);
+ ESetColor(&(d->bg_solid), 160, 160, 160);
if (solid)
- d->bg.solid = *solid;
+ d->bg_solid = *solid;
d->bg.file = NULL;
if (bg)
d->bg.file = duplicate(bg);
d->bg.real_file = NULL;
d->bg.im = NULL;
- d->bg.tile = tile;
+ d->bg_tile = tile;
d->bg.keep_aspect = keep_aspect;
d->bg.xjust = xjust;
d->bg.yjust = yjust;
@@ -452,17 +454,72 @@
EDBUG_RETURN_;
}
+static void
+BgFindImageSize(BgPart * bgp, int rw, int rh, int *pw, int *ph, int setbg)
+{
+ int w, h;
+
+ if (bgp->xperc > 0)
+ {
+ w = (rw * bgp->xperc) >> 10;
+ }
+ else
+ {
+ if (!setbg)
+ w = (imlib_image_get_width() * rw) / root.w;
+ else
+ w = imlib_image_get_width();
+ }
+
+ if (bgp->yperc > 0)
+ {
+ h = (rh * bgp->yperc) >> 10;
+ }
+ else
+ {
+ if (!setbg)
+ {
+ h = (imlib_image_get_height() * rh) / root.h;
+ }
+ else
+ {
+ h = imlib_image_get_height();
+ }
+ }
+
+ if (w <= 0)
+ w = 1;
+ if (h <= 0)
+ h = 1;
+
+ if (bgp->keep_aspect)
+ {
+ if (bgp->yperc <= 0)
+ {
+ if (((w << 10) / h) !=
+ ((imlib_image_get_width() << 10) / imlib_image_get_height()))
+ h = ((w * imlib_image_get_height()) / imlib_image_get_width());
+ }
+ else
+ {
+ if (((h << 10) / w) !=
+ ((imlib_image_get_height() << 10) / imlib_image_get_width()))
+ w = ((h * imlib_image_get_width()) / imlib_image_get_height());
+ }
+ }
+
+ *pw = w;
+ *ph = h;
+}
+
void
SetBackgroundTo(Window win, Background * dsk, char setbg)
{
- int w, h, x, y, ww, hh;
unsigned int rw, rh;
- Pixmap pmap, mask, dpmap;
+ Pixmap dpmap;
GC gc;
XGCValues gcv;
- char hasbg, hasfg;
int rt, depth;
- ColorModifierClass *cm;
EDBUG(4, "SetBackgroundTo");
@@ -473,14 +530,10 @@
GetWinWH(win, &rw, &rh);
depth = GetWinDepth(win);
+ imlib_context_set_drawable(win);
- EAllocColor(&dsk->bg.solid);
- pmap = mask = 0;
+ EAllocColor(&dsk->bg_solid);
gc = 0;
- w = 0;
- h = 0;
- hasbg = 0;
- hasfg = 0;
rt = imlib_context_get_dither();
if (desks.hiqualitybg)
@@ -490,42 +543,42 @@
}
dpmap = dsk->pmap;
- if (!setbg)
- dpmap = 0;
+ if (!setbg && dpmap)
+ {
+ /* Always regenerate if setting non-desktop window (?) */
+ imlib_free_pixmap_and_mask(dpmap);
+ dpmap = 0;
+ }
+
if (!dpmap)
{
- cm = dsk->cmclass;
- if (cm)
- {
- cm->ref_count--;
- }
- else
- {
- cm = (ColorModifierClass *) FindItem("BACKGROUND", 0,
- LIST_FINDBY_NAME,
- LIST_TYPE_COLORMODIFIER);
- }
+ int w, h, x, y;
+ char hasbg, hasfg;
+ Pixmap pmap, mask;
+ ColorModifierClass *cm;
- if (dsk->bg.file)
+ if (dsk->bg.file && !dsk->bg.im)
{
- if (!dsk->bg.im)
- {
- if (!dsk->bg.real_file)
- dsk->bg.real_file = FindFile(dsk->bg.file);
- dsk->bg.im = ELoadImage(dsk->bg.real_file);
- }
+ if (!dsk->bg.real_file)
+ dsk->bg.real_file = FindFile(dsk->bg.file);
+ dsk->bg.im = ELoadImage(dsk->bg.real_file);
}
- if (dsk->top.file)
+ if (dsk->top.file && !dsk->top.im)
{
- if (!dsk->top.im)
- {
- if (!dsk->top.real_file)
- dsk->top.real_file = FindFile(dsk->top.file);
- dsk->top.im = ELoadImage(dsk->top.real_file);
- }
+ if (!dsk->top.real_file)
+ dsk->top.real_file = FindFile(dsk->top.file);
+ dsk->top.im = ELoadImage(dsk->top.real_file);
}
+ cm = dsk->cmclass;
+ if (cm)
+ cm->ref_count--;
+ else
+ cm = (ColorModifierClass *) FindItem("BACKGROUND", 0,
+ LIST_FINDBY_NAME,
+ LIST_TYPE_COLORMODIFIER);
+
if (cm)
{
cm->ref_count++;
@@ -550,373 +603,101 @@
}
#endif
}
- }
-
- if (dsk->top.im)
- hasfg = 1;
- if (dsk->bg.im)
- hasbg = 1;
- if ((hasfg) && (hasbg))
- {
- imlib_context_set_image(dsk->bg.im);
+ hasbg = hasfg = 0;
+ if (dsk->top.im)
+ hasfg = 1;
+ if (dsk->bg.im)
+ hasbg = 1;
- if (dsk->bg.xperc > 0)
- {
- w = (rw * dsk->bg.xperc) >> 10;
- }
- else
- {
- if (!setbg)
- w = (imlib_image_get_width() * rw) / root.w;
- else
- w = imlib_image_get_width();
- }
+ w = h = x = y = 0;
- if (dsk->bg.yperc > 0)
- {
- h = (rh * dsk->bg.yperc) >> 10;
- }
- else
+ if (hasbg)
{
- if (!setbg)
- {
- h = (imlib_image_get_height() * rh) / root.h;
- }
- else
- {
- h = imlib_image_get_height();
- }
- }
+ imlib_context_set_image(dsk->bg.im);
- if (w <= 0)
- w = 1;
- if (h <= 0)
- h = 1;
+ BgFindImageSize(&(dsk->bg), rw, rh, &w, &h, setbg);
+ x = ((rw - w) * dsk->bg.xjust) >> 10;
+ y = ((rh - h) * dsk->bg.yjust) >> 10;
- if (dsk->bg.keep_aspect)
- {
- if (dsk->bg.yperc <= 0)
- {
- if (((w << 10) / h) !=
- ((imlib_image_get_width() << 10) /
- imlib_image_get_height()))
- h = ((w * imlib_image_get_height()) /
- imlib_image_get_width());
- }
- else
- {
- if (((h << 10) / w) !=
- ((imlib_image_get_height() << 10) /
- imlib_image_get_width()))
- w = ((h * imlib_image_get_width()) /
- imlib_image_get_height());
- }
+ imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, w, h);
}
- dpmap = ECreatePixmap(disp, win, rw, rh, depth);
- gc = XCreateGC(disp, dpmap, 0, &gcv);
- if (!dsk->bg.tile)
- {
- XSetForeground(disp, gc, dsk->bg.solid.pixel);
- XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
- }
- x = ((rw - w) * dsk->bg.xjust) >> 10;
- y = ((rh - h) * dsk->bg.yjust) >> 10;
- imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, w, h);
- XSetTile(disp, gc, pmap);
- XSetTSOrigin(disp, gc, x, y);
- XSetFillStyle(disp, gc, FillTiled);
- if (!dsk->bg.tile)
- {
- XFillRectangle(disp, dpmap, gc, x, y, w, h);
- }
- else
+ if (hasbg && !hasfg && setbg && x == 0 && y == 0 && w == rw && h == rh)
{
- XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
- }
- imlib_free_pixmap_and_mask(pmap);
-
- imlib_context_set_image(dsk->top.im);
-
- if (dsk->top.xperc > 0)
- {
- ww = (rw * dsk->top.xperc) >> 10;
- }
- else
- {
- if (!setbg)
- {
- ww = (imlib_image_get_width() * rw) / root.w;
- }
- else
- {
- ww = imlib_image_get_width();
- }
+ /* Put image 1:1 onto the current root window */
+ dpmap = pmap;
}
- if (dsk->top.yperc > 0)
+ else if (hasbg && !hasfg && dsk->bg_tile)
{
- hh = (rh * dsk->top.yperc) >> 10;
+ /* BG only, tiled */
+ dpmap = ECreatePixmap(disp, win, w, h, depth);
+ gc = XCreateGC(disp, dpmap, 0, &gcv);
}
else
{
- if (!setbg)
- {
- hh = (imlib_image_get_height() * rh) / root.h;
- }
- else
+ /* The rest that require some more work */
+ dpmap = ECreatePixmap(disp, win, rw, rh, depth);
+ gc = XCreateGC(disp, dpmap, 0, &gcv);
+ if (!dsk->bg_tile)
{
- hh = imlib_image_get_height();
+ XSetForeground(disp, gc, dsk->bg_solid.pixel);
+ XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
}
}
- if (ww <= 0)
- ww = 1;
- if (hh <= 0)
- hh = 1;
- if (dsk->top.keep_aspect)
- {
- if (dsk->top.yperc <= 0)
- {
- if (((ww << 10) / hh) !=
- ((imlib_image_get_width() << 10) /
- imlib_image_get_height()))
- hh =
- ((ww * imlib_image_get_height()) /
- imlib_image_get_width());
- }
- else
- {
- if (((hh << 10) / ww) !=
- ((imlib_image_get_height() << 10) /
- imlib_image_get_width()))
- ww =
- ((hh * imlib_image_get_width()) /
- imlib_image_get_height());
- }
- }
- imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, ww, hh);
- x = ((rw - ww) * dsk->top.xjust) >> 10;
- y = ((rh - hh) * dsk->top.yjust) >> 10;
- XSetTile(disp, gc, pmap);
- XSetTSOrigin(disp, gc, x, y);
- XSetFillStyle(disp, gc, FillTiled);
- if (mask)
- {
- XSetClipMask(disp, gc, mask);
- XSetClipOrigin(disp, gc, x, y);
- }
- XFillRectangle(disp, dpmap, gc, x, y, ww, hh);
- imlib_free_pixmap_and_mask(pmap);
- }
- else if (hasbg)
- {
- imlib_context_set_image(dsk->bg.im);
- if (dsk->bg.xperc > 0)
- w = (rw * dsk->bg.xperc) >> 10;
- else
+ if (hasbg && dpmap != pmap)
{
- if (!setbg)
- w = (imlib_image_get_width() * rw) / root.w;
+ XSetTile(disp, gc, pmap);
+ XSetTSOrigin(disp, gc, x, y);
+ XSetFillStyle(disp, gc, FillTiled);
+ if (dsk->bg_tile)
+ XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
else
- w = imlib_image_get_width();
+ XFillRectangle(disp, dpmap, gc, x, y, w, h);
+ IMLIB_FREE_PIXMAP_AND_MASK(pmap, mask);
}
- if (dsk->bg.yperc > 0)
- h = (rh * dsk->bg.yperc) >> 10;
- else
+ if (hasfg)
{
- if (!setbg)
- h = (imlib_image_get_height() * rh) / root.h;
- else
- h = imlib_image_get_height();
- }
+ int ww, hh;
- if (w <= 0)
- w = 1;
- if (h <= 0)
- h = 1;
+ imlib_context_set_image(dsk->top.im);
- if (dsk->bg.keep_aspect)
- {
- if (dsk->bg.yperc <= 0)
- {
- if (((w << 10) / h) !=
- ((imlib_image_get_width() << 10) /
- imlib_image_get_height()))
- h = ((w * imlib_image_get_height()) /
- imlib_image_get_width());
- }
- else
- {
- if (((h << 10) / w) !=
- ((imlib_image_get_height() << 10) /
- imlib_image_get_width()))
- w = ((h * imlib_image_get_width()) /
- imlib_image_get_height());
- }
- }
- dpmap = 0;
- x = ((rw - w) * dsk->bg.xjust) >> 10;
- y = ((rh - h) * dsk->bg.yjust) >> 10;
- if (setbg)
- {
- if (dsk->bg.tile)
- {
- if ((x != 0) || (y != 0))
- {
- dpmap = ECreatePixmap(disp, win, w, h, depth);
- gc = XCreateGC(disp, dpmap, 0, &gcv);
- }
- }
- else if ((x != 0) || (y != 0) || ((int)rw != (int)w)
- || ((int)rh != (int)h))
- {
- dpmap = ECreatePixmap(disp, win, rw, rh, depth);
- gc = XCreateGC(disp, dpmap, 0, &gcv);
- XSetForeground(disp, gc, dsk->bg.solid.pixel);
- XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
- }
- }
- else
- {
- if (dsk->bg.tile)
- {
- dpmap = ECreatePixmap(disp, win, w, h, depth);
- gc = XCreateGC(disp, dpmap, 0, &gcv);
- }
- else
- {
- dpmap = ECreatePixmap(disp, win, rw, rh, depth);
- gc = XCreateGC(disp, dpmap, 0, &gcv);
- XSetForeground(disp, gc, dsk->bg.solid.pixel);
- XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
- }
- }
- imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, w, h);
- if (dpmap)
- {
+ BgFindImageSize(&(dsk->top), rw, rh, &ww, &hh, setbg);
+ x = ((rw - ww) * dsk->top.xjust) >> 10;
+ y = ((rh - hh) * dsk->top.yjust) >> 10;
+
+ imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, ww, hh);
XSetTile(disp, gc, pmap);
XSetTSOrigin(disp, gc, x, y);
XSetFillStyle(disp, gc, FillTiled);
- if (dsk->bg.tile)
+ if (mask)
{
- XFillRectangle(disp, dpmap, gc, 0, 0, w, h);
- }
- else
- {
- XFillRectangle(disp, dpmap, gc, x, y, w, h);
- }
- imlib_free_pixmap_and_mask(pmap);
- }
- else
- dpmap = pmap;
- }
- else if (hasfg)
- {
- dpmap = ECreatePixmap(disp, win, rw, rh, depth);
- gc = XCreateGC(disp, dpmap, 0, &gcv);
- XSetForeground(disp, gc, dsk->bg.solid.pixel);
- XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
-
- imlib_context_set_image(dsk->top.im);
-
- if (dsk->top.xperc > 0)
- {
- ww = (rw * dsk->top.xperc) >> 10;
- }
- else
- {
- if (!setbg)
- {
- ww = (imlib_image_get_width() * rw) / root.w;
- }
- else
- {
- ww = imlib_image_get_width();
+ XSetClipMask(disp, gc, mask);
+ XSetClipOrigin(disp, gc, x, y);
}
+ XFillRectangle(disp, dpmap, gc, x, y, ww, hh);
+ IMLIB_FREE_PIXMAP_AND_MASK(pmap, mask);
}
- if (dsk->top.yperc > 0)
- {
- hh = (rh * dsk->top.yperc) >> 10;
- }
- else
- {
- if (!setbg)
- {
- hh = (imlib_image_get_height() * rh) / root.h;
- }
- else
- {
- hh = imlib_image_get_height();
- }
- }
- if (ww <= 0)
- ww = 1;
- if (hh <= 0)
- hh = 1;
- if (dsk->top.keep_aspect)
- {
- if (dsk->top.yperc <= 0)
- {
- if (((ww << 10) / hh) !=
- ((imlib_image_get_width() << 10) /
- imlib_image_get_height()))
- hh =
- ((ww * imlib_image_get_height()) /
- imlib_image_get_width());
- }
- else
- {
- if (((hh << 10) / ww) !=
- ((imlib_image_get_height() << 10) /
- imlib_image_get_width()))
- ww =
- ((hh * imlib_image_get_width()) /
- imlib_image_get_height());
- }
- }
- imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, ww, hh);
- x = ((rw - ww) * dsk->top.xjust) >> 10;
- y = ((rh - hh) * dsk->top.yjust) >> 10;
- XSetTile(disp, gc, pmap);
- XSetTSOrigin(disp, gc, x, y);
- XSetFillStyle(disp, gc, FillTiled);
- if (mask)
- {
- XSetClipMask(disp, gc, mask);
- XSetClipOrigin(disp, gc, x, y);
- }
- XFillRectangle(disp, dpmap, gc, x, y, ww, hh);
- imlib_free_pixmap_and_mask(pmap);
- }
- if (!dsk->keepim)
- {
- if (dsk->top.im)
- {
- imlib_context_set_image(dsk->top.im);
- imlib_free_image();
- dsk->top.im = NULL;
- }
- if (dsk->bg.im)
- {
- imlib_context_set_image(dsk->bg.im);
- imlib_free_image();
- dsk->bg.im = NULL;
- }
+ if (!dsk->keepim)
+ FreeBGimages(dsk, 0);
}
+
if (setbg)
{
if (dpmap)
{
- SetBG(win, dpmap, 0);
+ HintsSetRootInfo(win, dpmap, 0);
+ XSetWindowBackgroundPixmap(disp, win, dpmap);
}
else
{
- SetBG(win, 0, dsk->bg.solid.pixel);
+ HintsSetRootInfo(win, 0, dsk->bg_solid.pixel);
+ XSetWindowBackground(disp, win, dsk->bg_solid.pixel);
}
- dsk->pmap = dpmap;
+ XClearWindow(disp, win);
}
else
{
@@ -930,6 +711,7 @@
XSetFillStyle(disp, gc, FillTiled);
XFillRectangle(disp, win, gc, 0, 0, rw, rh);
imlib_free_pixmap_and_mask(dpmap);
+ dpmap = 0;
}
else
{
@@ -937,11 +719,12 @@
gc = XCreateGC(disp, win, 0, &gcv);
XSetClipMask(disp, gc, 0);
XSetFillStyle(disp, gc, FillSolid);
- XSetForeground(disp, gc, dsk->bg.solid.pixel);
+ XSetForeground(disp, gc, dsk->bg_solid.pixel);
XFillRectangle(disp, win, gc, 0, 0, rw, rh);
}
XSync(disp, False);
}
+ dsk->pmap = dpmap;
if (gc)
XFreeGC(disp, gc);
@@ -2189,7 +1972,13 @@
for (j = 0; j < ENLIGHTENMENT_CONF_NUM_DESKTOPS; j++)
{
if ((desks.desk[j].bg == lst[i]) && (!desks.desk[j].viewable))
- SetBG(desks.desk[j].win, 0, 0);
+ {
+ Window win = desks.desk[j].win;
+
+ HintsSetRootInfo(win, 0, 0);
+ XSetWindowBackground(disp, win, 0);
+ XClearWindow(disp, win);
+ }
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/hints.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- hints.c 8 Nov 2003 10:54:04 -0000 1.11
+++ hints.c 22 Nov 2003 00:15:40 -0000 1.12
@@ -253,3 +253,34 @@
XFree(name);
EDBUG_RETURN_;
}
+
+void
+HintsSetRootInfo(Window win, Pixmap pmap, int color)
+{
+ static Atom a = 0, aa = 0, aaa = 0;
+ static Window alive_win = 0;
+
+ EDBUG(6, "HintsSetRootInfo");
+
+ if (!a)
+ {
+ a = XInternAtom(disp, "_XROOTPMAP_ID", False);
+ aa = XInternAtom(disp, "_XROOTCOLOR_PIXEL", False);
+ aaa = XInternAtom(disp, "_XROOTWINDOW", False);
+ }
+ if (!alive_win)
+ {
+ alive_win = ECreateWindow(root.win, -100, -100, 1, 1, 0);
+ XChangeProperty(disp, alive_win, aaa, XA_WINDOW, 32, PropModeReplace,
+ (unsigned char *)&alive_win, 1);
+ XChangeProperty(disp, root.win, aaa, XA_WINDOW, 32, PropModeReplace,
+ (unsigned char *)&alive_win, 1);
+ }
+
+ XChangeProperty(disp, win, a, XA_PIXMAP, 32, PropModeReplace,
+ (unsigned char *)&pmap, 1);
+ XChangeProperty(disp, win, aa, XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *)&color, 1);
+
+ EDBUG_RETURN_;
+}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -3 -r1.115 -r1.116
--- ipc.c 15 Nov 2003 22:27:17 -0000 1.115
+++ ipc.c 22 Nov 2003 00:15:40 -0000 1.116
@@ -1094,7 +1094,7 @@
if (bg)
{
- EGetColor(&(bg->bg.solid), &r, &g, &b);
+ EGetColor(&(bg->bg_solid), &r, &g, &b);
Esnprintf(buf, sizeof(buf),
"%s ref_count %u\n" " bg.solid\t %i %i %i \n"
" bg.file\t %s \ttop.file\t %s \n"
@@ -1105,7 +1105,7 @@
" bg.xperc\t %i \ttop.xperc\t %i \n"
" bg.yperc\t %i \ttop.yperc\t %i \n", bg->name,
bg->ref_count, r, g, b,
- bg->bg.file, bg->top.file, bg->bg.tile,
+ bg->bg.file, bg->top.file, bg->bg_tile,
bg->bg.keep_aspect, bg->top.keep_aspect,
bg->bg.xjust, bg->top.xjust, bg->bg.yjust,
bg->top.yjust, bg->bg.xperc, bg->top.xperc,
@@ -1147,7 +1147,7 @@
word(params, 4, G);
word(params, 5, B);
- ESetColor(&(bg->bg.solid), atoi(R), atoi(G),
+ ESetColor(&(bg->bg_solid), atoi(R), atoi(G),
atoi(B));
}
else if (!strcmp(type, "bg.file"))
@@ -1158,7 +1158,7 @@
}
else if (!strcmp(type, "bg.tile"))
{
- bg->bg.tile = atoi(valu);
+ bg->bg_tile = atoi(valu);
}
else if (!strcmp(type, "bg.keep_aspect"))
{
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/settings.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -3 -r1.79 -r1.80
--- settings.c 15 Nov 2003 22:27:17 -0000 1.79
+++ settings.c 22 Nov 2003 00:15:40 -0000 1.80
@@ -2460,8 +2460,8 @@
mode.desktop_bg_timeout = tmp_bg_timeout;
desks.hiqualitybg = tmp_hiq;
mode.user_bg = tmp_userbg;
- ESetColor(&(tmp_bg->bg.solid), tmp_bg_r, tmp_bg_g, tmp_bg_b);
- tmp_bg->bg.tile = tmp_bg_tile;
+ ESetColor(&(tmp_bg->bg_solid), tmp_bg_r, tmp_bg_g, tmp_bg_b);
+ tmp_bg->bg_tile = tmp_bg_tile;
tmp_bg->bg.keep_aspect = tmp_bg_keep_aspect;
tmp_bg->bg.xjust = tmp_bg_xjust;
tmp_bg->bg.yjust = 1024 - tmp_bg_yjust;
@@ -2565,7 +2565,7 @@
{
if (tbg->pmap)
imlib_free_pixmap_and_mask(tbg->pmap);
- ESetColor(&(tbg->bg.solid), tmp_bg_r, tmp_bg_g, tmp_bg_b);
+ ESetColor(&(tbg->bg_solid), tmp_bg_r, tmp_bg_g, tmp_bg_b);
if (tbg->bg.file)
Efree(tbg->bg.file);
tbg->bg.file = NULL;
@@ -2583,7 +2583,7 @@
if (tbg->bg.real_file)
Efree(tbg->bg.real_file);
tbg->bg.real_file = NULL;
- tbg->bg.tile = tmp_bg_tile;
+ tbg->bg_tile = tmp_bg_tile;
tbg->bg.keep_aspect = tmp_bg_keep_aspect;
tbg->bg.xjust = tmp_bg_xjust;
tbg->bg.yjust = 1024 - tmp_bg_yjust;
@@ -2623,8 +2623,8 @@
DialogItemTextSetText(bg_filename, s);
DialogDrawItems(bg_sel_dialog, bg_filename, 0, 0, 99999, 99999);
- EGetColor(&(tmp_bg->bg.solid), &tmp_bg_r, &tmp_bg_g, &tmp_bg_b);
- tmp_bg_tile = tmp_bg->bg.tile;
+ EGetColor(&(tmp_bg->bg_solid), &tmp_bg_r, &tmp_bg_g, &tmp_bg_b);
+ tmp_bg_tile = tmp_bg->bg_tile;
tmp_bg_keep_aspect = tmp_bg->bg.keep_aspect;
tmp_bg_xjust = tmp_bg->bg.xjust;
tmp_bg_yjust = 1024 - tmp_bg->bg.yjust;
@@ -3199,7 +3199,7 @@
Background *bg;
bg = bglist[i];
- if ((bg) && (bg->bg.tile) && (bg->bg.xperc == 0)
+ if ((bg) && (bg->bg_tile) && (bg->bg.xperc == 0)
&& (bg->bg.yperc == 0))
{
AddItem(bg, bg->name, 0, LIST_TYPE_BACKGROUND);
@@ -3289,8 +3289,8 @@
tmp_bg_image = 0;
tmp_bg->keepim = 1;
- EGetColor(&(bg->bg.solid), &tmp_bg_r, &tmp_bg_g, &tmp_bg_b);
- tmp_bg_tile = bg->bg.tile;
+ EGetColor(&(bg->bg_solid), &tmp_bg_r, &tmp_bg_g, &tmp_bg_b);
+ tmp_bg_tile = bg->bg_tile;
tmp_bg_keep_aspect = bg->bg.keep_aspect;
tmp_bg_xjust = bg->bg.xjust;
tmp_bg_yjust = 1024 - bg->bg.yjust;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- x.c 5 Nov 2003 17:24:47 -0000 1.56
+++ x.c 22 Nov 2003 00:15:41 -0000 1.57
@@ -701,39 +701,6 @@
}
void
-SetBG(Window win, Pixmap pmap, int color)
-{
- static Atom a = 0, aa = 0, aaa = 0;
- static Window alive_win = 0;
-
- EDBUG(6, "SetBG");
- if (!a)
- {
- a = XInternAtom(disp, "_XROOTPMAP_ID", False);
- aa = XInternAtom(disp, "_XROOTCOLOR_PIXEL", False);
- aaa = XInternAtom(disp, "_XROOTWINDOW", False);
- }
- if (!alive_win)
- {
- alive_win = ECreateWindow(root.win, -100, -100, 1, 1, 0);
- XChangeProperty(disp, alive_win, aaa, XA_WINDOW, 32, PropModeReplace,
- (unsigned char *)&alive_win, 1);
- XChangeProperty(disp, root.win, aaa, XA_WINDOW, 32, PropModeReplace,
- (unsigned char *)&alive_win, 1);
- }
- XChangeProperty(disp, win, a, XA_PIXMAP, 32, PropModeReplace,
- (unsigned char *)&pmap, 1);
- XChangeProperty(disp, win, aa, XA_CARDINAL, 32, PropModeReplace,
- (unsigned char *)&color, 1);
- if (pmap)
- XSetWindowBackgroundPixmap(disp, win, pmap);
- else
- XSetWindowBackground(disp, win, color);
- XClearWindow(disp, win);
- EDBUG_RETURN_;
-}
-
-void
GetWinXY(Window win, int *x, int *y)
{
Window w1;
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs