Move windows out of inactive heads upon layout change. Signed-off-by: Tomas Janousek <tomi@nomi.cz>
Tomas Janousek tomi@nomi.cz
2 files changed,
20 insertions(+),
0 deletions(-)
M
src/Screen.cc
→
src/Screen.cc
@@ -1909,6 +1909,9 @@
// send resize notify m_resize_sig.notify(); m_workspace_area_sig.notify(); + + // move windows out of inactive heads + clearHeads(); }@@ -2018,6 +2021,22 @@ m_xinerama_avail = false;
m_xinerama_num_heads = 0; #endif // XINERAMA +} + +/* Move windows out of inactive heads */ +void BScreen::clearHeads() { + if (!hasXinerama()) return; + + for (Workspaces::iterator i = m_workspaces_list.begin(); + i != m_workspaces_list.end(); i++) { + for (Workspace::Windows::iterator win = (*i)->windowList().begin(); + win != (*i)->windowList().end(); win++) { + if (getHead((*win)->fbWindow()) == 0) { + // first head is a safe bet here + (*win)->placeWindow(1); + } + } + } } int BScreen::getHead(int x, int y) const {
M
src/Screen.hh
→
src/Screen.hh
@@ -406,6 +406,7 @@ /// @return umber of xinerama heads
int numHeads() const { return m_xinerama_num_heads; } void initXinerama(); + void clearHeads(); /** * Determines head number for a position * @param x position in pixels on the screen