From 97e08c3853a77571f4d51b481581877db2250555 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Sat, 19 Mar 2011 15:05:39 +0100 Subject: bugfix: reposition windows only if they are invisible changing the layout or the number of the attached monitors might lead to invisible windows. only those windows should be positioned to the closest monitor, if they are not visible already. --- src/Screen.cc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index e54b328..45ca998 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1990,11 +1990,26 @@ void BScreen::clearHeads() { for (Workspace::Windows::iterator win = (*i)->windowList().begin(); win != (*i)->windowList().end(); win++) { - int closest_head = getHead((*win)->fbWindow()); - if (closest_head == 0) { - closest_head = 1; // first head is a safe bet here + FluxboxWindow& w = *(*win); + + // check if the window is invisible + bool invisible = true; + int j; + for (j = 0; j < m_xinerama_num_heads; ++j) { + XineramaHeadInfo& hi = m_xinerama_headinfo[j]; + if (RectangleUtil::overlapRectangles(hi, w)) { + invisible = false; + break; + } + } + + if (invisible) { // get closest head and replace the (now invisible) cwindow + int closest_head = getHead(w.fbWindow()); + if (closest_head == 0) { + closest_head = 1; // first head is a safe bet here + } + w.placeWindow(closest_head); } - (*win)->placeWindow(closest_head); } } } -- cgit v0.11.2