From 6882c231fa8557bbe8dcc8c3caad37a132c8d22a Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Tue, 7 Sep 1999 18:36:19 +0000 Subject: [PATCH] Tue Sep 7 11:43:42 PDT 1999 Michael Jennings Added paranoia checks to make sure the desktop pixmap property hasn't been corrupted. SVN revision: 191 --- ChangeLog | 6 ++++++ src/pixmap.c | 30 +++++++++++++++++++----------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12e3fbf..94eb387 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2361,3 +2361,9 @@ Fri Sep 3 17:05:02 PDT 1999 Michael Jennings Eterm passes "make distcheck" now. Hurray. ------------------------------------------------------------------------------- +Tue Sep 7 11:43:42 PDT 1999 Michael Jennings + + Added paranoia checks to make sure the desktop pixmap property hasn't + been corrupted. + +------------------------------------------------------------------------------- diff --git a/src/pixmap.c b/src/pixmap.c index 7beb1f7..5240913 100644 --- a/src/pixmap.c +++ b/src/pixmap.c @@ -456,18 +456,26 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short D_PIXMAP(("desktop_pixmap == %08x, simg->pmap->pixmap == %08x\n", desktop_pixmap, simg->pmap->pixmap)); if (simg->pmap->pixmap != None) { XGetGeometry(Xdisplay, desktop_pixmap, &w, &px, &py, &pw, &ph, &pb, &pd); - if (pw < (unsigned int) scr->width || ph < (unsigned int) scr->height) { - XFreeGC(Xdisplay, gc); - gc = XCreateGC(Xdisplay, desktop_pixmap, 0, &gcvalue); - XSetTile(Xdisplay, gc, desktop_pixmap); - XSetTSOrigin(Xdisplay, gc, pw - (x % pw), ph - (y % ph)); - XSetFillStyle(Xdisplay, gc, FillTiled); - XFillRectangle(Xdisplay, simg->pmap->pixmap, gc, 0, 0, scr->width, scr->height); + if ((pw <= 0) || (ph <= 0)) { + print_error("Value of desktop pixmap property is invalid. Please restart your " + "window manager or use Esetroot to set a new one."); + desktop_pixmap = None; + D_PIXMAP(("Setting background of window 0x%08x to the background color\n", win)); + XSetWindowBackground(Xdisplay, win, PixColors[bgColor]); } else { - XCopyArea(Xdisplay, desktop_pixmap, simg->pmap->pixmap, gc, x, y, width, height, 0, 0); - } - D_PIXMAP(("Setting background of window 0x%08x to 0x%08x\n", win, simg->pmap->pixmap)); - XSetWindowBackgroundPixmap(Xdisplay, win, simg->pmap->pixmap); + if (pw < (unsigned int) scr->width || ph < (unsigned int) scr->height) { + XFreeGC(Xdisplay, gc); + gc = XCreateGC(Xdisplay, desktop_pixmap, 0, &gcvalue); + XSetTile(Xdisplay, gc, desktop_pixmap); + XSetTSOrigin(Xdisplay, gc, pw - (x % pw), ph - (y % ph)); + XSetFillStyle(Xdisplay, gc, FillTiled); + XFillRectangle(Xdisplay, simg->pmap->pixmap, gc, 0, 0, scr->width, scr->height); + } else { + XCopyArea(Xdisplay, desktop_pixmap, simg->pmap->pixmap, gc, x, y, width, height, 0, 0); + } + D_PIXMAP(("Setting background of window 0x%08x to 0x%08x\n", win, simg->pmap->pixmap)); + XSetWindowBackgroundPixmap(Xdisplay, win, simg->pmap->pixmap); + } } } else { D_PIXMAP(("Setting background of window 0x%08x to the background color\n", win));