[Thread Prev][Thread Next]   >Date Index >Thread Index

[wmx] A possible fix for the focus problem when switching channels

Ben Stern - Thu Mar 20 06:49:01 2008

As mentioned in http://ml.42.org/wmx/msg00653.html, when switching to an
empty channel (or at least to a channel where nothing is focused) and away
from a Gtk2 app such as firefox, keyboard commands to switch channels stop
working.

As far as I can tell, this is caused by the old active client not getting
deactivated.

The attached patch should fix it.  I also cleaned up a little
parenthesizing, to make sure that that wasn't the problem, but effectively
the fix seems to be deactiving the client and resetting the focus to the
root if the active client is on the wrong channel.

Ben
-- 
Ben Stern             UNIX & Networks Monkey             bstern@bstern.org
This post does not represent FTI, even if I claim it does.  Neener neener.
UM Linux Users' Group     Electromagnetic Networks      Microbrew Software
diff -rub wmx-6/Channel.C wmx-6pl1/Channel.C
--- wmx-6/Channel.C	2000-05-24 11:46:14.000000000 -0400
+++ wmx-6pl1/Channel.C	2008-03-20 01:30:07.000000000 -0400
@@ -158,12 +158,14 @@
 
     for (i = 0; i < considering.count(); ++i) {
 	considering.item(i)->flipChannel(False, m_currentChannel);
-	if (considering.item(i)->channel() == m_channels &&
+	if ((considering.item(i)->channel() == m_channels) &&
 	    !considering.item(i)->isSticky()) createNewChannel();
     }
 
-    if (m_activeClient && m_activeClient->channel() != channel()) {
+    if (m_activeClient && (m_activeClient->channel() != channel())) {
+        if (m_activeClient) m_activeClient->deactivate();
 	m_activeClient = 0;
+        XSetInputFocus(m_display, PointerRoot, None, timestamp(False));
     }
 
     checkChannel(m_channels-1);

Next: