leave fullscreen windows on top, even without the focus, as long as focused window is on another head

This commit is contained in:
Mark Tiefenbruck 2007-12-21 18:35:05 -08:00
parent f6ee704a1d
commit 0906477984
2 changed files with 32 additions and 5 deletions

View file

@ -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();
}
}
}

View file

@ -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);