aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/FbWindow.cc30
-rw-r--r--src/FbTk/FbWindow.hh6
2 files changed, 33 insertions, 3 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 195eeea..47e1399 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -19,7 +19,7 @@
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: FbWindow.cc,v 1.31 2004/01/21 20:07:41 fluxgen Exp $ 22// $Id: FbWindow.cc,v 1.32 2004/04/28 13:04:06 rathnor Exp $
23 23
24#include "FbWindow.hh" 24#include "FbWindow.hh"
25 25
@@ -32,6 +32,7 @@
32#include "config.h" 32#include "config.h"
33#endif // HAVE_CONFIG_H 33#endif // HAVE_CONFIG_H
34 34
35#include <X11/Xutil.h>
35#include <X11/Xatom.h> 36#include <X11/Xatom.h>
36 37
37#include <cassert> 38#include <cassert>
@@ -342,6 +343,33 @@ void FbWindow::reparent(const FbWindow &parent, int x, int y) {
342 updateGeometry(); 343 updateGeometry();
343} 344}
344 345
346std::string FbWindow::textProperty(Atom property) const {
347 XTextProperty text_prop;
348 char ** stringlist;
349 int count;
350 std::string ret;
351
352 if (XGetTextProperty(s_display, window(), &text_prop, property) == 0)
353 return "";
354
355 if (text_prop.value == 0 || text_prop.nitems == 0)
356 return "";
357
358 if (text_prop.encoding != XA_STRING) {
359 // still returns a "StringList" despite the different name
360 if (XmbTextPropertyToTextList(s_display, &text_prop, &stringlist, &count) == 0 || count == 0)
361 return "";
362 } else {
363 if (XTextPropertyToStringList(&text_prop, &stringlist, &count) == 0 || count == 0)
364 return "";
365
366 }
367
368 ret = stringlist[0];
369 XFreeStringList(stringlist);
370 return ret;
371}
372
345bool FbWindow::property(Atom property, 373bool FbWindow::property(Atom property,
346 long long_offset, long long_length, 374 long long_offset, long long_length,
347 bool do_delete, 375 bool do_delete,
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index d44e36f..045356f 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -19,7 +19,7 @@
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: FbWindow.hh,v 1.28 2004/01/21 20:22:26 fluxgen Exp $ 22// $Id: FbWindow.hh,v 1.29 2004/04/28 13:04:06 rathnor Exp $
23 23
24#ifndef FBTK_FBWINDOW_HH 24#ifndef FBTK_FBWINDOW_HH
25#define FBTK_FBWINDOW_HH 25#define FBTK_FBWINDOW_HH
@@ -28,7 +28,7 @@
28 28
29#include <X11/Xlib.h> 29#include <X11/Xlib.h>
30#include <memory> 30#include <memory>
31 31#include <string>
32 32
33namespace FbTk { 33namespace FbTk {
34 34
@@ -135,6 +135,8 @@ public:
135 unsigned char *data, 135 unsigned char *data,
136 int nelements); 136 int nelements);
137 137
138 std::string textProperty(Atom property) const;
139
138 /// @return parent FbWindow 140 /// @return parent FbWindow
139 const FbWindow *parent() const { return m_parent; } 141 const FbWindow *parent() const { return m_parent; }
140 /// @return real X window 142 /// @return real X window