]> Dogcows Code - chaz/openbox/blobdiff - src/XAtom.cc
change default style to mbdtex
[chaz/openbox] / src / XAtom.cc
index a98c366fc79cc9e15e1fd3db951d2cc6504d7221..b2a7c4efae9369820c81526c974b4e79c1da6468 100644 (file)
@@ -52,6 +52,7 @@ XAtom::XAtom(Display *d) {
   _atoms[wm_take_focus] = create("WM_TAKE_FOCUS");
   _atoms[wm_name] = create("WM_NAME");
   _atoms[wm_icon_name] = create("WM_ICON_NAME");
+  _atoms[wm_class] = create("WM_CLASS");
   _atoms[motif_wm_hints] = create("_MOTIF_WM_HINTS");
   _atoms[blackbox_hints] = create("_BLACKBOX_HINTS");
   _atoms[blackbox_attributes] = create("_BLACKBOX_ATTRIBUTES");
@@ -304,7 +305,7 @@ void XAtom::setValue(Window win, Atoms atom, StringType type,
   switch (type) {
   case ansi: t = _atoms[string]; break;
   case utf8: t = _atoms[utf8_string]; break;
-  default: assert(False); // unhandled StringType
+  default: assert(False); return; // unhandled StringType
   }
   setValue(win, _atoms[atom], t,
            reinterpret_cast<unsigned char *>(const_cast<char *>(value.c_str())),
@@ -324,7 +325,7 @@ void XAtom::setValue(Window win, Atoms atom, StringType type,
   switch (type) {
   case ansi: t = _atoms[string]; break;
   case utf8: t = _atoms[utf8_string]; break;
-  default: assert(False); // unhandled StringType
+  default: assert(False); return; // unhandled StringType
   }
 
   std::string value;
@@ -454,7 +455,7 @@ bool XAtom::getValue(Window win, Atoms atom, StringType type,
   switch (type) {
   case ansi: t = _atoms[string]; break;
   case utf8: t = _atoms[utf8_string]; break;
-  default: assert(False); // unhandled StringType
+  default: assert(False); return False; // unhandled StringType
   }
   
   unsigned char *value;
@@ -471,10 +472,10 @@ bool XAtom::getValue(Window win, Atoms atom, StringType type,
     std::string::const_iterator tmp = it; // current string.begin()
     it = std::find(tmp, end, '\0');       // look for null between tmp and end
     strings.push_back(std::string(tmp, it));   // s[tmp:it)
+    ++num;
     if (it == end) break;
     ++it;
     if (it == end) break;
-    ++num;
   }
 
   nelements = num;
@@ -490,3 +491,25 @@ void XAtom::eraseValue(Window win, Atoms atom) const {
   assert(atom >= 0 && atom < NUM_ATOMS);
   XDeleteProperty(_display, win, _atoms[atom]);
 }
+
+
+void XAtom::sendClientMessage(Window target, Atoms type, Window about,
+                              long data, long data1, long data2,
+                              long data3) const {
+  assert(atom >= 0 && atom < NUM_ATOMS);
+  assert(target != None);
+
+  XEvent e;
+  e.xclient.type = ClientMessage;
+  e.xclient.format = 32;
+  e.xclient.message_type = _atoms[type];
+  e.xclient.window = about;
+  e.xclient.data.l[0] = data;
+  e.xclient.data.l[1] = data1;
+  e.xclient.data.l[2] = data2;
+  e.xclient.data.l[3] = data3;
+
+  XSendEvent(_display, target, False,
+             SubstructureRedirectMask | SubstructureNotifyMask,
+             &e);
+}
This page took 0.024961 seconds and 4 git commands to generate.