all repos — fluxbox @ 95193fd598968fc0ad5ea113410c6fd6e6042629

custom fork of the fluxbox windowmanager

moved getWMName to Xutil
fluxgen fluxgen
commit

95193fd598968fc0ad5ea113410c6fd6e6042629

parent

01a3274e357279c3644b39a5838e48690f7c8746

2 files changed, 10 insertions(+), 87 deletions(-)

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

@@ -19,64 +19,17 @@ // 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: SlitClient.cc,v 1.1 2003/06/20 01:25:26 fluxgen Exp $ +// $Id: SlitClient.cc,v 1.2 2003/06/22 12:30:59 fluxgen Exp $ #include "SlitClient.hh" -#include "I18n.hh" #include "Screen.hh" #include "App.hh" +#include "Xutil.hh" #include <X11/Xutil.h> #include <X11/Xatom.h> -namespace { - -void getWMName(BScreen *screen, Window window, std::string& name) { - name = ""; - - if (screen == 0 || window == None) - return; - - Display *display = FbTk::App::instance()->display(); - - XTextProperty text_prop; - char **list; - int num; - I18n *i18n = I18n::instance(); - - if (XGetWMName(display, window, &text_prop)) { - if (text_prop.value && text_prop.nitems > 0) { - if (text_prop.encoding != XA_STRING) { - - text_prop.nitems = strlen((char *) text_prop.value); - - if ((XmbTextPropertyToTextList(display, &text_prop, - &list, &num) == Success) && - (num > 0) && *list) { - name = static_cast<char *>(*list); - XFreeStringList(list); - } else - name = (char *)text_prop.value; - - } else - name = (char *)text_prop.value; - } else { // default name - name = i18n->getMessage( - FBNLS::WindowSet, FBNLS::WindowUnnamed, - "Unnamed"); - } - } else { - // default name - name = i18n->getMessage( - FBNLS::WindowSet, FBNLS::WindowUnnamed, - "Unnamed"); - } - -} - -}; // end anonymous namespace - SlitClient::SlitClient(BScreen *screen, Window win) { initialize(screen, win); }

@@ -100,7 +53,7 @@ move(0, 0);

resize(0, 0); if (matchName().empty()) - getWMName(screen, clientWindow(), m_match_name); + m_match_name = Xutil::getWMName(clientWindow()); m_visible = true; }
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.12 2003/06/15 18:36:16 fluxgen Exp $ +// $Id: WinClient.cc,v 1.13 2003/06/22 12:35:03 fluxgen Exp $ #include "WinClient.hh"

@@ -29,6 +29,7 @@ #include "Screen.hh"

#include "I18n.hh" #include "FbAtoms.hh" #include "EventManager.hh" +#include "Xutil.hh" #include <iostream> #include <algorithm>

@@ -256,39 +257,7 @@ }

void WinClient::updateTitle() { - XTextProperty text_prop; - char **list = 0; - int num = 0; - I18n *i18n = I18n::instance(); - - if (getWMName(text_prop)) { - if (text_prop.value && text_prop.nitems > 0) { - if (text_prop.encoding != XA_STRING) { - - text_prop.nitems = strlen((char *) text_prop.value); - - if (XmbTextPropertyToTextList(FbTk::App::instance()->display(), &text_prop, - &list, &num) == Success && - num > 0 && *list) { - m_title = static_cast<char *>(*list); - XFreeStringList(list); - } else - m_title = (char *)text_prop.value; - - } else - m_title = (char *)text_prop.value; - XFree((char *) text_prop.value); - } else { // ok, we don't have a name, set default name - m_title = i18n->getMessage( - FBNLS::WindowSet, FBNLS::WindowUnnamed, - "Unnamed"); - } - } else { - m_title = i18n->getMessage( - FBNLS::WindowSet, FBNLS::WindowUnnamed, - "Unnamed"); - } - + m_title = Xutil::getWMName(window()); } void WinClient::updateIconTitle() {

@@ -307,11 +276,12 @@ num > 0 && *list) {

m_icon_title = (char *)*list; XFreeStringList(list); } else - m_icon_title = (char *)text_prop.value; + m_icon_title = text_prop.value ? (char *)text_prop.value : ""; } else - m_icon_title = (char *)text_prop.value; + m_icon_title = text_prop.value ? (char *)text_prop.value : ""; - XFree((char *) text_prop.value); + if (text_prop.value) + XFree((char *) text_prop.value); } else m_icon_title = title(); } else