aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-06-29 21:42:15 (GMT)
committerMathias Gumz <akira@fluxbox.org>2016-07-01 17:41:59 (GMT)
commit9d34cdbfa9a4e026cca504c7aec728ddfc86cbc6 (patch)
tree89ad8658fa827f7fd3b27f34ab330a8231764deb /src
parent9dccccb84df930eca0e74a96d18b0cee36a3e216 (diff)
downloadfluxbox-9d34cdbfa9a4e026cca504c7aec728ddfc86cbc6.zip
fluxbox-9d34cdbfa9a4e026cca504c7aec728ddfc86cbc6.tar.bz2
avoid calling into XLib
Testing one bug, the function seems usually be called with the root window as parameter, so we can save a pointless lookup for the root of the root by testing against window before testing against window_root. Elegantly, this will "fix" the bug where XGetGeometry of the second heads root will either report the first heads root or some junk (xephyr case?) BUG: 1128
Diffstat (limited to 'src')
-rw-r--r--src/fluxbox.cc16
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
982BScreen *Fluxbox::searchScreen(Window window) { 982BScreen *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 }