From 0676161673d4347197c9d20fe3d613527633e597 Mon Sep 17 00:00:00 2001
From: Mark Tiefenbruck <mark@fluxbox.org>
Date: Fri, 21 Dec 2007 22:44:14 -0800
Subject: if a window is prevented from stealing the focus, don't put it on top

---
 src/Window.cc | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/Window.cc b/src/Window.cc
index a993076..6806afa 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -549,8 +549,11 @@ void FluxboxWindow::init() {
         // check if we should prevent this window from gaining focus
         m_focused = false; // deiconify sets this
         if (!Fluxbox::instance()->isStartup() &&
-            screen().focusControl().focusNew())
+            screen().focusControl().focusNew()) {
             m_focused = focusRequestFromClient(*m_client);
+            if (!m_focused)
+                lower();
+        }
     }
 
     if (fullscreen) {
@@ -2224,12 +2227,16 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
     // Note: this function never gets called from WithdrawnState
     // initial state is handled in restoreAttributes() and init()
 
-    if (screen().focusControl().focusNew())
-        m_focused = focusRequestFromClient(*client);
-
     setCurrentClient(*client, false); // focus handled on MapNotify
     deiconify();
 
+    if (screen().focusControl().focusNew()) {
+        m_focused = false; // deiconify sets this
+        m_focused = focusRequestFromClient(*client);
+        if (!m_focused)
+            lower();
+    }
+
 }
 
 bool FluxboxWindow::focusRequestFromClient(WinClient &from) {
-- 
cgit v0.11.2