From 0d1b204121ba7168b03cd960e3a616b7b9a6c9b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Wed, 31 Aug 2016 15:57:50 +0200 Subject: re-use position sanitization for modal placement --- src/Window.cc | 14 +++++++++----- 1 file 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() { setWindowType(m_client->getWindowType()); - if (fluxbox.isStartup()) { - m_placed = true; - } else if (m_client->normal_hint_flags & (PPosition|USPosition)) { - m_placed = true; - // sanitize explicit position + auto sanitizePosition = [&]() { int head = screen().getHead(fbWindow()); if (head == 0 && screen().hasXinerama()) head = screen().getCurrHead(); @@ -489,6 +485,13 @@ void FluxboxWindow::init() { top = frame().y(); } frame().move(left, top); + }; + + if (fluxbox.isStartup()) { + m_placed = true; + } else if (m_client->normal_hint_flags & (PPosition|USPosition)) { + m_placed = true; + sanitizePosition(); } else { if (!isWindowVisibleOnSomeHeadOrScreen(*this)) { // this probably should never happen, but if a window @@ -544,6 +547,7 @@ void FluxboxWindow::init() { const int x = twin->frame().x() + int(twin->frame().width() - frame().width())/2; const int y = twin->frame().y() + int(twin->frame().height() - frame().height())/2; frame().move(x, y); + sanitizePosition(); m_placed = true; } else // if no parent then set default layer moveToLayer(m_state.layernum, m_state.layernum != ::ResourceLayer::NORMAL); -- cgit v0.11.2