summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/event.cpp4
-rw-r--r--src/privatescreen.h1
-rw-r--r--src/privatewindow.h1
-rw-r--r--src/window.cpp12
4 files changed, 16 insertions, 2 deletions
diff --git a/src/event.cpp b/src/event.cpp
index 6acf04f..4d7a2c6 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1086,6 +1086,7 @@ CompScreen::handleEvent (XEvent *event)
w->priv->placed = false;
w->priv->managed = false;
+ w->priv->unmanaging = true;
if (w->priv->frame)
{
w->priv->unreparent ();
@@ -1660,6 +1661,9 @@ CompScreen::handleEvent (XEvent *event)
state &= ~CompWindowStateDemandsAttentionMask;
w->changeState (state);
+
+ if (priv->nextActiveWindow == event->xfocus.window)
+ priv->nextActiveWindow = None;
}
}
else
diff --git a/src/privatescreen.h b/src/privatescreen.h
index fe19cff..04c5865 100644
--- a/src/privatescreen.h
+++ b/src/privatescreen.h
@@ -334,6 +334,7 @@ class PrivateScreen : public CoreOptions {
CompTimer pingTimer;
Window activeWindow;
+ Window nextActiveWindow;
Window below;
char displayString[256];
diff --git a/src/privatewindow.h b/src/privatewindow.h
index 8413691..59521be 100644
--- a/src/privatewindow.h
+++ b/src/privatewindow.h
@@ -239,6 +239,7 @@ class PrivateWindow {
bool invisible;
bool destroyed;
bool managed;
+ bool unmanaging;
int destroyRefCnt;
int unmapRefCnt;
diff --git a/src/window.cpp b/src/window.cpp
index e9b3260..1a32af9 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1718,12 +1718,15 @@ CompWindow::focus ()
if (overrideRedirect ())
return false;
- if (!priv->managed)
+ if (!priv->managed || priv->unmanaging)
return false;
if (!onCurrentDesktop ())
return false;
+ if (priv->destroyed)
+ return false;
+
if (!priv->shaded && (priv->state & CompWindowStateHiddenMask))
return false;
@@ -1937,6 +1940,9 @@ CompWindow::moveInputFocusTo ()
setFocus = true;
}
+ if (setFocus)
+ screen->priv->nextActiveWindow = priv->id;
+
if (!setFocus && !modalTransient)
{
CompWindow *ancestor;
@@ -1958,7 +1964,8 @@ CompWindow::moveInputFocusTo ()
void
CompWindow::moveInputFocusToOtherWindow ()
{
- if (priv->id == screen->activeWindow ())
+ if (priv->id == screen->activeWindow () ||
+ priv->id == screen->priv->nextActiveWindow)
{
CompWindow *ancestor;
@@ -5233,6 +5240,7 @@ PrivateWindow::PrivateWindow (CompWindow *window) :
invisible (true),
destroyed (false),
managed (false),
+ unmanaging (false),
destroyRefCnt (1),
unmapRefCnt (1),