diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/Layer.hh | 3 | ||||
-rw-r--r-- | src/FbTk/MultLayers.hh | 5 | ||||
-rw-r--r-- | src/FbTk/XLayer.cc | 16 | ||||
-rw-r--r-- | src/FbTk/XLayer.hh | 5 | ||||
-rw-r--r-- | src/FocusControl.cc | 2 |
5 files changed, 19 insertions, 12 deletions
diff --git a/src/FbTk/Layer.hh b/src/FbTk/Layer.hh index 405285c..b9257c3 100644 --- a/src/FbTk/Layer.hh +++ b/src/FbTk/Layer.hh | |||
@@ -43,7 +43,6 @@ public: | |||
43 | virtual void raise(ItemType &item); | 43 | virtual void raise(ItemType &item); |
44 | /// move item to bottom | 44 | /// move item to bottom |
45 | virtual void lower(ItemType &item); | 45 | virtual void lower(ItemType &item); |
46 | virtual void restack(); | ||
47 | /// @return layer item on specific position, on failure 0 | 46 | /// @return layer item on specific position, on failure 0 |
48 | ItemType *getItem(unsigned int position); | 47 | ItemType *getItem(unsigned int position); |
49 | /// @return number of elements in layer | 48 | /// @return number of elements in layer |
@@ -52,6 +51,8 @@ public: | |||
52 | const ListType &itemList() const { return m_list; } | 51 | const ListType &itemList() const { return m_list; } |
53 | /// @return layer list | 52 | /// @return layer list |
54 | ListType &itemList() { return m_list; } | 53 | ListType &itemList() { return m_list; } |
54 | protected: | ||
55 | virtual void restack(); | ||
55 | private: | 56 | private: |
56 | ListType m_list; | 57 | ListType m_list; |
57 | }; | 58 | }; |
diff --git a/src/FbTk/MultLayers.hh b/src/FbTk/MultLayers.hh index e502ed6..2e3915d 100644 --- a/src/FbTk/MultLayers.hh +++ b/src/FbTk/MultLayers.hh | |||
@@ -52,7 +52,6 @@ public: | |||
52 | 52 | ||
53 | void moveToLayer(XLayerItem &item, int layernum); | 53 | void moveToLayer(XLayerItem &item, int layernum); |
54 | int size(); | 54 | int size(); |
55 | void restack(); | ||
56 | 55 | ||
57 | XLayer *getLayer(size_t num); | 56 | XLayer *getLayer(size_t num); |
58 | const XLayer *getLayer(size_t num) const; | 57 | const XLayer *getLayer(size_t num) const; |
@@ -62,10 +61,10 @@ public: | |||
62 | void unlock() { if (--m_lock == 0) restack(); } | 61 | void unlock() { if (--m_lock == 0) restack(); } |
63 | 62 | ||
64 | private: | 63 | private: |
65 | std::vector<XLayer *> m_layers; | 64 | void restack(); |
66 | 65 | ||
66 | std::vector<XLayer *> m_layers; | ||
67 | int m_lock; | 67 | int m_lock; |
68 | |||
69 | }; | 68 | }; |
70 | 69 | ||
71 | }; | 70 | }; |
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 | ||
39 | XLayer::XLayer(MultLayers &manager, int layernum): | 39 | XLayer::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 | ||
43 | XLayer::~XLayer() { | 43 | XLayer::~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 | ||
75 | int XLayer::countWindows() { | 76 | int XLayer::countWindows() { |
@@ -177,8 +178,11 @@ void XLayer::remove(XLayerItem &item) { | |||
177 | void XLayer::raise(XLayerItem &item) { | 178 | void 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) { | |||
198 | void XLayer::tempRaise(XLayerItem &item) { | 202 | void 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 | ||
217 | void XLayer::lower(XLayerItem &item) { | 222 | void 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()) |
diff --git a/src/FbTk/XLayer.hh b/src/FbTk/XLayer.hh index acc299c..bfd7010 100644 --- a/src/FbTk/XLayer.hh +++ b/src/FbTk/XLayer.hh | |||
@@ -44,7 +44,6 @@ public: | |||
44 | 44 | ||
45 | void setLayerNum(int layernum) { m_layernum = layernum; }; | 45 | void setLayerNum(int layernum) { m_layernum = layernum; }; |
46 | int getLayerNum() { return m_layernum; }; | 46 | int getLayerNum() { return m_layernum; }; |
47 | void restack(); | ||
48 | // Put all items on the same layer (called when layer item added to) | 47 | // Put all items on the same layer (called when layer item added to) |
49 | void alignItem(XLayerItem &item); | 48 | void alignItem(XLayerItem &item); |
50 | int countWindows(); | 49 | int countWindows(); |
@@ -73,9 +72,11 @@ public: | |||
73 | void moveToLayer(XLayerItem &item, int layernum); | 72 | void moveToLayer(XLayerItem &item, int layernum); |
74 | 73 | ||
75 | private: | 74 | private: |
75 | void restack(); | ||
76 | |||
76 | MultLayers &m_manager; | 77 | MultLayers &m_manager; |
77 | int m_layernum; | 78 | int m_layernum; |
78 | 79 | bool m_needs_restack; | |
79 | }; | 80 | }; |
80 | 81 | ||
81 | } // namespace FbTk | 82 | } // namespace FbTk |
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index ce46dcc..78752bb 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -146,8 +146,6 @@ void FocusControl::cycleFocus(const FocusableList &window_list, | |||
146 | 146 | ||
147 | // if we were already cycling, then restore the old state | 147 | // if we were already cycling, then restore the old state |
148 | if (m_cycling_last) { | 148 | if (m_cycling_last) { |
149 | m_screen.layerManager().restack(); | ||
150 | |||
151 | // set back to originally selected window in that group | 149 | // set back to originally selected window in that group |
152 | m_cycling_last->fbwindow()->setCurrentClient(*m_cycling_last, false); | 150 | m_cycling_last->fbwindow()->setCurrentClient(*m_cycling_last, false); |
153 | 151 | ||