From 0906477984edbd9f6e62fed3800ea9a441919a58 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Fri, 21 Dec 2007 18:35:05 -0800 Subject: leave fullscreen windows on top, even without the focus, as long as focused window is on another head --- src/Window.cc | 35 ++++++++++++++++++++++++++++++----- src/Window.hh | 2 ++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/Window.cc b/src/Window.cc index fed465e..4c1bf64 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1499,11 +1499,11 @@ void FluxboxWindow::setFullscreen(bool flag) { m_last_resize_x = frame().x(); m_last_resize_y = frame().y(); - moveToLayer(::Layer::ABOVE_DOCK); - fullscreen = true; - stateSig().notify(); + setFullscreenLayer(); + if (!isFocused()) + screen().focusedWindowSig().attach(this); } else if (!flag && isFullscreen()) { @@ -1541,6 +1541,21 @@ void FluxboxWindow::setFullscreen(bool flag) { } } +void FluxboxWindow::setFullscreenLayer() { + + FluxboxWindow *foc = FocusControl::focusedFbWindow(); + // if another window on the same head is focused, make sure we can see it + if (isFocused() || !foc || &foc->screen() != &screen() || + getOnHead() != foc->getOnHead()) { + moveToLayer(::Layer::ABOVE_DOCK); + } else { + moveToLayer(m_old_layernum); + lower(); + } + stateSig().notify(); + +} + /** Maximize window both horizontal and vertical */ @@ -1899,10 +1914,15 @@ void FluxboxWindow::setFocusFlag(bool focus) { installColormap(focus); + // if we're fullscreen and another window gains focus on the same head, + // then we need to let the user see it if (fullscreen && !focus) - moveToLayer(m_old_layernum); - if (fullscreen && focus) + screen().focusedWindowSig().attach(this); + + if (fullscreen && focus) { moveToLayer(::Layer::ABOVE_DOCK); + screen().focusedWindowSig().detach(this); + } if (focus != frame().focused()) frame().setFocus(focus); @@ -2922,6 +2942,11 @@ void FluxboxWindow::update(FbTk::Subject *subj) { titleSig().notify(); } + } else if (subj && typeid(*subj) == typeid(BScreen::ScreenSubject)) { + if (subj == &screen().focusedWindowSig()) { + if (FocusControl::focusedFbWindow()) + setFullscreenLayer(); + } } } diff --git a/src/Window.hh b/src/Window.hh index 032ea07..e75b84c 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -547,6 +547,8 @@ private: void associateClientWindow(bool use_attrs = false, int x = 0, int y = 0, unsigned int width = 1, unsigned int height = 1, int gravity = ForgetGravity, unsigned int client_bw = 0); void setState(unsigned long stateval, bool setting_up); + /// set the layer of a fullscreen window + void setFullscreenLayer(); // modifies left and top if snap is necessary void doSnapping(int &left, int &top); -- cgit v0.11.2