]> git.tdb.fi Git - libs/gui.git/commitdiff
Add Window::set_title
authorMikko Rasa <tdb@tdb.fi>
Sat, 22 Sep 2007 17:07:27 +0000 (17:07 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sat, 22 Sep 2007 17:07:27 +0000 (17:07 +0000)
source/window.cpp
source/window.h

index 5395a00535c3aa2c4ee41797b0d71b6513aaacf1..3de9ba7f33894ba1c5c07d1f71a73d7faf1a51eb 100644 (file)
@@ -6,6 +6,7 @@ Distributed under the LGPL
 */
 
 #include <vector>
+#include <X11/Xatom.h>
 #include <X11/Xutil.h>
 #include <msp/core/error.h>
 #include "window.h"
@@ -52,6 +53,17 @@ Window::~Window()
                XCloseDisplay(display);
 }
 
+void Window::set_title(const string &title)
+{
+       vector<unsigned char> buf(title.begin(), title.end());
+       XTextProperty prop;
+       prop.value=&buf[0];
+       prop.encoding=XA_STRING;
+       prop.format=8;
+       prop.nitems=title.size();
+       XSetWMName(display, window, &prop);
+}
+
 void Window::show()
 {
        XMapRaised(display, window);
index 0f1dfbaf8c18ca343fbe617c6808ddfc52f800f7..a8ad867cca9acac780cf3f34535d69c21df286b1 100644 (file)
@@ -49,6 +49,8 @@ public:
        Window(const DisplayOptions &dopt);
        virtual ~Window();
 
+       void set_title(const std::string &);
+
        unsigned get_width() const  { return options.width; }
        unsigned get_height() const { return options.height; }
        void show();