diff options
-rw-r--r-- | src/Window.cc | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/Window.cc b/src/Window.cc index 12b37c9..1c9c795 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -217,6 +217,19 @@ void tempRaiseFluxboxWindow(FluxboxWindow &win) { | |||
217 | win.oplock = false; | 217 | win.oplock = false; |
218 | } | 218 | } |
219 | 219 | ||
220 | bool isWindowVisibleOnSomeHeadOrScreen(FluxboxWindow const& w) { | ||
221 | int real_x = w.frame().x(); | ||
222 | int real_y = w.frame().y(); | ||
223 | |||
224 | if (w.screen().hasXinerama()) { // xinerama available => use head info | ||
225 | return (0 != w.screen().getHead(real_x, real_y)); // if visible on some head | ||
226 | } else { // no xinerama available => use screen info | ||
227 | return (real_x >= 0 && real_y >= 0 && | ||
228 | real_x <= (signed) w.screen().width() && | ||
229 | real_y <= (signed) w.screen().height()); // if visible on the screen | ||
230 | } | ||
231 | } | ||
232 | |||
220 | class SetClientCmd:public FbTk::Command<void> { | 233 | class SetClientCmd:public FbTk::Command<void> { |
221 | public: | 234 | public: |
222 | explicit SetClientCmd(WinClient &client):m_client(client) { | 235 | explicit SetClientCmd(WinClient &client):m_client(client) { |
@@ -455,22 +468,16 @@ void FluxboxWindow::init() { | |||
455 | m_placed = true; | 468 | m_placed = true; |
456 | else if (m_client->isTransient() || | 469 | else if (m_client->isTransient() || |
457 | m_client->normal_hint_flags & (PPosition|USPosition)) { | 470 | m_client->normal_hint_flags & (PPosition|USPosition)) { |
458 | 471 | if (isWindowVisibleOnSomeHeadOrScreen(*this)) | |
459 | int real_x = frame().x(); | 472 | m_placed = true; |
460 | int real_y = frame().y(); | 473 | } else { |
461 | 474 | if (!isWindowVisibleOnSomeHeadOrScreen(*this)) { | |
462 | if (screen().hasXinerama()) { // xinerama available => use head info | 475 | int cur = screen().getHead(fbWindow()); |
463 | if (0 != screen().getHead(real_x, real_y)) // if visible on some head | 476 | move(screen().getHeadX(cur), screen().getHeadY(cur)); |
464 | m_placed = true; | 477 | m_placed = false; // allow placement strategy to fix position |
465 | } else { // no xinerama available => use screen info | ||
466 | if (real_x >= 0 && real_y >= 0 && | ||
467 | real_x <= (signed) screen().width() && | ||
468 | real_y <= (signed) screen().height()) // if visible on the screen | ||
469 | m_placed = true; | ||
470 | } | 478 | } |
471 | |||
472 | } else | ||
473 | setOnHead(screen().getCurrHead()); | 479 | setOnHead(screen().getCurrHead()); |
480 | } | ||
474 | 481 | ||
475 | // we must do this now, or else resizing may not work properly | 482 | // we must do this now, or else resizing may not work properly |
476 | applyDecorations(); | 483 | applyDecorations(); |