diff options
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r-- | src/fluxbox.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 7b73360..492b64d 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -981,14 +981,22 @@ void Fluxbox::attachSignals(WinClient &winclient) { | |||
981 | 981 | ||
982 | BScreen *Fluxbox::searchScreen(Window window) { | 982 | BScreen *Fluxbox::searchScreen(Window window) { |
983 | 983 | ||
984 | ScreenList::iterator it = m_screens.begin(); | ||
985 | ScreenList::iterator it_end = m_screens.end(); | ||
986 | |||
987 | // let's first assume window is a root window | ||
988 | for (; it != it_end; ++it) { | ||
989 | if (*it && (*it)->rootWindow() == window) | ||
990 | return *it; | ||
991 | } | ||
992 | |||
993 | // no? query the root for window and try with that | ||
984 | Window window_root = FbTk::FbWindow::rootWindow(display(), window); | 994 | Window window_root = FbTk::FbWindow::rootWindow(display(), window); |
985 | if (window_root == None) { | 995 | if (window_root == None || window_root == window) { |
986 | return 0; | 996 | return 0; |
987 | } | 997 | } |
988 | 998 | ||
989 | ScreenList::iterator it = m_screens.begin(); | 999 | for (it = m_screens.begin(); it != it_end; ++it) { |
990 | ScreenList::iterator it_end = m_screens.end(); | ||
991 | for (; it != it_end; ++it) { | ||
992 | if (*it && (*it)->rootWindow() == window_root) | 1000 | if (*it && (*it)->rootWindow() == window_root) |
993 | return *it; | 1001 | return *it; |
994 | } | 1002 | } |