1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
7 #include "rootwindow.hh"
9 #include "otk/display.hh"
13 OBRootWindow::OBRootWindow(int screen)
14 : _info(otk::OBDisplay::screenInfo(screen))
18 Openbox::instance->registerHandler(_info->getRootWindow(), this);
22 OBRootWindow::~OBRootWindow()
27 void OBRootWindow::updateDesktopNames()
29 const int numWorkspaces = 1; // XXX: change this to the number of workspaces!
31 const otk::OBProperty *property = Openbox::instance->property();
33 unsigned long num = (unsigned) -1;
35 if (!property->get(_info->getRootWindow(),
36 otk::OBProperty::net_desktop_names,
37 otk::OBProperty::utf8, &num, &_names))
39 for (int i = 0; i < numWorkspaces; ++i)
40 if (i <= static_cast<int>(_names.size()))
41 _names.push_back("Unnamed workspace");
45 void OBRootWindow::propertyHandler(const XPropertyEvent &e)
47 otk::OtkEventHandler::propertyHandler(e);
49 const otk::OBProperty *property = Openbox::instance->property();
51 if (e.atom == property->atom(otk::OBProperty::net_desktop_names))
56 void OBRootWindow::clientMessageHandler(const XClientMessageEvent &e)
58 otk::OtkEventHandler::clientMessageHandler(e);
60 if (e.format != 32) return;
62 //const otk::OBProperty *property = Openbox::instance->property();
64 // XXX: so many client messages to handle here!
68 void OBRootWindow::setDesktopName(int i, const std::string &name)
70 const int numWorkspaces = 1; // XXX: change this to the number of workspaces!
72 assert(i < numWorkspaces);
74 const otk::OBProperty *property = Openbox::instance->property();
76 otk::OBProperty::StringVect newnames = _names;
78 property->set(_info->getRootWindow(), otk::OBProperty::net_desktop_names,
79 otk::OBProperty::utf8, newnames);