]>
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"
10 #include "otk/display.hh"
14 OBRootWindow::OBRootWindow(int screen
)
15 : OBWidget(OBWidget::Type_Root
),
16 _info(otk::OBDisplay::screenInfo(screen
))
20 Openbox::instance
->registerHandler(_info
->rootWindow(), this);
24 OBRootWindow::~OBRootWindow()
29 void OBRootWindow::updateDesktopNames()
31 const int numWorkspaces
= 1; // XXX: change this to the number of workspaces!
33 const otk::OBProperty
*property
= Openbox::instance
->property();
35 unsigned long num
= (unsigned) -1;
37 if (!property
->get(_info
->rootWindow(),
38 otk::OBProperty::net_desktop_names
,
39 otk::OBProperty::utf8
, &num
, &_names
))
41 for (int i
= 0; i
< numWorkspaces
; ++i
)
42 if (i
<= static_cast<int>(_names
.size()))
43 _names
.push_back("Unnamed workspace");
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!
81 void OBRootWindow::setDesktopName(int i
, const std::string
&name
)
83 const int numWorkspaces
= 1; // XXX: change this to the number of workspaces!
85 assert(i
< numWorkspaces
);
87 const otk::OBProperty
*property
= Openbox::instance
->property();
89 otk::OBProperty::StringVect newnames
= _names
;
91 property
->set(_info
->rootWindow(), otk::OBProperty::net_desktop_names
,
92 otk::OBProperty::utf8
, newnames
);
96 void OBRootWindow::mapRequestHandler(const XMapRequestEvent
&e
)
99 printf("MapRequest for 0x%lx\n", e
.window
);
102 OBClient
*client
= Openbox::instance
->findClient(e
.window
);
105 // XXX: uniconify and/or unshade the window
107 Openbox::instance
->screen(_info
->screen())->manageWindow(e
.window
);
This page took 0.042121 seconds and 4 git commands to generate.