updateWMClassName

This commit is contained in:
fluxgen 2003-06-15 18:36:16 +00:00
parent f6fcf36231
commit c182d9846f

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: WinClient.cc,v 1.11 2003/06/12 15:13:23 rathnor Exp $ // $Id: WinClient.cc,v 1.12 2003/06/15 18:36:16 fluxgen Exp $
#include "WinClient.hh" #include "WinClient.hh"
@ -176,48 +176,35 @@ bool WinClient::getWMIconName(XTextProperty &textprop) const {
return XGetWMName(FbTk::App::instance()->display(), window(), &textprop); return XGetWMName(FbTk::App::instance()->display(), window(), &textprop);
} }
const std::string WinClient::getWMClassName() const { const std::string &WinClient::getWMClassName() const {
return m_instance_name;
}
const std::string &WinClient::getWMClassClass() const {
return m_class_name;
}
void WinClient::updateWMClassHint() {
XClassHint ch; XClassHint ch;
if (XGetClassHint(FbTk::App::instance()->display(), window(), &ch) == 0) { if (XGetClassHint(FbTk::App::instance()->display(), window(), &ch) == 0) {
#ifdef DEBUG #ifdef DEBUG
cerr<<"Failed to read class hint!"<<endl; cerr<<"WinClient: Failed to read class hint!"<<endl;
#endif //DEBUG #endif //DEBUG
return ""; } else {
} else {
string m_instance_name;
if (ch.res_name != 0) { if (ch.res_name != 0) {
m_instance_name = const_cast<char *>(ch.res_name); m_instance_name = const_cast<char *>(ch.res_name);
XFree(ch.res_name); XFree(ch.res_name);
ch.res_name = 0;
} else } else
m_instance_name = ""; m_instance_name = "";
if (ch.res_class != 0)
XFree(ch.res_class);
return m_instance_name;
}
}
const std::string WinClient::getWMClassClass() const {
XClassHint ch;
if (XGetClassHint(FbTk::App::instance()->display(), window(), &ch) == 0) {
#ifdef DEBUG
cerr<<"Failed to read class hint!"<<endl;
#endif //DEBUG
return "";
} else {
string m_class_name;
if (ch.res_name != 0)
XFree(ch.res_name);
if (ch.res_class != 0) { if (ch.res_class != 0) {
m_class_name = const_cast<char *>(ch.res_class); m_class_name = const_cast<char *>(ch.res_class);
XFree(ch.res_class); XFree(ch.res_class);
ch.res_class = 0;
} else } else
m_class_name = ""; m_class_name = "";
return m_class_name;
} }
} }