fix sanity check for transient and explicitly placed windows

When a screen has more heads and some part of the screen is not on any
head and some window is placed into this invisible area then the window
is invisible which sucks. This patch repositions such windows so that
they are visible.
Example:
* head 1 is at (0,120) (size 640x480)
* head 2 is at (480,0) (size 800x600)
* whole screen virtual size is 1440x600
* that means rectangle from (0,0) to (640,120) is not visible on any head
  and any windows placed there would not be visible; for example wireshark
  likes to place dialog boxes at (0,0)
This commit is contained in:
Peter Hercek 2012-07-29 00:00:59 +02:00 committed by Mathias Gumz
parent 71f75c70ae
commit 60a53113e0

View file

@ -446,11 +446,15 @@ void FluxboxWindow::init() {
int real_x = frame().x();
int real_y = frame().y();
if (real_x >= 0 &&
real_y >= 0 &&
real_x <= (signed) screen().width() &&
real_y <= (signed) screen().height())
m_placed = true;
if (screen().hasXinerama()) { // xinerama available => use head info
if (0 != screen().getHead(real_x, real_y)) // if visible on some head
m_placed = true;
} else { // no xinerama available => use screen info
if (real_x >= 0 && real_y >= 0 &&
real_x <= (signed) screen().width() &&
real_y <= (signed) screen().height()) // if visible on the screen
m_placed = true;
}
} else
setOnHead(screen().getCurrHead());