]> Dogcows Code - chaz/openbox/commitdiff
unmap works.. once
authorDana Jansens <danakj@orodu.net>
Wed, 4 Dec 2002 01:04:31 +0000 (01:04 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 4 Dec 2002 01:04:31 +0000 (01:04 +0000)
src/client.cc
src/client.hh
src/frame.cc
src/frame.hh
src/rootwindow.cc
src/rootwindow.hh
src/screen.cc

index 0fd5787b8669be2c2b92a88532731108089ccc4e..4fc8ef976d6bd1217f37001c3ec69cb29cebe8b7 100644 (file)
@@ -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);
+}
+
+
 }
index 9c0bd7d4402272bdb2b0523d18cbd11f9c033285..e07ce12df32c1e955f2075abdf1ad99641730944 100644 (file)
@@ -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);
 };
 
 }
index 725a430614d1e7979266fa643de71a2758989c2e..6107d779a7e4768107edc8970c1c954d6433bc8b 100644 (file)
@@ -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());
 
index 500dcb4a0ce3c227d202b8b5c874a1691edb3ec7..e1647a991e2e7243722d5d2a61617ecb764ef56b 100644 (file)
@@ -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:
index bc62fdc55dbfdc9999f26b0deccacba8d9b47acf..ff8a644fa648d4eb732273ae3b04d04ea5654761 100644 (file)
@@ -112,6 +112,8 @@ void OBRootWindow::mapRequestHandler(const XMapRequestEvent &e)
 #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;
 
index 1dbfc04a7aefdbc472591d8debfc01980c701ece..35cda699cae79de10e9b80d1748e0fcfe08bfc80 100644 (file)
@@ -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);
 };
 
 }
index 3c6731c2c940ad5732bbd241bc88352922219d77..01abd83c0c341a7f7deadf026bd7db5cda8d7d4b 100644 (file)
@@ -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);
This page took 0.035086 seconds and 4 git commands to generate.