aboutsummaryrefslogtreecommitdiff
path: root/src/Xutil.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-01-30 11:06:25 (GMT)
committerrathnor <rathnor>2004-01-30 11:06:25 (GMT)
commit8b5f039f10e51f972dbed0a4d75fc569bde4b9a8 (patch)
tree6807bde3faf8c4508c8050d5eab4a6c9665cc253 /src/Xutil.cc
parentbfcf8c42056dbdb5f0e38cf97c653ea6c62e8cda (diff)
downloadfluxbox-8b5f039f10e51f972dbed0a4d75fc569bde4b9a8.zip
fluxbox-8b5f039f10e51f972dbed0a4d75fc569bde4b9a8.tar.bz2
slitlist fixing up
Diffstat (limited to 'src/Xutil.cc')
-rw-r--r--src/Xutil.cc56
1 files changed, 55 insertions, 1 deletions
diff --git a/src/Xutil.cc b/src/Xutil.cc
index a5a6c59..e36080a 100644
--- a/src/Xutil.cc
+++ b/src/Xutil.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: Xutil.cc,v 1.3 2004/01/11 16:04:39 fluxgen Exp $ 23// $Id: Xutil.cc,v 1.4 2004/01/30 11:06:25 rathnor Exp $
24 24
25#include "Xutil.hh" 25#include "Xutil.hh"
26 26
@@ -30,6 +30,8 @@
30#include <X11/Xutil.h> 30#include <X11/Xutil.h>
31#include <X11/Xatom.h> 31#include <X11/Xatom.h>
32#include <X11/Xlib.h> 32#include <X11/Xlib.h>
33#include <iostream>
34using namespace std;
33 35
34namespace Xutil { 36namespace Xutil {
35 37
@@ -79,5 +81,57 @@ std::string getWMName(Window window) {
79 return name; 81 return name;
80} 82}
81 83
84
85// The name of this particular instance
86std::string getWMClassName(Window win) {
87 XClassHint ch;
88 std::string instance_name;
89
90 if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) {
91#ifdef DEBUG
92 cerr<<"Xutil: Failed to read class hint!"<<endl;
93#endif //DEBUG
94 instance_name = "";
95 } else {
96
97 XFree(ch.res_class);
98
99 if (ch.res_class != 0) {
100 instance_name = const_cast<char *>(ch.res_name);
101 XFree(ch.res_name);
102 ch.res_name = 0;
103 } else
104 instance_name = "";
105 }
106
107 return instance_name;
108
109}
110
111// the name of the general class of the app
112std::string getWMClassClass(Window win) {
113 XClassHint ch;
114 std::string class_name;
115
116 if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) {
117#ifdef DEBUG
118 cerr<<"Xutil: Failed to read class hint!"<<endl;
119#endif //DEBUG
120 class_name = "";
121 } else {
122
123 XFree(ch.res_name);
124
125 if (ch.res_class != 0) {
126 class_name = const_cast<char *>(ch.res_class);
127 XFree(ch.res_class);
128 ch.res_class = 0;
129 } else
130 class_name = "";
131 }
132
133 return class_name;
134}
135
82}; // end namespace Xutil 136}; // end namespace Xutil
83 137