aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2014-09-14 15:52:29 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2014-09-14 15:52:29 (GMT)
commitf0a178f515a4d207288875fcff55dbd073b6319b (patch)
tree1d9d2c541485a469e9710783efcc3737f7b4e448
parent026343b6b13024c56e9273f5012076536965bd27 (diff)
downloadfluxbox-f0a178f515a4d207288875fcff55dbd073b6319b.zip
fluxbox-f0a178f515a4d207288875fcff55dbd073b6319b.tar.bz2
fix: check the correct XClassHint property
kudos to Arkadiusz Bokowy (this commit is a slightly changed version of a patch sent to the devel-ml): when retrieving the '.res_name' of a XClassHint we should check '.res_name' and not '.res_class'. the other changes only reduce the code.
-rw-r--r--src/Xutil.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Xutil.cc b/src/Xutil.cc
index 2ef9315..68432a3 100644
--- a/src/Xutil.cc
+++ b/src/Xutil.cc
@@ -97,18 +97,15 @@ FbTk::FbString getWMClassName(Window win) {
97 97
98 if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) { 98 if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) {
99 fbdbg<<"Xutil: Failed to read class hint!"<<endl; 99 fbdbg<<"Xutil: Failed to read class hint!"<<endl;
100
101 instance_name = "";
102 } else { 100 } else {
103 101
104 XFree(ch.res_class); 102 XFree(ch.res_class);
105 103
106 if (ch.res_class != 0) { 104 if (ch.res_name != 0) {
107 instance_name = const_cast<char *>(ch.res_name); 105 instance_name = const_cast<char *>(ch.res_name);
108 XFree(ch.res_name); 106 XFree(ch.res_name);
109 ch.res_name = 0; 107 ch.res_name = 0;
110 } else 108 }
111 instance_name = "";
112 } 109 }
113 110
114 return instance_name; 111 return instance_name;
@@ -122,7 +119,6 @@ FbTk::FbString getWMClassClass(Window win) {
122 119
123 if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) { 120 if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) {
124 fbdbg<<"Xutil: Failed to read class hint!"<<endl; 121 fbdbg<<"Xutil: Failed to read class hint!"<<endl;
125 class_name = "";
126 } else { 122 } else {
127 123
128 XFree(ch.res_name); 124 XFree(ch.res_name);
@@ -131,8 +127,7 @@ FbTk::FbString getWMClassClass(Window win) {
131 class_name = const_cast<char *>(ch.res_class); 127 class_name = const_cast<char *>(ch.res_class);
132 XFree(ch.res_class); 128 XFree(ch.res_class);
133 ch.res_class = 0; 129 ch.res_class = 0;
134 } else 130 }
135 class_name = "";
136 } 131 }
137 132
138 return class_name; 133 return class_name;