diff options
author | rsc <devnull@localhost> | 2003-10-01 15:20:53 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-10-01 15:20:53 +0000 |
commit | d4853cf44b50f5de560cdea4530bd17659a32cb8 (patch) | |
tree | 16831e07ea3712c3dc843cfd294a5716704f38a9 /src/libdraw | |
parent | 5adfe7e525d79eb079f8f438dc2c37072da65b30 (diff) | |
download | plan9port-d4853cf44b50f5de560cdea4530bd17659a32cb8.tar.gz plan9port-d4853cf44b50f5de560cdea4530bd17659a32cb8.tar.bz2 plan9port-d4853cf44b50f5de560cdea4530bd17659a32cb8.zip |
Move resize into main proc.
Diffstat (limited to 'src/libdraw')
-rw-r--r-- | src/libdraw/x11-init.c | 34 | ||||
-rw-r--r-- | src/libdraw/x11-memdraw.h | 1 |
2 files changed, 29 insertions, 6 deletions
diff --git a/src/libdraw/x11-init.c b/src/libdraw/x11-init.c index 31001240..85543e83 100644 --- a/src/libdraw/x11-init.c +++ b/src/libdraw/x11-init.c @@ -14,6 +14,7 @@ static Memimage *xattach(char*); static void plan9cmap(void); static int setupcmap(XWindow); +static int xreplacescreenimage(void); static XGC xgc(XDrawable, int, int); static Image *getimage0(Display*); @@ -99,6 +100,8 @@ getwindow(Display *d, int ref) { Image *i; + if(xreplacescreenimage() == 0) + return 0; freeimage(d->screenimage); i = getimage0(d); screen = d->screenimage = d->image = i; @@ -144,6 +147,13 @@ xattach(char *label) XWMHints hint; /* + if(XInitThreads() == 0){ + fprint(2, "XInitThreads failed\n"); + abort(); + } + */ + + /* * Connect to X server. */ _x.display = XOpenDisplay(NULL); @@ -567,17 +577,29 @@ xexpose(XEvent *e, XDisplay *xd) int xconfigure(XEvent *e, XDisplay *xd) { - Memimage *m; XConfigureEvent *xe = (XConfigureEvent*)e; - XDrawable pixmap; if(xe->width == Dx(_x.screenr) && xe->height == Dy(_x.screenr)) return 0; - - pixmap = XCreatePixmap(xd, _x.drawable, xe->width, xe->height, _x.depth); - m = xallocmemimage(Rect(0, 0, xe->width, xe->height), _x.chan, pixmap); + _x.newscreenr = Rect(0, 0, xe->width, xe->height); + return 1; +} + +static int +xreplacescreenimage(void) +{ + Memimage *m; + XDrawable pixmap; + Rectangle r; + + r = _x.newscreenr; + if(eqrect(_x.screenr, r)) + return 0; + + pixmap = XCreatePixmap(_x.display, _x.drawable, Dx(r), Dy(r), _x.depth); + m = xallocmemimage(r, _x.chan, pixmap); _x.screenpm = pixmap; - _x.screenr = Rect(0, 0, xe->width, xe->height); + _x.screenr = r; _drawreplacescreenimage(m); return 1; } diff --git a/src/libdraw/x11-memdraw.h b/src/libdraw/x11-memdraw.h index c8234b20..9fffe34e 100644 --- a/src/libdraw/x11-memdraw.h +++ b/src/libdraw/x11-memdraw.h @@ -52,6 +52,7 @@ struct Xprivate { u32int gczero0pixmap; XDisplay *kbdcon; XDisplay *mousecon; + Rectangle newscreenr; Memimage* screenimage; XDrawable screenpm; Rectangle screenr; |