Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h backgrounds.c desktops.c pager.c startup.c
Log Message:
Background generation tweaks, background selector speedups.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.472
retrieving revision 1.473
diff -u -3 -r1.472 -r1.473
--- E.h 17 Jul 2005 12:55:10 -0000 1.472
+++ E.h 24 Jul 2005 12:22:10 -0000 1.473
@@ -995,7 +995,11 @@
void BackgroundPixmapFree(Background * bg);
void BackgroundImagesFree(Background * bg, int free_pmap);
void BackgroundDestroyByName(const char *name);
-void BackgroundApply(Background * bg, Window win, int setbg);
+Pixmap BackgroundApply(Background * bg, Drawable draw,
+ unsigned int rw, unsigned int rh,
+ int is_win);
+void BackgroundSet(Background * bg, Window win, unsigned int rw,
+ unsigned int rh);
void BackgroundIncRefcount(Background * bg);
void BackgroundDecRefcount(Background * bg);
void BackgroundTouch(Background * bg);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/backgrounds.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- backgrounds.c 17 Jul 2005 12:55:11 -0000 1.34
+++ backgrounds.c 24 Jul 2005 12:22:18 -0000 1.35
@@ -449,216 +449,320 @@
*ph = h;
}
-/*
- * Apply a background to window/pixmap.
- *
- * If setbg is != 0, the (scaled) BG pixmap is stored in bg->pmap, otherwise
- * bg->pmap is left unchanged.
- */
-void
-BackgroundApply(Background * bg, Window win, int setbg)
+static void
+e16_tile_image_onto_image(Imlib_Image * tile, int blend, int tw, int th,
+ int dx, int dy, int dw, int dh, int ox, int oy)
{
- int rw, rh, depth;
- Pixmap dpmap;
- GC gc;
- int rt;
+ Imlib_Image *im, *tim;
+ int x, y, tx, ty, ww, hh;
+ int sw, sh;
+
+ im = imlib_context_get_image();
+ imlib_context_set_image(tile);
+ sw = imlib_image_get_width();
+ sh = imlib_image_get_height();
+ if (sw == tw && sh == th)
+ {
+ tim = tile;
+ }
+ else
+ {
+ tim = imlib_create_image(tw, th);
+ imlib_context_set_image(tim);
+ imlib_context_set_blend(0);
+ imlib_blend_image_onto_image(tile, 0, 0, 0, sw, sh, 0, 0, tw, th);
+ }
+ imlib_context_set_image(im);
- if (!EGetGeometry(win, NULL, NULL, NULL, &rw, &rh, NULL, &depth))
- return;
+ if (ox)
+ {
+ ox = tw - ox;
+ ox %= tw;
+ if (ox < 0)
+ ox += tw;
+ }
+ if (oy)
+ {
+ oy = th - oy;
+ oy %= th;
+ if (oy < 0)
+ oy += th;
+ }
+ dw += dx;
+ dh += dy;
+ y = dy;
+ ty = oy;
+ hh = th - oy;
+ for (;;)
+ {
+ if (y + hh >= dh)
+ hh = dh - y;
+ if (hh <= 0)
+ break;
+ x = dx;
+ tx = ox;
+ ww = tw - ox;
+ for (;;)
+ {
+ if (x + ww >= dw)
+ ww = dw - x;
+ if (ww <= 0)
+ break;
+ imlib_blend_image_onto_image(tim, blend, tx, ty, ww, hh,
+ x, y, ww, hh);
+ tx = 0;
+ x += ww;
+ ww = tw;
+ }
+ ty = 0;
+ y += hh;
+ hh = th;
+ }
+ if (tim != tile)
+ {
+ imlib_context_set_image(tim);
+ imlib_free_image();
+ imlib_context_set_image(im);
+ }
+}
- imlib_context_set_drawable(win);
+Pixmap
+BackgroundApply(Background * bg, Drawable draw,
+ unsigned int rw, unsigned int rh, int is_win)
+{
+ Pixmap pmap;
+ GC gc;
- EAllocColor(&bg->bg_solid);
- gc = 0;
- rt = imlib_context_get_dither();
+ int rt;
+ int x, y;
+ unsigned int w, h, ww, hh;
+ char hasbg, hasfg;
+ Imlib_Image *im;
- if (Conf.backgrounds.hiquality)
- {
- imlib_context_set_dither(1);
-#if 0 /* ??? */
- imlib_context_set_anti_alias(1);
+#if ENABLE_COLOR_MODIFIERS
+ ColorModifierClass *cm;
#endif
+
+ if (bg->bg.file && !bg->bg.im)
+ {
+ if (!bg->bg.real_file)
+ bg->bg.real_file = ThemeFileFind(bg->bg.file, 0);
+ bg->bg.im = ELoadImage(bg->bg.real_file);
}
- dpmap = (setbg) ? bg->pmap : None;
- if (!dpmap)
+ if (bg->top.file && !bg->top.im)
{
- int w, h, x, y;
- char hasbg, hasfg;
- Pixmap pmap, mask;
+ if (!bg->top.real_file)
+ bg->top.real_file = ThemeFileFind(bg->top.file, 0);
+ bg->top.im = ELoadImage(bg->top.real_file);
+ }
#if ENABLE_COLOR_MODIFIERS
- ColorModifierClass *cm;
-#endif
+ cm = bg->cmclass;
+ if (cm)
+ cm->ref_count--;
+ else
+ cm = FindItem("BACKGROUND", 0, LIST_FINDBY_NAME,
LIST_TYPE_COLORMODIFIER);
- if (bg->bg.file && !bg->bg.im)
+ if (cm)
+ {
+ cm->ref_count++;
+#if 0 /* To be implemented? */
+ if (bg->top.im)
{
- if (!bg->bg.real_file)
- bg->bg.real_file = ThemeFileFind(bg->bg.file, 0);
- bg->bg.im = ELoadImage(bg->bg.real_file);
+ Imlib_set_image_red_curve(pImlib_Context, bg->top.im, cm->red.map);
+ Imlib_set_image_green_curve(pImlib_Context, bg->top.im,
+ cm->green.map);
+ Imlib_set_image_blue_curve(pImlib_Context, bg->top.im,
+ cm->blue.map);
}
-
- if (bg->top.file && !bg->top.im)
+ if (bg->bg.im)
{
- if (!bg->top.real_file)
- bg->top.real_file = ThemeFileFind(bg->top.file, 0);
- bg->top.im = ELoadImage(bg->top.real_file);
+ Imlib_set_image_red_curve(pImlib_Context, bg->bg.im, cm->red.map);
+ Imlib_set_image_green_curve(pImlib_Context, bg->bg.im,
+ cm->green.map);
+ Imlib_set_image_blue_curve(pImlib_Context, bg->bg.im,
+ cm->blue.map);
}
-
-#if ENABLE_COLOR_MODIFIERS
- cm = bg->cmclass;
- if (cm)
- cm->ref_count--;
- else
- cm = FindItem("BACKGROUND", 0, LIST_FINDBY_NAME,
- LIST_TYPE_COLORMODIFIER);
-
- if (cm)
- {
- cm->ref_count++;
-#if 0 /* To be implemented? */
- if (bg->top.im)
- {
- Imlib_set_image_red_curve(pImlib_Context, bg->top.im,
- cm->red.map);
- Imlib_set_image_green_curve(pImlib_Context, bg->top.im,
- cm->green.map);
- Imlib_set_image_blue_curve(pImlib_Context, bg->top.im,
- cm->blue.map);
- }
- if (bg->bg.im)
- {
- Imlib_set_image_red_curve(pImlib_Context, bg->bg.im,
- cm->red.map);
- Imlib_set_image_green_curve(pImlib_Context, bg->bg.im,
- cm->green.map);
- Imlib_set_image_blue_curve(pImlib_Context, bg->bg.im,
- cm->blue.map);
- }
#endif
- }
+ }
#endif
- hasbg = hasfg = 0;
- if (bg->top.im)
- hasfg = 1;
- if (bg->bg.im)
- hasbg = 1;
-
- w = h = x = y = 0;
-
- if (hasbg)
- {
- imlib_context_set_image(bg->bg.im);
-
- BgFindImageSize(&(bg->bg), rw, rh, &w, &h);
- x = ((rw - w) * bg->bg.xjust) >> 10;
- y = ((rh - h) * bg->bg.yjust) >> 10;
+ hasbg = bg->bg.im != NULL;
+ hasfg = bg->top.im != NULL;
- imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, w, h);
- }
+ if (!hasbg && !hasfg)
+ {
+ /* Solid color only */
+ EAllocColor(&bg->bg_solid);
- if (hasbg && !hasfg && setbg && x == 0 && y == 0 && w == rw && h == rh)
+ if (is_win)
{
- /* Put image 1:1 onto the current root window */
- dpmap = pmap;
- }
- else if (hasbg && !hasfg && bg->bg_tile && !TransparencyEnabled())
- {
- /* BG only, tiled */
- dpmap = ECreatePixmap(win, w, h, depth);
- gc = ECreateGC(dpmap, 0, NULL);
+ ESetWindowBackground(draw, bg->bg_solid.pixel);
}
else
{
- /* The rest that require some more work */
- dpmap = ECreatePixmap(win, rw, rh, depth);
- gc = ECreateGC(dpmap, 0, NULL);
- if (!hasbg || !bg->bg_tile)
- {
- XSetForeground(disp, gc, bg->bg_solid.pixel);
- XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
- }
+ gc = ECreateGC(draw, 0, NULL);
+ XSetClipMask(disp, gc, 0);
+ XSetFillStyle(disp, gc, FillSolid);
+ XSetForeground(disp, gc, bg->bg_solid.pixel);
+ XFillRectangle(disp, draw, gc, 0, 0, rw, rh);
+ EFreeGC(gc);
}
+ return None;
+ }
- if (hasbg && dpmap != pmap)
- {
- XSetTile(disp, gc, pmap);
- XSetTSOrigin(disp, gc, x, y);
- XSetFillStyle(disp, gc, FillTiled);
- if (bg->bg_tile)
- XFillRectangle(disp, dpmap, gc, 0, 0, rw, rh);
- else
- XFillRectangle(disp, dpmap, gc, x, y, w, h);
- imlib_free_pixmap_and_mask(pmap);
- }
+ /* Has either bg or fg image */
- if (hasfg)
- {
- int ww, hh;
+ rt = imlib_context_get_dither();
+ if (Conf.backgrounds.hiquality)
+ {
+ imlib_context_set_dither(1);
+#if 0 /* ??? */
+ imlib_context_set_anti_alias(1);
+#endif
+ }
- imlib_context_set_image(bg->top.im);
+ w = h = x = y = 0;
- BgFindImageSize(&(bg->top), rw, rh, &ww, &hh);
- x = ((rw - ww) * bg->top.xjust) >> 10;
- y = ((rh - hh) * bg->top.yjust) >> 10;
+ if (hasbg)
+ {
+ imlib_context_set_image(bg->bg.im);
+
+ BgFindImageSize(&(bg->bg), rw, rh, &w, &h);
+ x = ((rw - w) * bg->bg.xjust) >> 10;
+ y = ((rh - h) * bg->bg.yjust) >> 10;
+ }
- imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, ww, hh);
+ if (is_win && hasbg && !hasfg && x == 0 && y == 0 &&
+ ((w == rw && h == rh) || (bg->bg_tile && !TransparencyEnabled())))
+ {
+ /* Window, no fg, no offset, and scale to 100%, or tiled, no trans */
+ pmap = ECreatePixmap(VRoot.win, w, h, VRoot.depth);
+ imlib_context_set_drawable(pmap);
+ imlib_render_image_on_drawable_at_size(0, 0, w, h);
+
+ if (x == 0 && y == 0)
+ {
+ ESetWindowBackgroundPixmap(draw, pmap);
+ }
+ else
+ {
+ gc = ECreateGC(draw, 0, NULL);
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);
+ XFillRectangle(disp, draw, gc, 0, 0, rw, rh);
+ EFreeGC(gc);
}
-
- if (!bg->keepim)
- BackgroundImagesFree(bg, 0);
+ goto done;
}
- if (setbg)
+ /* The rest that require some more work */
+ if (is_win)
+ pmap = ECreatePixmap(VRoot.win, rw, rh, VRoot.depth);
+ else
+ pmap = draw;
+ imlib_context_set_drawable(pmap);
+
+ if (hasbg && x == 0 && y == 0 && w == rw && h == rh)
{
- if (bg->pmap != dpmap)
- BackgroundPixmapFree(bg);
- bg->pmap = dpmap;
- if (dpmap)
- ESetWindowBackgroundPixmap(win, dpmap);
- else
- ESetWindowBackground(win, bg->bg_solid.pixel);
- EClearWindow(win);
+ im = bg->bg.im;
+ imlib_context_set_image(im);
}
else
{
- if (dpmap)
- {
- if (!gc)
- gc = ECreateGC(dpmap, 0, NULL);
- XSetClipMask(disp, gc, 0);
- XSetTile(disp, gc, dpmap);
- XSetTSOrigin(disp, gc, 0, 0);
- XSetFillStyle(disp, gc, FillTiled);
- XFillRectangle(disp, win, gc, 0, 0, rw, rh);
- imlib_free_pixmap_and_mask(dpmap);
+ /* Create full size image */
+ im = imlib_create_image(rw, rh);
+ imlib_context_set_image(im);
+ imlib_image_set_has_alpha(0);
+ if (!hasbg || !bg->bg_tile)
+ {
+ /* Fill solid */
+ imlib_context_set_blend(0);
+ imlib_context_set_color(bg->bg_solid.red, bg->bg_solid.green,
+ bg->bg_solid.blue, 0);
+ imlib_image_fill_rectangle(0, 0, rw, rh);
}
- else
+ if (hasbg)
{
- if (!gc)
- gc = ECreateGC(win, 0, NULL);
- XSetClipMask(disp, gc, 0);
- XSetFillStyle(disp, gc, FillSolid);
- XSetForeground(disp, gc, bg->bg_solid.pixel);
- XFillRectangle(disp, win, gc, 0, 0, rw, rh);
+ if (bg->bg_tile)
+ {
+ e16_tile_image_onto_image(bg->bg.im, 0, w, h,
+ 0, 0, rw, rh, x, y);
+ }
+ else
+ {
+ imlib_context_set_image(bg->bg.im);
+ ww = imlib_image_get_width();
+ hh = imlib_image_get_height();
+ imlib_context_set_image(im);
+ imlib_blend_image_onto_image(bg->bg.im, 1, 0, 0, ww, hh,
+ x, y, w, h);
+ }
}
}
- if (gc)
- EFreeGC(gc);
+ if (hasfg)
+ {
+ imlib_context_set_image(bg->top.im);
+
+ BgFindImageSize(&(bg->top), rw, rh, &w, &h);
+ x = ((rw - w) * bg->top.xjust) >> 10;
+ y = ((rh - h) * bg->top.yjust) >> 10;
+
+ ww = imlib_image_get_width();
+ hh = imlib_image_get_height();
+ imlib_context_set_image(im);
+ imlib_blend_image_onto_image(bg->top.im, 0, 0, 0, ww, hh, x, y, w, h);
+ }
+
+ imlib_render_image_on_drawable_at_size(0, 0, rw, rh);
+ if (im != bg->bg.im)
+ imlib_free_image();
+
+ done:
+ if (!bg->keepim)
+ BackgroundImagesFree(bg, 0);
imlib_context_set_dither(rt);
+
+ return pmap;
+}
+
+/*
+ * Apply a background to window/pixmap.
+ * The (scaled) BG pixmap is stored in bg->pmap.
+ */
+void
+BackgroundSet(Background * bg, Window win, unsigned int w, unsigned int h)
+{
+ Pixmap pmap;
+
+ if (bg->pmap)
+ pmap = bg->pmap;
+ else
+ pmap = BackgroundApply(bg, win, w, h, 1);
+
+ bg->pmap = pmap;
+ if (pmap != None)
+ ESetWindowBackgroundPixmap(win, pmap);
+ else
+ ESetWindowBackground(win, bg->bg_solid.pixel);
+ EClearWindow(win);
+}
+
+static void
+BackgroundApply2(Background * bg, Window win)
+{
+ Window rr;
+ int x, y;
+ unsigned int w, h, bw, depth;
+
+ if (!XGetGeometry(disp, win, &rr, &x, &y, &w, &h, &bw, &depth))
+ return;
+
+ BackgroundApply(bg, win, w, h, 1);
}
Background *
@@ -840,6 +944,30 @@
return bg->last_viewed;
}
+static Pixmap
+BackgroundCacheMini(Background * bg, int keep)
+{
+ char s[4096];
+ Imlib_Image *im;
+ Pixmap pmap;
+
+ Esnprintf(s, sizeof(s), "%s/cached/bgsel/%s", EDirUserCache(),
+ BackgroundGetName(bg));
+ pmap = ECreatePixmap(VRoot.win, 64, 48, VRoot.depth);
+ BackgroundApply(bg, pmap, 64, 48, 0);
+ imlib_context_set_drawable(pmap);
+ im = imlib_create_image_from_drawable(0, 0, 0, 64, 48, 0);
+ imlib_context_set_image(im);
+ imlib_image_set_format("png");
+ imlib_save_image(s);
+ imlib_free_image_and_decache();
+
+ if (keep)
+ return pmap;
+ EFreePixmap(pmap);
+ return None;
+}
+
#define S(str) ((str) ? str : "(null)")
static void
BackgroundGetInfoString1(const Background * bg, char *buf, int len)
@@ -952,25 +1080,17 @@
{
tmp = ThemeFileFind(bg1, 0);
if (!tmp)
- {
- ok = 0;
- }
+ ok = 0;
else
- {
- Efree(tmp);
- }
+ Efree(tmp);
}
if (bg2)
{
tmp = ThemeFileFind(bg2, 0);
if (!tmp)
- {
- ok = 0;
- }
+ ok = 0;
else
- {
- Efree(tmp);
- }
+ Efree(tmp);
}
if (ok)
{
@@ -1316,6 +1436,7 @@
static DItem *tmp_w[10];
static Background *tmp_bg; /* The background being configured */
+static Pixmap tmp_bg_mini_pixmap = None;
static int tmp_bg_sel_sliderval = 0;
static int tmp_bg_r;
static int tmp_bg_g;
@@ -1338,6 +1459,16 @@
{
int i;
+ if (val < 0)
+ {
+ BackgroundImagesKeep(tmp_bg, 0);
+ tmp_bg = NULL;
+ if (tmp_bg_mini_pixmap != None)
+ EFreePixmap(tmp_bg_mini_pixmap);
+ tmp_bg_mini_pixmap = None;
+ return;
+ }
+
if (val < 2)
{
Conf.backgrounds.timeout = tmp_bg_timeout;
@@ -1352,38 +1483,17 @@
tmp_bg->bg.xperc = tmp_bg_xperc;
tmp_bg->bg.yperc = 1024 - tmp_bg_yperc;
- if (!tmp_bg_image)
- BackgroundImagesRemove(tmp_bg);
-
for (i = 0; i < DesksGetNumber(); i++)
{
if (DeskGetBackground(i) == tmp_bg)
DeskSetBg(i, tmp_bg, 1);
}
- {
- char s[4096];
- Imlib_Image *im;
- Pixmap p2;
-
- Esnprintf(s, sizeof(s), "%s/cached/bgsel/%s", EDirUserCache(),
- BackgroundGetName(tmp_bg));
- p2 = ECreatePixmap(VRoot.win, 64, 48, VRoot.depth);
- BackgroundApply(tmp_bg, p2, 0);
- imlib_context_set_drawable(p2);
- im = imlib_create_image_from_drawable(0, 0, 0, 64, 48, 0);
- imlib_context_set_image(im);
- imlib_image_set_format("png");
- imlib_save_image(s);
- imlib_free_image_and_decache();
- EFreePixmap(p2);
- BG_RedrawView(1);
- }
- }
+ BackgroundCacheMini(tmp_bg, 0);
+ BG_RedrawView(1);
- if (val != 1)
- {
- BackgroundImagesKeep(tmp_bg, 0);
+ if (!tmp_bg_image)
+ BackgroundImagesRemove(tmp_bg);
}
autosave();
@@ -1391,14 +1501,13 @@
/* Draw the background preview image */
static void
-CB_DesktopMiniDisplayRedraw(Dialog * d __UNUSED__, int val __UNUSED__,
- void *data)
+CB_DesktopMiniDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
{
Background *bg;
+ Pixmap pmap;
int w, h;
DItem *di;
Window win;
- Pixmap pmap;
XColor xclr;
const char *fbg, *ffg;
@@ -1409,24 +1518,32 @@
win = DialogItemAreaGetWindow(di);
DialogItemAreaGetSize(di, &w, &h);
- fbg = (tmp_bg_image) ? BackgroundGetBgFile(tmp_bg) : NULL;
- ffg = (tmp_bg_image) ? BackgroundGetFgFile(tmp_bg) : NULL;
- ESetColor(&xclr, tmp_bg_r, tmp_bg_g, tmp_bg_b);
- bg = BackgroundCreate("TEMP", &xclr, fbg, tmp_bg_tile,
- tmp_bg_keep_aspect, tmp_bg_xjust,
- 1024 - tmp_bg_yjust, tmp_bg_xperc,
- 1024 - tmp_bg_yperc, ffg,
- tmp_bg->top.keep_aspect, tmp_bg->top.xjust,
- tmp_bg->top.yjust, tmp_bg->top.xperc,
- tmp_bg->top.yperc);
+ if (tmp_bg_mini_pixmap == None)
+ tmp_bg_mini_pixmap = ECreatePixmap(win, w, h, VRoot.depth);
+ pmap = tmp_bg_mini_pixmap;
- pmap = ECreatePixmap(win, w, h, VRoot.depth);
- ESetWindowBackgroundPixmap(win, pmap);
- BackgroundApply(bg, pmap, 0);
- EClearWindow(win);
- EFreePixmap(pmap);
+ if (val == 1)
+ {
+ ESetWindowBackgroundPixmap(win, pmap);
+ BackgroundApply(tmp_bg, pmap, w, h, 0);
+ }
+ else
+ {
+ fbg = (tmp_bg_image) ? BackgroundGetBgFile(tmp_bg) : NULL;
+ ffg = (tmp_bg_image) ? BackgroundGetFgFile(tmp_bg) : NULL;
+ ESetColor(&xclr, tmp_bg_r, tmp_bg_g, tmp_bg_b);
+ bg = BackgroundCreate("TEMP", &xclr, fbg, tmp_bg_tile,
+ tmp_bg_keep_aspect, tmp_bg_xjust,
+ 1024 - tmp_bg_yjust, tmp_bg_xperc,
+ 1024 - tmp_bg_yperc, ffg,
+ tmp_bg->top.keep_aspect, tmp_bg->top.xjust,
+ tmp_bg->top.yjust, tmp_bg->top.xperc,
+ tmp_bg->top.yperc);
- BackgroundDestroy(bg);
+ BackgroundApply(bg, pmap, w, h, 0);
+ BackgroundDestroy(bg);
+ }
+ EClearWindow(win);
}
/* Update tmp vars according to the current tmp_bg */
@@ -1442,8 +1559,6 @@
tmp_bg_yjust = 1024 - tmp_bg->bg.yjust;
tmp_bg_xperc = tmp_bg->bg.xperc;
tmp_bg_yperc = 1024 - tmp_bg->bg.yperc;
-
- BackgroundImagesKeep(tmp_bg, 1);
}
static void
@@ -1468,7 +1583,10 @@
{
int i;
+ if (tmp_bg && tmp_bg != bg)
+ BackgroundImagesKeep(tmp_bg, 0);
tmp_bg = bg;
+ BackgroundImagesKeep(tmp_bg, 1);
/* Fetch new BG values */
BG_GetValues();
@@ -1489,7 +1607,7 @@
DialogItemSliderSetVal(tmp_w[9], tmp_bg_xperc);
/* Redraw preview image */
- CB_DesktopMiniDisplayRedraw(NULL, 0, bg_mini_disp);
+ CB_DesktopMiniDisplayRedraw(NULL, 1, bg_mini_disp);
/* Redraw scrolling BG list */
BG_RedrawView(0);
@@ -1569,6 +1687,7 @@
BackgroundDestroy(tmp_bg);
else
BackgroundDelete(tmp_bg);
+ tmp_bg = NULL;
BgDialogSetNewCurrent(bg);
@@ -1605,7 +1724,7 @@
bglist = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND);
if (!bglist)
- goto done;
+ return;
win = DialogItemAreaGetWindow(bg_sel);
DialogItemAreaGetSize(bg_sel, &w, &h);
@@ -1617,9 +1736,7 @@
XFillRectangle(disp, pmap, gc, 0, 0, w, h);
ESetWindowBackgroundPixmap(win, pmap);
- x = -(tmp_bg_sel_sliderval * (64 + 8) / 4);
- if (x < (w - ((64 + 8) * num)))
- x = w - ((64 + 8) * num);
+ x = -(num * (64 + 8) - w) * tmp_bg_sel_sliderval / (4 * num);
for (i = 0; i < num; i++)
{
@@ -1669,18 +1786,8 @@
im = ELoadImage(s);
if (!im)
{
- Esnprintf(s, sizeof(s), "%s/cached/bgsel/%s",
- EDirUserCache(), BackgroundGetName(bglist[i]));
- p2 = ECreatePixmap(pmap, 64, 48, VRoot.depth);
- BackgroundApply(bglist[i], p2, 0);
+ p2 = BackgroundCacheMini(bglist[i], 1);
XCopyArea(disp, p2, pmap, gc, 0, 0, 64, 48, x + 4, 4);
- imlib_context_set_drawable(p2);
- im =
- imlib_create_image_from_drawable(0, 0, 0, 64, 48, 0);
- imlib_context_set_image(im);
- imlib_image_set_format("png");
- imlib_save_image(s);
- imlib_free_image_and_decache();
EFreePixmap(p2);
}
else
@@ -1709,9 +1816,6 @@
Efree(bglist);
EClearWindow(win);
-
- done:
- return;
}
static void
@@ -1750,21 +1854,19 @@
{
case ButtonPress:
bglist = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND);
- x = (tmp_bg_sel_sliderval * (64 + 8) / 4);
- if (x > ((num * (64 + 8)) - w))
- x = ((num * (64 + 8)) - w);
- x += ev->xbutton.x;
- x = x / (64 + 8);
- tmp_bg_selected = x;
+ if (!bglist)
+ break;
+
+ x = (num * (64 + 8) - w) * tmp_bg_sel_sliderval / (4 * num) +
+ ev->xbutton.x;
+ tmp_bg_selected = x / (64 + 8);
if ((tmp_bg_selected >= 0) && (tmp_bg_selected < num))
{
- BackgroundImagesKeep(tmp_bg, 0);
BgDialogSetNewCurrent(bglist[tmp_bg_selected]);
DeskSetBg(DesksGetCurrent(), tmp_bg, 0);
autosave();
}
- if (bglist)
- Efree(bglist);
+ Efree(bglist);
break;
case ButtonRelease:
@@ -1792,11 +1894,10 @@
static void
BGSettingsGoTo(Background * bg)
{
- Dialog *bgd;
Background **bglist;
int i, num;
- if (!(bgd = FindItem("CONFIGURE_BG", 0, LIST_FINDBY_NAME,
LIST_TYPE_DIALOG)))
+ if (!FindItem("CONFIGURE_BG", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG))
return;
bglist = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND);
@@ -1811,7 +1912,6 @@
DialogDrawItems(bg_sel_dialog, bg_sel_slider, 0, 0, 99999, 99999);
DialogItemCallCallback(NULL, bg_sel_slider);
tmp_bg_selected = i;
- BackgroundImagesKeep(tmp_bg, 0);
BgDialogSetNewCurrent(bglist[tmp_bg_selected]);
tmp_bg_selected = -1;
break;
@@ -2364,7 +2464,7 @@
DialogAddButton(d, _("OK"), CB_ConfigureBG, 1, DIALOG_BUTTON_OK);
DialogAddButton(d, _("Apply"), CB_ConfigureBG, 0, DIALOG_BUTTON_APPLY);
DialogAddButton(d, _("Close"), CB_ConfigureBG, 1, DIALOG_BUTTON_CLOSE);
- DialogSetExitFunction(d, CB_ConfigureBG, 2);
+ DialogSetExitFunction(d, CB_ConfigureBG, -1);
DialogBindKey(d, "Escape", DialogCallbackClose, 0);
DialogBindKey(d, "Return", CB_ConfigureBG, 0);
@@ -2373,13 +2473,6 @@
CB_DesktopMiniDisplayRedraw(NULL, 1, area);
BG_RedrawView(0);
BGSettingsGoTo(tmp_bg);
- /* This is kind of a hack - somehow it loses the correct current desktop
- * information when we actually open up the dialog box, so this
- * should fix the atom which apparently gets clobbered somewhere
- * above here
- * --Mandrake
- */
- DeskRefresh(DesksGetCurrent());
}
/*
@@ -2568,7 +2661,7 @@
win = None;
sscanf(p, "%lx", &win);
if (win)
- BackgroundApply(bg, win, 0);
+ BackgroundApply2(bg, win);
}
}
else if (!strncmp(cmd, "cfg", 2))
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -3 -r1.157 -r1.158
--- desktops.c 16 Jul 2005 16:57:39 -0000 1.157
+++ desktops.c 24 Jul 2005 12:22:19 -0000 1.158
@@ -835,7 +835,7 @@
if (!bg)
return;
- BackgroundApply(bg, EoGetWin(d), 1);
+ BackgroundSet(bg, EoGetWin(d), EoGetW(d), EoGetH(d));
HintsSetRootInfo(EoGetWin(d),
BackgroundGetPixmap(bg), BackgroundGetColor(bg));
}
@@ -1692,7 +1692,7 @@
bg = DeskGetBackground(i);
if (bg)
- BackgroundApply(DeskGetBackground(i), pmap, 0);
+ BackgroundApply(DeskGetBackground(i), pmap, 64, 48, 0);
else
{
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 0);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -3 -r1.162 -r1.163
--- pager.c 21 Jul 2005 22:10:57 -0000 1.162
+++ pager.c 24 Jul 2005 12:22:19 -0000 1.163
@@ -523,7 +523,7 @@
}
else
{
- BackgroundApply(bg, pmap, 0);
+ BackgroundApply(bg, pmap, p->dw, p->dh, 0);
imlib_context_set_drawable(pmap);
im = imlib_create_image_from_drawable(0, 0, 0, p->dw, p->dh, 1);
imlib_context_set_image(im);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/startup.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- startup.c 22 Jul 2005 17:00:10 -0000 1.56
+++ startup.c 24 Jul 2005 12:22:19 -0000 1.57
@@ -102,12 +102,14 @@
ImageclassApply(ic, b2, bw, bh, 0, 0, 0, 0, ST_UNKNWN);
}
- BackgroundApply(bg, win1, 1);
- BackgroundApply(bg, win2, 1);
+ BackgroundSet(bg, win1, VRoot.w, VRoot.h);
+ BackgroundSet(bg, win2, VRoot.w, VRoot.h);
BackgroundImagesFree(bg, 1);
EobjMap(init_win1, 0);
EobjMap(init_win2, 0);
+
+ EobjsRepaint();
}
void
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs