From 1aa5ede1b70dfba6519eeaa38101948bbdfea8a2 Mon Sep 17 00:00:00 2001
From: fluxgen <fluxgen>
Date: Tue, 15 Apr 2003 00:17:59 +0000
Subject: fixed client count bug

---
 src/Ewmh.cc  | 29 +++++++++++++++++++++--------
 src/Gnome.cc | 31 +++++++++++++++++++++++--------
 2 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index c17bd92..92c6dbd 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -19,7 +19,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: Ewmh.cc,v 1.15 2003/04/14 12:11:21 fluxgen Exp $
+// $Id: Ewmh.cc,v 1.16 2003/04/15 00:14:24 fluxgen Exp $
 
 #include "Ewmh.hh" 
 
@@ -128,10 +128,19 @@ void Ewmh::setupWindow(FluxboxWindow &win) {
 void Ewmh::updateClientList(BScreen &screen) {
     size_t num=0;
 
-    BScreen::Workspaces::const_iterator workspace_it = screen.getWorkspacesList().begin();
-    BScreen::Workspaces::const_iterator workspace_it_end = screen.getWorkspacesList().end();
+    BScreen::Workspaces::const_iterator workspace_it = 
+        screen.getWorkspacesList().begin();
+    BScreen::Workspaces::const_iterator workspace_it_end = 
+        screen.getWorkspacesList().end();
     for (; workspace_it != workspace_it_end; ++workspace_it) {
-        num += (*workspace_it)->getWindowList().size();
+        Workspace::Windows::iterator win_it = 
+            (*workspace_it)->getWindowList().begin();
+        Workspace::Windows::iterator win_it_end = 
+            (*workspace_it)->getWindowList().end();
+        for (; win_it != win_it_end; ++win_it) {
+            num += (*win_it)->numClients();
+        }
+
     }
     //int num = getCurrentWorkspace()->getWindowList().size();
 	
@@ -146,15 +155,19 @@ void Ewmh::updateClientList(BScreen &screen) {
     for (; workspace_it != workspace_it_end; ++workspace_it) {
 	
         // Fill in array of window ID's
-        Workspace::Windows::const_iterator it = (*workspace_it)->getWindowList().begin();
-        Workspace::Windows::const_iterator it_end = (*workspace_it)->getWindowList().end();		
+        Workspace::Windows::const_iterator it = 
+            (*workspace_it)->getWindowList().begin();
+        Workspace::Windows::const_iterator it_end = 
+            (*workspace_it)->getWindowList().end();		
         for (; it != it_end; ++it) {
             if ((*it)->numClients() == 1)
                 wl[win++] = (*it)->getClientWindow();
             else {
                 // add every client in fluxboxwindow to list window list
-                std::list<WinClient *>::iterator client_it = (*it)->clientList().begin();
-                std::list<WinClient *>::iterator client_it_end = (*it)->clientList().end();
+                std::list<WinClient *>::iterator client_it = 
+                    (*it)->clientList().begin();
+                std::list<WinClient *>::iterator client_it_end = 
+                    (*it)->clientList().end();
                 for (; client_it != client_it_end; ++client_it)
                     wl[win++] = (*client_it)->window();
             }
diff --git a/src/Gnome.cc b/src/Gnome.cc
index c35c6b8..717cc60 100644
--- a/src/Gnome.cc
+++ b/src/Gnome.cc
@@ -19,13 +19,14 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: Gnome.cc,v 1.15 2003/04/14 12:11:59 fluxgen Exp $
+// $Id: Gnome.cc,v 1.16 2003/04/15 00:17:59 fluxgen Exp $
 
 #include "Gnome.hh"
 
 #include "fluxbox.hh"
 #include "Window.hh"
 #include "Screen.hh"
+#include "WinClient.hh"
 
 #include <iostream>
 #include <new>
@@ -125,10 +126,17 @@ void Gnome::setupWindow(FluxboxWindow &win) {
 void Gnome::updateClientList(BScreen &screen) {
     size_t num=0;
 
-    BScreen::Workspaces::const_iterator workspace_it = screen.getWorkspacesList().begin();
-    BScreen::Workspaces::const_iterator workspace_it_end = screen.getWorkspacesList().end();
+    BScreen::Workspaces::const_iterator workspace_it = 
+        screen.getWorkspacesList().begin();
+    BScreen::Workspaces::const_iterator workspace_it_end = 
+        screen.getWorkspacesList().end();
     for (; workspace_it != workspace_it_end; ++workspace_it) {
-        num += (*workspace_it)->getWindowList().size();
+        Workspace::Windows::iterator win_it = 
+            (*workspace_it)->getWindowList().begin();
+        Workspace::Windows::iterator win_it_end = 
+            (*workspace_it)->getWindowList().end();
+        for (; win_it != win_it_end; ++win_it)
+            num += (*win_it)->numClients();
     }
     //int num = getCurrentWorkspace()->getWindowList().size();
 	
@@ -143,14 +151,21 @@ void Gnome::updateClientList(BScreen &screen) {
     for (; workspace_it != workspace_it_end; ++workspace_it) {
 	
         // Fill in array of window ID's
-        Workspace::Windows::const_iterator it = (*workspace_it)->getWindowList().begin();
-        Workspace::Windows::const_iterator it_end = (*workspace_it)->getWindowList().end();		
+        Workspace::Windows::const_iterator it = 
+            (*workspace_it)->getWindowList().begin();
+        Workspace::Windows::const_iterator it_end = 
+            (*workspace_it)->getWindowList().end();		
         for (; it != it_end; ++it) {
             // TODO!
             //check if the window don't want to be visible in the list
             //if (! ( (*it)->getGnomeHints() & WIN_STATE_HIDDEN) ) {
-            wl[win++] = (*it)->getClientWindow();
-            //}
+            std::list<WinClient *>::iterator client_it = 
+                (*it)->clientList().begin();
+            std::list<WinClient *>::iterator client_it_end = 
+                (*it)->clientList().end();
+            for (; client_it != client_it_end; ++client_it)
+                wl[win++] = (*client_it)->window();
+
         }
     }
     //number of windows to show in client list
-- 
cgit v0.11.2