mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-24 11:41:58 +00:00
Move resize into main proc.
This commit is contained in:
parent
5adfe7e525
commit
d4853cf44b
2 changed files with 29 additions and 6 deletions
|
@ -14,6 +14,7 @@
|
||||||
static Memimage *xattach(char*);
|
static Memimage *xattach(char*);
|
||||||
static void plan9cmap(void);
|
static void plan9cmap(void);
|
||||||
static int setupcmap(XWindow);
|
static int setupcmap(XWindow);
|
||||||
|
static int xreplacescreenimage(void);
|
||||||
static XGC xgc(XDrawable, int, int);
|
static XGC xgc(XDrawable, int, int);
|
||||||
static Image *getimage0(Display*);
|
static Image *getimage0(Display*);
|
||||||
|
|
||||||
|
@ -99,6 +100,8 @@ getwindow(Display *d, int ref)
|
||||||
{
|
{
|
||||||
Image *i;
|
Image *i;
|
||||||
|
|
||||||
|
if(xreplacescreenimage() == 0)
|
||||||
|
return 0;
|
||||||
freeimage(d->screenimage);
|
freeimage(d->screenimage);
|
||||||
i = getimage0(d);
|
i = getimage0(d);
|
||||||
screen = d->screenimage = d->image = i;
|
screen = d->screenimage = d->image = i;
|
||||||
|
@ -143,6 +146,13 @@ xattach(char *label)
|
||||||
XWindow xrootwin;
|
XWindow xrootwin;
|
||||||
XWMHints hint;
|
XWMHints hint;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(XInitThreads() == 0){
|
||||||
|
fprint(2, "XInitThreads failed\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect to X server.
|
* Connect to X server.
|
||||||
*/
|
*/
|
||||||
|
@ -567,17 +577,29 @@ xexpose(XEvent *e, XDisplay *xd)
|
||||||
int
|
int
|
||||||
xconfigure(XEvent *e, XDisplay *xd)
|
xconfigure(XEvent *e, XDisplay *xd)
|
||||||
{
|
{
|
||||||
Memimage *m;
|
|
||||||
XConfigureEvent *xe = (XConfigureEvent*)e;
|
XConfigureEvent *xe = (XConfigureEvent*)e;
|
||||||
XDrawable pixmap;
|
|
||||||
|
|
||||||
if(xe->width == Dx(_x.screenr) && xe->height == Dy(_x.screenr))
|
if(xe->width == Dx(_x.screenr) && xe->height == Dy(_x.screenr))
|
||||||
return 0;
|
return 0;
|
||||||
|
_x.newscreenr = Rect(0, 0, xe->width, xe->height);
|
||||||
pixmap = XCreatePixmap(xd, _x.drawable, xe->width, xe->height, _x.depth);
|
return 1;
|
||||||
m = xallocmemimage(Rect(0, 0, xe->width, xe->height), _x.chan, pixmap);
|
}
|
||||||
|
|
||||||
|
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.screenpm = pixmap;
|
||||||
_x.screenr = Rect(0, 0, xe->width, xe->height);
|
_x.screenr = r;
|
||||||
_drawreplacescreenimage(m);
|
_drawreplacescreenimage(m);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ struct Xprivate {
|
||||||
u32int gczero0pixmap;
|
u32int gczero0pixmap;
|
||||||
XDisplay *kbdcon;
|
XDisplay *kbdcon;
|
||||||
XDisplay *mousecon;
|
XDisplay *mousecon;
|
||||||
|
Rectangle newscreenr;
|
||||||
Memimage* screenimage;
|
Memimage* screenimage;
|
||||||
XDrawable screenpm;
|
XDrawable screenpm;
|
||||||
Rectangle screenr;
|
Rectangle screenr;
|
||||||
|
|
Loading…
Reference in a new issue