Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
backgrounds.c desktops.c dialog.c hiwin.c pager.c x.c xwin.h
zoom.c
Log Message:
Move some window background pixmap handling down to Win layer.
===================================================================
RCS file: /cvs/e/e16/e/src/backgrounds.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -3 -r1.95 -r1.96
--- backgrounds.c 20 May 2007 12:46:24 -0000 1.95
+++ backgrounds.c 25 May 2007 22:40:47 -0000 1.96
@@ -1516,7 +1516,6 @@
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;
static int tmp_bg_sel_sliderval_old;
static int tmp_bg_r;
@@ -1545,9 +1544,6 @@
memset(tmp_w, 0, sizeof(tmp_w));
BackgroundImagesKeep(tmp_bg, 0);
tmp_bg = NULL;
- if (tmp_bg_mini_pixmap != None)
- EFreePixmap(tmp_bg_mini_pixmap);
- tmp_bg_mini_pixmap = None;
return;
}
@@ -1596,17 +1592,9 @@
win = DialogItemAreaGetWindow(di);
DialogItemAreaGetSize(di, &w, &h);
- if (tmp_bg_mini_pixmap == None)
- tmp_bg_mini_pixmap = ECreatePixmap(win, w, h, 0);
- pmap = tmp_bg_mini_pixmap;
-
if (val == 1)
{
- ESetWindowBackgroundPixmap(win, pmap);
- BackgroundApplyPmap(tmp_bg, win, pmap, w, h);
- }
- else
- {
+ pmap = EGetWindowBackgroundPixmap(win);
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);
@@ -1620,8 +1608,8 @@
BackgroundApplyPmap(bg, win, pmap, w, h);
BackgroundDestroy(bg);
+ EClearWindow(win);
}
- EClearWindow(win);
}
/* Update tmp vars according to the current tmp_bg */
@@ -1682,9 +1670,6 @@
DialogItemSliderSetVal(tmp_w[8], tmp_bg_yperc);
DialogItemSliderSetVal(tmp_w[9], tmp_bg_xperc);
- /* Redraw preview image */
- CB_DesktopMiniDisplayRedraw(NULL, 1, bg_mini_disp);
-
/* Redraw scrolling BG list */
BG_RedrawView();
@@ -1795,14 +1780,13 @@
win = DialogItemAreaGetWindow(bg_sel);
DialogItemAreaGetSize(bg_sel, &w, &h);
- pmap = ECreatePixmap(win, w, h, 0);
+ pmap = EGetWindowBackgroundPixmap(win);
gc = EXCreateGC(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);
x = -(num * (64 + 8) - w) * tmp_bg_sel_sliderval / (4 * num);
@@ -1847,7 +1831,6 @@
x += (64 + 8);
}
EXFreeGC(gc);
- EFreePixmap(pmap);
EClearWindow(win);
}
===================================================================
RCS file: /cvs/e/e16/e/src/desktops.c,v
retrieving revision 1.259
retrieving revision 1.260
diff -u -3 -r1.259 -r1.260
--- desktops.c 18 May 2007 08:25:02 -0000 1.259
+++ desktops.c 25 May 2007 22:40:47 -0000 1.260
@@ -406,6 +406,7 @@
desks.order[desk] = desk;
win = (desk == 0) ? VRoot.win : NoWin;
+
Esnprintf(buf, sizeof(buf), "Desk-%d", desk);
EoSetNoRedirect(dsk, 1);
EoInit(dsk, EOBJ_TYPE_DESK, win, 0, 0, VRoot.w, VRoot.h, 0, buf);
@@ -2304,16 +2305,18 @@
if (!wins[i])
{
Background *bg;
- Pixmap pmap;
wins[i] = ECreateWindow(win, 0, 0, 64, 48, 0);
ESetWindowBorderWidth(wins[i], 1);
- pmap = ECreatePixmap(wins[i], 64, 48, 0);
- ESetWindowBackgroundPixmap(wins[i], pmap);
bg = DeskBackgroundGet(DeskGet(i));
if (bg)
- BackgroundApplyPmap(bg, wins[i], pmap, 64, 48);
+ {
+ Pixmap pmap;
+
+ pmap = EGetWindowBackgroundPixmap(wins[i]);
+ BackgroundApplyPmap(bg, wins[i], pmap, 64, 48);
+ }
else
{
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 0);
@@ -2321,8 +2324,6 @@
ImageclassApply(ic, wins[i], 64, 48, 0, 0, STATE_NORMAL,
ST_SOLID);
}
-
- EFreePixmap(pmap);
}
}
===================================================================
RCS file: /cvs/e/e16/e/src/dialog.c,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -3 -r1.185 -r1.186
--- dialog.c 18 May 2007 21:18:24 -0000 1.185
+++ dialog.c 25 May 2007 22:40:47 -0000 1.186
@@ -172,7 +172,6 @@
{
EWin *ewin;
Win win;
- Pixmap pmap;
int w, h;
char *name;
char *title;
@@ -286,7 +285,6 @@
TextclassDecRefcount(d->tclass);
FreePmapMask(&(d->pmm_bg));
- EFreePixmap(d->pmap);
EDestroyWindow(d->win);
Efree(d);
@@ -491,14 +489,8 @@
if (d->pmm_bg.pmap == None)
return;
- if (d->resize || d->pmap == None)
- {
- if (d->pmap != None)
- EFreePixmap(d->pmap);
- d->pmap = ECreatePixmap(d->win, d->w, d->h, 0);
- ESetWindowBackgroundPixmap(d->win, d->pmap);
- }
- EXCopyArea(d->pmm_bg.pmap, d->pmap, 0, 0, d->w, d->h, 0, 0);
+ EGetWindowBackgroundPixmap(d->win);
+ EXCopyArea(d->pmm_bg.pmap, WinGetPmap(d->win), 0, 0, d->w, d->h, 0, 0);
d->redraw = 1;
@@ -1813,9 +1805,9 @@
if (!di->text)
break;
if (!d->redraw)
- EXCopyArea(d->pmm_bg.pmap, d->pmap, di->x, di->y, di->w, di->h,
- di->x, di->y);
- TextDraw(di->tclass, d->win, d->pmap, 0, 0, state, di->text,
+ EXCopyArea(d->pmm_bg.pmap, WinGetPmap(d->win), di->x, di->y,
+ di->w, di->h, di->x, di->y);
+ TextDraw(di->tclass, d->win, WinGetPmap(d->win), 0, 0, state, di->text,
x, di->y, w, 99999, 17, TextclassGetJustification(di->tclass));
break;
}
===================================================================
RCS file: /cvs/e/e16/e/src/hiwin.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- hiwin.c 6 Apr 2007 22:20:07 -0000 1.25
+++ hiwin.c 25 May 2007 22:40:47 -0000 1.26
@@ -215,10 +215,8 @@
if (shown)
{
- pmap = ECreatePixmap(EoGetWin(phi), EoGetW(phi), EoGetH(phi), 0);
- ESetWindowBackgroundPixmap(EoGetWin(phi), pmap);
+ pmap = EGetWindowBackgroundPixmap(EoGetWin(phi));
HiwinRenderPixmapDrawX(phi, pmap);
- EFreePixmap(pmap);
EClearWindow(EoGetWin(phi));
}
===================================================================
RCS file: /cvs/e/e16/e/src/pager.c,v
retrieving revision 1.244
retrieving revision 1.245
diff -u -3 -r1.244 -r1.245
--- pager.c 20 May 2007 12:44:56 -0000 1.244
+++ pager.c 25 May 2007 22:40:47 -0000 1.245
@@ -82,7 +82,6 @@
{
EWin *ewin;
Win win;
- Pixmap pmap;
int w, h;
char *name;
Pixmap bgpmap;
@@ -164,8 +163,6 @@
Efree(p->name);
EDestroyWindow(p->win);
PagerHiwinHide();
- if (p->pmap != None)
- EFreePixmap(p->pmap);
if (p->bgpmap != None)
EFreePixmap(p->bgpmap);
@@ -250,16 +247,16 @@
y = ((phase & 0xfffffff8) + offsets[phase % 8]) % hh;
y2 = (y * VRoot.h) / hh;
- ScaleRect(VRoot.win, VRoot.xwin, p->win, p->pmap, NULL, 0, y2, VRoot.w,
- VRoot.h / hh, xx, yy + y, ww, 1, Conf_pagers.hiq);
+ ScaleRect(VRoot.win, VRoot.xwin, p->win, WinGetPmap(p->win), NULL, 0, y2,
+ VRoot.w, VRoot.h / hh, xx, yy + y, ww, 1, Conf_pagers.hiq);
EClearArea(p->win, xx, yy + y, ww, 1, False);
y2 = p->h;
#else
y = ((phase & 0xfffffff8) + offsets[phase % 8]) % ww;
y2 = (y * VRoot.w) / ww;
- ScaleRect(VRoot.win, VRoot.xwin, p->win, p->pmap, NULL, y2, 0, VRoot.w / ww,
- VRoot.h, xx + y, yy, 1, hh, Conf_pagers.hiq);
+ ScaleRect(VRoot.win, VRoot.xwin, p->win, WinGetPmap(p->win), NULL, y2, 0,
+ VRoot.w / ww, VRoot.h, xx + y, yy, 1, hh, Conf_pagers.hiq);
EClearArea(p->win, xx + y, yy, 1, hh, False);
y2 = p->w;
#endif
@@ -378,6 +375,7 @@
EWin *const *lst;
int i, num, update_screen_included, update_screen_only;
int pager_mode = PagersGetMode();
+ Pixmap pmap;
p->update_phase = 0;
DesksGetAreaSize(&ax, &ay);
@@ -402,6 +400,8 @@
p->x1 = p->y1 = 99999;
p->x2 = p->y2 = -99999;
+ pmap = EGetWindowBackgroundPixmap(p->win);
+
if (update_screen_only)
goto do_screen_update;
@@ -424,7 +424,7 @@
return;
p->do_update = 0;
- gc = EXCreateGC(p->pmap, 0, NULL);
+ gc = EXCreateGC(pmap, 0, NULL);
if (gc == None)
return;
@@ -437,7 +437,7 @@
if (update_screen_included && x == cx && y == cy)
continue;
#endif
- XCopyArea(disp, p->bgpmap, p->pmap, gc, 0, 0, p->dw, p->dh,
+ XCopyArea(disp, p->bgpmap, pmap, gc, 0, 0, p->dw, p->dh,
x * p->dw, y * p->dh);
}
}
@@ -463,7 +463,7 @@
XSetClipMask(disp, gc, ewin->mini_pmm.mask);
XSetClipOrigin(disp, gc, wx, wy);
}
- XCopyArea(disp, ewin->mini_pmm.pmap, p->pmap, gc, 0, 0,
+ XCopyArea(disp, ewin->mini_pmm.pmap, pmap, gc, 0, 0,
ww, wh, wx, wy);
if (ewin->mini_pmm.mask)
XSetClipMask(disp, gc, None);
@@ -471,9 +471,9 @@
else
{
XSetForeground(disp, gc, BlackPixel(disp, VRoot.scr));
- XDrawRectangle(disp, p->pmap, gc, wx - 1, wy - 1, ww + 1, wh + 1);
+ XDrawRectangle(disp, pmap, gc, wx - 1, wy - 1, ww + 1, wh + 1);
XSetForeground(disp, gc, WhitePixel(disp, VRoot.scr));
- XFillRectangle(disp, p->pmap, gc, wx, wy, ww, wh);
+ XFillRectangle(disp, pmap, gc, wx, wy, ww, wh);
}
}
@@ -486,7 +486,7 @@
do_screen_update:
Dprintf("doPagerUpdate %d: Snap screen\n", p->dsk->num);
/* Update pager area by snapshotting entire screen */
- ScaleRect(VRoot.win, VRoot.xwin, p->win, p->pmap, NULL, 0, 0,
+ ScaleRect(VRoot.win, VRoot.xwin, p->win, pmap, NULL, 0, 0,
VRoot.w, VRoot.h, cx * p->dw, cy * p->dh, p->dw, p->dh,
Conf_pagers.hiq);
@@ -680,9 +680,6 @@
DesksGetAreaSize(&ax, &ay);
- if (p->pmap != None)
- EFreePixmap(p->pmap);
-
p->w = w;
p->h = h;
p->dw = w / ax;
@@ -691,8 +688,6 @@
if (p->scale <= 0. || Mode.op_source == OPSRC_USER)
p->scale = ((float)VRoot.w / p->dw + (float)VRoot.h / p->dh) / 2;
- p->pmap = ECreatePixmap(p->win, p->w, p->h, 0);
- ESetWindowBackgroundPixmap(p->win, p->pmap);
p->do_newbg = 1;
PagerCheckUpdate(p, NULL);
@@ -887,7 +882,7 @@
h = 1;
if (!gc)
- gc = EXCreateGC(p->pmap, 0, NULL);
+ gc = EXCreateGC(WinGetPmap(p->win), 0, NULL);
/* NB! If the pixmap/mask was created by imlib, free it. Due to imlibs */
/* image/pixmap cache it may be in use elsewhere. */
@@ -907,7 +902,8 @@
if (!ewin->mini_pmm.pmap)
return;
- XCopyArea(disp, p->pmap, ewin->mini_pmm.pmap, gc, x, y, w, h, 0, 0);
+ XCopyArea(disp, WinGetPmap(p->win), ewin->mini_pmm.pmap, gc, x, y, w, h, 0,
+ 0);
#if 0 /* FIXME - Remove? */
if (hiwin && ewin == hiwin->ewin)
===================================================================
RCS file: /cvs/e/e16/e/src/x.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -3 -r1.157 -r1.158
--- x.c 20 May 2007 12:46:24 -0000 1.157
+++ x.c 25 May 2007 22:40:47 -0000 1.158
@@ -49,6 +49,8 @@
static Win win_first = NULL;
static Win win_last = NULL;
+#define WinBgInvalidate(win) if (win->bg_owned > 0) win->bg_owned = -1
+
#if !EXPOSE_WIN
Window
WinGetXwin(const Win win)
@@ -548,6 +550,7 @@
if ((w == win->w) && (h == win->h))
return;
+ WinBgInvalidate(win);
win->w = w;
win->h = h;
@@ -567,6 +570,9 @@
if ((w == win->w) && (h == win->h) && (x == win->x) && (y == win->y))
return;
+ if (w != win->w || h != win->h)
+ WinBgInvalidate(win);
+
win->x = x;
win->y = y;
win->w = w;
@@ -608,7 +614,10 @@
Eprintf("ExDestroyWindow: %p %#lx\n", win, win->xwin);
#endif
if (win->parent != None)
- XDestroyWindow(disp, win->xwin);
+ {
+ EFreeWindowBackgroundPixmap(win);
+ XDestroyWindow(disp, win->xwin);
+ }
/* Mark the ones to be deleted */
nsub = ExDelTree(win);
@@ -962,11 +971,13 @@
}
if ((mask & CWWidth) && (wc->width != win->w))
{
+ WinBgInvalidate(win);
win->w = wc->width;
doit = 1;
}
if ((mask & CWHeight) && (wc->height != win->h))
{
+ WinBgInvalidate(win);
win->h = wc->height;
doit = 1;
}
@@ -981,12 +992,46 @@
if (!win)
return;
+ if (win->bgpmap && win->bg_owned)
+ EFreeWindowBackgroundPixmap(win);
win->bgpmap = pmap;
+ win->bg_owned = 0; /* Don't manage pixmap */
win->bgcol = 0xffffffff; /* Hmmm.. */
XSetWindowBackgroundPixmap(disp, win->xwin, pmap);
}
+Pixmap
+EGetWindowBackgroundPixmap(Win win)
+{
+ Pixmap pmap;
+
+ if (!win)
+ return None;
+
+ if (win->bg_owned < 0) /* Free if invalidated */
+ EFreeWindowBackgroundPixmap(win);
+ else if (win->bgpmap)
+ return win->bgpmap;
+
+ /* Allocate/set new */
+ pmap = ECreatePixmap(win, win->w, win->h, 0);
+ ESetWindowBackgroundPixmap(win, pmap);
+ win->bg_owned = 1; /* Manage pixmap */
+
+ return pmap;
+}
+
+void
+EFreeWindowBackgroundPixmap(Win win)
+{
+ if (!win || !win->bgpmap || !win->bg_owned)
+ return;
+
+ EFreePixmap(win->bgpmap);
+ win->bgpmap = 0;
+}
+
void
ESetWindowBackground(Win win, unsigned int col)
{
@@ -995,7 +1040,7 @@
if (win->bgpmap)
{
- win->bgpmap = 0;
+ EFreeWindowBackgroundPixmap(win);
win->bgcol = col;
}
else if (win->bgcol != col)
===================================================================
RCS file: /cvs/e/e16/e/src/xwin.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- xwin.h 20 May 2007 08:08:59 -0000 1.29
+++ xwin.h 25 May 2007 22:40:47 -0000 1.30
@@ -75,6 +75,7 @@
char in_use;
signed char do_del;
char attached;
+ signed char bg_owned; /* bgpmap "owned" by Win */
int num_rect;
int ord;
XRectangle *rects;
@@ -89,6 +90,7 @@
#if EXPOSE_WIN
#define WinGetXwin(win) ((win)->xwin)
+#define WinGetPmap(win) ((win)->bgpmap)
#define WinGetX(win) ((win)->x)
#define WinGetY(win) ((win)->y)
#define WinGetW(win) ((win)->w)
@@ -155,6 +157,8 @@
void EConfigureWindow(Win win, unsigned int mask,
XWindowChanges * wc);
void ESetWindowBackgroundPixmap(Win win, Pixmap pmap);
+Pixmap EGetWindowBackgroundPixmap(Win win);
+void EFreeWindowBackgroundPixmap(Win win);
void ESetWindowBackground(Win win, unsigned int col);
int ETranslateCoordinates(Win src_w, Win dst_w,
int src_x, int src_y,
===================================================================
RCS file: /cvs/e/e16/e/src/zoom.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- zoom.c 13 Jan 2007 19:14:29 -0000 1.40
+++ zoom.c 25 May 2007 22:40:47 -0000 1.41
@@ -187,7 +187,6 @@
return 0;
win = ECreateWindow(VRoot.win, x, y, w, h, 0);
- ESetWindowBackgroundPixmap(win, None);
ESetWindowBackground(win, BlackPixel(disp, VRoot.scr));
ERaiseWindow(win);
EMapWindow(win);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs