diff options
author | rathnor <rathnor> | 2003-04-15 23:09:26 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-04-15 23:09:26 (GMT) |
commit | 909b3c5665213ef2a05ef26e33506d02829bdd93 (patch) | |
tree | 293a3a87f5ed1524c98d6011daa76743b953373e | |
parent | 4ca88642fad0b89209aea9272b835b1e724975ad (diff) | |
download | fluxbox_lack-909b3c5665213ef2a05ef26e33506d02829bdd93.zip fluxbox_lack-909b3c5665213ef2a05ef26e33506d02829bdd93.tar.bz2 |
raise on focus [at end of cycle], also a temporary raise while cycling
(Simon)
-rw-r--r-- | src/FbTk/XLayer.cc | 23 | ||||
-rw-r--r-- | src/FbTk/XLayer.hh | 5 | ||||
-rw-r--r-- | src/FbTk/XLayerItem.cc | 6 | ||||
-rw-r--r-- | src/FbTk/XLayerItem.hh | 4 | ||||
-rw-r--r-- | src/Screen.cc | 17 | ||||
-rw-r--r-- | src/Window.cc | 38 | ||||
-rw-r--r-- | 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 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: XLayer.cc,v 1.6 2003/02/18 15:08:12 rathnor Exp $ | 23 | // $Id: XLayer.cc,v 1.7 2003/04/15 23:09:24 rathnor Exp $ |
24 | 24 | ||
25 | #include "XLayer.hh" | 25 | #include "XLayer.hh" |
26 | #include "XLayerItem.hh" | 26 | #include "XLayerItem.hh" |
@@ -264,6 +264,27 @@ void XLayer::raise(XLayerItem &item) { | |||
264 | 264 | ||
265 | } | 265 | } |
266 | 266 | ||
267 | void XLayer::tempRaise(XLayerItem &item) { | ||
268 | // assume it is already in this layer | ||
269 | |||
270 | if (&item == itemList().front()) | ||
271 | return; // nothing to do | ||
272 | |||
273 | iterator it = std::find(itemList().begin(), itemList().end(), &item); | ||
274 | if (it != itemList().end()) | ||
275 | // don't remove it | ||
276 | #ifdef DEBUG | ||
277 | else { | ||
278 | cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<<m_layernum<<"]"<<endl; | ||
279 | return; | ||
280 | } | ||
281 | #endif // DEBUG | ||
282 | |||
283 | // don't add it back to the top | ||
284 | stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum)); | ||
285 | |||
286 | } | ||
287 | |||
267 | void XLayer::lower(XLayerItem &item) { | 288 | void XLayer::lower(XLayerItem &item) { |
268 | // assume already in this layer | 289 | // assume already in this layer |
269 | 290 | ||
diff --git a/src/FbTk/XLayer.hh b/src/FbTk/XLayer.hh index 88ba4ef..82bee5e 100644 --- a/src/FbTk/XLayer.hh +++ b/src/FbTk/XLayer.hh | |||
@@ -20,7 +20,7 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: XLayer.hh,v 1.3 2003/02/09 14:11:14 rathnor Exp $ | 23 | // $Id: XLayer.hh,v 1.4 2003/04/15 23:09:25 rathnor Exp $ |
24 | 24 | ||
25 | 25 | ||
26 | #ifndef FBTK_XLAYER_HH | 26 | #ifndef FBTK_XLAYER_HH |
@@ -72,6 +72,9 @@ public: | |||
72 | void raise(XLayerItem &item); | 72 | void raise(XLayerItem &item); |
73 | void lower(XLayerItem &item); | 73 | void lower(XLayerItem &item); |
74 | 74 | ||
75 | // raise it, but don't make it permanent (i.e. restack will revert) | ||
76 | void tempRaise(XLayerItem &item); | ||
77 | |||
75 | // send to next layer up | 78 | // send to next layer up |
76 | void raiseLayer(XLayerItem &item); | 79 | void raiseLayer(XLayerItem &item); |
77 | void lowerLayer(XLayerItem &item); | 80 | void lowerLayer(XLayerItem &item); |
diff --git a/src/FbTk/XLayerItem.cc b/src/FbTk/XLayerItem.cc index 3a3f444..fdc7fb6 100644 --- a/src/FbTk/XLayerItem.cc +++ b/src/FbTk/XLayerItem.cc | |||
@@ -20,7 +20,7 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: XLayerItem.cc,v 1.6 2003/02/18 15:08:12 rathnor Exp $ | 23 | // $Id: XLayerItem.cc,v 1.7 2003/04/15 23:09:25 rathnor Exp $ |
24 | 24 | ||
25 | #include "XLayerItem.hh" | 25 | #include "XLayerItem.hh" |
26 | #include "XLayer.hh" | 26 | #include "XLayer.hh" |
@@ -56,6 +56,10 @@ void XLayerItem::lower() { | |||
56 | m_layer->lower(*this); | 56 | m_layer->lower(*this); |
57 | } | 57 | } |
58 | 58 | ||
59 | void XLayerItem::tempRaise() { | ||
60 | m_layer->tempRaise(*this); | ||
61 | } | ||
62 | |||
59 | void XLayerItem::stepUp() { | 63 | void XLayerItem::stepUp() { |
60 | m_layer->stepUp(*this); | 64 | m_layer->stepUp(*this); |
61 | } | 65 | } |
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 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: XLayerItem.hh,v 1.6 2003/02/18 15:08:12 rathnor Exp $ | 23 | // $Id: XLayerItem.hh,v 1.7 2003/04/15 23:09:26 rathnor Exp $ |
24 | 24 | ||
25 | #ifndef FBTK_XLAYERITEM_HH | 25 | #ifndef FBTK_XLAYERITEM_HH |
26 | #define FBTK_XLAYERITEM_HH | 26 | #define FBTK_XLAYERITEM_HH |
@@ -46,6 +46,8 @@ public: | |||
46 | 46 | ||
47 | void raise(); | 47 | void raise(); |
48 | void lower(); | 48 | void lower(); |
49 | void tempRaise(); // this raise gets reverted by a restack() | ||
50 | |||
49 | // go above the next item visible in this layer | 51 | // go above the next item visible in this layer |
50 | void stepUp(); | 52 | void stepUp(); |
51 | void stepDown(); | 53 | 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 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.122 2003/04/15 14:42:03 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.123 2003/04/15 23:09:12 rathnor Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -1371,6 +1371,9 @@ void BScreen::nextFocus(int opts) { | |||
1371 | if (!cycling_focus) { | 1371 | if (!cycling_focus) { |
1372 | cycling_focus = True; | 1372 | cycling_focus = True; |
1373 | cycling_window = focused_list.begin(); | 1373 | cycling_window = focused_list.begin(); |
1374 | } else { | ||
1375 | // already cycling, so restack to put windows back in their proper order | ||
1376 | m_layermanager.restack(); | ||
1374 | } | 1377 | } |
1375 | // if it is stacked, we want the highest window in the focused list | 1378 | // if it is stacked, we want the highest window in the focused list |
1376 | // that is on the same workspace | 1379 | // that is on the same workspace |
@@ -1392,8 +1395,10 @@ void BScreen::nextFocus(int opts) { | |||
1392 | (fbwin->isStuck() | 1395 | (fbwin->isStuck() |
1393 | || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { | 1396 | || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { |
1394 | // either on this workspace, or stuck | 1397 | // either on this workspace, or stuck |
1395 | if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) | 1398 | if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) { |
1399 | fbwin->tempRaise(); | ||
1396 | break; | 1400 | break; |
1401 | } | ||
1397 | } | 1402 | } |
1398 | } | 1403 | } |
1399 | cycling_window = it; | 1404 | cycling_window = it; |
@@ -1444,6 +1449,9 @@ void BScreen::prevFocus(int opts) { | |||
1444 | if (!cycling_focus) { | 1449 | if (!cycling_focus) { |
1445 | cycling_focus = True; | 1450 | cycling_focus = True; |
1446 | cycling_window = focused_list.end(); | 1451 | cycling_window = focused_list.end(); |
1452 | } else { | ||
1453 | // already cycling, so restack to put windows back in their proper order | ||
1454 | m_layermanager.restack(); | ||
1447 | } | 1455 | } |
1448 | // if it is stacked, we want the highest window in the focused list | 1456 | // if it is stacked, we want the highest window in the focused list |
1449 | // that is on the same workspace | 1457 | // that is on the same workspace |
@@ -1466,8 +1474,10 @@ void BScreen::prevFocus(int opts) { | |||
1466 | (fbwin->isStuck() | 1474 | (fbwin->isStuck() |
1467 | || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { | 1475 | || fbwin->getWorkspaceNumber() == getCurrentWorkspaceID())) { |
1468 | // either on this workspace, or stuck | 1476 | // either on this workspace, or stuck |
1469 | if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) | 1477 | if (! (doSkipWindow(fbwin, opts) || !fbwin->setInputFocus()) ) { |
1478 | fbwin->tempRaise(); | ||
1470 | break; | 1479 | break; |
1480 | } | ||
1471 | } | 1481 | } |
1472 | } | 1482 | } |
1473 | cycling_window = it; | 1483 | cycling_window = it; |
@@ -2167,6 +2177,7 @@ void BScreen::notifyReleasedKeys(XKeyEvent &ke) { | |||
2167 | WinClient *client = *cycling_window; | 2177 | WinClient *client = *cycling_window; |
2168 | focused_list.erase(cycling_window); | 2178 | focused_list.erase(cycling_window); |
2169 | focused_list.push_front(client); | 2179 | focused_list.push_front(client); |
2180 | client->fbwindow()->raise(); | ||
2170 | } | 2181 | } |
2171 | } | 2182 | } |
2172 | 2183 | ||
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 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.137 2003/04/15 21:38:23 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.138 2003/04/15 23:09:13 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -153,6 +153,23 @@ void lowerFluxboxWindow(FluxboxWindow &win) { | |||
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | /// raise window and do the same for each transient it holds | ||
157 | void tempRaiseFluxboxWindow(FluxboxWindow &win) { | ||
158 | |||
159 | if (!win.isIconic()) { | ||
160 | // don't update netizen, as it is only temporary | ||
161 | win.getLayerItem().tempRaise(); | ||
162 | } | ||
163 | |||
164 | // for each transient do raise | ||
165 | std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin(); | ||
166 | std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end(); | ||
167 | for (; it != it_end; ++it) { | ||
168 | if (!(*it)->isIconic()) | ||
169 | tempRaiseFluxboxWindow(*(*it)); | ||
170 | } | ||
171 | } | ||
172 | |||
156 | class SetClientCmd:public FbTk::Command { | 173 | class SetClientCmd:public FbTk::Command { |
157 | public: | 174 | public: |
158 | explicit SetClientCmd(WinClient &client):m_client(client) { | 175 | explicit SetClientCmd(WinClient &client):m_client(client) { |
@@ -1410,6 +1427,25 @@ void FluxboxWindow::lower() { | |||
1410 | lowerFluxboxWindow(*bottom); | 1427 | lowerFluxboxWindow(*bottom); |
1411 | } | 1428 | } |
1412 | 1429 | ||
1430 | void FluxboxWindow::tempRaise() { | ||
1431 | if (isIconic()) | ||
1432 | deiconify(); | ||
1433 | |||
1434 | // get root window | ||
1435 | FluxboxWindow *win = this; | ||
1436 | while (win->getTransientFor()) { | ||
1437 | win = win->getTransientFor(); | ||
1438 | assert(win != win->getTransientFor()); | ||
1439 | } | ||
1440 | // if we don't have any root window use this as root | ||
1441 | if (win == 0) | ||
1442 | win = this; | ||
1443 | |||
1444 | // raise this window and every transient in it | ||
1445 | tempRaiseFluxboxWindow(*win); | ||
1446 | } | ||
1447 | |||
1448 | |||
1413 | void FluxboxWindow::raiseLayer() { | 1449 | void FluxboxWindow::raiseLayer() { |
1414 | // don't let it up to menu layer | 1450 | // don't let it up to menu layer |
1415 | if (getLayerNum() == (Fluxbox::instance()->getMenuLayer()+1)) | 1451 | 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 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.hh,v 1.56 2003/04/15 18:56:42 fluxgen Exp $ | 25 | // $Id: Window.hh,v 1.57 2003/04/15 23:09:15 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -155,6 +155,7 @@ public: | |||
155 | void stick(); | 155 | void stick(); |
156 | void raise(); | 156 | void raise(); |
157 | void lower(); | 157 | void lower(); |
158 | void tempRaise(); | ||
158 | void raiseLayer(); | 159 | void raiseLayer(); |
159 | void lowerLayer(); | 160 | void lowerLayer(); |
160 | void moveToLayer(int layernum); | 161 | void moveToLayer(int layernum); |