]>
Dogcows Code - chaz/openbox/blob - src/rootwindow.cc
a028ac81183b8ea8904e64d4a6ca3199e0973ba6
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 : _info(otk::OBDisplay::screenInfo(screen
))
19 Openbox::instance
->registerHandler(_info
->getRootWindow(), this);
23 OBRootWindow::~OBRootWindow()
28 void OBRootWindow::updateDesktopNames()
30 const int numWorkspaces
= 1; // XXX: change this to the number of workspaces!
32 const otk::OBProperty
*property
= Openbox::instance
->property();
34 unsigned long num
= (unsigned) -1;
36 if (!property
->get(_info
->getRootWindow(),
37 otk::OBProperty::net_desktop_names
,
38 otk::OBProperty::utf8
, &num
, &_names
))
40 for (int i
= 0; i
< numWorkspaces
; ++i
)
41 if (i
<= static_cast<int>(_names
.size()))
42 _names
.push_back("Unnamed workspace");
46 void OBRootWindow::propertyHandler(const XPropertyEvent
&e
)
48 otk::OtkEventHandler::propertyHandler(e
);
50 const otk::OBProperty
*property
= Openbox::instance
->property();
52 // compress changes to a single property into a single change
54 while (XCheckTypedEvent(otk::OBDisplay::display
, e
.type
, &ce
)) {
55 // XXX: it would be nice to compress ALL changes to a property, not just
56 // changes in a row without other props between.
57 if (ce
.xproperty
.atom
!= e
.atom
) {
58 XPutBackEvent(otk::OBDisplay::display
, &ce
);
63 if (e
.atom
== property
->atom(otk::OBProperty::net_desktop_names
))
68 void OBRootWindow::clientMessageHandler(const XClientMessageEvent
&e
)
70 otk::OtkEventHandler::clientMessageHandler(e
);
72 if (e
.format
!= 32) return;
74 //const otk::OBProperty *property = Openbox::instance->property();
76 // XXX: so many client messages to handle here!
80 void OBRootWindow::setDesktopName(int i
, const std::string
&name
)
82 const int numWorkspaces
= 1; // XXX: change this to the number of workspaces!
84 assert(i
< numWorkspaces
);
86 const otk::OBProperty
*property
= Openbox::instance
->property();
88 otk::OBProperty::StringVect newnames
= _names
;
90 property
->set(_info
->getRootWindow(), otk::OBProperty::net_desktop_names
,
91 otk::OBProperty::utf8
, newnames
);
95 void OBRootWindow::mapRequestHandler(const XMapRequestEvent
&e
)
98 printf("MapRequest for 0x%lx\n", e
.window
);
101 OBClient
*client
= Openbox::instance
->findClient(e
.window
);
103 printf("Client: %lx\n", client
);
106 printf("found client\n");
107 // XXX: uniconify and/or unshade the window
109 Openbox::instance
->screen(_info
->getScreenNumber())->
110 manageWindow(e
.window
);
116 void OBRootWindow::configureRequestHandler(const XConfigureRequestEvent
&e
)
118 OtkEventHandler::configureRequestHandler(e
);
120 // when configure requests come to the root window, just pass them on
126 xwc
.height
= e
.height
;
127 xwc
.border_width
= e
.border_width
;
128 xwc
.sibling
= e
.above
;
129 xwc
.stack_mode
= e
.detail
;
131 XConfigureWindow(otk::OBDisplay::display
, e
.window
,
This page took 0.041907 seconds and 4 git commands to generate.