Fix some incorrect window attribute propagation. Cleanups.

SVN revision: 22968
This commit is contained in:
Kim Woelders 2006-05-28 11:51:42 +00:00
parent 3a1af27148
commit e418400bf9
5 changed files with 31 additions and 43 deletions

View File

@ -492,8 +492,7 @@ BgFindImageSize(BgPart * bgp, unsigned int rw, unsigned int rh,
}
static Pixmap
BackgroundCreatePixmap(Drawable draw, unsigned int w, unsigned int h,
unsigned int depth)
BackgroundCreatePixmap(Win win, unsigned int w, unsigned int h)
{
Pixmap pmap;
@ -501,11 +500,11 @@ BackgroundCreatePixmap(Drawable draw, unsigned int w, unsigned int h,
* Stupid hack to avoid that a new root pixmap has the same ID as the now
* invalid one from a previous session.
*/
pmap = EXCreatePixmap(draw, w, h, depth);
if (draw == VRoot.xwin && pmap == Mode.root.ext_pmap)
pmap = ECreatePixmap(win, w, h, 0);
if (win == RRoot.win && pmap == Mode.root.ext_pmap)
{
EFreePixmap(pmap);
pmap = EXCreatePixmap(draw, w, h, depth);
pmap = ECreatePixmap(win, w, h, 0);
Mode.root.ext_pmap = None;
Mode.root.ext_pmap_valid = 0;
}
@ -513,7 +512,7 @@ BackgroundCreatePixmap(Drawable draw, unsigned int w, unsigned int h,
}
void
BackgroundRealize(Background * bg, Drawable draw, unsigned int rw,
BackgroundRealize(Background * bg, Win win, Drawable draw, unsigned int rw,
unsigned int rh, int is_win, Pixmap * ppmap,
unsigned long *ppixel)
{
@ -573,6 +572,9 @@ BackgroundRealize(Background * bg, Drawable draw, unsigned int rw,
}
#endif
if (!draw)
draw = WinGetXwin(win);
hasbg = bg->bg.im != NULL;
hasfg = bg->top.im != NULL;
@ -612,8 +614,8 @@ BackgroundRealize(Background * bg, Drawable draw, unsigned int rw,
((w == rw && h == rh) || (bg->bg_tile && !TransparencyEnabled())))
{
/* Window, no fg, no offset, and scale to 100%, or tiled, no trans */
pmap = BackgroundCreatePixmap(draw, w, h, VRoot.depth);
EImageRenderOnDrawable(bg->bg.im, NULL, pmap, 0, 0, w, h, 0);
pmap = BackgroundCreatePixmap(win, w, h);
EImageRenderOnDrawable(bg->bg.im, win, pmap, 0, 0, w, h, 0);
#if 0 /* FIXME - Remove? */
if (x == 0 && y == 0) /* Hmmm. Always true. */
@ -635,7 +637,7 @@ BackgroundRealize(Background * bg, Drawable draw, unsigned int rw,
/* The rest that require some more work */
if (is_win)
pmap = BackgroundCreatePixmap(draw, rw, rh, VRoot.depth);
pmap = BackgroundCreatePixmap(win, rw, rh);
else
pmap = draw;
@ -679,7 +681,7 @@ BackgroundRealize(Background * bg, Drawable draw, unsigned int rw,
EImageBlend(im, bg->top.im, 1, 0, 0, ww, hh, x, y, w, h, 0, 0);
}
EImageRenderOnDrawable(im, NULL, pmap, 0, 0, rw, rh, 0);
EImageRenderOnDrawable(im, win, pmap, 0, 0, rw, rh, 0);
if (im != bg->bg.im)
EImageFree(im);
@ -694,10 +696,10 @@ BackgroundRealize(Background * bg, Drawable draw, unsigned int rw,
}
void
BackgroundApplyPmap(Background * bg, Drawable draw,
BackgroundApplyPmap(Background * bg, Win win, Drawable draw,
unsigned int w, unsigned int h)
{
BackgroundRealize(bg, draw, w, h, 0, NULL, NULL);
BackgroundRealize(bg, win, draw, w, h, 0, NULL, NULL);
}
static void
@ -710,7 +712,7 @@ BackgroundApplyWin(Background * bg, Win win)
if (!EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL))
return;
BackgroundRealize(bg, Xwin(win), w, h, 1, &pmap, &pixel);
BackgroundRealize(bg, win, None, w, h, 1, &pmap, &pixel);
if (pmap != None)
{
ESetWindowBackgroundPixmap(win, pmap);
@ -736,7 +738,7 @@ BackgroundSet(Background * bg, Win win, unsigned int w, unsigned int h)
if (bg->pmap)
pmap = bg->pmap;
else
BackgroundRealize(bg, Xwin(win), w, h, 1, &pmap, &pixel);
BackgroundRealize(bg, win, None, w, h, 1, &pmap, &pixel);
bg->pmap = pmap;
if (pmap != None)
@ -949,7 +951,7 @@ BackgroundCacheMini(Background * bg, int keep, int nuke)
/* Create new cached bg mini image */
pmap = ECreatePixmap(VRoot.win, 64, 48, 0);
BackgroundApplyPmap(bg, pmap, 64, 48);
BackgroundApplyPmap(bg, VRoot.win, pmap, 64, 48);
im = EImageGrabDrawable(pmap, None, 0, 0, 64, 48, 0);
EImageSave(im, s);
EFreePixmap(pmap);
@ -1524,7 +1526,7 @@ CB_DesktopMiniDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
if (val == 1)
{
ESetWindowBackgroundPixmap(win, pmap);
BackgroundApplyPmap(tmp_bg, pmap, w, h);
BackgroundApplyPmap(tmp_bg, win, pmap, w, h);
}
else
{
@ -1539,7 +1541,7 @@ CB_DesktopMiniDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
tmp_bg->top.yjust, tmp_bg->top.xperc,
tmp_bg->top.yperc);
BackgroundApplyPmap(bg, pmap, w, h);
BackgroundApplyPmap(bg, win, pmap, w, h);
BackgroundDestroy(bg);
}
EClearWindow(win);

View File

@ -30,11 +30,11 @@ Background *BackgroundFind(const char *name);
char *BackgroundGetUniqueString(const Background * bg);
void BackgroundPixmapSet(Background * bg, Pixmap pmap);
void BackgroundDestroyByName(const char *name);
void BackgroundRealize(Background * bg, Drawable draw,
void BackgroundRealize(Background * bg, Win win, Drawable draw,
unsigned int rw, unsigned int rh,
int is_win, Pixmap * ppmap,
unsigned long *ppixel);
void BackgroundApplyPmap(Background * bg, Drawable draw,
void BackgroundApplyPmap(Background * bg, Win win, Drawable draw,
unsigned int rw, unsigned int rh);
void BackgroundSet(Background * bg, Win win, unsigned int rw,
unsigned int rh);

View File

@ -624,8 +624,8 @@ DeskBackgroundRefresh(Desk * dsk, int why)
pixel = 0;
if (pmap == None)
BackgroundRealize(bg, EoGetXwin(dsk), EoGetW(dsk), EoGetH(dsk),
1, &pmap, &pixel);
BackgroundRealize(bg, EoGetWin(dsk), None,
EoGetW(dsk), EoGetH(dsk), 1, &pmap, &pixel);
if (pmap != None)
BackgroundPixmapSet(bg, pmap);
@ -2305,7 +2305,7 @@ CB_DesktopDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
bg = DeskBackgroundGet(DeskGet(i));
if (bg)
BackgroundApplyPmap(bg, pmap, 64, 48);
BackgroundApplyPmap(bg, wins[i], pmap, 64, 48);
else
{
ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 0);

View File

@ -305,7 +305,7 @@ PagerEwinUpdateMini(Pager * p, EWin * ewin)
{
ewin->mini_pmm.type = 1;
ewin->mini_pmm.mask = None;
ScaleRect(EoGetWin(ewin), draw, VRoot.win, None, &ewin->mini_pmm.pmap,
ScaleRect(EoGetWin(ewin), draw, p->win, None, &ewin->mini_pmm.pmap,
0, 0, EoGetW(ewin), EoGetH(ewin), 0, 0, w, h,
Conf_pagers.hiq);
}
@ -532,7 +532,7 @@ PagerUpdateBg(Pager * p)
else
{
#endif
BackgroundApplyPmap(bg, pmap, p->dw, p->dh);
BackgroundApplyPmap(bg, p->win, pmap, p->dw, p->dh);
#if USE_PAGER_BACKGROUND_CACHE
im = EImageGrabDrawable(pmap, None, 0, 0, p->dw, p->dh, 0);
EImageSave(im, s);

View File

@ -202,36 +202,22 @@ SetupX(const char *dstr)
/* Root defaults */
RRoot.scr = DefaultScreen(disp);
RRoot.xwin = DefaultRootWindow(disp);
RRoot.w = DisplayWidth(disp, RRoot.scr);
RRoot.h = DisplayHeight(disp, RRoot.scr);
RRoot.vis = DefaultVisual(disp, RRoot.scr);
RRoot.depth = DefaultDepth(disp, RRoot.scr);
RRoot.cmap = DefaultColormap(disp, RRoot.scr);
RRoot.w = DisplayWidth(disp, RRoot.scr);
RRoot.h = DisplayHeight(disp, RRoot.scr);
RRoot.win = ERegisterWindow(RRoot.xwin, NULL);
VRoot.xwin = RRoot.xwin;
VRoot.vis = RRoot.vis;
VRoot.depth = RRoot.depth;
VRoot.cmap = RRoot.cmap;
RRoot.win = ERegisterWindow(RRoot.xwin, NULL);
if (Mode.wm.window)
{
XSetWindowAttributes attr;
/* Running E in its own virtual root window */
attr.backing_store = NotUseful;
attr.override_redirect = False;
attr.colormap = VRoot.cmap;
attr.border_pixel = 0;
attr.background_pixel = 0;
attr.save_under = True;
VRoot.xwin = XCreateWindow(disp, RRoot.xwin, 0, 0, VRoot.w, VRoot.h, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect | CWSaveUnder |
CWBackingStore | CWColormap | CWBackPixel |
CWBorderPixel, &attr);
VRoot.win = ERegisterWindow(VRoot.xwin, NULL);
VRoot.win = ECreateWindow(RRoot.win, 0, 0, VRoot.w, VRoot.h, 0);
VRoot.xwin = WinGetXwin(VRoot.win);
/* Enable eesh and edox to pix up the virtual root */
Esnprintf(buf, sizeof(buf), "%#lx", VRoot.xwin);