aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/XLayer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/XLayer.cc')
-rw-r--r--src/FbTk/XLayer.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/FbTk/XLayer.cc b/src/FbTk/XLayer.cc
index 0d878d3..2d92080 100644
--- a/src/FbTk/XLayer.cc
+++ b/src/FbTk/XLayer.cc
@@ -37,7 +37,7 @@ using std::endl;
37#endif // DEBUG 37#endif // DEBUG
38 38
39XLayer::XLayer(MultLayers &manager, int layernum): 39XLayer::XLayer(MultLayers &manager, int layernum):
40 m_manager(manager), m_layernum(layernum) { 40 m_manager(manager), m_layernum(layernum), m_needs_restack(false) {
41} 41}
42 42
43XLayer::~XLayer() { 43XLayer::~XLayer() {
@@ -70,6 +70,7 @@ void XLayer::restack() {
70 70
71 delete [] winlist; 71 delete [] winlist;
72 72
73 m_needs_restack = false;
73} 74}
74 75
75int XLayer::countWindows() { 76int XLayer::countWindows() {
@@ -177,8 +178,11 @@ void XLayer::remove(XLayerItem &item) {
177void XLayer::raise(XLayerItem &item) { 178void XLayer::raise(XLayerItem &item) {
178 // assume it is already in this layer 179 // assume it is already in this layer
179 180
180 if (&item == itemList().front()) 181 if (&item == itemList().front()) {
182 if (m_needs_restack)
183 restack();
181 return; // nothing to do 184 return; // nothing to do
185 }
182 186
183 iterator it = find(itemList().begin(), itemList().end(), &item); 187 iterator it = find(itemList().begin(), itemList().end(), &item);
184 if (it != itemList().end()) 188 if (it != itemList().end())
@@ -198,7 +202,7 @@ void XLayer::raise(XLayerItem &item) {
198void XLayer::tempRaise(XLayerItem &item) { 202void XLayer::tempRaise(XLayerItem &item) {
199 // assume it is already in this layer 203 // assume it is already in this layer
200 204
201 if (&item == itemList().front()) 205 if (!m_needs_restack && &item == itemList().front())
202 return; // nothing to do 206 return; // nothing to do
203 207
204 iterator it = find(itemList().begin(), itemList().end(), &item); 208 iterator it = find(itemList().begin(), itemList().end(), &item);
@@ -212,14 +216,18 @@ void XLayer::tempRaise(XLayerItem &item) {
212 // don't add it back to the top 216 // don't add it back to the top
213 stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum)); 217 stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
214 218
219 m_needs_restack = true;
215} 220}
216 221
217void XLayer::lower(XLayerItem &item) { 222void XLayer::lower(XLayerItem &item) {
218 // assume already in this layer 223 // assume already in this layer
219 224
220 // is it already the lowest? 225 // is it already the lowest?
221 if (&item == itemList().back()) 226 if (&item == itemList().back()) {
227 if (m_needs_restack)
228 restack();
222 return; // nothing to do 229 return; // nothing to do
230 }
223 231
224 iterator it = find(itemList().begin(), itemList().end(), &item); 232 iterator it = find(itemList().begin(), itemList().end(), &item);
225 if (it != itemList().end()) 233 if (it != itemList().end())