all repos — fluxbox @ c182d9846fbc5fa8a7a3686e7062919b214b1dfc

custom fork of the fluxbox windowmanager

updateWMClassName
fluxgen fluxgen
commit

c182d9846fbc5fa8a7a3686e7062919b214b1dfc

parent

f6fcf362314ef7385bba48cf911ab967f5086667

1 files changed, 15 insertions(+), 28 deletions(-)

jump to
M src/WinClient.ccsrc/WinClient.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 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"

@@ -176,48 +176,35 @@ bool WinClient::getWMIconName(XTextProperty &textprop) const {

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; - if (XGetClassHint(FbTk::App::instance()->display(), window(), &ch) == 0) { #ifdef DEBUG - cerr<<"Failed to read class hint!"<<endl; + cerr<<"WinClient: Failed to read class hint!"<<endl; #endif //DEBUG - return ""; - } else { - string m_instance_name; + } else { + if (ch.res_name != 0) { m_instance_name = const_cast<char *>(ch.res_name); XFree(ch.res_name); + ch.res_name = 0; } else 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) { m_class_name = const_cast<char *>(ch.res_class); XFree(ch.res_class); + ch.res_class = 0; } else m_class_name = ""; - return m_class_name; } }