One minor fix and one to fix that focus issue.

Maarten.
>From ef34abe9a244f472a928a6bb413288d6ed400353 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[EMAIL PROTECTED]>
Date: Tue, 25 Nov 2008 18:51:37 +0100
Subject: [PATCH] awful.client: fix minor luadoc issue

Signed-off-by: Maarten Maathuis <[EMAIL PROTECTED]>
---
 lib/awful/client.lua.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in
index bee96e1..60984b1 100644
--- a/lib/awful/client.lua.in
+++ b/lib/awful/client.lua.in
@@ -363,7 +363,7 @@ function getmaster(screen)
     return visible(s)[1]
 end
 
--- Set the client as slave: put it at the end of other windows.
+--- Set the client as slave: put it at the end of other windows.
 -- @param c The window to set as slave.
 function setslave(c)
     local cls = visible(c.screen)
-- 
1.6.0.4

>From 83ce87d590cec65450dc8cb973a71dcbffa95f6d Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[EMAIL PROTECTED]>
Date: Wed, 26 Nov 2008 19:18:20 +0100
Subject: [PATCH] client: focus on root window upon client_unfocus()

Signed-off-by: Maarten Maathuis <[EMAIL PROTECTED]>
---
 client.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/client.c b/client.c
index fd2007e..2f0cc43 100644
--- a/client.c
+++ b/client.c
@@ -157,8 +157,13 @@ client_getbywin(xcb_window_t w)
 static void
 client_unfocus(client_t *c)
 {
+    xcb_window_t root_win = xutil_screen_get(globalconf.connection, 
c->phys_screen)->root;
     globalconf.screens[c->phys_screen].client_focus = NULL;
 
+    /* Set focus on root window, so no events leak to the current window. */
+    xcb_set_input_focus(globalconf.connection, XCB_INPUT_FOCUS_POINTER_ROOT,
+        root_win, XCB_CURRENT_TIME);
+
     /* Call hook */
     if(globalconf.hooks.unfocus != LUA_REFNIL)
     {
@@ -175,9 +180,6 @@ client_unfocus(client_t *c)
 void
 client_ban(client_t *c)
 {
-    if (globalconf.screen_focus->client_focus == c)
-        client_unfocus(c);
-
     if(!c->isbanned)
     {
         /* Move all clients out of the physical viewport into negative 
coordinate space. */
@@ -191,6 +193,10 @@ client_ban(client_t *c)
 
         c->isbanned = true;
     }
+
+    /* Wait until the last moment to take away the focus from the window. */
+    if (globalconf.screens[c->phys_screen].client_focus == c)
+        client_unfocus(c);
 }
 
 /** Give focus to client, or to first client if client is NULL.
-- 
1.6.0.4

Reply via email to