Mercurial > dwindows
comparison gtk3/dw.c @ 1479:1d414e81a099
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.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 22 Dec 2011 12:09:43 +0000 |
parents | 9097a5eb144c |
children | 1ad57598f9cb |
comparison
equal
deleted
inserted
replaced
1478:7216f4301364 | 1479:1d414e81a099 |
---|---|
8509 } | 8509 } |
8510 | 8510 |
8511 | 8511 |
8512 union extents_union { guchar **gu_extents; unsigned long **extents; }; | 8512 union extents_union { guchar **gu_extents; unsigned long **extents; }; |
8513 static Atom extents_atom = 0; | 8513 static Atom extents_atom = 0; |
8514 static time_t extents_time = 0; | |
8514 | 8515 |
8515 static Bool property_notify_predicate(Display *xdisplay, XEvent *event, XPointer window_id) | 8516 static Bool property_notify_predicate(Display *xdisplay, XEvent *event, XPointer window_id) |
8516 { | 8517 { |
8517 unsigned long *window = (unsigned long *)window_id; | 8518 unsigned long *window = (unsigned long *)window_id; |
8518 | 8519 time_t currtime = time(NULL); |
8519 if(event->xany.type == PropertyNotify && event->xany.window == *window && event->xproperty.atom == extents_atom) | 8520 |
8521 /* If it is the event we are looking for... or if the timeout has expired */ | |
8522 if((event->xany.type == PropertyNotify && event->xany.window == *window && event->xproperty.atom == extents_atom) || | |
8523 (currtime - extents_time) > 1) | |
8520 return True; | 8524 return True; |
8521 return False; | 8525 return False; |
8522 } | 8526 } |
8523 | 8527 |
8524 /* Internal function to figure out the frame extents of an unmapped window */ | 8528 /* Internal function to figure out the frame extents of an unmapped window */ |
8555 xevent.xclient.message_type = extents_request_atom; | 8559 xevent.xclient.message_type = extents_request_atom; |
8556 xevent.xclient.display = xdisplay; | 8560 xevent.xclient.display = xdisplay; |
8557 xevent.xclient.window = window_id; | 8561 xevent.xclient.window = window_id; |
8558 xevent.xclient.format = 32; | 8562 xevent.xclient.format = 32; |
8559 | 8563 |
8564 /* Send the property request */ | |
8560 XSendEvent(xdisplay, xroot_window, False, | 8565 XSendEvent(xdisplay, xroot_window, False, |
8561 (SubstructureRedirectMask | SubstructureNotifyMask), | 8566 (SubstructureRedirectMask | SubstructureNotifyMask), |
8562 &xevent); | 8567 &xevent); |
8563 | 8568 |
8569 /* Record the request time */ | |
8570 time(&extents_time); | |
8571 | |
8572 /* Look for the property notify event */ | |
8564 XIfEvent(xdisplay, ¬ify_xevent, property_notify_predicate, (XPointer)&window_id); | 8573 XIfEvent(xdisplay, ¬ify_xevent, property_notify_predicate, (XPointer)&window_id); |
8574 | |
8575 /* If we didn't get the notification... put the event back onto the stack */ | |
8576 if(notify_xevent.xany.type != PropertyNotify || notify_xevent.xany.window != window_id | |
8577 || notify_xevent.xproperty.atom != extents_atom) | |
8578 XPutBackEvent(xdisplay, ¬ify_xevent); | |
8565 } | 8579 } |
8566 | 8580 |
8567 /* Attempt to retrieve window's frame extents. */ | 8581 /* Attempt to retrieve window's frame extents. */ |
8568 eu.extents = &extents; | 8582 eu.extents = &extents; |
8569 if(gdk_property_get(gdkwindow, | 8583 if(gdk_property_get(gdkwindow, |