all repos — fluxbox @ c314d05553b6105b983267a97d14429681d90ae2

custom fork of the fluxbox windowmanager

add some property accessors
rathnor rathnor
commit

c314d05553b6105b983267a97d14429681d90ae2

parent

e139cbb0283f7480fc26c58dc3f8a48e69011eab

2 files changed, 50 insertions(+), 2 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.10 2003/06/12 14:51:59 fluxgen Exp $ +// $Id: WinClient.cc,v 1.11 2003/06/12 15:13:23 rathnor Exp $ #include "WinClient.hh"

@@ -174,6 +174,51 @@ }

bool WinClient::getWMIconName(XTextProperty &textprop) const { return XGetWMName(FbTk::App::instance()->display(), window(), &textprop); +} + +const std::string WinClient::getWMClassName() 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_instance_name; + if (ch.res_name != 0) { + m_instance_name = const_cast<char *>(ch.res_name); + XFree(ch.res_name); + } 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); + } else + m_class_name = ""; + return m_class_name; + } } void WinClient::updateTransientInfo() {
M src/WinClient.hhsrc/WinClient.hh

@@ -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.hh,v 1.5 2003/05/14 12:07:05 fluxgen Exp $ +// $Id: WinClient.hh,v 1.6 2003/06/12 15:13:23 rathnor Exp $ #ifndef WINCLIENT_HH #define WINCLIENT_HH

@@ -48,6 +48,9 @@ void reparent(Window win, int x, int y);

bool getAttrib(XWindowAttributes &attr) const; bool getWMName(XTextProperty &textprop) const; bool getWMIconName(XTextProperty &textprop) const; + const std::string getWMClassName() const; // name member of class structure + const std::string getWMClassClass() const; // class member of class structure + inline const std::string getTitle() const { return m_title; } void updateTitle(); void updateIconTitle(); BScreen &screen() { return m_screen; }