From: Mikko Rasa Date: Sat, 22 Sep 2007 17:07:27 +0000 (+0000) Subject: Add Window::set_title X-Git-Tag: 0.9~20 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=20c2cd80da121df17c239c9c2a4be6a00159dad4;p=libs%2Fgui.git Add Window::set_title --- diff --git a/source/window.cpp b/source/window.cpp index 5395a00..3de9ba7 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -6,6 +6,7 @@ Distributed under the LGPL */ #include +#include #include #include #include "window.h" @@ -52,6 +53,17 @@ Window::~Window() XCloseDisplay(display); } +void Window::set_title(const string &title) +{ + vector 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); diff --git a/source/window.h b/source/window.h index 0f1dfba..a8ad867 100644 --- a/source/window.h +++ b/source/window.h @@ -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();