From 206a7ca10d0747acaab1f00975ff519badf61600 Mon Sep 17 00:00:00 2001
From: rathnor <rathnor>
Date: Sun, 7 Mar 2004 23:37:39 +0000
Subject: fix _NET_WM_DESKTOP client message handling

---
 ChangeLog   |  4 ++++
 src/Ewmh.cc | 31 +++++++++++++++++++++++--------
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7252d32..89f5938 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 (Format: Year/Month/Day)
 Changes for 0.9.9:
+*04/03/08:
+  * Fix receipt of _NET_WM_DESKTOP client messages (Simon)
+    - fixes xmms "show on all desktops" not working
+    Ewmh.cc
 *04/03/03:
   * Fix update of keys on keymap change (Simon)
     fluxbox.cc
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 7f23302..64583cc 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.44 2004/02/20 09:05:38 fluxgen Exp $
+// $Id: Ewmh.cc,v 1.45 2004/03/07 23:37:39 rathnor Exp $
 
 #include "Ewmh.hh" 
 
@@ -498,15 +498,30 @@ void Ewmh::updateWorkspace(FluxboxWindow &win) {
 bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, 
                               BScreen * screen, WinClient * const winclient) {
     if (ce.message_type == m_net_wm_desktop) {
-        if (screen == 0)
-            return true;
         // ce.data.l[0] = workspace number
-        // valid window and workspace number?
-        if (winclient == 0 || winclient->fbwindow() == 0 ||
-            static_cast<unsigned int>(ce.data.l[0]) >= screen->getCount())
+        // valid window
+
+        if (winclient == 0 || winclient->fbwindow() == 0)
             return true;
-		
-        screen->sendToWorkspace(ce.data.l[0], winclient->fbwindow(), false);		
+
+        FluxboxWindow *fbwin = winclient->fbwindow();
+
+        // if it's stick, make sure it is stuck.
+        // otherwise, make sure it isn't stuck
+        if (ce.data.l[0] == 0xFFFFFFFF) {
+            if (!fbwin->isStuck())
+                fbwin->stick();
+            return true;
+        } else if (fbwin->isStuck())
+            fbwin->stick();
+
+        // the screen is the root window of the message,
+        // which doesn't apply here (so borrow the variable :) )
+        screen = &fbwin->screen();
+        // valid workspace number?
+        if (static_cast<unsigned int>(ce.data.l[0]) < screen->getCount())
+            screen->sendToWorkspace(ce.data.l[0], fbwin, false);		
+
         return true;
     } else if (ce.message_type == m_net_wm_state) {
         if (winclient == 0 || winclient->fbwindow() == 0)
-- 
cgit v0.11.2