diff options
author | mathias <mathias> | 2006-10-30 19:31:15 (GMT) |
---|---|---|
committer | mathias <mathias> | 2006-10-30 19:31:15 (GMT) |
commit | e5e76e7761f52ba7c0deca75bcecae4fbd3e2ff5 (patch) | |
tree | c84838a84802805e9b1463045e86200b7cef917f /src/Xutil.cc | |
parent | 426c12c25c2ef095a882619ad7424684b88465b8 (diff) | |
download | fluxbox_pavel-e5e76e7761f52ba7c0deca75bcecae4fbd3e2ff5.zip fluxbox_pavel-e5e76e7761f52ba7c0deca75bcecae4fbd3e2ff5.tar.bz2 |
Cosmetic patch from Slava Semushin
Diffstat (limited to 'src/Xutil.cc')
-rw-r--r-- | src/Xutil.cc | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/Xutil.cc b/src/Xutil.cc index 87f5253..c138142 100644 --- a/src/Xutil.cc +++ b/src/Xutil.cc | |||
@@ -32,7 +32,13 @@ | |||
32 | #include <X11/Xatom.h> | 32 | #include <X11/Xatom.h> |
33 | #include <X11/Xlib.h> | 33 | #include <X11/Xlib.h> |
34 | #include <iostream> | 34 | #include <iostream> |
35 | using namespace std; | 35 | |
36 | using std::string; | ||
37 | |||
38 | #ifdef DEBUG | ||
39 | using std::cerr; | ||
40 | using std::endl; | ||
41 | #endif // DEBUG | ||
36 | 42 | ||
37 | namespace Xutil { | 43 | namespace Xutil { |
38 | 44 | ||
@@ -48,14 +54,14 @@ FbTk::FbString getWMName(Window window) { | |||
48 | char **list; | 54 | char **list; |
49 | int num; | 55 | int num; |
50 | _FB_USES_NLS; | 56 | _FB_USES_NLS; |
51 | std::string name; | 57 | string name; |
52 | 58 | ||
53 | if (XGetWMName(display, window, &text_prop)) { | 59 | if (XGetWMName(display, window, &text_prop)) { |
54 | if (text_prop.value && text_prop.nitems > 0) { | 60 | if (text_prop.value && text_prop.nitems > 0) { |
55 | if (text_prop.encoding != XA_STRING) { | 61 | if (text_prop.encoding != XA_STRING) { |
56 | 62 | ||
57 | text_prop.nitems = strlen((char *) text_prop.value); | 63 | text_prop.nitems = strlen((char *) text_prop.value); |
58 | 64 | ||
59 | if ((XmbTextPropertyToTextList(display, &text_prop, | 65 | if ((XmbTextPropertyToTextList(display, &text_prop, |
60 | &list, &num) == Success) && | 66 | &list, &num) == Success) && |
61 | (num > 0) && *list) { | 67 | (num > 0) && *list) { |
@@ -63,7 +69,7 @@ FbTk::FbString getWMName(Window window) { | |||
63 | XFreeStringList(list); | 69 | XFreeStringList(list); |
64 | } else | 70 | } else |
65 | name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; | 71 | name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; |
66 | 72 | ||
67 | } else | 73 | } else |
68 | name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; | 74 | name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; |
69 | 75 | ||
@@ -82,19 +88,19 @@ FbTk::FbString getWMName(Window window) { | |||
82 | 88 | ||
83 | 89 | ||
84 | // The name of this particular instance | 90 | // The name of this particular instance |
85 | std::string getWMClassName(Window win) { | 91 | string getWMClassName(Window win) { |
86 | XClassHint ch; | 92 | XClassHint ch; |
87 | std::string instance_name; | 93 | string instance_name; |
88 | 94 | ||
89 | if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) { | 95 | if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) { |
90 | #ifdef DEBUG | 96 | #ifdef DEBUG |
91 | cerr<<"Xutil: Failed to read class hint!"<<endl; | 97 | cerr<<"Xutil: Failed to read class hint!"<<endl; |
92 | #endif //DEBUG | 98 | #endif //DEBUG |
93 | instance_name = ""; | 99 | instance_name = ""; |
94 | } else { | 100 | } else { |
95 | 101 | ||
96 | XFree(ch.res_class); | 102 | XFree(ch.res_class); |
97 | 103 | ||
98 | if (ch.res_class != 0) { | 104 | if (ch.res_class != 0) { |
99 | instance_name = const_cast<char *>(ch.res_name); | 105 | instance_name = const_cast<char *>(ch.res_name); |
100 | XFree(ch.res_name); | 106 | XFree(ch.res_name); |
@@ -108,19 +114,19 @@ std::string getWMClassName(Window win) { | |||
108 | } | 114 | } |
109 | 115 | ||
110 | // the name of the general class of the app | 116 | // the name of the general class of the app |
111 | std::string getWMClassClass(Window win) { | 117 | string getWMClassClass(Window win) { |
112 | XClassHint ch; | 118 | XClassHint ch; |
113 | std::string class_name; | 119 | string class_name; |
114 | 120 | ||
115 | if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) { | 121 | if (XGetClassHint(FbTk::App::instance()->display(), win, &ch) == 0) { |
116 | #ifdef DEBUG | 122 | #ifdef DEBUG |
117 | cerr<<"Xutil: Failed to read class hint!"<<endl; | 123 | cerr<<"Xutil: Failed to read class hint!"<<endl; |
118 | #endif //DEBUG | 124 | #endif //DEBUG |
119 | class_name = ""; | 125 | class_name = ""; |
120 | } else { | 126 | } else { |
121 | 127 | ||
122 | XFree(ch.res_name); | 128 | XFree(ch.res_name); |
123 | 129 | ||
124 | if (ch.res_class != 0) { | 130 | if (ch.res_class != 0) { |
125 | class_name = const_cast<char *>(ch.res_class); | 131 | class_name = const_cast<char *>(ch.res_class); |
126 | XFree(ch.res_class); | 132 | XFree(ch.res_class); |