]> Dogcows Code - chaz/openbox/commitdiff
focus the desktop when entering show-desktop-mode, and refocus what was focused befor...
authorDana Jansens <danakj@orodu.net>
Mon, 10 Feb 2003 17:00:34 +0000 (17:00 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 10 Feb 2003 17:00:34 +0000 (17:00 +0000)
src/screen.cc

index 3a064560f72dc1aba2961ea61271ecc6c6a5f7c4..75d8e87ea06daf323a4bcc01f876a5fe484ea7a1 100644 (file)
@@ -884,10 +884,25 @@ void Screen::showDesktop(bool show)
 {
   if (show == _showing_desktop) return; // no change
 
+  // save the window focus, and restore it when leaving the show-desktop mode
+  static Window saved_focus = 0;
+  if (show) {
+    Client *c = openbox->focusedClient();
+    if (c) saved_focus = c->window();
+  } else {
+    Client *c = openbox->findClient(saved_focus);
+    if (c) c->focus();
+  }
+  
   _showing_desktop = show;
   ClientList::iterator it, end = clients.end();
-  for (it = clients.begin(); it != end; ++it)
-    (*it)->showhide();
+  for (it = clients.begin(); it != end; ++it) {
+    if ((*it)->type() == Client::Type_Desktop) {
+      if (show)
+        (*it)->focus();
+    } else
+      (*it)->showhide();
+  }
 }
 
 void Screen::propertyHandler(const XPropertyEvent &e)
This page took 0.02692 seconds and 4 git commands to generate.