xglcomp

diff src/main.cc @ 12:1c0d056ec360

moving slowly
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 05 Feb 2016 03:33:18 +0200
parents cb636a23f4f2
children 593a5e4a351f
line diff
     1.1 --- a/src/main.cc	Thu Feb 04 04:15:15 2016 +0200
     1.2 +++ b/src/main.cc	Fri Feb 05 03:33:18 2016 +0200
     1.3 @@ -72,10 +72,9 @@
     1.4  			break;
     1.5  
     1.6  		case ConfigureNotify:
     1.7 -			// XXX is this right?
     1.8  			if((cwin = find_window_xid(ev.xconfigure.window))) {
     1.9  				log_debug("updating window attributes for: %x\n", cwin->xwin);
    1.10 -				XGetWindowAttributes(dpy, cwin->xwin, &cwin->attr);
    1.11 +				cwin->update_attr();
    1.12  			}
    1.13  			break;
    1.14  
    1.15 @@ -239,6 +238,7 @@
    1.16  	pop_xerr_handler();
    1.17  
    1.18  	XFixesDestroyRegion(dpy, region);
    1.19 +	cwin->damaged = true;
    1.20  }
    1.21  
    1.22  static void redraw()
    1.23 @@ -272,13 +272,11 @@
    1.24  
    1.25  static void draw_window(CompWindow *cwin)
    1.26  {
    1.27 -	if(!cwin->xpixmap) {
    1.28 -		cwin->xpixmap = XCompositeNameWindowPixmap(dpy, cwin->xwin);
    1.29 -		if(!cwin->xpixmap) {
    1.30 -			log_warning("failed to get pixmap\n");
    1.31 -			return;
    1.32 +	if(!cwin->xpixmap || !cwin->pixmap_valid) {
    1.33 +		cwin->update_pixmap();
    1.34 +		if(!cwin->tex_valid) {
    1.35 +			cwin->update_texture();
    1.36  		}
    1.37 -		cwin->tex.set_image(dpy, cwin->xpixmap);
    1.38  	}
    1.39  
    1.40  	glBindTexture(GL_TEXTURE_2D, cwin->tex.get_id());
    1.41 @@ -294,6 +292,8 @@
    1.42  	glTexCoord2f(0, 1);
    1.43  	glVertex2f(cwin->attr.x, cwin->attr.y + cwin->attr.height);
    1.44  	glEnd();
    1.45 +
    1.46 +	cwin->damaged = false;
    1.47  }
    1.48  
    1.49  static void reshape(int x, int y)