summaryrefslogtreecommitdiff
path: root/util/epist/window.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-07-12 02:48:43 +0000
committerDana Jansens <danakj@orodu.net>2002-07-12 02:48:43 +0000
commit5112b6270431cf1fe288d63e15bfbe689c0624bf (patch)
tree94305ea6b3f192ef595c1c26f2e5b177203bd415 /util/epist/window.cc
parente8b6f65186587ac8e79fcc81d8006ea1270a02d4 (diff)
gets a whole lotta window information now, and updtes when it changes!
Diffstat (limited to 'util/epist/window.cc')
-rw-r--r--util/epist/window.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/util/epist/window.cc b/util/epist/window.cc
index 15f8b11c..62087283 100644
--- a/util/epist/window.cc
+++ b/util/epist/window.cc
@@ -35,13 +35,14 @@ using std::endl;
using std::hex;
using std::dec;
-
XWindow::XWindow(Window window) : _window(window) {
_unmapped = false;
XSelectInput(_display, _window, PropertyChangeMask | StructureNotifyMask);
updateState();
updateDesktop();
+ updateTitle();
+ updateClass();
}
@@ -80,3 +81,32 @@ void XWindow::updateDesktop() {
static_cast<unsigned long>(_desktop)))
_desktop = 0;
}
+
+
+void XWindow::updateTitle() {
+ _title = "";
+
+ // try netwm
+ if (! _xatom->getValue(_window, XAtom::net_wm_name, XAtom::utf8, _title)) {
+ // try old x stuff
+ _xatom->getValue(_window, XAtom::wm_name, XAtom::ansi, _title);
+ }
+
+ if (_title.empty())
+ _title = "Unnamed";
+}
+
+
+void XWindow::updateClass() {
+ // set the defaults
+ _app_name = _app_class = "";
+
+ XAtom::StringVect v;
+ unsigned long num = 2;
+
+ if (! _xatom->getValue(_window, XAtom::wm_class, XAtom::ansi, num, v))
+ return;
+
+ if (num > 0) _app_name = v[0];
+ if (num > 1) _app_class = v[1];
+}