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.cc53
1 files changed, 42 insertions, 11 deletions
diff --git a/src/FbTk/XLayer.cc b/src/FbTk/XLayer.cc
index 786cefe..8307805 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.1 2003/01/16 12:41:27 rathnor Exp $ 23// $Id: XLayer.cc,v 1.2 2003/01/29 21:42:53 rathnor Exp $
24 24
25#include "XLayer.hh" 25#include "XLayer.hh"
26#include "XLayerItem.hh" 26#include "XLayerItem.hh"
@@ -38,13 +38,24 @@ XLayer::~XLayer() {
38} 38}
39 39
40void XLayer::restack() { 40void XLayer::restack() {
41 int numWindows = size(); 41 int numWindows = 0;
42 Window *winlist = new Window[numWindows];
43 typedef FbTk::Layer<XLayerItem> BaseClass;
44 iterator it = itemList().begin(); 42 iterator it = itemList().begin();
45 iterator it_end = itemList().end(); 43 iterator it_end = itemList().end();
46 for (size_t i=0; it != it_end; ++it, i++) { 44 for (size_t i=0; it != it_end; ++it, i++) {
47 winlist[i] = (*it)->window(); 45 numWindows += (*it)->numWindows();
46 }
47
48 // each LayerItem can contain several windows
49 it = itemList().begin();
50 it_end = itemList().end();
51 Window *winlist = new Window[numWindows];
52 size_t j=0;
53 for (size_t i=0; it != it_end; ++it, i++) {
54 XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
55 XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end();
56 for (; wit != wit_end; ++wit, j++) {
57 winlist[j] = (*wit);
58 }
48 } 59 }
49 60
50 XRestackWindows(FbTk::App::instance()->display(), winlist, numWindows); 61 XRestackWindows(FbTk::App::instance()->display(), winlist, numWindows);
@@ -54,16 +65,36 @@ void XLayer::restack() {
54 65
55void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) { 66void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) {
56 // little optimisation 67 // little optimisation
68 Window *winlist;
69 size_t i, size, num = item->numWindows();
70
57 if (!above) { // must need to go right to top 71 if (!above) { // must need to go right to top
58 XRaiseWindow(FbTk::App::instance()->display(), item->window()); 72 XRaiseWindow(FbTk::App::instance()->display(), item->getWindows().front());
59 return; 73 if (num > 1) {
74 i = 0;
75 // stack relative to top one (just raised)
76 size = num;
77 winlist = new Window[size];
78 } else {
79 return;
80 }
81 } else {
82 i=1;
83 // stack relative to one above
84
85 size = num+1;
86 winlist = new Window[size];
87 winlist[0] = above->getWindows().front();
60 } 88 }
61 89
62 Window * winlist = new Window[2];
63 winlist[0] = above->window();
64 winlist[1] = item->window();
65 90
66 XRestackWindows(FbTk::App::instance()->display(), winlist, 2); 91 XLayerItem::Windows::iterator it = item->getWindows().begin();
92 XLayerItem::Windows::iterator it_end = item->getWindows().end();
93 for (; it != it_end; ++it, i++) {
94 winlist[i] = (*it);
95 }
96
97 XRestackWindows(FbTk::App::instance()->display(), winlist, size);
67 98
68 delete [] winlist; 99 delete [] winlist;
69} 100}