# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1324555783 0 # Node ID 1d414e81a099eff044bb963e17a922b82810de80 # Parent 7216f4301364bf1b1859836b09e422278256c46a FIXME: Workaround on GTK for Compiz not sending property notify events for certain window styles causing a deadlock. Implement a timeout and if the timeout expires push the event back. diff -r 7216f4301364 -r 1d414e81a099 gtk/dw.c --- a/gtk/dw.c Thu Dec 22 09:53:02 2011 +0000 +++ b/gtk/dw.c Thu Dec 22 12:09:43 2011 +0000 @@ -10126,12 +10126,16 @@ union extents_union { guchar **gu_extents; unsigned long **extents; }; static Atom extents_atom = 0; +static time_t extents_time = 0; static Bool property_notify_predicate(Display *xdisplay, XEvent *event, XPointer window_id) { unsigned long *window = (unsigned long *)window_id; - - if(event->xany.type == PropertyNotify && event->xany.window == *window && event->xproperty.atom == extents_atom) + time_t currtime = time(NULL); + + /* If it is the event we are looking for... or if the timeout has expired */ + if((event->xany.type == PropertyNotify && event->xany.window == *window && event->xproperty.atom == extents_atom) || + (currtime - extents_time) > 1) return True; return False; } @@ -10171,11 +10175,21 @@ xevent.xclient.window = window_id; xevent.xclient.format = 32; + /* Send the property request */ XSendEvent(xdisplay, xroot_window, False, (SubstructureRedirectMask | SubstructureNotifyMask), &xevent); - + + /* Record the request time */ + time(&extents_time); + + /* Look for the property notify event */ XIfEvent(xdisplay, ¬ify_xevent, property_notify_predicate, (XPointer)&window_id); + + /* If we didn't get the notification... put the event back onto the stack */ + if(notify_xevent.xany.type != PropertyNotify || notify_xevent.xany.window != window_id + || notify_xevent.xproperty.atom != extents_atom) + XPutBackEvent(xdisplay, ¬ify_xevent); } /* Attempt to retrieve window's frame extents. */ diff -r 7216f4301364 -r 1d414e81a099 gtk3/dw.c --- a/gtk3/dw.c Thu Dec 22 09:53:02 2011 +0000 +++ b/gtk3/dw.c Thu Dec 22 12:09:43 2011 +0000 @@ -8511,12 +8511,16 @@ union extents_union { guchar **gu_extents; unsigned long **extents; }; static Atom extents_atom = 0; +static time_t extents_time = 0; static Bool property_notify_predicate(Display *xdisplay, XEvent *event, XPointer window_id) { unsigned long *window = (unsigned long *)window_id; - - if(event->xany.type == PropertyNotify && event->xany.window == *window && event->xproperty.atom == extents_atom) + time_t currtime = time(NULL); + + /* If it is the event we are looking for... or if the timeout has expired */ + if((event->xany.type == PropertyNotify && event->xany.window == *window && event->xproperty.atom == extents_atom) || + (currtime - extents_time) > 1) return True; return False; } @@ -8557,11 +8561,21 @@ xevent.xclient.window = window_id; xevent.xclient.format = 32; + /* Send the property request */ XSendEvent(xdisplay, xroot_window, False, (SubstructureRedirectMask | SubstructureNotifyMask), &xevent); + /* Record the request time */ + time(&extents_time); + + /* Look for the property notify event */ XIfEvent(xdisplay, ¬ify_xevent, property_notify_predicate, (XPointer)&window_id); + + /* If we didn't get the notification... put the event back onto the stack */ + if(notify_xevent.xany.type != PropertyNotify || notify_xevent.xany.window != window_id + || notify_xevent.xproperty.atom != extents_atom) + XPutBackEvent(xdisplay, ¬ify_xevent); } /* Attempt to retrieve window's frame extents. */