summaryrefslogtreecommitdiff
path: root/src/SlitClient.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/SlitClient.cc')
-rw-r--r--src/SlitClient.cc53
1 files changed, 3 insertions, 50 deletions
diff --git a/src/SlitClient.cc b/src/SlitClient.cc
index 74a10a4..fe2567f 100644
--- a/src/SlitClient.cc
+++ b/src/SlitClient.cc
@@ -19,64 +19,17 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: SlitClient.cc,v 1.1 2003/06/20 01:25:26 fluxgen Exp $ 22// $Id: SlitClient.cc,v 1.2 2003/06/22 12:30:59 fluxgen Exp $
23 23
24#include "SlitClient.hh" 24#include "SlitClient.hh"
25 25
26#include "I18n.hh"
27#include "Screen.hh" 26#include "Screen.hh"
28#include "App.hh" 27#include "App.hh"
28#include "Xutil.hh"
29 29
30#include <X11/Xutil.h> 30#include <X11/Xutil.h>
31#include <X11/Xatom.h> 31#include <X11/Xatom.h>
32 32
33namespace {
34
35void getWMName(BScreen *screen, Window window, std::string& name) {
36 name = "";
37
38 if (screen == 0 || window == None)
39 return;
40
41 Display *display = FbTk::App::instance()->display();
42
43 XTextProperty text_prop;
44 char **list;
45 int num;
46 I18n *i18n = I18n::instance();
47
48 if (XGetWMName(display, window, &text_prop)) {
49 if (text_prop.value && text_prop.nitems > 0) {
50 if (text_prop.encoding != XA_STRING) {
51
52 text_prop.nitems = strlen((char *) text_prop.value);
53
54 if ((XmbTextPropertyToTextList(display, &text_prop,
55 &list, &num) == Success) &&
56 (num > 0) && *list) {
57 name = static_cast<char *>(*list);
58 XFreeStringList(list);
59 } else
60 name = (char *)text_prop.value;
61
62 } else
63 name = (char *)text_prop.value;
64 } else { // default name
65 name = i18n->getMessage(
66 FBNLS::WindowSet, FBNLS::WindowUnnamed,
67 "Unnamed");
68 }
69 } else {
70 // default name
71 name = i18n->getMessage(
72 FBNLS::WindowSet, FBNLS::WindowUnnamed,
73 "Unnamed");
74 }
75
76}
77
78}; // end anonymous namespace
79
80SlitClient::SlitClient(BScreen *screen, Window win) { 33SlitClient::SlitClient(BScreen *screen, Window win) {
81 initialize(screen, win); 34 initialize(screen, win);
82} 35}
@@ -100,7 +53,7 @@ void SlitClient::initialize(BScreen *screen, Window win) {
100 resize(0, 0); 53 resize(0, 0);
101 54
102 if (matchName().empty()) 55 if (matchName().empty())
103 getWMName(screen, clientWindow(), m_match_name); 56 m_match_name = Xutil::getWMName(clientWindow());
104 m_visible = true; 57 m_visible = true;
105} 58}
106 59