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
Thomas Lübking thomas.luebking@gmail.com
1 files changed,
12 insertions(+),
4 deletions(-)
jump to
M
src/fluxbox.cc
→
src/fluxbox.cc
@@ -981,14 +981,22 @@ }
BScreen *Fluxbox::searchScreen(Window window) { + ScreenList::iterator it = m_screens.begin(); + ScreenList::iterator it_end = m_screens.end(); + + // let's first assume window is a root window + for (; it != it_end; ++it) { + if (*it && (*it)->rootWindow() == window) + return *it; + } + + // no? query the root for window and try with that Window window_root = FbTk::FbWindow::rootWindow(display(), window); - if (window_root == None) { + if (window_root == None || window_root == window) { return 0; } - ScreenList::iterator it = m_screens.begin(); - ScreenList::iterator it_end = m_screens.end(); - for (; it != it_end; ++it) { + for (it = m_screens.begin(); it != it_end; ++it) { if (*it && (*it)->rootWindow() == window_root) return *it; }