unmap works.. once
Dana Jansens danakj@orodu.net
7 files changed,
52 insertions(+),
19 deletions(-)
M
src/client.cc
→
src/client.cc
@@ -6,6 +6,7 @@ #endif
#include "client.hh" #include "frame.hh" +#include "screen.hh" #include "bbscreen.hh" #include "openbox.hh" #include "otk/display.hh"@@ -29,8 +30,6 @@ _screen(screen), _window(window)
{ assert(screen >= 0); assert(window); - - Openbox::instance->registerHandler(_window, this); ignore_unmaps = 0;@@ -772,6 +771,8 @@
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)@@ -822,6 +823,32 @@ // XXX: raise the window
break; } } +} + + +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); }
M
src/client.hh
→
src/client.hh
@@ -130,7 +130,8 @@ State_Toggle //!< _NET_WM_STATE_TOGGLE
}; //! 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;@@ -415,12 +416,11 @@ //! Returns the position and size of the client relative to the root window
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); }; }
M
src/frame.cc
→
src/frame.cc
@@ -354,16 +354,15 @@
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());
M
src/frame.hh
→
src/frame.hh
@@ -25,6 +25,9 @@ namespace ob {
//! 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:
M
src/rootwindow.cc
→
src/rootwindow.cc
@@ -112,6 +112,8 @@
#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;
M
src/rootwindow.hh
→
src/rootwindow.hh
@@ -52,20 +52,17 @@ OBRootWindow(int screen);
//! 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); }; }
M
src/screen.cc
→
src/screen.cc
@@ -350,6 +350,8 @@ CWEventMask|CWDontPropagate, &attrib_set);
// 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);@@ -384,6 +386,9 @@ {
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);