- if (e.message_type == property->atom(otk::OBProperty::wm_change_state))
- setWMState(e.data.l[0]);
- else if (e.message_type ==
- property->atom(otk::OBProperty::net_wm_desktop))
- setDesktop(e.data.l[0]);
+ if (e.message_type == property->atom(otk::OBProperty::wm_change_state)) {
+ // compress changes into a single change
+ bool compress = false;
+ XEvent ce;
+ while (XCheckTypedEvent(otk::OBDisplay::display, e.type, &ce)) {
+ // XXX: it would be nice to compress ALL messages of a type, not just
+ // messages in a row without other message types between.
+ if (ce.xclient.message_type != e.message_type) {
+ XPutBackEvent(otk::OBDisplay::display, &ce);
+ break;
+ }
+ compress = true;
+ }
+ if (compress)
+ setWMState(ce.xclient.data.l[0]); // use the found event
+ else
+ setWMState(e.data.l[0]); // use the original event
+ } else if (e.message_type ==
+ property->atom(otk::OBProperty::net_wm_desktop)) {
+ // compress changes into a single change
+ bool compress = false;
+ XEvent ce;
+ while (XCheckTypedEvent(otk::OBDisplay::display, e.type, &ce)) {
+ // XXX: it would be nice to compress ALL messages of a type, not just
+ // messages in a row without other message types between.
+ if (ce.xclient.message_type != e.message_type) {
+ XPutBackEvent(otk::OBDisplay::display, &ce);
+ break;
+ }
+ compress = true;
+ }
+ if (compress)
+ setDesktop(e.data.l[0]); // use the found event
+ else
+ setDesktop(e.data.l[0]); // use the original event
+ }