]> Dogcows Code - chaz/openbox/blobdiff - src/screen.cc
use client messages to switch desktops/move windows between desktops
[chaz/openbox] / src / screen.cc
index 657705565893fa6c0e89bdb3dcb524ef2e405993..49d63409b23de7a7240304414efd9a88107e5d44 100644 (file)
@@ -138,6 +138,11 @@ OBScreen::OBScreen(int screen)
 
   // register this class as the event handler for the root window
   Openbox::instance->registerHandler(_info->rootWindow(), this);
+
+  // call the python Startup callbacks
+  EventData *data = new_event_data(_number, 0, EventShutdown, 0);
+  Openbox::instance->bindings()->fireEvent(data);
+  Py_XDECREF((PyObject*)data);
 }
 
 
@@ -151,6 +156,11 @@ OBScreen::~OBScreen()
   while (!clients.empty())
     unmanageWindow(clients.front());
 
+  // call the python Shutdown callbacks
+  EventData *data = new_event_data(_number, 0, EventShutdown, 0);
+  Openbox::instance->bindings()->fireEvent(data);
+  Py_XDECREF((PyObject*)data);
+
   XDestroyWindow(otk::OBDisplay::display, _focuswindow);
   XDestroyWindow(otk::OBDisplay::display, _supportwindow);
 
@@ -554,19 +564,9 @@ void OBScreen::unmanageWindow(OBClient *client)
 
   // remove from the stacking order
   _stacking.remove(client);
-  
-  // pass around focus if this window was focused XXX do this better!
-  if (Openbox::instance->focusedClient() == client) {
-    OBClient *newfocus = 0;
-    OBClient::List::iterator it, end = _stacking.end();
-    for (it = _stacking.begin(); it != end; ++it)
-      if ((*it)->desktop() == _desktop && (*it)->normal() && (*it)->focus()) {
-        newfocus = *it;
-        break;
-      }
-    if (!newfocus)
-      client->unfocus();
-  }
+
+  // unfocus the client
+  client->unfocus();
 
   // remove from the wm's map
   Openbox::instance->removeClient(client->window());
@@ -659,6 +659,10 @@ void OBScreen::changeDesktop(long desktop)
       (*it)->frame->show();
     }
   }
+
+  // if nothing is focused, force the callbacks to fire
+//  if (!Openbox::instance->focusedClient())
+//    Openbox::instance->setFocusedClient(0);
 }
 
 void OBScreen::changeNumDesktops(long num)
This page took 0.0264 seconds and 4 git commands to generate.