xglcomp

diff src/cwin.cc @ 7:03ca0fd49916

merged
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 30 Jan 2016 07:48:51 +0200
parents e831d38e6faa
children b0081a0c211f
line diff
     1.1 --- a/src/cwin.cc	Fri Jan 29 10:23:08 2016 +0200
     1.2 +++ b/src/cwin.cc	Sat Jan 30 07:48:51 2016 +0200
     1.3 @@ -1,9 +1,13 @@
     1.4  #include <string.h>
     1.5  #include <vector>
     1.6  #include <algorithm>
     1.7 +#include <X11/Xlib.h>
     1.8 +#include <X11/extensions/Xdamage.h>
     1.9  #include "cwin.h"
    1.10  #include "logger.h"
    1.11  
    1.12 +extern Display *dpy;
    1.13 +
    1.14  static std::vector<CompWindow*> cwinlist;
    1.15  
    1.16  CompWindow::CompWindow(Window xid)
    1.17 @@ -12,6 +16,17 @@
    1.18  	xpixmap = 0;
    1.19  	memset(&attr, 0, sizeof attr);
    1.20  	mapped = false;
    1.21 +	damage = 0;
    1.22 +}
    1.23 +
    1.24 +CompWindow::~CompWindow()
    1.25 +{
    1.26 +	if(xpixmap) {
    1.27 +		XFreePixmap(dpy, xpixmap);
    1.28 +	}
    1.29 +	if(damage) {
    1.30 +		XDamageDestroy(dpy, damage);
    1.31 +	}
    1.32  }
    1.33  
    1.34  void add_window(CompWindow *cwin)
    1.35 @@ -21,6 +36,11 @@
    1.36  		return;
    1.37  	}
    1.38  
    1.39 +	// create the damage structure to track dirty regions in this window
    1.40 +	if(!cwin->damage) {
    1.41 +		cwin->damage = XDamageCreate(dpy, cwin->xwin, XDamageReportNonEmpty);
    1.42 +	}
    1.43 +
    1.44  	cwinlist.push_back(cwin);
    1.45  }
    1.46