aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Window.cc41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 109b522..f800e85 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -457,14 +457,43 @@ void FluxboxWindow::init() {
457 457
458 setWindowType(m_client->getWindowType()); 458 setWindowType(m_client->getWindowType());
459 459
460 bool is_visible = isWindowVisibleOnSomeHeadOrScreen(*this); 460 if (fluxbox.isStartup()) {
461 461 m_placed = true;
462 if (fluxbox.isStartup()) 462 } else if (m_client->normal_hint_flags & (PPosition|USPosition)) {
463 m_placed = true; 463 m_placed = true;
464 else if (m_client->normal_hint_flags & (PPosition|USPosition)) { 464 // sanitize explicit position
465 m_placed = is_visible; 465 int head = screen().getHead(fbWindow());
466 if (head == 0 && screen().hasXinerama())
467 head = screen().getCurrHead();
468 int left = screen().maxLeft(head), top = screen().maxTop(head),
469 btm = screen().maxBottom(head), rght = screen().maxRight(head);
470 const int margin = hasTitlebar() ? 32 : 8;
471 // ensure the window intersects with the workspace x-axis
472 if (int(frame().x() + frame().width()) < left) {
473 left += margin - frame().width();
474 } else if (frame().x() > rght) {
475 left = rght - margin;
476 } else {
477 left = frame().x();
478 }
479 if (hasTitlebar()) {
480 // ensure the titlebar is inside the workspace
481 top = std::max(top, std::min(frame().y(), btm - margin));
482 } else {
483 // ensure "something" is inside the workspace
484 if (int(frame().y() + frame().height()) < top)
485 top += margin - frame().height();
486 else if (frame().y() > btm)
487 top = btm - margin;
488 else
489 top = frame().y();
490 }
491 frame().move(left, top);
466 } else { 492 } else {
467 if (!is_visible) { 493 if (!isWindowVisibleOnSomeHeadOrScreen(*this)) {
494 // this probably should never happen, but if a window
495 // unexplicitly has its topleft corner outside any screen,
496 // move it to the current screen and ensure it's just placed
468 int cur = screen().getHead(fbWindow()); 497 int cur = screen().getHead(fbWindow());
469 move(screen().getHeadX(cur), screen().getHeadY(cur)); 498 move(screen().getHeadX(cur), screen().getHeadY(cur));
470 m_placed = false; // allow placement strategy to fix position 499 m_placed = false; // allow placement strategy to fix position