aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ewmh.cc')
-rw-r--r--src/Ewmh.cc12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index b6793e0..0da4190 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -821,17 +821,15 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
821 const BScreen::WorkspaceNames &workspacenames = screen.getWorkspaceNames(); 821 const BScreen::WorkspaceNames &workspacenames = screen.getWorkspaceNames();
822 const size_t number_of_desks = workspacenames.size(); 822 const size_t number_of_desks = workspacenames.size();
823 823
824 char** names = new char*[number_of_desks]; 824 const char** names = new const char*[number_of_desks];
825 825
826 for (size_t i = 0; i < number_of_desks; i++) { 826 for (size_t i = 0; i < number_of_desks; i++) {
827 names[i] = new char[workspacenames[i].size() + 1]; // +1 for \0 827 names[i] = workspacenames[i].c_str();
828 memset(names[i], 0, workspacenames[i].size());
829 strcpy(names[i], workspacenames[i].c_str());
830 } 828 }
831 829
832#ifdef X_HAVE_UTF8_STRING 830#ifdef X_HAVE_UTF8_STRING
833 int code = Xutf8TextListToTextProperty(FbTk::App::instance()->display(), 831 int code = Xutf8TextListToTextProperty(FbTk::App::instance()->display(),
834 names, number_of_desks, XUTF8StringStyle, &text); 832 const_cast<char**>(names), number_of_desks, XUTF8StringStyle, &text);
835 if (code != XNoMemory && code != XLocaleNotSupported) { 833 if (code != XNoMemory && code != XLocaleNotSupported) {
836 XSetTextProperty(FbTk::App::instance()->display(), 834 XSetTextProperty(FbTk::App::instance()->display(),
837 screen.rootWindow().window(), 835 screen.rootWindow().window(),
@@ -848,11 +846,7 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
848 } 846 }
849#endif 847#endif
850 848
851 for (size_t i = 0; i < number_of_desks; i++)
852 delete[] names[i];
853
854 delete[] names; 849 delete[] names;
855
856} 850}
857 851
858void Ewmh::updateCurrentWorkspace(BScreen &screen) { 852void Ewmh::updateCurrentWorkspace(BScreen &screen) {