xglcomp

diff src/main.cc @ 9:245dd960f0b3

added xerror handling helpers
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 02 Feb 2016 12:54:02 +0200
parents b0081a0c211f
children cb636a23f4f2
line diff
     1.1 --- a/src/main.cc	Sat Jan 30 07:58:07 2016 +0200
     1.2 +++ b/src/main.cc	Tue Feb 02 12:54:02 2016 +0200
     1.3 @@ -10,6 +10,8 @@
     1.4  #include "cwin.h"
     1.5  #include "opengl.h"
     1.6  #include "logger.h"
     1.7 +#include "xerr.h"
     1.8 +
     1.9  
    1.10  static bool query_extensions();
    1.11  static bool register_compositor();
    1.12 @@ -65,18 +67,20 @@
    1.13  		CompWindow *cwin;
    1.14  		switch(ev.type) {
    1.15  		case CreateNotify:
    1.16 +			log_debug("CreateNotify: %x\n", ev.xcreatewindow.window);
    1.17  			manage_window(ev.xcreatewindow.window);
    1.18  			break;
    1.19  
    1.20  		case ConfigureNotify:
    1.21  			// XXX is this right?
    1.22  			if((cwin = find_window_xid(ev.xconfigure.window))) {
    1.23 -				log_debug("updating window attributes\n");
    1.24 +				log_debug("updating window attributes for: %x\n", cwin->xwin);
    1.25  				XGetWindowAttributes(dpy, cwin->xwin, &cwin->attr);
    1.26  			}
    1.27  			break;
    1.28  
    1.29  		case DestroyNotify:
    1.30 +			log_debug("DestroyNotify: %x\n", ev.xdestroywindow.window);
    1.31  			unmanage_window(ev.xdestroywindow.window);
    1.32  			break;
    1.33  
    1.34 @@ -226,10 +230,13 @@
    1.35  {
    1.36  	XserverRegion region;
    1.37  	CompWindow *cwin = find_window_xid(ev->drawable);
    1.38 -	if(!cwin) return;
    1.39 +	if(!cwin || !cwin->damage) return;
    1.40  
    1.41  	region = XFixesCreateRegion(dpy, 0, 0);
    1.42 +
    1.43 +	push_xerr_handler(xerr_debug);
    1.44  	XDamageSubtract(dpy, cwin->damage, None, region);
    1.45 +	pop_xerr_handler();
    1.46  }
    1.47  
    1.48  static void redraw()