#if defined(SHAPE) || defined(DOXYGEN_IGNORE)
//! Called when a shape extention event fires
- virtual void shapeHandler(const XShapeEvent &) {};
+ virtual void shapeHandler(const XShapeEvent &) {}
#endif // SHAPE
virtual ~OtkEventHandler();
openbox3_LDADD=../otk/libotk.a @LIBINTL@
openbox3_SOURCES= client.cc frame.cc openbox.cc screen.cc \
- main.cc xeventhandler.cc
+ main.cc
MAINTAINERCLEANFILES= Makefile.in
namespace ob {
OBClient::OBClient(int screen, Window window)
- : _screen(screen), _window(window)
+ : otk::OtkEventHandler(),
+ _screen(screen), _window(window)
{
+ assert(screen >= 0);
assert(window);
+ Openbox::instance->registerHandler(_window, this);
+
ignore_unmaps = 0;
// update EVERYTHING the first time!!
}
-void OBClient::update(const XPropertyEvent &e)
+void OBClient::propertyHandler(const XPropertyEvent &e)
{
+ otk::OtkEventHandler::propertyHandler(e);
+
const otk::OBProperty *property = Openbox::instance->property();
if (e.atom == XA_WM_NORMAL_HINTS)
}
-void OBClient::update(const XClientMessageEvent &e)
+void OBClient::clientMessageHandler(const XClientMessageEvent &e)
{
+ otk::OtkEventHandler::clientMessageHandler(e);
+
if (e.format != 32) return;
const otk::OBProperty *property = Openbox::instance->property();
#if defined(SHAPE) || defined(DOXYGEN_IGNORE)
-void OBClient::update(const XShapeEvent &e)
+void OBClient::shapeHandler(const XShapeEvent &e)
{
+ otk::OtkEventHandler::shapeHandler(e);
+
_shaped = e.shaped;
}
#endif
#include "otk/strut.hh"
#include "otk/rect.hh"
+#include "otk/eventhandler.hh"
namespace ob {
class' member variables and call whatever is nessary to complete the
change (such as causing a redraw of the titlebar after the title is changed).
*/
-class OBClient {
+class OBClient : public otk::OtkEventHandler {
public:
//! The frame window which decorates around the client window
//! Returns the position and size of the client relative to the root window
inline const otk::Rect &area() const { return _area; }
- //! Updates the OBClient class from a property change XEvent
- void update(const XPropertyEvent &e);
- //! Processes a client message XEvent for the window and causes an action
- //! or whatever was specified to occur
- void update(const XClientMessageEvent &e);
-#if defined(SHAPE) || defined(DOXYGEN_IGNORE)
- //! Updates the client's shape status
- void update(const XShapeEvent &e);
-#endif
+ virtual void propertyHandler(const XPropertyEvent &);
+ virtual void clientMessageHandler(const XClientMessageEvent &);
+
+ virtual void shapeHandler(const XShapeEvent &);
+
//! Changes the stored positions and size of the OBClient window
/*!
This does not actually change the physical geometry, that needs to be done
_property = new otk::OBProperty();
+ // set this class as the fallback event handler (for map events)
+ setFallbackHandler(this);
+
// create the mouse cursors we'll use
_cursors.session = XCreateFontCursor(otk::OBDisplay::display, XC_left_ptr);
_cursors.move = XCreateFontCursor(otk::OBDisplay::display, XC_fleur);
return (OBClient*) 0;
}
+
+void Openbox::mapRequestHandler(const XMapRequestEvent &e)
+{
+#ifdef DEBUG
+ printf("MapRequest for 0x%lx\n", e.window);
+#endif // DEBUG
+
+ otk::OtkEventHandler::mapRequestHandler(e);
+
+ OBClient *client = findClient(e.window);
+
+ if (client) {
+ // XXX: uniconify and/or unshade the window
+ } else {
+ int screen = INT_MAX;
+
+ for (int i = 0; i < ScreenCount(otk::OBDisplay::display); ++i)
+ if (otk::OBDisplay::screenInfo(i)->getRootWindow() == e.parent) {
+ screen = i;
+ break;
+ }
+
+ if (screen >= ScreenCount(otk::OBDisplay::display)) {
+ /*
+ we got a map request for a window who's parent isn't root. this
+ can happen in only one circumstance:
+
+ a client window unmapped a managed window, and then remapped it
+ somewhere between unmapping the client window and reparenting it
+ to root.
+
+ regardless of how it happens, we need to find the screen that
+ the window is on
+ */
+ XWindowAttributes wattrib;
+ if (! XGetWindowAttributes(otk::OBDisplay::display, e.window,
+ &wattrib)) {
+ // failed to get the window attributes, perhaps the window has
+ // now been destroyed?
+ return;
+ }
+
+ for (int i = 0; i < ScreenCount(otk::OBDisplay::display); ++i)
+ if (otk::OBDisplay::screenInfo(i)->getRootWindow() == wattrib.root) {
+ screen = i;
+ break;
+ }
+ }
+
+ assert(screen < static_cast<int>(_screens.size()));
+ _screens[screen]->manageWindow(e.window);
+ }
+}
+
}
manager can be destroyed.
*/
inline void shutdown() { _doshutdown = true; }
+
+ virtual void mapRequestHandler(const XMapRequestEvent &);
};
}