diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-08-31 13:57:50 (GMT) |
---|---|---|
committer | Thomas Lübking <thomas.luebking@gmail.com> | 2016-08-31 18:37:37 (GMT) |
commit | 0d1b204121ba7168b03cd960e3a616b7b9a6c9b1 (patch) | |
tree | f1b997609528082f7ca68ad1de8ce02e29c22eee | |
parent | 6ca6422344f0046ef1794c5fbaea90d28692fd5f (diff) | |
download | fluxbox-0d1b204121ba7168b03cd960e3a616b7b9a6c9b1.zip fluxbox-0d1b204121ba7168b03cd960e3a616b7b9a6c9b1.tar.bz2 |
re-use position sanitization for modal placement
-rw-r--r-- | src/Window.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Window.cc b/src/Window.cc index 7855f68..77a228e 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -457,11 +457,7 @@ void FluxboxWindow::init() { | |||
457 | 457 | ||
458 | setWindowType(m_client->getWindowType()); | 458 | setWindowType(m_client->getWindowType()); |
459 | 459 | ||
460 | if (fluxbox.isStartup()) { | 460 | auto sanitizePosition = [&]() { |
461 | m_placed = true; | ||
462 | } else if (m_client->normal_hint_flags & (PPosition|USPosition)) { | ||
463 | m_placed = true; | ||
464 | // sanitize explicit position | ||
465 | int head = screen().getHead(fbWindow()); | 461 | int head = screen().getHead(fbWindow()); |
466 | if (head == 0 && screen().hasXinerama()) | 462 | if (head == 0 && screen().hasXinerama()) |
467 | head = screen().getCurrHead(); | 463 | head = screen().getCurrHead(); |
@@ -489,6 +485,13 @@ void FluxboxWindow::init() { | |||
489 | top = frame().y(); | 485 | top = frame().y(); |
490 | } | 486 | } |
491 | frame().move(left, top); | 487 | frame().move(left, top); |
488 | }; | ||
489 | |||
490 | if (fluxbox.isStartup()) { | ||
491 | m_placed = true; | ||
492 | } else if (m_client->normal_hint_flags & (PPosition|USPosition)) { | ||
493 | m_placed = true; | ||
494 | sanitizePosition(); | ||
492 | } else { | 495 | } else { |
493 | if (!isWindowVisibleOnSomeHeadOrScreen(*this)) { | 496 | if (!isWindowVisibleOnSomeHeadOrScreen(*this)) { |
494 | // this probably should never happen, but if a window | 497 | // this probably should never happen, but if a window |
@@ -544,6 +547,7 @@ void FluxboxWindow::init() { | |||
544 | const int x = twin->frame().x() + int(twin->frame().width() - frame().width())/2; | 547 | const int x = twin->frame().x() + int(twin->frame().width() - frame().width())/2; |
545 | const int y = twin->frame().y() + int(twin->frame().height() - frame().height())/2; | 548 | const int y = twin->frame().y() + int(twin->frame().height() - frame().height())/2; |
546 | frame().move(x, y); | 549 | frame().move(x, y); |
550 | sanitizePosition(); | ||
547 | m_placed = true; | 551 | m_placed = true; |
548 | } else // if no parent then set default layer | 552 | } else // if no parent then set default layer |
549 | moveToLayer(m_state.layernum, m_state.layernum != ::ResourceLayer::NORMAL); | 553 | moveToLayer(m_state.layernum, m_state.layernum != ::ResourceLayer::NORMAL); |