From b4b163f365aad9d342f80267dff5e6f68a32e0c3 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <fourdan.olivier@wanadoo.fr>
Date: Fri, 12 Mar 2004 22:04:10 +0000
Subject: [PATCH] Put back a small optimization

(Old svn revision: 11632)
---
 src/client.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/client.c b/src/client.c
index 59e11048f..2da0d1a95 100644
--- a/src/client.c
+++ b/src/client.c
@@ -4849,6 +4849,12 @@ clientSetFocus (Client * c, unsigned short flags)
     if ((c) && FLAG_TEST (c->flags, CLIENT_FLAG_VISIBLE))
     {
         TRACE ("setting focus to client \"%s\" (0x%lx)", c->name, c->window);
+        if ((c == client_focus) && !(flags & FOCUS_FORCE))
+        {
+            TRACE ("client \"%s\" (0x%lx) is already focused, ignoring request",
+                c->name, c->window);
+            return;
+        }        
         if (flags & FOCUS_SORT)
         {
             clientSortRing(c);
@@ -4861,10 +4867,8 @@ clientSetFocus (Client * c, unsigned short flags)
         if (FLAG_TEST (c->wm_flags, WM_FLAG_INPUT))
         {
             XSetInputFocus (dpy, c->window, RevertToNone, CurrentTime);
-            frameDraw (c, FALSE, FALSE);
             XFlush (dpy);
         }
-        
         if (FLAG_TEST(c->wm_flags, WM_FLAG_TAKEFOCUS))
         {
             sendClientMessage (c->window, wm_protocols, wm_takefocus, CurrentTime);
-- 
GitLab