]> Dogcows Code - chaz/openbox/blobdiff - src/screen.cc
supply python routines for next/prev workspace
[chaz/openbox] / src / screen.cc
index 896f38081d15756f85a55fdeef1d16ab52a84a2e..657705565893fa6c0e89bdb3dcb524ef2e405993 100644 (file)
@@ -502,9 +502,14 @@ void OBScreen::manageWindow(Window window)
   Openbox::instance->addClient(client->frame->grip_left(), client);
   Openbox::instance->addClient(client->frame->grip_right(), client);
 
+  bool shown = false;
+  
   // if on the current desktop.. (or all desktops)
-  if (client->desktop() == _desktop || client->desktop() == (signed)0xffffffff)
+  if (client->desktop() == _desktop ||
+      client->desktop() == (signed)0xffffffff) {
+    shown = true;
     client->frame->show();
+  }
  
   // XXX: handle any requested states such as maximized
 
@@ -520,12 +525,14 @@ void OBScreen::manageWindow(Window window)
 
   Openbox::instance->bindings()->grabButtons(true, client);
 
-  // XXX: make this optional or more intelligent
-  if (client->normal())
-    client->focus();
+  if (shown) {
+    // XXX: make this optional or more intelligent
+    if (client->normal())
+      client->focus();
+  }
 
   // call the python NEWWINDOW binding
-  EventData *data = new_event_data(window, EventNewWindow, 0);
+  EventData *data = new_event_data(_number, window, EventNewWindow, 0);
   Openbox::instance->bindings()->fireEvent(data);
   Py_DECREF((PyObject*)data);
 
@@ -538,7 +545,8 @@ void OBScreen::unmanageWindow(OBClient *client)
   OBFrame *frame = client->frame;
 
   // call the python CLOSEWINDOW binding 
-  EventData *data = new_event_data(client->window(), EventCloseWindow, 0);
+  EventData *data = new_event_data(_number, client->window(),
+                                   EventCloseWindow, 0);
   Openbox::instance->bindings()->fireEvent(data);
   Py_DECREF((PyObject*)data);
 
@@ -552,7 +560,7 @@ void OBScreen::unmanageWindow(OBClient *client)
     OBClient *newfocus = 0;
     OBClient::List::iterator it, end = _stacking.end();
     for (it = _stacking.begin(); it != end; ++it)
-      if ((*it)->normal() && (*it)->focus()) {
+      if ((*it)->desktop() == _desktop && (*it)->normal() && (*it)->focus()) {
         newfocus = *it;
         break;
       }
@@ -631,6 +639,8 @@ void OBScreen::changeDesktop(long desktop)
 
   if (!(desktop >= 0 && desktop < _num_desktops)) return;
 
+  printf("Moving to desktop %ld\n", desktop);
+  
   long old = _desktop;
   
   _desktop = desktop;
@@ -639,6 +649,8 @@ void OBScreen::changeDesktop(long desktop)
                                      otk::OBProperty::Atom_Cardinal,
                                      _desktop);
 
+  if (old == _desktop) return;
+  
   OBClient::List::iterator it, end = clients.end();
   for (it = clients.begin(); it != end; ++it) {
     if ((*it)->desktop() == old) {
@@ -655,6 +667,8 @@ void OBScreen::changeNumDesktops(long num)
   
   if (!(num > 0)) return;
 
+  // XXX: move windows on desktops that will no longer exist!
+  
   _num_desktops = num;
   Openbox::instance->property()->set(_info->rootWindow(),
                                      otk::OBProperty::net_number_of_desktops,
This page took 0.021588 seconds and 4 git commands to generate.