all repos — fluxbox @ 4870c5f0913dd212837c4970e14510520d7bcd84

custom fork of the fluxbox windowmanager

cleaning
fluxgen fluxgen
commit

4870c5f0913dd212837c4970e14510520d7bcd84

parent

b8cc8770e8b36fdc054575cc921cdcfab56c2eaf

2 files changed, 26 insertions(+), 53 deletions(-)

jump to
M src/FbTk/XLayerItem.ccsrc/FbTk/XLayerItem.cc

@@ -20,32 +20,31 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: XLayerItem.cc,v 1.3 2003/02/02 16:32:41 rathnor Exp $ +// $Id: XLayerItem.cc,v 1.4 2003/02/03 13:43:46 fluxgen Exp $ #include "XLayerItem.hh" #include "XLayer.hh" using namespace FbTk; -XLayerItem::XLayerItem(Window win) : - m_layer(0), m_layeriterator(0) { - m_windows.push_front(win); +XLayerItem::XLayerItem(Window win, XLayer &layer) : + m_layer(&layer), m_layeriterator(0) { + m_window = win; } -/* -XLayerItem::XLayerItem(XLayer &layer): - m_layer(&layer) { - m_layeriterator = layer.insert(*this); - }*/ XLayerItem::~XLayerItem() { - if (m_layer) - m_layer->remove(*this); + m_layer->remove(*this); } -void XLayerItem::setLayer(XLayer *layer) { +void XLayerItem::setLayer(XLayer &layer) { // make sure we don't try to set the same layer - m_layer = layer; + if (m_layer == &layer) + return; + + m_layer->remove(*this); + m_layer = &layer; + m_layer->insert(*this); } void XLayerItem::raise() {

@@ -64,21 +63,3 @@ void XLayerItem::stepDown() {

m_layer->stepDown(*this); } -void XLayerItem::addWindow(Window win) { - // I'd like to think we can trust ourselves that it won't be added twice... - // Otherwise we're always scanning through the list. - m_windows.push_back(win); -} - -void XLayerItem::removeWindow(Window win) { - // I'd like to think we can trust ourselves that it won't be added twice... - // Otherwise we're always scanning through the list. - - XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), win); - m_windows.erase(it); -} - -void XLayerItem::bringToTop(Window win) { - removeWindow(win); - addWindow(win); -}
M src/FbTk/XLayerItem.hhsrc/FbTk/XLayerItem.hh

@@ -20,52 +20,44 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: XLayerItem.hh,v 1.3 2003/02/02 16:32:41 rathnor Exp $ +// $Id: XLayerItem.hh,v 1.4 2003/02/03 13:42:47 fluxgen Exp $ #ifndef FBTK_XLAYERITEM_HH #define FBTK_XLAYERITEM_HH #include "LayerItem.hh" #include "XLayer.hh" +#include "NotCopyable.hh" + #include <X11/Xlib.h> namespace FbTk { -class XLayerItem : public LayerItem { +class XLayerItem : public LayerItem, private NotCopyable { public: typedef std::list<Window> Windows; - XLayerItem(Window win); + XLayerItem(Window win, XLayer &layer); ~XLayerItem(); - void setLayer(XLayer *layer); - XLayer *getLayer() const { return m_layer; } + + void setLayer(XLayer &layer); + void raise(); void lower(); void stepUp(); void stepDown(); - XLayer::iterator getLayerIterator() const { return m_layeriterator; }; - void setLayerIterator(XLayer::iterator it) { m_layeriterator = it; }; - bool isEmpty() const { return m_windows.empty(); } - - // not currently implemented - bool visible() { return true; } - - // an XLayerItem holds several windows that are equivalent in a layer - // (i.e. if one is raised, then they should all be). - void addWindow(Window win); - void removeWindow(Window win); - - // using this you can bring one window to the top (equivalent to add then remove) - void bringToTop(Window win); + //!! we don't need this? + bool visible() const { return true; } - Windows &getWindows() { return m_windows; } - size_t numWindows() const { return m_windows.size(); } + const XLayer &getLayer() const { return *m_layer; } + XLayer &getLayer() { return *m_layer; } + Window window() const { return m_window; } private: XLayer *m_layer; XLayer::iterator m_layeriterator; - Windows m_windows; + Window m_window; }; };