]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
allow for the client to be validated.
[chaz/openbox] / src / client.cc
index 77906e801a90bdb9b39cb9e44014b914330c0d8c..3939b0c61ada1b63278e7d0691ccf392da3cf722 100644 (file)
@@ -49,6 +49,8 @@ Client::Client(int screen, Window window)
   _layer = Layer_Normal;
   // default to not urgent
   _urgent = false;
+  // not positioned unless specified
+  _positioned = false;
   
   getArea();
   getDesktop();
@@ -115,6 +117,21 @@ Client::~Client()
 }
 
 
+bool Client::validate() const
+{
+  XSync(**otk::display, false); // get all events on the server
+
+  XEvent e;
+  if (XCheckTypedWindowEvent(**otk::display, _window, DestroyNotify, &e) ||
+      XCheckTypedWindowEvent(**otk::display, _window, UnmapNotify, &e)) {
+    XPutBackEvent(**otk::display, &e);
+    return false;
+  }
+
+  return true;
+}
+
+
 void Client::getGravity()
 {
   XWindowAttributes wattrib;
@@ -636,6 +653,9 @@ void Client::updateTransientFor()
 void Client::propertyHandler(const XPropertyEvent &e)
 {
   otk::EventHandler::propertyHandler(e);
+
+  // validate cuz we query stuff off the client here
+  if (!validate()) return;
   
   // compress changes to a single property into a single change
   XEvent ce;
@@ -910,6 +930,9 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
 {
   otk::EventHandler::clientMessageHandler(e);
   
+  // validate cuz we query stuff off the client here
+  if (!validate()) return;
+  
   if (e.format != 32) return;
 
   if (e.message_type == otk::Property::atoms.wm_change_state) {
This page took 0.022766 seconds and 4 git commands to generate.