summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <fourdan.olivier@wanadoo.fr>2008-06-15 11:30:14 +0000
committerOlivier Fourdan <fourdan.olivier@wanadoo.fr>2008-06-15 11:30:14 +0000
commitadcb8b237a6da17af14d8ae82995c4412e136003 (patch)
tree73fdd1700569d06371d69cc16c2d78fa5270c08d
parentdacfdd065c78c6fbd51a5f90cc69fb20ae0f01c1 (diff)
downloadxfwm4-adcb8b237a6da17af14d8ae82995c4412e136003.tar.gz
Set focus to the fallback window when relying only on TakeFocus to avoid a race condition with the client application
(Old svn revision: 27067)
-rw-r--r--src/focus.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/focus.c b/src/focus.c
index 01409c73f..4123b7dd5 100644
--- a/src/focus.c
+++ b/src/focus.c
@@ -595,9 +595,15 @@ clientSetFocus (ScreenInfo *screen_info, Client *c, Time timestamp, unsigned sho
}
clientUpdateOpacity (screen_info, c);
}
- else if (!client_focus)
+ else
{
- /* Hack to prevent loosing focus when all remaining windows won't accept focus, see bug #1853 */
+ /*
+ * If we are relying only on the client application to take focus, we need to set the focus
+ * explicitely on our own fallback window otherwise there is a race condition between the
+ * application and the window manager. If the application does not take focus before the
+ * the previously focused window is unmapped (when iconifying or closing for example), the focus
+ * will be reverted to the root window and focus transition will fail.
+ */
XSetInputFocus (myScreenGetXDisplay (screen_info), screen_info->xfwm4_win, RevertToPointerRoot, timestamp);
}