summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-12-03 17:35:52 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-12-03 17:35:52 +0800
commit102f93956cbbf073fb3b4917dba3b0da9df804fc (patch)
treea703f40a9de621fba6f8cb814c83c6091ec40a3d /src
parent48cf7aacfe5864780f61e75530c52a2951f9335f (diff)
downloadmobileperf-102f93956cbbf073fb3b4917dba3b0da9df804fc.tar.gz
mobileperf-102f93956cbbf073fb3b4917dba3b0da9df804fc.tar.bz2
Fix some focus issues:
- Don't give soon-to-be-unmanaged windows focus when closing a window - Transfer focus to another window if a window that is about to get focus is closed Forward port 5a78a90a3ec9de02b8e52790fbc376a2502cead7 to master. Fixes gnome-do issue
Diffstat (limited to 'src')
-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),