From 9616a676d869b8f67742da99d55e9327ea867166 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Wed, 23 Feb 2011 22:49:27 +0100 Subject: renamed FbTk::XLayer to FbTk::Layer and FbTk::XLayerItem to FbTk::LayerItem --- src/AlphaMenu.cc | 2 +- src/AlphaMenu.hh | 2 +- src/Ewmh.cc | 8 +- src/FbMenu.cc | 2 +- src/FbMenu.hh | 6 +- src/FbTk/Layer.cc | 310 ++++++++++++++++++++++++++++++++++++++++++++++++ src/FbTk/Layer.hh | 116 +++++++----------- src/FbTk/LayerItem.cc | 94 +++++++++++++++ src/FbTk/LayerItem.hh | 62 ++++++++-- src/FbTk/Makefile.am | 4 +- src/FbTk/MultLayers.cc | 34 +++--- src/FbTk/MultLayers.hh | 30 ++--- src/FbTk/XLayer.cc | 310 ------------------------------------------------ src/FbTk/XLayer.hh | 85 ------------- src/FbTk/XLayerItem.cc | 94 --------------- src/FbTk/XLayerItem.hh | 79 ------------ src/FbWinFrame.hh | 10 +- src/LayerMenu.cc | 2 +- src/LayerMenu.hh | 2 +- src/Screen.cc | 4 +- src/Screen.hh | 4 +- src/Slit.cc | 6 +- src/Slit.hh | 6 +- src/ToggleMenu.hh | 2 +- src/Toolbar.cc | 2 +- src/Toolbar.hh | 10 +- src/Window.hh | 8 +- src/Xinerama.hh | 4 +- src/fluxbox.cc | 2 +- src/tests/testLayers.cc | 22 ++-- 30 files changed, 586 insertions(+), 736 deletions(-) create mode 100644 src/FbTk/Layer.cc create mode 100644 src/FbTk/LayerItem.cc delete mode 100644 src/FbTk/XLayer.cc delete mode 100644 src/FbTk/XLayer.hh delete mode 100644 src/FbTk/XLayerItem.cc delete mode 100644 src/FbTk/XLayerItem.hh diff --git a/src/AlphaMenu.cc b/src/AlphaMenu.cc index f15c9d1..219d6ea 100644 --- a/src/AlphaMenu.cc +++ b/src/AlphaMenu.cc @@ -33,7 +33,7 @@ #include "Window.hh" AlphaMenu::AlphaMenu(FbTk::ThemeProxy &tm, - FbTk::ImageControl &imgctrl, FbTk::XLayer &layer): + FbTk::ImageControl &imgctrl, FbTk::Layer &layer): ToggleMenu(tm, imgctrl, layer) { diff --git a/src/AlphaMenu.hh b/src/AlphaMenu.hh index 27f26dd..0da21de 100644 --- a/src/AlphaMenu.hh +++ b/src/AlphaMenu.hh @@ -35,7 +35,7 @@ namespace FbTk { class AlphaMenu : public ToggleMenu { public: AlphaMenu(FbTk::ThemeProxy &tm, - FbTk::ImageControl &imgctrl, FbTk::XLayer &layer); + FbTk::ImageControl &imgctrl, FbTk::Layer &layer); // we override these to update the menu when the active window changes void move(int x, int y); diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 77581b8..241fd0a 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -34,8 +34,8 @@ #include "FbTk/App.hh" #include "FbTk/FbWindow.hh" #include "FbTk/I18n.hh" -#include "FbTk/XLayerItem.hh" -#include "FbTk/XLayer.hh" +#include "FbTk/LayerItem.hh" +#include "FbTk/Layer.hh" #include "FbTk/FbPixmap.hh" #include @@ -1205,8 +1205,8 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, above_win == winclient) // this would be very wrong :) return true; - FbTk::XLayerItem &below_item = winclient->fbwindow()->layerItem(); - FbTk::XLayerItem &above_item = above_win->fbwindow()->layerItem(); + FbTk::LayerItem &below_item = winclient->fbwindow()->layerItem(); + FbTk::LayerItem &above_item = above_win->fbwindow()->layerItem(); // this might break the transient_for layering diff --git a/src/FbMenu.cc b/src/FbMenu.cc index 5bc3622..dffd07c 100644 --- a/src/FbMenu.cc +++ b/src/FbMenu.cc @@ -29,7 +29,7 @@ FluxboxWindow *FbMenu::s_window = 0; FbMenu::FbMenu(FbTk::ThemeProxy &tm, - FbTk::ImageControl &imgctrl, FbTk::XLayer &layer): + FbTk::ImageControl &imgctrl, FbTk::Layer &layer): FbTk::Menu(tm, imgctrl), m_layeritem(fbwindow(), layer) { diff --git a/src/FbMenu.hh b/src/FbMenu.hh index 2e709fd..23c2ad5 100644 --- a/src/FbMenu.hh +++ b/src/FbMenu.hh @@ -25,7 +25,7 @@ #include #include "FbTk/Menu.hh" -#include "FbTk/XLayerItem.hh" +#include "FbTk/LayerItem.hh" #include "FbTk/AutoReloadHelper.hh" class FluxboxWindow; @@ -38,7 +38,7 @@ class MenuTheme; class FbMenu:public FbTk::Menu { public: FbMenu(FbTk::ThemeProxy &tm, FbTk::ImageControl &imgctrl, - FbTk::XLayer &layer); + FbTk::Layer &layer); virtual ~FbMenu() { } void raise() { m_layeritem.raise(); } void lower() { m_layeritem.lower(); } @@ -53,7 +53,7 @@ public: static FluxboxWindow *window() { return s_window; } private: - FbTk::XLayerItem m_layeritem; + FbTk::LayerItem m_layeritem; std::auto_ptr m_reloader; static FluxboxWindow *s_window; }; diff --git a/src/FbTk/Layer.cc b/src/FbTk/Layer.cc new file mode 100644 index 0000000..d3c6615 --- /dev/null +++ b/src/FbTk/Layer.cc @@ -0,0 +1,310 @@ +// Layer.cc for FbTk - fluxbox toolkit +// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) +// and Simon Bowden (rathnor at users.sourceforge.net) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// 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. + +#include "Layer.hh" +#include "LayerItem.hh" +#include "App.hh" +#include "FbWindow.hh" +#include "MultLayers.hh" + +#include +#include +#include + +using namespace FbTk; + +#ifdef DEBUG +using std::cerr; +using std::endl; +#endif // DEBUG + +namespace { + +int sum_windows(int nr, LayerItem* item) { + return nr + item->numWindows(); +} + +int count_windows(const FbTk::Layer::ItemList& items) { + return std::accumulate(items.begin(), items.end(), 0, sum_windows); +} + + +void extract_windows_to_stack(const LayerItem::Windows& windows, std::vector& stack) { + LayerItem::Windows::const_iterator i = windows.begin(); + LayerItem::Windows::const_iterator end = windows.end(); + for (; i != end; ++i) { + Window w = (*i)->window(); + if (w) + stack.push_back(w); + } +} + +void extract_windows_to_stack(const FbTk::Layer::ItemList& items, LayerItem* temp_raised, std::vector& stack) { + + if (temp_raised) { // add windows that go on top + extract_windows_to_stack(temp_raised->getWindows(), stack); + } + + FbTk::Layer::ItemList::const_iterator it = items.begin(); + FbTk::Layer::ItemList::const_iterator it_end = items.end(); + for (; it != it_end; ++it) { // add all the windows from each other item + if (*it == temp_raised) { + continue; + } + extract_windows_to_stack((*it)->getWindows(), stack); + } +} + +void restack(const FbTk::Layer::ItemList& items, LayerItem* temp_raised) { + + std::vector stack; + extract_windows_to_stack(items, temp_raised, stack); + + if (!stack.empty()) + XRestackWindows(FbTk::App::instance()->display(), &stack[0], stack.size()); +} + +} // end of anonymous namespace + + +void Layer::restack(const std::vector& layers) { + + std::vector stack; + std::vector::const_iterator l; + for (l = layers.begin(); l != layers.end(); ++l) { + extract_windows_to_stack((*l)->itemList(), 0, stack); + } + + if (!stack.empty()) + XRestackWindows(FbTk::App::instance()->display(), &stack[0], stack.size()); +} + +Layer::Layer(MultLayers &manager, int layernum): + m_manager(manager), m_layernum(layernum), m_needs_restack(false) { +} + +Layer::~Layer() { + +} + +void Layer::restack() { + if (m_manager.isUpdatable()) { + ::restack(itemList(), 0); + m_needs_restack = false; + } +} + +void Layer::restackAndTempRaise(LayerItem &item) { + ::restack(itemList(), &item); +} + +int Layer::countWindows() { + return ::count_windows(itemList()); +} + + +// Stack all windows associated with 'item' below the 'above' item +void Layer::stackBelowItem(LayerItem &item, LayerItem *above) { + if (!m_manager.isUpdatable()) + return; + + // if there are no windows provided for above us, + // then we must restack the entire layer + // we can't do XRaiseWindow because a restack then causes OverrideRedirect + // windows to get pushed to the bottom + if (!above || m_needs_restack) { // must need to go right to top + restack(); + return; + } + + std::vector stack; + + // We do have a window to stack below + // so we put it on top, and fill the rest of the array with the ones to go below it. + // assume that above's window exists + stack.push_back(above->getWindows().back()->window()); + + // fill the rest of the array + extract_windows_to_stack(item.getWindows(), stack); + + XRestackWindows(FbTk::App::instance()->display(), &stack[0], stack.size()); +} + +// We can't just use Restack here, because it won't do anything if they're +// already in the same relative order excluding other windows +void Layer::alignItem(LayerItem &item) { + if (itemList().front() == &item) { + stackBelowItem(item, m_manager.getLowestItemAboveLayer(m_layernum)); + return; + } + + // Note: some other things effectively assume that the window list is + // sorted from highest to lowest + // get our item + iterator myit = std::find(itemList().begin(), itemList().end(), &item); + iterator it = myit; + + // go to the one above it in our layer (top is front, so we decrement) + --it; + + // keep going until we find one that is currently visible to the user + while (it != itemList().begin() && !(*it)->visible()) + --it; + + if (it == itemList().begin() && !(*it)->visible()) + // reached front item, but it wasn't visible, therefore it was already raised + stackBelowItem(item, m_manager.getLowestItemAboveLayer(m_layernum)); + else + stackBelowItem(item, *it); + +} + +Layer::iterator Layer::insert(LayerItem &item, unsigned int pos) { +#ifdef DEBUG + // at this point we don't support insertions into a layer other than at the top + if (pos != 0) + cerr<<__FILE__<<"("<<__LINE__<<"): Insert using non-zero position not valid in Layer"< -#include +#include namespace FbTk { -template > -class LayerBase { -public: - typedef Container ListType; - typedef typename Container::iterator iterator; - typedef typename Container::reverse_iterator reverse_iterator; - virtual ~LayerBase() { } - /// insert in top by default - virtual iterator insert(ItemType &item, unsigned int pos=0); - /// remove item from list - virtual void remove(ItemType &item); - /// move item to top - virtual void raise(ItemType &item); - /// move item to bottom - virtual void lower(ItemType &item); - /// @return number of elements in layer - size_t size() const { return m_list.size(); } - /// @return layer list - const ListType &itemList() const { return m_list; } - /// @return layer list - ListType &itemList() { return m_list; } -protected: - virtual void restack(); -private: - ListType m_list; -}; +class MultLayers; +class LayerItem; -template -typename Container::iterator LayerBase::insert(ItemType &item, unsigned int position) { - // make sure we don't alreay have it in the list - if (std::find(itemList().begin(), itemList().end(), &item) != itemList().end()) - return m_list.end(); +class Layer { +public: - if (position > size()) - position = size(); + Layer(MultLayers &manager, int layernum); + ~Layer(); - iterator it = m_list.begin(); + typedef std::list ItemList; + typedef std::list::iterator iterator; - for (unsigned int i=0; i::reverse_iterator reverse_iterator; - m_list.insert(it, &item); - restack(); - return it++; -} + void setLayerNum(int layernum) { m_layernum = layernum; }; + int getLayerNum() { return m_layernum; }; + // Put all items on the same layer (called when layer item added to) + void alignItem(LayerItem &item); + int countWindows(); + void stackBelowItem(LayerItem &item, LayerItem *above); + LayerItem *getLowestItem(); + const ItemList &itemList() const { return m_items; } + ItemList &itemList() { return m_items; } + // we redefine these as Layer has special optimisations, and X restacking needs + iterator insert(LayerItem &item, unsigned int pos=0); + void remove(LayerItem &item); -template -void LayerBase::remove(ItemType &item) { - iterator it = std::find(itemList().begin(), itemList().end(), &item); - if (it != itemList().end()) - m_list.erase(it); -} + // bring to top of layer + void raise(LayerItem &item); + void lower(LayerItem &item); -template -void LayerBase::raise(ItemType &item) { - if (&item == itemList().front()) // already at the bottom - return; - remove(item); - insert(item, 0); - restack(); -} + // raise it, but don't make it permanent (i.e. restack will revert) + void tempRaise(LayerItem &item); -template -void LayerBase::lower(ItemType &item) { - if (&item == itemList().back()) // already at the bottom - return; - remove(item); - insert(item, size()); - restack(); -} + // send to next layer up + void raiseLayer(LayerItem &item); + void lowerLayer(LayerItem &item); + void moveToLayer(LayerItem &item, int layernum); -template -void LayerBase::restack() { -} + static void restack(const std::vector& layers); +private: + void restack(); + void restackAndTempRaise(LayerItem &item); -} // end namespace FbTk + MultLayers &m_manager; + int m_layernum; + bool m_needs_restack; + ItemList m_items; +}; +} // namespace FbTk -#endif // FBTK_LAYERTEMPLATE_HH +#endif // FBTK_XLAYER_HH diff --git a/src/FbTk/LayerItem.cc b/src/FbTk/LayerItem.cc new file mode 100644 index 0000000..02be4f0 --- /dev/null +++ b/src/FbTk/LayerItem.cc @@ -0,0 +1,94 @@ +// LayerItem.cc for FbTk - fluxbox toolkit +// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) +// and Simon Bowden (rathnor at users.sourceforge.net) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// 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. + +#include "LayerItem.hh" +#include "Layer.hh" + +#include + +using namespace FbTk; + +LayerItem::LayerItem(FbWindow &win, Layer &layer) : + m_layer(&layer) { + m_windows.push_back(&win); + m_layer->insert(*this); +} + + +LayerItem::~LayerItem() { + m_layer->remove(*this); +} + +void LayerItem::setLayer(Layer &layer) { + // make sure we don't try to set the same layer + if (m_layer == &layer) + return; + + m_layer->remove(*this); + m_layer = &layer; + m_layer->insert(*this); +} + +void LayerItem::raise() { + m_layer->raise(*this); +} + +void LayerItem::lower() { + m_layer->lower(*this); +} + +void LayerItem::tempRaise() { + m_layer->tempRaise(*this); +} + +void LayerItem::raiseLayer() { + m_layer->raiseLayer(*this); +} + +void LayerItem::lowerLayer() { + m_layer->lowerLayer(*this); +} + +void LayerItem::moveToLayer(int layernum) { + m_layer->moveToLayer(*this, layernum); +} + +void LayerItem::addWindow(FbWindow &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); + m_layer->alignItem(*this); +} + +void LayerItem::removeWindow(FbWindow &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. + + LayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win); + if (it != m_windows.end()) + m_windows.erase(it); +} + +void LayerItem::bringToTop(FbWindow &win) { + removeWindow(win); + addWindow(win); +} diff --git a/src/FbTk/LayerItem.hh b/src/FbTk/LayerItem.hh index 945bb9a..5d1035e 100644 --- a/src/FbTk/LayerItem.hh +++ b/src/FbTk/LayerItem.hh @@ -1,7 +1,7 @@ -// LayerItem.hh for fluxbox +// LayerItem.hh for FbTk - fluxbox toolkit // Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) // and Simon Bowden (rathnor at users.sourceforge.net) -// +// // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation @@ -20,20 +20,60 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -#ifndef FBTK_LAYERITEM_HH -#define FBTK_LAYERITEM_HH +#ifndef FBTK_XLAYERITEM_HH +#define FBTK_XLAYERITEM_HH + +#include "Layer.hh" +#include "NotCopyable.hh" +#include namespace FbTk { -/// pure interface class, an item in layer -class LayerItem { +class FbWindow; + +class LayerItem : private NotCopyable { public: - virtual ~LayerItem() { } + typedef std::vector Windows; + + LayerItem(FbWindow &win, Layer &layer); + ~LayerItem(); + + void setLayer(Layer &layer); + + void raise(); + void lower(); + void tempRaise(); // this raise gets reverted by a restack() + + // send to next layer up + void raiseLayer(); + void lowerLayer(); + void moveToLayer(int layernum); + + // this is needed for step and cycle functions + // (you need to know the next one visible, otherwise nothing may appear to happen) + // not yet implemented + bool visible() const { return true; } + + const Layer &getLayer() const { return *m_layer; } + Layer &getLayer() { return *m_layer; } + int getLayerNum() { return m_layer->getLayerNum(); } + + // an LayerItem holds several windows that are equivalent in a layer + // (i.e. if one is raised, then they should all be). + void addWindow(FbWindow &win); + void removeWindow(FbWindow &win); + + // using this you can bring one window to the top of this item (equivalent to add then remove) + void bringToTop(FbWindow &win); + + Windows &getWindows() { return m_windows; } + size_t numWindows() const { return m_windows.size(); } - virtual void raise() = 0; - virtual void lower() = 0; +private: + Layer *m_layer; + Windows m_windows; }; -} // end namespace FbTk +} -#endif // FBTK_LAYERITEM_HH +#endif // FBTK_XLAYERITEM_HH diff --git a/src/FbTk/Makefile.am b/src/FbTk/Makefile.am index 45a24b3..8619cc1 100644 --- a/src/FbTk/Makefile.am +++ b/src/FbTk/Makefile.am @@ -40,8 +40,8 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \ Button.hh Button.cc \ TextButton.hh TextButton.cc \ Container.hh Container.cc \ - Layer.hh LayerItem.hh MultLayers.cc MultLayers.hh \ - XLayer.cc XLayer.hh XLayerItem.cc XLayerItem.hh \ + MultLayers.cc MultLayers.hh \ + Layer.cc Layer.hh LayerItem.cc LayerItem.hh \ Resource.hh Resource.cc \ StringUtil.hh StringUtil.cc Parser.hh Parser.cc \ RegExp.hh RegExp.cc \ diff --git a/src/FbTk/MultLayers.cc b/src/FbTk/MultLayers.cc index 0f0748f..2027286 100644 --- a/src/FbTk/MultLayers.cc +++ b/src/FbTk/MultLayers.cc @@ -21,8 +21,8 @@ // DEALINGS IN THE SOFTWARE. #include "MultLayers.hh" -#include "XLayer.hh" -#include "XLayerItem.hh" +#include "Layer.hh" +#include "LayerItem.hh" #include "App.hh" #include "FbWindow.hh" @@ -34,7 +34,7 @@ MultLayers::MultLayers(int numlayers) : m_lock(0) { for (int i=0; i < numlayers; ++i) - m_layers.push_back(new XLayer(*this, i)); + m_layers.push_back(new Layer(*this, i)); } MultLayers::~MultLayers() { @@ -45,19 +45,19 @@ MultLayers::~MultLayers() { } -XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) { +LayerItem *MultLayers::getLowestItemAboveLayer(int layernum) { if (layernum >= static_cast(m_layers.size()) || layernum <= 0) return 0; layernum--; // next one up - XLayerItem *item = 0; + LayerItem *item = 0; while (layernum >= 0 && (item = m_layers[layernum]->getLowestItem()) == 0) layernum--; return item; } -void MultLayers::addToTop(XLayerItem &item, int layernum) { +void MultLayers::addToTop(LayerItem &item, int layernum) { layernum = FbTk::Util::clamp(layernum, 0, static_cast(m_layers.size()) - 1); m_layers[layernum]->insert(item); restack(); @@ -65,7 +65,7 @@ void MultLayers::addToTop(XLayerItem &item, int layernum) { // raise the whole layer -void MultLayers::raise(XLayer &layer) { +void MultLayers::raise(Layer &layer) { int layernum = layer.getLayerNum(); if (layernum >= static_cast(m_layers.size() - 1)) // already on top @@ -75,7 +75,7 @@ void MultLayers::raise(XLayer &layer) { } // lower the whole layer -void MultLayers::lower(XLayer &layer) { +void MultLayers::lower(Layer &layer) { int layernum = layer.getLayerNum(); if (layernum == 0) // already on bottom @@ -85,22 +85,22 @@ void MultLayers::lower(XLayer &layer) { } /* raise the item one level */ -void MultLayers::raiseLayer(XLayerItem &item) { +void MultLayers::raiseLayer(LayerItem &item) { // get the layer it is in - XLayer &curr_layer = item.getLayer(); + Layer &curr_layer = item.getLayer(); moveToLayer(item, curr_layer.getLayerNum()-1); } /* raise the item one level */ -void MultLayers::lowerLayer(XLayerItem &item) { +void MultLayers::lowerLayer(LayerItem &item) { // get the layer it is in - XLayer &curr_layer = item.getLayer(); + Layer &curr_layer = item.getLayer(); moveToLayer(item, curr_layer.getLayerNum()+1); } -void MultLayers::moveToLayer(XLayerItem &item, int layernum) { +void MultLayers::moveToLayer(LayerItem &item, int layernum) { // get the layer it is in - XLayer &curr_layer = item.getLayer(); + Layer &curr_layer = item.getLayer(); // do nothing if the item already is in the requested layer if (curr_layer.getLayerNum() == layernum) @@ -114,7 +114,7 @@ void MultLayers::restack() { if (!isUpdatable()) return; - XLayer::restack(m_layers); + Layer::restack(m_layers); } int MultLayers::size() { @@ -125,13 +125,13 @@ int MultLayers::size() { return num; } -XLayer *MultLayers::getLayer(size_t num) { +Layer *MultLayers::getLayer(size_t num) { if (num >= m_layers.size()) return 0; return m_layers[num]; } -const XLayer *MultLayers::getLayer(size_t num) const { +const Layer *MultLayers::getLayer(size_t num) const { if (num >= m_layers.size()) return 0; return m_layers[num]; diff --git a/src/FbTk/MultLayers.hh b/src/FbTk/MultLayers.hh index 735ff6a..62c006f 100644 --- a/src/FbTk/MultLayers.hh +++ b/src/FbTk/MultLayers.hh @@ -27,34 +27,34 @@ namespace FbTk { -class XLayerItem; -class XLayer; +class LayerItem; +class Layer; class MultLayers { public: explicit MultLayers(int numlayers); ~MultLayers(); - XLayerItem *getLowestItemAboveLayer(int layernum); + LayerItem *getLowestItemAboveLayer(int layernum); /// if there are none below, it will return null - XLayerItem *getItemBelow(XLayerItem &item); - XLayerItem *getItemAbove(XLayerItem &item); - void addToTop(XLayerItem &item, int layernum); - void remove(XLayerItem &item); + LayerItem *getItemBelow(LayerItem &item); + LayerItem *getItemAbove(LayerItem &item); + void addToTop(LayerItem &item, int layernum); + void remove(LayerItem &item); // raise/lower the whole layer - void raise(XLayer &layer); - void lower(XLayer &layer); + void raise(Layer &layer); + void lower(Layer &layer); // raise/lower the item a whole layer, not just to top of current layer - void raiseLayer(XLayerItem &item); - void lowerLayer(XLayerItem &item); + void raiseLayer(LayerItem &item); + void lowerLayer(LayerItem &item); - void moveToLayer(XLayerItem &item, int layernum); + void moveToLayer(LayerItem &item, int layernum); int size(); - XLayer *getLayer(size_t num); - const XLayer *getLayer(size_t num) const; + Layer *getLayer(size_t num); + const Layer *getLayer(size_t num) const; bool isUpdatable() const { return m_lock == 0; } void lock() { ++m_lock; } @@ -63,7 +63,7 @@ public: private: void restack(); - std::vector m_layers; + std::vector m_layers; int m_lock; }; diff --git a/src/FbTk/XLayer.cc b/src/FbTk/XLayer.cc deleted file mode 100644 index f20f8ff..0000000 --- a/src/FbTk/XLayer.cc +++ /dev/null @@ -1,310 +0,0 @@ -// XLayer.cc for FbTk - fluxbox toolkit -// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) -// and Simon Bowden (rathnor at users.sourceforge.net) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// 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. - -#include "XLayer.hh" -#include "XLayerItem.hh" -#include "App.hh" -#include "FbWindow.hh" -#include "MultLayers.hh" - -#include -#include -#include - -using namespace FbTk; - -#ifdef DEBUG -using std::cerr; -using std::endl; -#endif // DEBUG - -namespace { - -int sum_windows(int nr, XLayerItem* item) { - return nr + item->numWindows(); -} - -int count_windows(const FbTk::XLayer::ItemList& items) { - return std::accumulate(items.begin(), items.end(), 0, sum_windows); -} - - -void extract_windows_to_stack(const XLayerItem::Windows& windows, std::vector& stack) { - XLayerItem::Windows::const_iterator i = windows.begin(); - XLayerItem::Windows::const_iterator end = windows.end(); - for (; i != end; ++i) { - Window w = (*i)->window(); - if (w) - stack.push_back(w); - } -} - -void extract_windows_to_stack(const FbTk::XLayer::ItemList& items, XLayerItem* temp_raised, std::vector& stack) { - - if (temp_raised) { // add windows that go on top - extract_windows_to_stack(temp_raised->getWindows(), stack); - } - - FbTk::XLayer::ItemList::const_iterator it = items.begin(); - FbTk::XLayer::ItemList::const_iterator it_end = items.end(); - for (; it != it_end; ++it) { // add all the windows from each other item - if (*it == temp_raised) { - continue; - } - extract_windows_to_stack((*it)->getWindows(), stack); - } -} - -void restack(const FbTk::XLayer::ItemList& items, XLayerItem* temp_raised) { - - std::vector stack; - extract_windows_to_stack(items, temp_raised, stack); - - if (!stack.empty()) - XRestackWindows(FbTk::App::instance()->display(), &stack[0], stack.size()); -} - -} // end of anonymous namespace - - -void XLayer::restack(const std::vector& layers) { - - std::vector stack; - std::vector::const_iterator l; - for (l = layers.begin(); l != layers.end(); ++l) { - extract_windows_to_stack((*l)->itemList(), 0, stack); - } - - if (!stack.empty()) - XRestackWindows(FbTk::App::instance()->display(), &stack[0], stack.size()); -} - -XLayer::XLayer(MultLayers &manager, int layernum): - m_manager(manager), m_layernum(layernum), m_needs_restack(false) { -} - -XLayer::~XLayer() { - -} - -void XLayer::restack() { - if (m_manager.isUpdatable()) { - ::restack(itemList(), 0); - m_needs_restack = false; - } -} - -void XLayer::restackAndTempRaise(XLayerItem &item) { - ::restack(itemList(), &item); -} - -int XLayer::countWindows() { - return ::count_windows(itemList()); -} - - -// Stack all windows associated with 'item' below the 'above' item -void XLayer::stackBelowItem(XLayerItem &item, XLayerItem *above) { - if (!m_manager.isUpdatable()) - return; - - // if there are no windows provided for above us, - // then we must restack the entire layer - // we can't do XRaiseWindow because a restack then causes OverrideRedirect - // windows to get pushed to the bottom - if (!above || m_needs_restack) { // must need to go right to top - restack(); - return; - } - - std::vector stack; - - // We do have a window to stack below - // so we put it on top, and fill the rest of the array with the ones to go below it. - // assume that above's window exists - stack.push_back(above->getWindows().back()->window()); - - // fill the rest of the array - extract_windows_to_stack(item.getWindows(), stack); - - XRestackWindows(FbTk::App::instance()->display(), &stack[0], stack.size()); -} - -// We can't just use Restack here, because it won't do anything if they're -// already in the same relative order excluding other windows -void XLayer::alignItem(XLayerItem &item) { - if (itemList().front() == &item) { - stackBelowItem(item, m_manager.getLowestItemAboveLayer(m_layernum)); - return; - } - - // Note: some other things effectively assume that the window list is - // sorted from highest to lowest - // get our item - iterator myit = std::find(itemList().begin(), itemList().end(), &item); - iterator it = myit; - - // go to the one above it in our layer (top is front, so we decrement) - --it; - - // keep going until we find one that is currently visible to the user - while (it != itemList().begin() && !(*it)->visible()) - --it; - - if (it == itemList().begin() && !(*it)->visible()) - // reached front item, but it wasn't visible, therefore it was already raised - stackBelowItem(item, m_manager.getLowestItemAboveLayer(m_layernum)); - else - stackBelowItem(item, *it); - -} - -XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) { -#ifdef DEBUG - // at this point we don't support insertions into a layer other than at the top - if (pos != 0) - cerr<<__FILE__<<"("<<__LINE__<<"): Insert using non-zero position not valid in XLayer"< -#include - -namespace FbTk { - -class MultLayers; -class XLayerItem; - -class XLayer { -public: - - XLayer(MultLayers &manager, int layernum); - ~XLayer(); - - typedef std::list ItemList; - typedef std::list::iterator iterator; - - //typedef std::list::reverse_iterator reverse_iterator; - - void setLayerNum(int layernum) { m_layernum = layernum; }; - int getLayerNum() { return m_layernum; }; - // Put all items on the same layer (called when layer item added to) - void alignItem(XLayerItem &item); - int countWindows(); - void stackBelowItem(XLayerItem &item, XLayerItem *above); - XLayerItem *getLowestItem(); - const ItemList &itemList() const { return m_items; } - ItemList &itemList() { return m_items; } - - // we redefine these as XLayer has special optimisations, and X restacking needs - iterator insert(XLayerItem &item, unsigned int pos=0); - void remove(XLayerItem &item); - - // bring to top of layer - void raise(XLayerItem &item); - void lower(XLayerItem &item); - - // raise it, but don't make it permanent (i.e. restack will revert) - void tempRaise(XLayerItem &item); - - // send to next layer up - void raiseLayer(XLayerItem &item); - void lowerLayer(XLayerItem &item); - void moveToLayer(XLayerItem &item, int layernum); - - static void restack(const std::vector& layers); - -private: - void restack(); - void restackAndTempRaise(XLayerItem &item); - - MultLayers &m_manager; - int m_layernum; - bool m_needs_restack; - ItemList m_items; -}; - -} // namespace FbTk - -#endif // FBTK_XLAYER_HH diff --git a/src/FbTk/XLayerItem.cc b/src/FbTk/XLayerItem.cc deleted file mode 100644 index 7f6f594..0000000 --- a/src/FbTk/XLayerItem.cc +++ /dev/null @@ -1,94 +0,0 @@ -// XLayerItem.cc for FbTk - fluxbox toolkit -// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) -// and Simon Bowden (rathnor at users.sourceforge.net) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// 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. - -#include "XLayerItem.hh" -#include "XLayer.hh" - -#include - -using namespace FbTk; - -XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) : - m_layer(&layer) { - m_windows.push_back(&win); - m_layer->insert(*this); -} - - -XLayerItem::~XLayerItem() { - m_layer->remove(*this); -} - -void XLayerItem::setLayer(XLayer &layer) { - // make sure we don't try to set the same layer - if (m_layer == &layer) - return; - - m_layer->remove(*this); - m_layer = &layer; - m_layer->insert(*this); -} - -void XLayerItem::raise() { - m_layer->raise(*this); -} - -void XLayerItem::lower() { - m_layer->lower(*this); -} - -void XLayerItem::tempRaise() { - m_layer->tempRaise(*this); -} - -void XLayerItem::raiseLayer() { - m_layer->raiseLayer(*this); -} - -void XLayerItem::lowerLayer() { - m_layer->lowerLayer(*this); -} - -void XLayerItem::moveToLayer(int layernum) { - m_layer->moveToLayer(*this, layernum); -} - -void XLayerItem::addWindow(FbWindow &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); - m_layer->alignItem(*this); -} - -void XLayerItem::removeWindow(FbWindow &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); - if (it != m_windows.end()) - m_windows.erase(it); -} - -void XLayerItem::bringToTop(FbWindow &win) { - removeWindow(win); - addWindow(win); -} diff --git a/src/FbTk/XLayerItem.hh b/src/FbTk/XLayerItem.hh deleted file mode 100644 index 67da511..0000000 --- a/src/FbTk/XLayerItem.hh +++ /dev/null @@ -1,79 +0,0 @@ -// XLayerItem.hh for FbTk - fluxbox toolkit -// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) -// and Simon Bowden (rathnor at users.sourceforge.net) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// 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. - -#ifndef FBTK_XLAYERITEM_HH -#define FBTK_XLAYERITEM_HH - -#include "XLayer.hh" -#include "NotCopyable.hh" -#include - -namespace FbTk { - -class FbWindow; - -class XLayerItem : private NotCopyable { -public: - typedef std::vector Windows; - - XLayerItem(FbWindow &win, XLayer &layer); - ~XLayerItem(); - - void setLayer(XLayer &layer); - - void raise(); - void lower(); - void tempRaise(); // this raise gets reverted by a restack() - - // send to next layer up - void raiseLayer(); - void lowerLayer(); - void moveToLayer(int layernum); - - // this is needed for step and cycle functions - // (you need to know the next one visible, otherwise nothing may appear to happen) - // not yet implemented - bool visible() const { return true; } - - const XLayer &getLayer() const { return *m_layer; } - XLayer &getLayer() { return *m_layer; } - int getLayerNum() { return m_layer->getLayerNum(); } - - // an XLayerItem holds several windows that are equivalent in a layer - // (i.e. if one is raised, then they should all be). - void addWindow(FbWindow &win); - void removeWindow(FbWindow &win); - - // using this you can bring one window to the top of this item (equivalent to add then remove) - void bringToTop(FbWindow &win); - - Windows &getWindows() { return m_windows; } - size_t numWindows() const { return m_windows.size(); } - -private: - XLayer *m_layer; - Windows m_windows; -}; - -} - -#endif // FBTK_XLAYERITEM_HH diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index 162bf3d..68da564 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh @@ -27,7 +27,7 @@ #include "FbTk/RefCount.hh" #include "FbTk/Subject.hh" #include "FbTk/Color.hh" -#include "FbTk/XLayerItem.hh" +#include "FbTk/LayerItem.hh" #include "FbTk/TextButton.hh" #include "FbTk/DefaultValue.hh" #include "FbTk/Container.hh" @@ -50,7 +50,7 @@ namespace FbTk { class ImageControl; template class Command; class Texture; -class XLayer; +class Layer; } /// holds a window frame with a client window @@ -231,8 +231,8 @@ public: unsigned int buttonHeight() const; bool externalTabMode() const { return m_tabmode == EXTERNAL && m_use_tabs; } - const FbTk::XLayerItem &layerItem() const { return m_layeritem; } - FbTk::XLayerItem &layerItem() { return m_layeritem; } + const FbTk::LayerItem &layerItem() const { return m_layeritem; } + FbTk::LayerItem &layerItem() { return m_layeritem; } const FbTk::Subject &frameExtentSig() const { return m_frame_extent_sig; } FbTk::Subject &frameExtentSig() { return m_frame_extent_sig; } @@ -310,7 +310,7 @@ private: //@{ FbTk::FbWindow m_window; ///< base window that holds each decorations (ie titlebar, handles) // want this deleted before the windows in it - FbTk::XLayerItem m_layeritem; + FbTk::LayerItem m_layeritem; FbTk::FbWindow m_titlebar; ///< titlebar window FbTk::Container m_tab_container; ///< Holds tabs diff --git a/src/LayerMenu.cc b/src/LayerMenu.cc index f1d9dd9..0638366 100644 --- a/src/LayerMenu.cc +++ b/src/LayerMenu.cc @@ -30,7 +30,7 @@ LayerMenu::LayerMenu(FbTk::ThemeProxy &tm, FbTk::ImageControl &imgctrl, - FbTk::XLayer &layer, LayerObject *object, bool save_rc): + FbTk::Layer &layer, LayerObject *object, bool save_rc): ToggleMenu(tm, imgctrl, layer) { _FB_USES_NLS; diff --git a/src/LayerMenu.hh b/src/LayerMenu.hh index 40e934c..ffb6c3f 100644 --- a/src/LayerMenu.hh +++ b/src/LayerMenu.hh @@ -64,7 +64,7 @@ class LayerMenu : public ToggleMenu { public: LayerMenu(FbTk::ThemeProxy &tm, FbTk::ImageControl &imgctrl, - FbTk::XLayer &layer, LayerObject *item, bool save_rc); + FbTk::Layer &layer, LayerObject *item, bool save_rc); void show(); }; diff --git a/src/Screen.cc b/src/Screen.cc index 1f53edc..e13c2c6 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -62,7 +62,7 @@ #include "FbTk/FbWindow.hh" #include "FbTk/SimpleCommand.hh" #include "FbTk/MultLayers.hh" -#include "FbTk/XLayerItem.hh" +#include "FbTk/LayerItem.hh" #include "FbTk/MacroCommand.hh" #include "FbTk/StringUtil.hh" #include "FbTk/ImageControl.hh" @@ -1794,7 +1794,7 @@ void BScreen::hideGeometry() { m_geom_window->hide(); } -void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) { +void BScreen::setLayer(FbTk::LayerItem &item, int layernum) { m_layermanager.moveToLayer(item, layernum); } diff --git a/src/Screen.hh b/src/Screen.hh index b3e80be..1a4ba9f 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -72,7 +72,7 @@ class OSDWindow; namespace FbTk { class Menu; class ImageControl; -class XLayerItem; +class LayerItem; class FbWindow; class Subject; } @@ -386,7 +386,7 @@ public: TooltipWindow& tooltipWindow() { return *m_tooltip_window; } - void setLayer(FbTk::XLayerItem &item, int layernum); + void setLayer(FbTk::LayerItem &item, int layernum); // remove? no, items are never removed from their layer until they die /// updates root window size and resizes/reconfigures screen clients diff --git a/src/Slit.cc b/src/Slit.cc index bdd1a28..aa62997 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -46,7 +46,7 @@ #include "FbCommands.hh" #include "Layer.hh" #include "LayerMenu.hh" -#include "FbTk/XLayer.hh" +#include "FbTk/Layer.hh" #include "RootTheme.hh" #include "FbMenu.hh" @@ -218,7 +218,7 @@ private: unsigned int Slit::s_eventmask = SubstructureRedirectMask | ButtonPressMask | EnterWindowMask | LeaveWindowMask | ExposureMask; -Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) +Slit::Slit(BScreen &scr, FbTk::Layer &layer, const char *filename) : m_hidden(false), m_visible(false), m_screen(scr), m_clientlist_menu(scr.menuTheme(), @@ -292,7 +292,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) frame.window.setAlpha(*m_rc_alpha); } - m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer)); + m_layeritem.reset(new FbTk::LayerItem(frame.window, layer)); m_layermenu.reset(new LayerMenu(scr.menuTheme(), scr.imageControl(), diff --git a/src/Slit.hh b/src/Slit.hh index 5514b42..fea43ea 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -37,7 +37,7 @@ #include "FbTk/FbWindow.hh" #include "FbTk/Timer.hh" #include "FbTk/Resource.hh" -#include "FbTk/XLayerItem.hh" +#include "FbTk/LayerItem.hh" #include "FbTk/Signal.hh" #include @@ -69,7 +69,7 @@ public: RIGHTBOTTOM, RIGHTCENTER, RIGHTTOP }; - Slit(BScreen &screen, FbTk::XLayer &layer, const char *filename = 0); + Slit(BScreen &screen, FbTk::Layer &layer, const char *filename = 0); virtual ~Slit(); void show() { frame.window.show(); m_visible = true; } @@ -178,7 +178,7 @@ private: // for KDE Atom m_kwm1_dockwindow, m_kwm2_dockwindow; - std::auto_ptr m_layeritem; + std::auto_ptr m_layeritem; std::auto_ptr m_slit_theme; static unsigned int s_eventmask; Strut *m_strut; diff --git a/src/ToggleMenu.hh b/src/ToggleMenu.hh index e7c0ad0..9f6f00b 100644 --- a/src/ToggleMenu.hh +++ b/src/ToggleMenu.hh @@ -31,7 +31,7 @@ class ToggleMenu: public FbMenu { public: ToggleMenu(class FbTk::ThemeProxy &tm, - FbTk::ImageControl &imgctrl, FbTk::XLayer &layer): + FbTk::ImageControl &imgctrl, FbTk::Layer &layer): FbMenu(tm, imgctrl, layer) { } virtual ~ToggleMenu() {} diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 26722f7..896268f 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -181,7 +181,7 @@ Toolbar::Frame::~Frame() { evm.remove(window); } -Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): +Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width): m_hidden(false), frame(*this, scrn.screenNumber()), m_window_pm(0), diff --git a/src/Toolbar.hh b/src/Toolbar.hh index ed77335..1f41ed5 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -37,8 +37,8 @@ #include "FbTk/Timer.hh" #include "FbTk/Resource.hh" -#include "FbTk/XLayer.hh" -#include "FbTk/XLayerItem.hh" +#include "FbTk/Layer.hh" +#include "FbTk/LayerItem.hh" #include "FbTk/EventHandler.hh" #include "FbTk/FbWindow.hh" #include "FbTk/Signal.hh" @@ -74,7 +74,7 @@ public: }; /// Create a toolbar on the screen with specific width - Toolbar(BScreen &screen, FbTk::XLayer &layer, size_t width = 200); + Toolbar(BScreen &screen, FbTk::Layer &layer, size_t width = 200); virtual ~Toolbar(); @@ -102,7 +102,7 @@ public: void reconfigure(); void setPlacement(Placement where); - int layerNumber() const { return const_cast(m_layeritem).getLayerNum(); } + int layerNumber() const { return const_cast(m_layeritem).getLayerNum(); } const FbTk::Menu &menu() const { return m_toolbarmenu; } FbTk::Menu &menu() { return m_toolbarmenu; } @@ -164,7 +164,7 @@ private: FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar - FbTk::XLayerItem m_layeritem; ///< layer item, must be declared before layermenu + FbTk::LayerItem m_layeritem; ///< layer item, must be declared before layermenu LayerMenu m_layermenu; FbMenu m_placementmenu, m_toolbarmenu; #ifdef XINERAMA diff --git a/src/Window.hh b/src/Window.hh index fee2807..9c2037a 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -30,7 +30,7 @@ #include "FbTk/Subject.hh" #include "FbTk/Observer.hh" #include "FbTk/EventHandler.hh" -#include "FbTk/XLayerItem.hh" +#include "FbTk/LayerItem.hh" #include "FbTk/Signal.hh" #include "FbWinFrame.hh" @@ -55,7 +55,7 @@ namespace FbTk { class TextButton; class MenuTheme; class ImageControl; -class XLayer; +class Layer; } /// Creates the window frame and handles any window event for it @@ -403,8 +403,8 @@ public: bool isTyping() const; - const FbTk::XLayerItem &layerItem() const { return m_frame.layerItem(); } - FbTk::XLayerItem &layerItem() { return m_frame.layerItem(); } + const FbTk::LayerItem &layerItem() const { return m_frame.layerItem(); } + FbTk::LayerItem &layerItem() { return m_frame.layerItem(); } Window clientWindow() const; diff --git a/src/Xinerama.hh b/src/Xinerama.hh index 9d7941b..b0ff70e 100644 --- a/src/Xinerama.hh +++ b/src/Xinerama.hh @@ -63,7 +63,7 @@ template class XineramaHeadMenu : public ToggleMenu { public: XineramaHeadMenu(FbTk::ThemeProxy &tm, BScreen &screen, - FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, + FbTk::ImageControl &imgctrl, FbTk::Layer &layer, ItemType &item, const FbTk::FbString & title = ""); void reloadHeads(); @@ -76,7 +76,7 @@ private: template XineramaHeadMenu::XineramaHeadMenu( FbTk::ThemeProxy &tm, BScreen &screen, - FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, ItemType &item, + FbTk::ImageControl &imgctrl, FbTk::Layer &layer, ItemType &item, const FbTk::FbString & title): ToggleMenu(tm, imgctrl, layer), m_object(item), m_screen(screen) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 4513c47..ee0abae 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -465,7 +465,7 @@ Fluxbox::Fluxbox(int argc, char **argv, Fluxbox::~Fluxbox() { // this needs to be destroyed before screens; otherwise, menus stored in - // key commands cause a segfault when the XLayerItem is destroyed + // key commands cause a segfault when the LayerItem is destroyed m_key.reset(0); leaveAll(); // leave all connections diff --git a/src/tests/testLayers.cc b/src/tests/testLayers.cc index 23d2f67..181e138 100644 --- a/src/tests/testLayers.cc +++ b/src/tests/testLayers.cc @@ -7,8 +7,8 @@ #include "Color.hh" #include "EventManager.hh" #include -#include "XLayer.hh" -#include "XLayerItem.hh" +#include "Layer.hh" +#include "LayerItem.hh" #include "MultLayers.hh" using namespace FbTk; @@ -87,26 +87,26 @@ int main() { Display *disp = app.display(); XEvent event; MultLayers *ml = new MultLayers(3); - XLayerItem *item_red = new XLayerItem(win_red.window()); + LayerItem *item_red = new XLayerItem(win_red.window()); item_red->addWindow(win_redB.window()); - XLayerItem *item_green = new XLayerItem(win_green.window()); - XLayerItem *item_blue = new XLayerItem(win_blue.window()); + LayerItem *item_green = new LayerItem(win_green.window()); + LayerItem *item_blue = new LayerItem(win_blue.window()); ml->addToTop(*item_blue, 0); ml->addToTop(*item_green, 0); ml->addToTop(*item_red, 0); - XLayerItem *item_red2 = new XLayerItem(win_red2.window()); - XLayerItem *item_green2 = new XLayerItem(win_green2.window()); - XLayerItem *item_blue2 = new XLayerItem(win_blue2.window()); + LayerItem *item_red2 = new LayerItem(win_red2.window()); + LayerItem *item_green2 = new LayerItem(win_green2.window()); + LayerItem *item_blue2 = new LayerItem(win_blue2.window()); ml->addToTop(*item_blue2, 1); ml->addToTop(*item_green2, 1); ml->addToTop(*item_red2, 1); - XLayerItem *item_red3 = new XLayerItem(win_red3.window()); - XLayerItem *item_green3 = new XLayerItem(win_green3.window()); - XLayerItem *item_blue3 = new XLayerItem(win_blue3.window()); + LayerItem *item_red3 = new LayerItem(win_red3.window()); + LayerItem *item_green3 = new LayerItem(win_green3.window()); + LayerItem *item_blue3 = new LayerItem(win_blue3.window()); ml->addToTop(*item_blue3, 2); ml->addToTop(*item_green3, 2); -- cgit v0.11.2