summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Moreau <oreaus@gmail.com>2011-03-18 13:06:13 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-03-18 13:06:13 +0800
commit1fb701594b78e950c031974d83c3566d1d648156 (patch)
tree02df0d4e8a395b43b088ec0e1b4341d16d1ec642 /src
parent149bc1f4aa91b9def2b344d8ad0dab8407533f62 (diff)
downloadmobilebling-1fb701594b78e950c031974d83c3566d1d648156.tar.gz
mobilebling-1fb701594b78e950c031974d83c3566d1d648156.tar.bz2
If an unexpected window gets focus (e.g. by a client calling XSetInputFocus directly), make sure that moving the input focus to a default window still works when that window is closed.
Forward port 556b681adaab3fe27fa456037be82e902dd371be to master
Diffstat (limited to 'src')
-rw-r--r--src/event.cpp21
-rw-r--r--src/window.cpp5
2 files changed, 16 insertions, 10 deletions
diff --git a/src/event.cpp b/src/event.cpp
index 06f84cc..6988423 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1876,11 +1876,8 @@ CompScreen::handleEvent (XEvent *event)
state &= ~CompWindowStateDemandsAttentionMask;
w->changeState (state);
-
- if (priv->nextActiveWindow == event->xfocus.window)
- priv->nextActiveWindow = None;
}
- else if (event->xfocus.window == priv->root)
+ else
{
/* Don't ever let the focus go to the root
* window except in grab cases
@@ -1890,12 +1887,20 @@ CompScreen::handleEvent (XEvent *event)
* the other window managers should handle that
*/
- if (event->xfocus.detail == NotifyDetailNone ||
- (event->xfocus.mode == NotifyNormal &&
- event->xfocus.detail == NotifyInferior))
+ if (event->xfocus.window == priv->root)
{
- screen->focusDefaultWindow ();
+ if (event->xfocus.detail == NotifyDetailNone ||
+ (event->xfocus.mode == NotifyNormal &&
+ event->xfocus.detail == NotifyInferior))
+ {
+ screen->focusDefaultWindow ();
+ }
+
+ priv->activeWindow = None;
}
+
+ if (priv->nextActiveWindow == event->xfocus.window)
+ priv->nextActiveWindow = None;
}
}
else
diff --git a/src/window.cpp b/src/window.cpp
index 53fe4d8..f26f7cb 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2014,8 +2014,9 @@ CompWindow::moveInputFocusTo ()
void
CompWindow::moveInputFocusToOtherWindow ()
{
- if (priv->id == screen->activeWindow () ||
- priv->id == screen->priv->nextActiveWindow)
+ if ((priv->id = screen->activeWindow () ||
+ priv->id == screen->priv->nextActiveWindow) ||
+ screen->activeWindow () == None)
{
CompWindow *ancestor;