]> Dogcows Code - chaz/openbox/commitdiff
more user friendly net_showing_desktop support
authorDana Jansens <danakj@orodu.net>
Mon, 10 Feb 2003 22:17:40 +0000 (22:17 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 10 Feb 2003 22:17:40 +0000 (22:17 +0000)
src/client.cc
src/screen.cc
src/screen.hh
wrap/ob.i

index 453bf745602144a4cd989c2e1e94cc0700935bb4..33e11ce07e1e596621acb3c61fe5070e8feabc38 100644 (file)
@@ -1017,15 +1017,23 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
 #ifdef DEBUG
     printf("net_active_window for 0x%lx\n", _window);
 #endif
+    if (openbox->screen(_screen)->showingDesktop())
+      openbox->screen(_screen)->showDesktop(false);
     if (_iconic)
       iconify(false);
+    else if (!frame->visible()) // if its not visible for other reasons, then
+      return;                   // don't mess with it
     if (_shaded)
       shade(false);
     focus();
     openbox->screen(_screen)->raiseWindow(this);
   } else if (e.message_type == otk::Property::atoms.openbox_active_window) {
+    if (openbox->screen(_screen)->showingDesktop())
+      openbox->screen(_screen)->showDesktop(false);
     if (_iconic)
       iconify(false);
+    else if (!frame->visible()) // if its not visible for other reasons, then
+      return;                   // don't mess with it
     if (e.data.l[0] && _shaded)
       shade(false);
     focus();
@@ -1553,6 +1561,10 @@ void Client::iconify(bool iconic, bool curdesk)
 {
   if (_iconic == iconic) return; // nothing to do
 
+#ifdef DEBUG
+    printf("%sconifying window: 0x%lx\n", (iconic ? "I" : "Uni"), _window);
+#endif
+
   _iconic = iconic;
 
   if (_iconic) {
index d242e8876173a7444297301a58a0fa8faab03488..3461178d6c3d80ac616af0778c63e3b6ff870da9 100644 (file)
@@ -889,15 +889,10 @@ void Screen::showDesktop(bool show)
   if (show) {
     Client *c = openbox->focusedClient();
     if (c) saved_focus = c->window();
-  } else {
-    Client *f = openbox->focusedClient();
-    if (!f || f->type() == Client::Type_Desktop) {
-      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) {
     if ((*it)->type() == Client::Type_Desktop) {
@@ -906,6 +901,19 @@ void Screen::showDesktop(bool show)
     } else
       (*it)->showhide();
   }
+
+  if (!show) {
+    Client *f = openbox->focusedClient();
+    if (!f || f->type() == Client::Type_Desktop) {
+      Client *c = openbox->findClient(saved_focus);
+      if (c) c->focus();
+    }
+  }
+
+  otk::Property::set(_info->rootWindow(),
+                     otk::Property::atoms.net_showing_desktop,
+                     otk::Property::atoms.cardinal,
+                     show ? 1 : 0);
 }
 
 void Screen::propertyHandler(const XPropertyEvent &e)
index e8306933042c5e38855a8c039c1ddff05dac2369..55518fc93a2860312940ec6b6b5c026badbca092 100644 (file)
@@ -143,10 +143,6 @@ private:
   */
   void changeNumDesktops(unsigned int num);
 
-  //! Shows and focuses the desktop and hides all the client windows, or
-  //! returns to the normal state, showing client windows.
-  void showDesktop(bool show);
-
 public:
 #ifndef SWIG
   //! Constructs a new Screen object
@@ -182,6 +178,10 @@ public:
 
   const DesktopLayout& desktopLayout() const { return _layout; }
 
+  //! Shows and focuses the desktop and hides all the client windows, or
+  //! returns to the normal state, showing client windows.
+  void showDesktop(bool show);
+
   //! Update's the screen's combined strut of all the clients.
   /*!
     Clients should call this whenever they change their strut.
index 0ba9a90e75be4a6da8ad2ecce6ac0d5ed72ab7c0..7e95f6024ae024d867e01d273eadba684920a54d 100644 (file)
--- a/wrap/ob.i
+++ b/wrap/ob.i
@@ -45,6 +45,9 @@
   }
 };
 
+// do this through events
+%ignore ob::Screen::showDesktop(bool);
+
 %import "otk.i"
 
 %import "actions.hh"
This page took 0.030929 seconds and 4 git commands to generate.