From: Dana Jansens Date: Wed, 4 Dec 2002 01:04:31 +0000 (+0000) Subject: unmap works.. once X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;ds=sidebyside;h=9860b76c50e5ecacc85921539058eab4c655c38d;p=chaz%2Fopenbox unmap works.. once --- diff --git a/src/client.cc b/src/client.cc index 0fd5787b..4fc8ef97 100644 --- a/src/client.cc +++ b/src/client.cc @@ -6,6 +6,7 @@ #include "client.hh" #include "frame.hh" +#include "screen.hh" #include "bbscreen.hh" #include "openbox.hh" #include "otk/display.hh" @@ -30,8 +31,6 @@ OBClient::OBClient(int screen, Window window) assert(screen >= 0); assert(window); - Openbox::instance->registerHandler(_window, this); - ignore_unmaps = 0; // update EVERYTHING the first time!! @@ -772,6 +771,8 @@ void OBClient::move(int x, int y) 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) @@ -825,4 +826,30 @@ void OBClient::configureRequestHandler(const XConfigureRequestEvent &e) } +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); +} + + } diff --git a/src/client.hh b/src/client.hh index 9c0bd7d4..e07ce12d 100644 --- a/src/client.hh +++ b/src/client.hh @@ -130,7 +130,8 @@ public: }; //! 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 @@ public: 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); }; } diff --git a/src/frame.cc b/src/frame.cc index 725a4306..6107d779 100644 --- a/src/frame.cc +++ b/src/frame.cc @@ -354,16 +354,15 @@ void OBFrame::adjustShape() 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()); diff --git a/src/frame.hh b/src/frame.hh index 500dcb4a..e1647a99 100644 --- a/src/frame.hh +++ b/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: diff --git a/src/rootwindow.cc b/src/rootwindow.cc index bc62fdc5..ff8a644f 100644 --- a/src/rootwindow.cc +++ b/src/rootwindow.cc @@ -112,6 +112,8 @@ void OBRootWindow::mapRequestHandler(const XMapRequestEvent &e) #include void OBRootWindow::configureRequestHandler(const XConfigureRequestEvent &e) { + OtkEventHandler::configureRequestHandler(e); + // when configure requests come to the root window, just pass them on XWindowChanges xwc; diff --git a/src/rootwindow.hh b/src/rootwindow.hh index 1dbfc04a..35cda699 100644 --- a/src/rootwindow.hh +++ b/src/rootwindow.hh @@ -52,20 +52,17 @@ public: //! 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); }; } diff --git a/src/screen.cc b/src/screen.cc index 3c6731c2..01abd83c 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -350,6 +350,8 @@ void OBScreen::manageWindow(Window window) // 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 @@ void OBScreen::unmanageWindow(OBClient *client) 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);