From 8bda89394b5bcbca5781f1e60bd786c17c1bee49 Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 10 Mar 2007 18:08:37 +0000 Subject: make sure we don't steal focus from unmanaged windows --- ChangeLog | 3 +++ src/fluxbox.cc | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7903cfc..fd1c184 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0rc3: +*07/03/10: + * Fixed stealing focus from unmanaged windows (Mark) + fluxbox.cc *07/03/07: * Fixed a little bug with reverting focus after closing menu (Mark) FbTk/Menu.cc diff --git a/src/fluxbox.cc b/src/fluxbox.cc index e4c68bf..2393837 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -1719,8 +1719,20 @@ void Fluxbox::timed_reconfigure() { } void Fluxbox::revert_focus() { - if (m_revert_screen && !FocusControl::focusedWindow() && - !FbTk::Menu::focused() && !m_showing_dialog) + if (!m_revert_screen || FocusControl::focusedWindow() || + FbTk::Menu::focused() || m_showing_dialog) + return; + + Window win; + int revert; + Display *disp = display(); + + XGetInputFocus(disp, &win, &revert); + + // we only want to revert focus if it's left dangling, as some other + // application may have set the focus to an unmanaged window + if (win == None || win == PointerRoot || + win == m_revert_screen->rootWindow().window()) FocusControl::revertFocus(*m_revert_screen); } -- cgit v0.11.2