aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2011-02-23 21:46:13 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-02-23 21:46:13 (GMT)
commit813e6c4402b7d13a9e7b1ce3e391bc4c8d894ea3 (patch)
treeb921da6cf7680d0bcded98caf319de6d058dca13 /src/FbTk
parentc859ae3987d0b49609effb98e8c28562e1947cf1 (diff)
downloadfluxbox_paul-813e6c4402b7d13a9e7b1ce3e391bc4c8d894ea3.zip
fluxbox_paul-813e6c4402b7d13a9e7b1ce3e391bc4c8d894ea3.tar.bz2
disabled overhead base classes 'FbTk::Layer' and 'FbTk::LayerItem'
had to add <algorithm> at various other files as a result of this change.
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/XLayer.cc13
-rw-r--r--src/FbTk/XLayer.hh9
-rw-r--r--src/FbTk/XLayerItem.cc18
-rw-r--r--src/FbTk/XLayerItem.hh6
4 files changed, 25 insertions, 21 deletions
diff --git a/src/FbTk/XLayer.cc b/src/FbTk/XLayer.cc
index 21790cb..f20f8ff 100644
--- a/src/FbTk/XLayer.cc
+++ b/src/FbTk/XLayer.cc
@@ -27,9 +27,9 @@
27#include "MultLayers.hh" 27#include "MultLayers.hh"
28 28
29#include <iostream> 29#include <iostream>
30#include <algorithm>
30#include <numeric> 31#include <numeric>
31 32
32using std::find;
33using namespace FbTk; 33using namespace FbTk;
34 34
35#ifdef DEBUG 35#ifdef DEBUG
@@ -91,7 +91,7 @@ void XLayer::restack(const std::vector<XLayer*>& layers) {
91 std::vector<Window> stack; 91 std::vector<Window> stack;
92 std::vector<XLayer*>::const_iterator l; 92 std::vector<XLayer*>::const_iterator l;
93 for (l = layers.begin(); l != layers.end(); ++l) { 93 for (l = layers.begin(); l != layers.end(); ++l) {
94 extract_windows_to_stack((*l)->getItemList(), 0, stack); 94 extract_windows_to_stack((*l)->itemList(), 0, stack);
95 } 95 }
96 96
97 if (!stack.empty()) 97 if (!stack.empty())
@@ -160,7 +160,7 @@ void XLayer::alignItem(XLayerItem &item) {
160 // Note: some other things effectively assume that the window list is 160 // Note: some other things effectively assume that the window list is
161 // sorted from highest to lowest 161 // sorted from highest to lowest
162 // get our item 162 // get our item
163 iterator myit = find(itemList().begin(), itemList().end(), &item); 163 iterator myit = std::find(itemList().begin(), itemList().end(), &item);
164 iterator it = myit; 164 iterator it = myit;
165 165
166 // go to the one above it in our layer (top is front, so we decrement) 166 // go to the one above it in our layer (top is front, so we decrement)
@@ -211,7 +211,8 @@ void XLayer::raise(XLayerItem &item) {
211 return; // nothing to do 211 return; // nothing to do
212 } 212 }
213 213
214 iterator it = find(itemList().begin(), itemList().end(), &item); 214
215 iterator it = std::find(itemList().begin(), itemList().end(), &item);
215 if (it != itemList().end()) 216 if (it != itemList().end())
216 itemList().erase(it); 217 itemList().erase(it);
217 else { 218 else {
@@ -232,7 +233,7 @@ void XLayer::tempRaise(XLayerItem &item) {
232 if (!m_needs_restack && &item == itemList().front()) 233 if (!m_needs_restack && &item == itemList().front())
233 return; // nothing to do 234 return; // nothing to do
234 235
235 iterator it = find(itemList().begin(), itemList().end(), &item); 236 iterator it = std::find(itemList().begin(), itemList().end(), &item);
236 if (it == itemList().end()) { 237 if (it == itemList().end()) {
237#ifdef DEBUG 238#ifdef DEBUG
238 cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<<m_layernum<<"]"<<endl; 239 cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<<m_layernum<<"]"<<endl;
@@ -258,7 +259,7 @@ void XLayer::lower(XLayerItem &item) {
258 return; // nothing to do 259 return; // nothing to do
259 } 260 }
260 261
261 iterator it = find(itemList().begin(), itemList().end(), &item); 262 iterator it = std::find(itemList().begin(), itemList().end(), &item);
262 if (it != itemList().end()) 263 if (it != itemList().end())
263 // remove this item 264 // remove this item
264 itemList().erase(it); 265 itemList().erase(it);
diff --git a/src/FbTk/XLayer.hh b/src/FbTk/XLayer.hh
index 3b7e45f..6255950 100644
--- a/src/FbTk/XLayer.hh
+++ b/src/FbTk/XLayer.hh
@@ -23,7 +23,7 @@
23#ifndef FBTK_XLAYER_HH 23#ifndef FBTK_XLAYER_HH
24#define FBTK_XLAYER_HH 24#define FBTK_XLAYER_HH
25 25
26#include "Layer.hh" 26#include <vector>
27#include <list> 27#include <list>
28 28
29namespace FbTk { 29namespace FbTk {
@@ -31,7 +31,7 @@ namespace FbTk {
31class MultLayers; 31class MultLayers;
32class XLayerItem; 32class XLayerItem;
33 33
34class XLayer : public FbTk::LayerBase<XLayerItem, std::list<XLayerItem *> > { 34class XLayer {
35public: 35public:
36 36
37 XLayer(MultLayers &manager, int layernum); 37 XLayer(MultLayers &manager, int layernum);
@@ -49,8 +49,8 @@ public:
49 int countWindows(); 49 int countWindows();
50 void stackBelowItem(XLayerItem &item, XLayerItem *above); 50 void stackBelowItem(XLayerItem &item, XLayerItem *above);
51 XLayerItem *getLowestItem(); 51 XLayerItem *getLowestItem();
52 const ItemList &getItemList() const { return itemList(); } 52 const ItemList &itemList() const { return m_items; }
53 ItemList &getItemList() { return itemList(); } 53 ItemList &itemList() { return m_items; }
54 54
55 // we redefine these as XLayer has special optimisations, and X restacking needs 55 // we redefine these as XLayer has special optimisations, and X restacking needs
56 iterator insert(XLayerItem &item, unsigned int pos=0); 56 iterator insert(XLayerItem &item, unsigned int pos=0);
@@ -77,6 +77,7 @@ private:
77 MultLayers &m_manager; 77 MultLayers &m_manager;
78 int m_layernum; 78 int m_layernum;
79 bool m_needs_restack; 79 bool m_needs_restack;
80 ItemList m_items;
80}; 81};
81 82
82} // namespace FbTk 83} // namespace FbTk
diff --git a/src/FbTk/XLayerItem.cc b/src/FbTk/XLayerItem.cc
index d822590..7f6f594 100644
--- a/src/FbTk/XLayerItem.cc
+++ b/src/FbTk/XLayerItem.cc
@@ -23,11 +23,13 @@
23#include "XLayerItem.hh" 23#include "XLayerItem.hh"
24#include "XLayer.hh" 24#include "XLayer.hh"
25 25
26#include <algorithm>
27
26using namespace FbTk; 28using namespace FbTk;
27 29
28XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) : 30XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) :
29 m_layer(&layer) { 31 m_layer(&layer) {
30 m_windows.push_front(&win); 32 m_windows.push_back(&win);
31 m_layer->insert(*this); 33 m_layer->insert(*this);
32} 34}
33 35
@@ -78,15 +80,15 @@ void XLayerItem::addWindow(FbWindow &win) {
78} 80}
79 81
80void XLayerItem::removeWindow(FbWindow &win) { 82void XLayerItem::removeWindow(FbWindow &win) {
81 // I'd like to think we can trust ourselves that it won't be added twice... 83 // I'd like to think we can trust ourselves that it won't be added twice...
82 // Otherwise we're always scanning through the list. 84 // Otherwise we're always scanning through the list.
83 85
84 XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win); 86 XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win);
85 if (it != m_windows.end()) 87 if (it != m_windows.end())
86 m_windows.erase(it); 88 m_windows.erase(it);
87} 89}
88 90
89void XLayerItem::bringToTop(FbWindow &win) { 91void XLayerItem::bringToTop(FbWindow &win) {
90 removeWindow(win); 92 removeWindow(win);
91 addWindow(win); 93 addWindow(win);
92} 94}
diff --git a/src/FbTk/XLayerItem.hh b/src/FbTk/XLayerItem.hh
index 8f9aebe..67da511 100644
--- a/src/FbTk/XLayerItem.hh
+++ b/src/FbTk/XLayerItem.hh
@@ -23,17 +23,17 @@
23#ifndef FBTK_XLAYERITEM_HH 23#ifndef FBTK_XLAYERITEM_HH
24#define FBTK_XLAYERITEM_HH 24#define FBTK_XLAYERITEM_HH
25 25
26#include "LayerItem.hh"
27#include "XLayer.hh" 26#include "XLayer.hh"
28#include "NotCopyable.hh" 27#include "NotCopyable.hh"
28#include <vector>
29 29
30namespace FbTk { 30namespace FbTk {
31 31
32class FbWindow; 32class FbWindow;
33 33
34class XLayerItem : public LayerItem, private NotCopyable { 34class XLayerItem : private NotCopyable {
35public: 35public:
36 typedef std::list<FbWindow *> Windows; 36 typedef std::vector<FbWindow *> Windows;
37 37
38 XLayerItem(FbWindow &win, XLayer &layer); 38 XLayerItem(FbWindow &win, XLayer &layer);
39 ~XLayerItem(); 39 ~XLayerItem();