From 909b3c5665213ef2a05ef26e33506d02829bdd93 Mon Sep 17 00:00:00 2001 From: rathnor Date: Tue, 15 Apr 2003 23:09:26 +0000 Subject: raise on focus [at end of cycle], also a temporary raise while cycling (Simon) --- src/FbTk/XLayer.cc | 23 ++++++++++++++++++++++- src/FbTk/XLayer.hh | 5 ++++- src/FbTk/XLayerItem.cc | 6 +++++- src/FbTk/XLayerItem.hh | 4 +++- src/Screen.cc | 17 ++++++++++++++--- src/Window.cc | 38 +++++++++++++++++++++++++++++++++++++- src/Window.hh | 3 ++- 7 files changed, 87 insertions(+), 9 deletions(-) diff --git a/src/FbTk/XLayer.cc b/src/FbTk/XLayer.cc index 43bd76c..ad1e49d 100644 --- a/src/FbTk/XLayer.cc +++ b/src/FbTk/XLayer.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: XLayer.cc,v 1.6 2003/02/18 15:08:12 rathnor Exp $ +// $Id: XLayer.cc,v 1.7 2003/04/15 23:09:24 rathnor Exp $ #include "XLayer.hh" #include "XLayerItem.hh" @@ -264,6 +264,27 @@ void XLayer::raise(XLayerItem &item) { } +void XLayer::tempRaise(XLayerItem &item) { + // assume it is already in this layer + + if (&item == itemList().front()) + return; // nothing to do + + iterator it = std::find(itemList().begin(), itemList().end(), &item); + if (it != itemList().end()) + // don't remove it +#ifdef DEBUG + else { + cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<lower(*this); } +void XLayerItem::tempRaise() { + m_layer->tempRaise(*this); +} + void XLayerItem::stepUp() { m_layer->stepUp(*this); } diff --git a/src/FbTk/XLayerItem.hh b/src/FbTk/XLayerItem.hh index 1998382..bf53aa6 100644 --- a/src/FbTk/XLayerItem.hh +++ b/src/FbTk/XLayerItem.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: XLayerItem.hh,v 1.6 2003/02/18 15:08:12 rathnor Exp $ +// $Id: XLayerItem.hh,v 1.7 2003/04/15 23:09:26 rathnor Exp $ #ifndef FBTK_XLAYERITEM_HH #define FBTK_XLAYERITEM_HH @@ -46,6 +46,8 @@ public: void raise(); void lower(); + void tempRaise(); // this raise gets reverted by a restack() + // go above the next item visible in this layer void stepUp(); void stepDown(); diff --git a/src/Screen.cc b/src/Screen.cc index 887e8fc..bac97e9 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.122 2003/04/15 14:42:03 fluxgen Exp $ +// $Id: Screen.cc,v 1.123 2003/04/15 23:09:12 rathnor Exp $ #include "Screen.hh" @@ -1371,6 +1371,9 @@ void BScreen::nextFocus(int opts) { if (!cycling_focus) { cycling_focus = True; cycling_window = focused_list.begin(); + } else { + // already cycling, so restack to put windows back in their proper order + m_layermanager.restack(); } // if it is stacked, we want the highest window in the focused list // that is on the same workspace @@ -1392,8 +1395,10 @@ void BScreen::nextFocus(int opts) { (fbwin->isStuck() || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { // either on this workspace, or stuck - if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) + if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) { + fbwin->tempRaise(); break; + } } } cycling_window = it; @@ -1444,6 +1449,9 @@ void BScreen::prevFocus(int opts) { if (!cycling_focus) { cycling_focus = True; cycling_window = focused_list.end(); + } else { + // already cycling, so restack to put windows back in their proper order + m_layermanager.restack(); } // if it is stacked, we want the highest window in the focused list // that is on the same workspace @@ -1466,8 +1474,10 @@ void BScreen::prevFocus(int opts) { (fbwin->isStuck() || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { // either on this workspace, or stuck - if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) + if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) { + fbwin->tempRaise(); break; + } } } cycling_window = it; @@ -2167,6 +2177,7 @@ void BScreen::notifyReleasedKeys(XKeyEvent &ke) { WinClient *client = *cycling_window; focused_list.erase(cycling_window); focused_list.push_front(client); + client->fbwindow()->raise(); } } diff --git a/src/Window.cc b/src/Window.cc index 69877e2..35f5be9 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.137 2003/04/15 21:38:23 fluxgen Exp $ +// $Id: Window.cc,v 1.138 2003/04/15 23:09:13 rathnor Exp $ #include "Window.hh" @@ -153,6 +153,23 @@ void lowerFluxboxWindow(FluxboxWindow &win) { } } +/// raise window and do the same for each transient it holds +void tempRaiseFluxboxWindow(FluxboxWindow &win) { + + if (!win.isIconic()) { + // don't update netizen, as it is only temporary + win.getLayerItem().tempRaise(); + } + + // for each transient do raise + std::list::const_iterator it = win.getTransients().begin(); + std::list::const_iterator it_end = win.getTransients().end(); + for (; it != it_end; ++it) { + if (!(*it)->isIconic()) + tempRaiseFluxboxWindow(*(*it)); + } +} + class SetClientCmd:public FbTk::Command { public: explicit SetClientCmd(WinClient &client):m_client(client) { @@ -1410,6 +1427,25 @@ void FluxboxWindow::lower() { lowerFluxboxWindow(*bottom); } +void FluxboxWindow::tempRaise() { + if (isIconic()) + deiconify(); + + // get root window + FluxboxWindow *win = this; + while (win->getTransientFor()) { + win = win->getTransientFor(); + assert(win != win->getTransientFor()); + } + // if we don't have any root window use this as root + if (win == 0) + win = this; + + // raise this window and every transient in it + tempRaiseFluxboxWindow(*win); +} + + void FluxboxWindow::raiseLayer() { // don't let it up to menu layer if (getLayerNum() == (Fluxbox::instance()->getMenuLayer()+1)) diff --git a/src/Window.hh b/src/Window.hh index 6245b0a..a626b28 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.hh,v 1.56 2003/04/15 18:56:42 fluxgen Exp $ +// $Id: Window.hh,v 1.57 2003/04/15 23:09:15 rathnor Exp $ #ifndef WINDOW_HH #define WINDOW_HH @@ -155,6 +155,7 @@ public: void stick(); void raise(); void lower(); + void tempRaise(); void raiseLayer(); void lowerLayer(); void moveToLayer(int layernum); -- cgit v0.11.2