diff options
author | rathnor <rathnor> | 2003-02-18 15:08:12 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-02-18 15:08:12 (GMT) |
commit | aa602770fbbd4e84154028d3181d275b81ea914d (patch) | |
tree | a626f85fa25292ba6293bfac0f0c44117a04830c /src/FbTk | |
parent | 9de08b90e82681d8b49b4b17251d83fd05a413cc (diff) | |
download | fluxbox_paul-aa602770fbbd4e84154028d3181d275b81ea914d.zip fluxbox_paul-aa602770fbbd4e84154028d3181d275b81ea914d.tar.bz2 |
change XLayerItem to hold FbWindows instead of X Window IDs (Window)
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/MultLayers.cc | 14 | ||||
-rw-r--r-- | src/FbTk/XLayer.cc | 22 | ||||
-rw-r--r-- | src/FbTk/XLayerItem.cc | 16 | ||||
-rw-r--r-- | src/FbTk/XLayerItem.hh | 13 |
4 files changed, 34 insertions, 31 deletions
diff --git a/src/FbTk/MultLayers.cc b/src/FbTk/MultLayers.cc index dab1ef8..fea4dae 100644 --- a/src/FbTk/MultLayers.cc +++ b/src/FbTk/MultLayers.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: MultLayers.cc,v 1.5 2003/02/09 14:11:13 rathnor Exp $ | 23 | // $Id: MultLayers.cc,v 1.6 2003/02/18 15:08:12 rathnor Exp $ |
24 | 24 | ||
25 | #include "MultLayers.hh" | 25 | #include "MultLayers.hh" |
26 | #include "XLayer.hh" | 26 | #include "XLayer.hh" |
@@ -151,10 +151,7 @@ void MultLayers::moveToLayer(XLayerItem &item, int layernum) { | |||
151 | 151 | ||
152 | void MultLayers::restack() { | 152 | void MultLayers::restack() { |
153 | 153 | ||
154 | int layernum=0, winnum=0, size=0; | 154 | int layernum=0, winnum=0, size = this->size(); |
155 | for (; layernum < m_layers.size(); layernum++) { | ||
156 | size += m_layers[layernum]->countWindows(); | ||
157 | } | ||
158 | 155 | ||
159 | Window *winlist = new Window[size]; | 156 | Window *winlist = new Window[size]; |
160 | for (layernum=0; layernum < m_layers.size(); layernum++) { | 157 | for (layernum=0; layernum < m_layers.size(); layernum++) { |
@@ -166,13 +163,14 @@ void MultLayers::restack() { | |||
166 | for (; it != it_end; ++it) { | 163 | for (; it != it_end; ++it) { |
167 | XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin(); | 164 | XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin(); |
168 | XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end(); | 165 | XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end(); |
169 | for (; wit != wit_end; ++wit, winnum++) { | 166 | for (; wit != wit_end; ++wit) { |
170 | winlist[winnum] = (*wit); | 167 | if ((*wit)->window()) |
168 | winlist[winnum++] = (*wit)->window(); | ||
171 | } | 169 | } |
172 | } | 170 | } |
173 | } | 171 | } |
174 | 172 | ||
175 | XRestackWindows(FbTk::App::instance()->display(), winlist, size); | 173 | XRestackWindows(FbTk::App::instance()->display(), winlist, winnum); |
176 | 174 | ||
177 | delete [] winlist; | 175 | delete [] winlist; |
178 | } | 176 | } |
diff --git a/src/FbTk/XLayer.cc b/src/FbTk/XLayer.cc index b5e9756..43bd76c 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.5 2003/02/09 14:11:14 rathnor Exp $ | 23 | // $Id: XLayer.cc,v 1.6 2003/02/18 15:08:12 rathnor Exp $ |
24 | 24 | ||
25 | #include "XLayer.hh" | 25 | #include "XLayer.hh" |
26 | #include "XLayerItem.hh" | 26 | #include "XLayerItem.hh" |
@@ -53,12 +53,13 @@ void XLayer::restack() { | |||
53 | for (size_t i=0; it != it_end; ++it, i++) { | 53 | for (size_t i=0; it != it_end; ++it, i++) { |
54 | XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin(); | 54 | XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin(); |
55 | XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end(); | 55 | XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end(); |
56 | for (; wit != wit_end; ++wit, j++) { | 56 | for (; wit != wit_end; ++wit) { |
57 | winlist[j] = (*wit); | 57 | if ((*wit)->window()) |
58 | winlist[j++] = (*wit)->window(); | ||
58 | } | 59 | } |
59 | } | 60 | } |
60 | 61 | ||
61 | XRestackWindows(FbTk::App::instance()->display(), winlist, num_windows); | 62 | XRestackWindows(FbTk::App::instance()->display(), winlist, j); |
62 | 63 | ||
63 | delete [] winlist; | 64 | delete [] winlist; |
64 | 65 | ||
@@ -84,7 +85,8 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) { | |||
84 | // if there are no windows provided for above us, | 85 | // if there are no windows provided for above us, |
85 | // then we must have to go right to the top of the stack | 86 | // then we must have to go right to the top of the stack |
86 | if (!above) { // must need to go right to top | 87 | if (!above) { // must need to go right to top |
87 | XRaiseWindow(FbTk::App::instance()->display(), item->getWindows().front()); | 88 | if (item->getWindows().front()->window()) |
89 | XRaiseWindow(FbTk::App::instance()->display(), item->getWindows().front()->window()); | ||
88 | 90 | ||
89 | // if this XLayerItem has more than one window, | 91 | // if this XLayerItem has more than one window, |
90 | // then we'll stack the rest in under the front one too | 92 | // then we'll stack the rest in under the front one too |
@@ -105,18 +107,20 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) { | |||
105 | winnum = 1; | 107 | winnum = 1; |
106 | size = num+1; | 108 | size = num+1; |
107 | winlist = new Window[size]; | 109 | winlist = new Window[size]; |
108 | winlist[0] = above->getWindows().back(); | 110 | // assume that above's window exists |
111 | winlist[0] = above->getWindows().back()->window(); | ||
109 | } | 112 | } |
110 | 113 | ||
111 | // fill the rest of the array | 114 | // fill the rest of the array |
112 | XLayerItem::Windows::iterator it = item->getWindows().begin(); | 115 | XLayerItem::Windows::iterator it = item->getWindows().begin(); |
113 | XLayerItem::Windows::iterator it_end = item->getWindows().end(); | 116 | XLayerItem::Windows::iterator it_end = item->getWindows().end(); |
114 | for (; it != it_end; ++it, winnum++) { | 117 | for (; it != it_end; ++it) { |
115 | winlist[winnum] = (*it); | 118 | if ((*it)->window()) |
119 | winlist[winnum++] = (*it)->window(); | ||
116 | } | 120 | } |
117 | 121 | ||
118 | // stack the windows | 122 | // stack the windows |
119 | XRestackWindows(FbTk::App::instance()->display(), winlist, size); | 123 | XRestackWindows(FbTk::App::instance()->display(), winlist, winnum); |
120 | 124 | ||
121 | delete [] winlist; | 125 | delete [] winlist; |
122 | 126 | ||
diff --git a/src/FbTk/XLayerItem.cc b/src/FbTk/XLayerItem.cc index abbbd61..3a3f444 100644 --- a/src/FbTk/XLayerItem.cc +++ b/src/FbTk/XLayerItem.cc | |||
@@ -20,16 +20,16 @@ | |||
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.5 2003/02/09 14:11:14 rathnor Exp $ | 23 | // $Id: XLayerItem.cc,v 1.6 2003/02/18 15:08:12 rathnor Exp $ |
24 | 24 | ||
25 | #include "XLayerItem.hh" | 25 | #include "XLayerItem.hh" |
26 | #include "XLayer.hh" | 26 | #include "XLayer.hh" |
27 | 27 | ||
28 | using namespace FbTk; | 28 | using namespace FbTk; |
29 | 29 | ||
30 | XLayerItem::XLayerItem(Window win, XLayer &layer) : | 30 | XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) : |
31 | m_layer(&layer), m_layeriterator(0) { | 31 | m_layer(&layer), m_layeriterator(0) { |
32 | m_windows.push_front(win); | 32 | m_windows.push_front(&win); |
33 | m_layer->insert(*this); | 33 | m_layer->insert(*this); |
34 | } | 34 | } |
35 | 35 | ||
@@ -76,21 +76,21 @@ void XLayerItem::moveToLayer(int layernum) { | |||
76 | m_layer->moveToLayer(*this, layernum); | 76 | m_layer->moveToLayer(*this, layernum); |
77 | } | 77 | } |
78 | 78 | ||
79 | void XLayerItem::addWindow(Window win) { | 79 | void XLayerItem::addWindow(FbWindow &win) { |
80 | // I'd like to think we can trust ourselves that it won't be added twice... | 80 | // I'd like to think we can trust ourselves that it won't be added twice... |
81 | // Otherwise we're always scanning through the list. | 81 | // Otherwise we're always scanning through the list. |
82 | m_windows.push_back(win); | 82 | m_windows.push_back(&win); |
83 | } | 83 | } |
84 | 84 | ||
85 | void XLayerItem::removeWindow(Window win) { | 85 | void XLayerItem::removeWindow(FbWindow &win) { |
86 | // I'd like to think we can trust ourselves that it won't be added twice... | 86 | // I'd like to think we can trust ourselves that it won't be added twice... |
87 | // Otherwise we're always scanning through the list. | 87 | // Otherwise we're always scanning through the list. |
88 | 88 | ||
89 | XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), win); | 89 | XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win); |
90 | m_windows.erase(it); | 90 | m_windows.erase(it); |
91 | } | 91 | } |
92 | 92 | ||
93 | void XLayerItem::bringToTop(Window win) { | 93 | void XLayerItem::bringToTop(FbWindow &win) { |
94 | removeWindow(win); | 94 | removeWindow(win); |
95 | addWindow(win); | 95 | addWindow(win); |
96 | } | 96 | } |
diff --git a/src/FbTk/XLayerItem.hh b/src/FbTk/XLayerItem.hh index b3fa9ca..1998382 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.5 2003/02/09 14:11:14 rathnor Exp $ | 23 | // $Id: XLayerItem.hh,v 1.6 2003/02/18 15:08:12 rathnor Exp $ |
24 | 24 | ||
25 | #ifndef FBTK_XLAYERITEM_HH | 25 | #ifndef FBTK_XLAYERITEM_HH |
26 | #define FBTK_XLAYERITEM_HH | 26 | #define FBTK_XLAYERITEM_HH |
@@ -28,6 +28,7 @@ | |||
28 | #include "LayerItem.hh" | 28 | #include "LayerItem.hh" |
29 | #include "XLayer.hh" | 29 | #include "XLayer.hh" |
30 | #include "NotCopyable.hh" | 30 | #include "NotCopyable.hh" |
31 | #include "FbWindow.hh" | ||
31 | 32 | ||
32 | #include <X11/Xlib.h> | 33 | #include <X11/Xlib.h> |
33 | 34 | ||
@@ -36,9 +37,9 @@ namespace FbTk { | |||
36 | 37 | ||
37 | class XLayerItem : public LayerItem, private NotCopyable { | 38 | class XLayerItem : public LayerItem, private NotCopyable { |
38 | public: | 39 | public: |
39 | typedef std::list<Window> Windows; | 40 | typedef std::list<FbWindow *> Windows; |
40 | 41 | ||
41 | XLayerItem(Window win, XLayer &layer); | 42 | XLayerItem(FbWindow &win, XLayer &layer); |
42 | ~XLayerItem(); | 43 | ~XLayerItem(); |
43 | 44 | ||
44 | void setLayer(XLayer &layer); | 45 | void setLayer(XLayer &layer); |
@@ -65,11 +66,11 @@ public: | |||
65 | 66 | ||
66 | // an XLayerItem holds several windows that are equivalent in a layer | 67 | // an XLayerItem holds several windows that are equivalent in a layer |
67 | // (i.e. if one is raised, then they should all be). | 68 | // (i.e. if one is raised, then they should all be). |
68 | void addWindow(Window win); | 69 | void addWindow(FbWindow &win); |
69 | void removeWindow(Window win); | 70 | void removeWindow(FbWindow &win); |
70 | 71 | ||
71 | // using this you can bring one window to the top of this item (equivalent to add then remove) | 72 | // using this you can bring one window to the top of this item (equivalent to add then remove) |
72 | void bringToTop(Window win); | 73 | void bringToTop(FbWindow &win); |
73 | 74 | ||
74 | Windows &getWindows() { return m_windows; } | 75 | Windows &getWindows() { return m_windows; } |
75 | size_t numWindows() const { return m_windows.size(); } | 76 | size_t numWindows() const { return m_windows.size(); } |