aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/XLayer.cc35
-rw-r--r--src/FbTk/XLayerItem.cc2
-rw-r--r--src/FbTk/XLayerItem.hh1
3 files changed, 23 insertions, 15 deletions
diff --git a/src/FbTk/XLayer.cc b/src/FbTk/XLayer.cc
index 63881d3..8d1d80a 100644
--- a/src/FbTk/XLayer.cc
+++ b/src/FbTk/XLayer.cc
@@ -131,24 +131,33 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) {
131 131
132} 132}
133 133
134// We can't just use Restack here, because it won't do anything if they're
135// already in the same relative order excluding other windows
134void XLayer::alignItem(XLayerItem &item) { 136void XLayer::alignItem(XLayerItem &item) {
137 if (itemList().front() == &item) {
138 stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
139 return;
140 }
141
135 // Note: some other things effectively assume that the window list is 142 // Note: some other things effectively assume that the window list is
136 // sorted from highest to lowest 143 // sorted from highest to lowest
137 size_t winnum = 0, 144 // get our item
138 num = item.numWindows(); 145 iterator myit = std::find(itemList().begin(), itemList().end(), &item);
139 Window *winlist = new Window[num]; 146 iterator it = myit;
140 147
141 // fill the rest of the array 148 // go to the one above it in our layer (top is front, so we decrement)
142 XLayerItem::Windows::iterator it = item.getWindows().begin(); 149 --it;
143 XLayerItem::Windows::iterator it_end = item.getWindows().end(); 150
144 for (; it != it_end; ++it) { 151 // keep going until we find one that is currently visible to the user
145 if ((*it)->window()) { 152 while (it != itemList().begin() && !(*it)->visible())
146 winlist[winnum++] = (*it)->window(); 153 --it;
147 } 154
148 } 155 if (it == itemList().begin() && !(*it)->visible())
156 // reached front item, but it wasn't visible, therefore it was already raised
157 stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
158 else
159 stackBelowItem(&item, *it);
149 160
150 XRestackWindows(FbTk::App::instance()->display(), winlist, winnum);
151 delete [] winlist;
152} 161}
153 162
154XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) { 163XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) {
diff --git a/src/FbTk/XLayerItem.cc b/src/FbTk/XLayerItem.cc
index 95befe7..ff554ad 100644
--- a/src/FbTk/XLayerItem.cc
+++ b/src/FbTk/XLayerItem.cc
@@ -28,7 +28,7 @@
28using namespace FbTk; 28using namespace FbTk;
29 29
30XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) : 30XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) :
31 m_layer(&layer), m_layeriterator(0) { 31 m_layer(&layer) {
32 m_windows.push_front(&win); 32 m_windows.push_front(&win);
33 m_layer->insert(*this); 33 m_layer->insert(*this);
34} 34}
diff --git a/src/FbTk/XLayerItem.hh b/src/FbTk/XLayerItem.hh
index 3cca8a9..3d778bb 100644
--- a/src/FbTk/XLayerItem.hh
+++ b/src/FbTk/XLayerItem.hh
@@ -79,7 +79,6 @@ public:
79 79
80private: 80private:
81 XLayer *m_layer; 81 XLayer *m_layer;
82 XLayer::iterator m_layeriterator;
83 Windows m_windows; 82 Windows m_windows;
84}; 83};
85 84