]>
Dogcows Code - chaz/openbox/blob - src/rootwindow.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
7 #include "rootwindow.hh"
11 #include "otk/display.hh"
15 OBRootWindow::OBRootWindow(int screen
)
16 : OBWidget(OBWidget::Type_Root
),
17 _info(otk::OBDisplay::screenInfo(screen
))
21 Openbox::instance
->registerHandler(_info
->rootWindow(), this);
25 OBRootWindow::~OBRootWindow()
30 void OBRootWindow::updateDesktopNames()
32 const int numWorkspaces
= 1; // XXX: change this to the number of workspaces!
34 const otk::OBProperty
*property
= Openbox::instance
->property();
36 unsigned long num
= (unsigned) -1;
38 if (!property
->get(_info
->rootWindow(),
39 otk::OBProperty::net_desktop_names
,
40 otk::OBProperty::utf8
, &num
, &_names
))
42 while ((signed)_names
.size() < numWorkspaces
)
43 _names
.push_back("Unnamed");
47 void OBRootWindow::propertyHandler(const XPropertyEvent
&e
)
49 otk::OtkEventHandler::propertyHandler(e
);
51 const otk::OBProperty
*property
= Openbox::instance
->property();
53 // compress changes to a single property into a single change
55 while (XCheckTypedEvent(otk::OBDisplay::display
, e
.type
, &ce
)) {
56 // XXX: it would be nice to compress ALL changes to a property, not just
57 // changes in a row without other props between.
58 if (ce
.xproperty
.atom
!= e
.atom
) {
59 XPutBackEvent(otk::OBDisplay::display
, &ce
);
64 if (e
.atom
== property
->atom(otk::OBProperty::net_desktop_names
))
69 void OBRootWindow::clientMessageHandler(const XClientMessageEvent
&e
)
71 otk::OtkEventHandler::clientMessageHandler(e
);
73 if (e
.format
!= 32) return;
75 //const otk::OBProperty *property = Openbox::instance->property();
77 // XXX: so many client messages to handle here! ..or not.. they go to clients
81 void OBRootWindow::setDesktopNames(const otk::OBProperty::StringVect
&names
)
84 const otk::OBProperty
*property
= Openbox::instance
->property();
85 property
->set(_info
->rootWindow(), otk::OBProperty::net_desktop_names
,
86 otk::OBProperty::utf8
, names
);
89 void OBRootWindow::setDesktopName(int i
, const std::string
&name
)
91 const int numWorkspaces
= 1; // XXX: change this to the number of workspaces!
93 assert(i
< numWorkspaces
);
95 const otk::OBProperty
*property
= Openbox::instance
->property();
97 otk::OBProperty::StringVect newnames
= _names
;
99 property
->set(_info
->rootWindow(), otk::OBProperty::net_desktop_names
,
100 otk::OBProperty::utf8
, newnames
);
104 void OBRootWindow::mapRequestHandler(const XMapRequestEvent
&e
)
106 otk::OtkEventHandler::mapRequestHandler(e
);
109 printf("MapRequest for 0x%lx\n", e
.window
);
112 Openbox::instance
->screen(_info
->screen())->manageWindow(e
.window
);
This page took 0.040095 seconds and 4 git commands to generate.