xglcomp

diff src/main.cc @ 7:03ca0fd49916

merged
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 30 Jan 2016 07:48:51 +0200
parents 86e57e56a454
children b0081a0c211f
line diff
     1.1 --- a/src/main.cc	Fri Jan 29 10:23:08 2016 +0200
     1.2 +++ b/src/main.cc	Sat Jan 30 07:48:51 2016 +0200
     1.3 @@ -16,6 +16,7 @@
     1.4  static void start_comp();
     1.5  static void manage_window(Window xwin);
     1.6  static void unmanage_window(Window xwin);
     1.7 +static void damage_window(XDamageNotifyEvent *ev);
     1.8  static void redraw();
     1.9  static void draw_window(CompWindow *cwin);
    1.10  static void reshape(int x, int y);
    1.11 @@ -108,6 +109,7 @@
    1.12  
    1.13  		default:
    1.14  			if(ev.type == xdmg_ev_base + XDamageNotify) {
    1.15 +				damage_window((XDamageNotifyEvent*)&ev);
    1.16  			}
    1.17  		}
    1.18  
    1.19 @@ -217,14 +219,20 @@
    1.20  	CompWindow *cwin = find_window_xid(xwin);
    1.21  	if(!cwin) return;
    1.22  
    1.23 -	if(cwin->xpixmap) {
    1.24 -		XFreePixmap(dpy, cwin->xpixmap);
    1.25 -	}
    1.26 -
    1.27  	remove_window(cwin);
    1.28  	delete cwin;
    1.29  }
    1.30  
    1.31 +static void damage_window(XDamageNotifyEvent *ev)
    1.32 +{
    1.33 +	XserverRegion region;
    1.34 +	CompWindow *cwin = find_window_xid(ev->drawable);
    1.35 +	if(!cwin) return;
    1.36 +
    1.37 +	region = XFixesCreateRegion(dpy, 0, 0);
    1.38 +	XDamageSubtract(dpy, cwin->damage, None, region);
    1.39 +}
    1.40 +
    1.41  static void redraw()
    1.42  {
    1.43  	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);