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
This commit is contained in:
parent
9dccccb84d
commit
9d34cdbfa9
1 changed files with 12 additions and 4 deletions
|
@ -981,14 +981,22 @@ void Fluxbox::attachSignals(WinClient &winclient) {
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue