aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2006-05-07 10:08:25 (GMT)
committersimonb <simonb>2006-05-07 10:08:25 (GMT)
commitfaf043bef92338fe976e639e94d309764065b8b7 (patch)
tree6554ea89ff6064465bd605da8f640ee43212b356 /src/Ewmh.cc
parentac098b4d0f0640b2997ff674a5c1b3447b6ba09a (diff)
downloadfluxbox-faf043bef92338fe976e639e94d309764065b8b7.zip
fluxbox-faf043bef92338fe976e639e94d309764065b8b7.tar.bz2
more utf8 changes, notably window titles
Diffstat (limited to 'src/Ewmh.cc')
-rw-r--r--src/Ewmh.cc37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 6bcd3e6..ea23a22 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -189,6 +189,15 @@ void Ewmh::initForScreen(BScreen &screen) {
189 189
190void Ewmh::setupClient(WinClient &winclient) { 190void Ewmh::setupClient(WinClient &winclient) {
191 updateStrut(winclient); 191 updateStrut(winclient);
192
193 FbTk::FbString newtitle = winclient.textProperty(m_net_wm_name);
194 if (!newtitle.empty()) {
195 winclient.setTitle(newtitle);
196 }
197 newtitle = winclient.textProperty(m_net_wm_icon_name);
198 if (!newtitle.empty()) {
199 winclient.setIconTitle(newtitle);
200 }
192} 201}
193 202
194void Ewmh::setupFrame(FluxboxWindow &win) { 203void Ewmh::setupFrame(FluxboxWindow &win) {
@@ -268,7 +277,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
268 &ret_type, &fmt, &nitems, &bytes_after, 277 &ret_type, &fmt, &nitems, &bytes_after,
269 (unsigned char **) &data) && data) { 278 (unsigned char **) &data) && data) {
270 unsigned int desktop = static_cast<long>(*data); 279 unsigned int desktop = static_cast<long>(*data);
271 if (desktop == -1 && !win.isStuck()) 280 if (desktop == (unsigned int)(-1) && !win.isStuck())
272 win.stick(); 281 win.stick();
273 else 282 else
274 win.setWorkspace(desktop); 283 win.setWorkspace(desktop);
@@ -433,11 +442,21 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
433 strcpy(names[i], workspacenames[i].c_str()); 442 strcpy(names[i], workspacenames[i].c_str());
434 } 443 }
435 444
445#ifdef X_HAVE_UTF8_STRING
446 Xutf8TextListToTextProperty(FbTk::App::instance()->display(),
447 names, number_of_desks, XUTF8StringStyle, &text);
448 XSetTextProperty(FbTk::App::instance()->display(), screen.rootWindow().window(),
449 &text, m_net_desktop_names);
450
451 XFree(text.value);
452
453#else
436 if (XStringListToTextProperty(names, number_of_desks, &text)) { 454 if (XStringListToTextProperty(names, number_of_desks, &text)) {
437 XSetTextProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), 455 XSetTextProperty(FbTk::App::instance()->display(), screen.rootWindow().window(),
438 &text, m_net_desktop_names); 456 &text, m_net_desktop_names);
439 XFree(text.value); 457 XFree(text.value);
440 } 458 }
459#endif
441 460
442 for (size_t i = 0; i < number_of_desks; i++) 461 for (size_t i = 0; i < number_of_desks; i++)
443 delete [] names[i]; 462 delete [] names[i];
@@ -810,7 +829,17 @@ bool Ewmh::propertyNotify(WinClient &winclient, Atom the_property) {
810 if (the_property == m_net_wm_strut) { 829 if (the_property == m_net_wm_strut) {
811 updateStrut(winclient); 830 updateStrut(winclient);
812 return true; 831 return true;
813 } 832 } else if (the_property == m_net_wm_name) {
833 FbTk::FbString newtitle = winclient.textProperty(the_property);
834 if (!newtitle.empty())
835 winclient.setTitle(newtitle);
836 return true;
837 } else if (the_property == m_net_wm_icon_name) {
838 FbTk::FbString newtitle = winclient.textProperty(the_property);
839 if (!newtitle.empty())
840 winclient.setIconTitle(newtitle);
841 return true;
842 }
814 843
815 return false; 844 return false;
816} 845}
@@ -841,6 +870,7 @@ void Ewmh::createAtoms() {
841 870
842 m_net_properties = XInternAtom(disp, "_NET_PROPERTIES", False); 871 m_net_properties = XInternAtom(disp, "_NET_PROPERTIES", False);
843 m_net_wm_name = XInternAtom(disp, "_NET_WM_NAME", False); 872 m_net_wm_name = XInternAtom(disp, "_NET_WM_NAME", False);
873 m_net_wm_icon_name = XInternAtom(disp, "_NET_WM_ICON_NAME", False);
844 m_net_wm_desktop = XInternAtom(disp, "_NET_WM_DESKTOP", False); 874 m_net_wm_desktop = XInternAtom(disp, "_NET_WM_DESKTOP", False);
845 875
846 // type atoms 876 // type atoms
@@ -1017,6 +1047,8 @@ void Ewmh::updateStrut(WinClient &winclient) {
1017 } 1047 }
1018} 1048}
1019 1049
1050
1051
1020void Ewmh::updateActions(FluxboxWindow &win) { 1052void Ewmh::updateActions(FluxboxWindow &win) {
1021 1053
1022 /* From Extended Window Manager Hints, draft 1.3: 1054 /* From Extended Window Manager Hints, draft 1.3:
@@ -1151,3 +1183,4 @@ void Ewmh::clearState(FluxboxWindow &win) {
1151void Ewmh::saveState(FluxboxWindow &win, WindowState *state) { 1183void Ewmh::saveState(FluxboxWindow &win, WindowState *state) {
1152 m_savedstate[&win] = state; 1184 m_savedstate[&win] = state;
1153} 1185}
1186