all repos — fluxbox @ e00c2b784a90d882689d61d042e26aa1caff0212

custom fork of the fluxbox windowmanager

fix initial window placement to allow proper head detection and window placement based on apps file

* a reasonable initial placement is important for later movements to
  different heads and correct head detection (required by apps file)
* it did not work well in case when (0,0) was not near any head
Peter Hercek hercek@users.sourceforge.net
commit

e00c2b784a90d882689d61d042e26aa1caff0212

parent

5e3217441ad0f97bff1e946fb93a9673ac806052

1 files changed, 21 insertions(+), 14 deletions(-)

jump to
M src/Window.ccsrc/Window.cc

@@ -217,6 +217,19 @@

win.oplock = false; } +bool isWindowVisibleOnSomeHeadOrScreen(FluxboxWindow const& w) { + int real_x = w.frame().x(); + int real_y = w.frame().y(); + + if (w.screen().hasXinerama()) { // xinerama available => use head info + return (0 != w.screen().getHead(real_x, real_y)); // if visible on some head + } else { // no xinerama available => use screen info + return (real_x >= 0 && real_y >= 0 && + real_x <= (signed) w.screen().width() && + real_y <= (signed) w.screen().height()); // if visible on the screen + } +} + class SetClientCmd:public FbTk::Command<void> { public: explicit SetClientCmd(WinClient &client):m_client(client) {

@@ -455,22 +468,16 @@ if (fluxbox.isStartup())

m_placed = true; else if (m_client->isTransient() || m_client->normal_hint_flags & (PPosition|USPosition)) { - - int real_x = frame().x(); - int real_y = frame().y(); - - 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; + if (isWindowVisibleOnSomeHeadOrScreen(*this)) + m_placed = true; + } else { + if (!isWindowVisibleOnSomeHeadOrScreen(*this)) { + int cur = screen().getHead(fbWindow()); + move(screen().getHeadX(cur), screen().getHeadY(cur)); + m_placed = false; // allow placement strategy to fix position } - - } else setOnHead(screen().getCurrHead()); + } // we must do this now, or else resizing may not work properly applyDecorations();