]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
no space on teh top or bottom of text..
[chaz/openbox] / src / client.cc
index 34fcf6fa24d929ee3eb0922da6044c8b2811b9c7..80bab9db978fc06425a0d3a93e27ee3c1ac9b051 100644 (file)
@@ -504,6 +504,17 @@ void OBClient::propertyHandler(const XPropertyEvent &e)
   
   const otk::OBProperty *property = Openbox::instance->property();
 
+  // compress changes to a single property into a single change
+  XEvent ce;
+  while (XCheckTypedEvent(otk::OBDisplay::display, e.type, &ce)) {
+    // XXX: it would be nice to compress ALL changes to a property, not just
+    //      changes in a row without other props between.
+    if (ce.xproperty.atom != e.atom) {
+      XPutBackEvent(otk::OBDisplay::display, &ce);
+      break;
+    }
+  }
+
   if (e.atom == XA_WM_NORMAL_HINTS)
     updateNormalHints();
   else if (e.atom == XA_WM_HINTS)
@@ -656,12 +667,44 @@ void OBClient::clientMessageHandler(const XClientMessageEvent &e)
 
   const otk::OBProperty *property = Openbox::instance->property();
   
-  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
+  }
   else if (e.message_type == property->atom(otk::OBProperty::net_wm_state))
+    // can't compress these
     setState((StateAction)e.data.l[0], e.data.l[1], e.data.l[2]);
 }
 
This page took 0.028847 seconds and 4 git commands to generate.