#include "client.hh"
#include "frame.hh"
+#include "screen.hh"
#include "bbscreen.hh"
#include "openbox.hh"
#include "otk/display.hh"
assert(screen >= 0);
assert(window);
- Openbox::instance->registerHandler(_window, this);
-
ignore_unmaps = 0;
// update EVERYTHING the first time!!
void OBClient::configureRequestHandler(const XConfigureRequestEvent &e)
{
+ OtkEventHandler::configureRequestHandler(e);
+
// XXX: if we are iconic (or shaded? (fvwm does that)) ignore the event
if (e.value_mask & CWBorderWidth)
}
+void OBClient::unmapHandler(const XUnmapEvent &e)
+{
+#ifdef DEBUG
+ printf("UnmapNotify for 0x%lx\n", e.window);
+#endif // DEBUG
+
+ OtkEventHandler::unmapHandler(e);
+
+ // this deletes us etc
+ Openbox::instance->screen(_screen)->unmanageWindow(this);
+}
+
+
+void OBClient::destroyHandler(const XDestroyWindowEvent &e)
+{
+#ifdef DEBUG
+ printf("DestroyNotify for 0x%lx\n", e.window);
+#endif // DEBUG
+
+ OtkEventHandler::destroyHandler(e);
+
+ // this deletes us etc
+ Openbox::instance->screen(_screen)->unmanageWindow(this);
+}
+
+
}
};
//! The event mask to grab on client windows
- static const long event_mask = PropertyChangeMask | FocusChangeMask;
+ static const long event_mask = PropertyChangeMask | FocusChangeMask |
+ StructureNotifyMask;
//! The number of unmap events to ignore on the window
int ignore_unmaps;
inline const otk::Rect &area() const { return _area; }
virtual void propertyHandler(const XPropertyEvent &e);
-
virtual void clientMessageHandler(const XClientMessageEvent &e);
-
virtual void shapeHandler(const XShapeEvent &e);
-
virtual void configureRequestHandler(const XConfigureRequestEvent &e);
+ virtual void unmapHandler(const XUnmapEvent &e);
+ virtual void destroyHandler(const XDestroyWindowEvent &e);
};
}
void OBFrame::grabClient()
{
- // select the event mask on the frame
- //XSelectInput(otk::OBDisplay::display, _window, SubstructureRedirectMask);
-
// reparent the client to the frame
XReparentWindow(otk::OBDisplay::display, _client->window(),
_plate.getWindow(), 0, 0);
_client->ignore_unmaps++;
- // raise the client above the frame
- //XRaiseWindow(otk::OBDisplay::display, _client->window());
+ // select the event mask on the client's parent
+ //XSelectInput(otk::OBDisplay::display, _plate.getWindow(),
+ // SubstructureRedirectMask);
+
// map the client so it maps when the frame does
XMapWindow(otk::OBDisplay::display, _client->window());
//! Holds and decorates a frame around an OBClient (client window)
/*!
+ The frame is responsible for calling XSelectInput on the client window's new
+ parent with the SubstructureRedirectMask so that structure events for the
+ client are sent to the window manager.
*/
class OBFrame : public otk::OtkWidget {
private:
#include <stdio.h>
void OBRootWindow::configureRequestHandler(const XConfigureRequestEvent &e)
{
+ OtkEventHandler::configureRequestHandler(e);
+
// when configure requests come to the root window, just pass them on
XWindowChanges xwc;
//! Destroys the OBRootWindow object
virtual ~OBRootWindow();
- virtual void propertyHandler(const XPropertyEvent &e);
-
- virtual void clientMessageHandler(const XClientMessageEvent &e);
-
- virtual void mapRequestHandler(const XMapRequestEvent &);
-
- virtual void configureRequestHandler(const XConfigureRequestEvent &e);
-
//! Sets the name of a desktop
/*!
@param i The index of the desktop to set the name for (base 0)
@param name The name to set for the desktop
*/
void setDesktopName(int i, const std::string &name);
+
+ virtual void propertyHandler(const XPropertyEvent &e);
+ virtual void clientMessageHandler(const XClientMessageEvent &e);
+ virtual void mapRequestHandler(const XMapRequestEvent &);
+ virtual void configureRequestHandler(const XConfigureRequestEvent &e);
};
}
// create the OBClient class, which gets all of the hints on the window
Openbox::instance->addClient(window, client = new OBClient(_number, window));
+ // register for events
+ Openbox::instance->registerHandler(window, client);
// we dont want a border on the client
XSetWindowBorderWidth(otk::OBDisplay::display, window, 0);
OBFrame *frame = client->frame;
// XXX: pass around focus if this window was focused
+
+ // unregister for handling events
+ Openbox::instance->clearHandler(client->window());
// remove the window from our save set
XChangeSaveSet(otk::OBDisplay::display, client->window(), SetModeDelete);