fixing up of layer code

This commit is contained in:
rathnor 2003-02-09 14:11:14 +00:00
parent 1a04cf1ce2
commit e3b99d4e48
15 changed files with 452 additions and 290 deletions

View file

@ -1,5 +1,9 @@
(Format: Year/Month/Day)
Changes for 0.1.15:
*10/02/03:
* More fiddling of Layer code, cleaning up (Henrik + Simon)
FbTk/MultLayers.hh/cc FbTk/XLayer.hh/cc FbTk/XLayerItem.hh/cc
Gnome.cc Screen.hh/cc Tab.cc Window.hh/cc Workspace.cc fluxbox.cc
*03/02/03:
* Integration of new Layering code, plus updates to the code (Simon)
- new KeyActions: Raise/LowerLayer, AlwaysOnTop/Bottom, Top/BottomLayer

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: MultLayers.cc,v 1.4 2003/02/03 13:46:13 fluxgen Exp $
// $Id: MultLayers.cc,v 1.5 2003/02/09 14:11:13 rathnor Exp $
#include "MultLayers.hh"
#include "XLayer.hh"
@ -97,13 +97,41 @@ void MultLayers::addToTop(XLayerItem &item, int layernum) {
restack();
}
// raise the whole layer
void MultLayers::raise(XLayer &layer) {
int layernum = layer.getLayerNum();
if (layernum >= (m_layers.size() - 1))
// already on top
return;
// not yet implemented
}
// lower the whole layer
void MultLayers::lower(XLayer &layer) {
int layernum = layer.getLayerNum();
if (layernum == 0)
// already on bottom
return;
// not yet implemented
}
/* raise the item one level */
void MultLayers::raise(XLayerItem &item) {
void MultLayers::raiseLayer(XLayerItem &item) {
// get the layer it is in
XLayer &curr_layer = item.getLayer();
moveToLayer(item, curr_layer.getLayerNum()-1);
}
/* raise the item one level */
void MultLayers::lowerLayer(XLayerItem &item) {
// get the layer it is in
XLayer &curr_layer = item.getLayer();
moveToLayer(item, curr_layer.getLayerNum()+1);
}
void MultLayers::moveToLayer(XLayerItem &item, int layernum) {
// get the layer it is in
XLayer &curr_layer = item.getLayer();
@ -119,28 +147,34 @@ void MultLayers::moveToLayer(XLayerItem &item, int layernum) {
layernum = m_layers.size()-1;
// remove item from old layer and insert it into the
item.setLayer(*m_layers[layernum]);
curr_layer.remove(item);
m_layers[layernum]->insert(item);
}
void MultLayers::restack() {
size_t winlist_size=0;
for (size_t layer=0; layer < m_layers.size(); layer++) {
winlist_size += m_layers[layer]->countWindows();
int layernum=0, winnum=0, size=0;
for (; layernum < m_layers.size(); layernum++) {
size += m_layers[layernum]->countWindows();
}
Window *winlist = new Window[winlist_size];
for (size_t layer=0, window=0; layer < m_layers.size(); layer++) {
Window *winlist = new Window[size];
for (layernum=0; layernum < m_layers.size(); layernum++) {
XLayer::ItemList::iterator item_it = m_layers[layer]->getItemList().begin();
XLayer::ItemList::iterator item_it_end = m_layers[layer]->getItemList().end();
for (; item_it != item_it_end; ++item_it, window++)
winlist[window] = (*item_it)->window();
XLayer::ItemList::iterator it = m_layers[layernum]->getItemList().begin();
XLayer::ItemList::iterator it_end = m_layers[layernum]->getItemList().end();
// add all windows from each layeritem in each layer
for (; it != it_end; ++it) {
XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end();
for (; wit != wit_end; ++wit, winnum++) {
winlist[winnum] = (*wit);
}
}
}
XRestackWindows(FbTk::App::instance()->display(), winlist, winlist_size);
XRestackWindows(FbTk::App::instance()->display(), winlist, size);
delete[] winlist;
delete [] winlist;
}
int MultLayers::size() {

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: MultLayers.hh,v 1.4 2003/02/03 13:46:42 fluxgen Exp $
// $Id: MultLayers.hh,v 1.5 2003/02/09 14:11:14 rathnor Exp $
#ifndef FBTK_MULTLAYERS_HH
#define FBTK_MULTLAYERS_HH
@ -44,9 +44,13 @@ public:
void addToTop(XLayerItem &item, int layernum);
void remove(XLayerItem &item);
// raise/lower the whole layer
void raise(XLayer &layer);
void lower(XLayer &layer);
// raise/lower the item a whole layer, not just to top of current layer
void raise(XLayerItem &item);
void lower(XLayerItem &item);
void raiseLayer(XLayerItem &item);
void lowerLayer(XLayerItem &item);
void moveToLayer(XLayerItem &item, int layernum);
int size();

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: XLayer.cc,v 1.4 2003/02/03 13:45:23 fluxgen Exp $
// $Id: XLayer.cc,v 1.5 2003/02/09 14:11:14 rathnor Exp $
#include "XLayer.hh"
#include "XLayerItem.hh"
@ -44,15 +44,24 @@ void XLayer::restack() {
// each LayerItem can contain several windows
iterator it = itemList().begin();
iterator it_end = itemList().end();
it = itemList().begin();
it_end = itemList().end();
Window *winlist = new Window[num_windows];
size_t j=0;
for (size_t window=0; it != it_end; ++it, window++) {
winlist[window] = (*it)->window();
// add all the windows from each item
for (size_t i=0; it != it_end; ++it, i++) {
XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end();
for (; wit != wit_end; ++wit, j++) {
winlist[j] = (*wit);
}
}
XRestackWindows(FbTk::App::instance()->display(), winlist, num_windows);
delete [] winlist;
}
int XLayer::countWindows() {
@ -60,70 +69,80 @@ int XLayer::countWindows() {
iterator it = itemList().begin();
iterator it_end = itemList().end();
for (size_t i=0; it != it_end; ++it, i++) {
num_windows ++; // one window per item
num_windows += (*it)->numWindows();
}
return num_windows;
}
// Stack all windows associated with 'item' below the 'above' item
void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) {
//!! What????
// little optimisation
/* Window *winlist;
size_t i, size, num = item->numWindows();
Window *winlist;
size_t winnum, size, num = item->numWindows();
// if there are no windows provided for above us,
// then we must have to go right to the top of the stack
if (!above) { // must need to go right to top
XRaiseWindow(FbTk::App::instance()->display(), item->getWindows().front());
// if this XLayerItem has more than one window,
// then we'll stack the rest in under the front one too
// our size needs to be the number of windows in the group, since there isn't one above.
if (num > 1) {
i = 0;
winnum = 0;
// stack relative to top one (just raised)
size = num;
winlist = new Window[size];
} else {
// we've raised the window, nothing else to do
return;
}
} else {
// We do have a window to stack below
i=1;
// stack relative to one above
// so we put it on top, and fill the rest of the array with the ones to go below it.
winnum = 1;
size = num+1;
winlist = new Window[size];
winlist[0] = above->getWindows().front();
winlist[0] = above->getWindows().back();
}
// fill the rest of the array
XLayerItem::Windows::iterator it = item->getWindows().begin();
XLayerItem::Windows::iterator it_end = item->getWindows().end();
for (; it != it_end; ++it, i++) {
winlist[i] = (*it);
for (; it != it_end; ++it, winnum++) {
winlist[winnum] = (*it);
}
// stack the windows
XRestackWindows(FbTk::App::instance()->display(), winlist, size);
delete [] winlist;
*/
}
XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) {
#ifdef DEBUG
if (pos != 0)//!! Why????
// 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"<<endl;
#endif // DEBUG
itemList().push_front(&item);
// restack below next window up
// item.setLayerIterator(itemList().begin());
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
return itemList().begin();
}
void XLayer::remove(XLayerItem &item) {
void XLayer::remove(XLayerItem &item) {
iterator it = itemList().begin();
iterator it_end = itemList().end();
for (; it != it_end; ++it) {
if (*it == &item)
if (*it == &item) {
itemList().erase(it);
break;
}
}
}
@ -141,7 +160,8 @@ void XLayer::cycleUp() {
}
void XLayer::cycleDown() {
// need to find highest visible window, and move it to bottom
// need to find lowest visible window, and move it to top
// so use a reverse iterator, and the same logic as cycleUp()
reverse_iterator it = itemList().rbegin();
reverse_iterator it_end = itemList().rend();
while (it != it_end && !(*it)->visible())
@ -159,80 +179,136 @@ void XLayer::stepUp(XLayerItem &item) {
if (&item == itemList().front())
return; // nothing to do
//!! better stable and slow than buggy!
/*
// TODO: is there a better way of doing this?
iterator it = item.getLayerIterator();
it--;
while ((*it) != itemList().front() && !(*it)->visible())
// 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().front() && !(*it)->visible()) {
if (it == itemList().begin() && !(*it)->visible()) {
// reached front item, but it wasn't visible, therefore it was already raised
//moveToBottom(item);
} else {
// it is the next visible item down, we need to be above it.
itemList().erase(item.getLayerIterator());
//itemList().insert(it, item);
item.setLayerIterator(it = itemList().insert(it, &item));
if (*it == itemList().front()) {
// remove that item from the list and add it back to before it (the one we want to go above)
itemList().erase(myit);
itemList().insert(it, &item);
// if we've reached the top of the layer, we need to stack below the next one up
if (it == itemList().begin()) {
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
} else {
it--;
// otherwise go up one in this layer (i.e. above the one we want to go above)
--it;
// and stack below that.
stackBelowItem(&item, *it);
}
}
*/
}
void XLayer::stepDown(XLayerItem &item) {
// need to find next visible window down, and put it below that
// if we're already the bottom of the layer
if (&item == itemList().back())
return; // nothing to do
//!! better stable and slow than buggy!
/* iterator it = item.getLayerIterator();
// get our position
iterator myit = std::find(itemList().begin(), itemList().end(), &item);
iterator it = myit;
// go one below it (top is front, so we must increment)
it++;
iterator it_end = itemList().end();
while (it != it_end && !(*it)->visible())
++it;
// keep going down until we find a visible one
while (it != it_end && !(*it)->visible())
it++;
// if we didn't reach the end, then stack below the
// item that we found.
if (it != it_end)
stackBelowItem(&item, *it);
*/
// if we did reach the end, then there are no visible windows, so we don't do anything
}
//!!
void XLayer::raise(XLayerItem &item) {
// assume it is already in this layer
if (&item == itemList().front())
return; // nothing to do
// itemList().erase(item.getLayerIterator());
iterator it = std::find(itemList().begin(), itemList().end(), &item);
if (it != itemList().end())
itemList().erase(it);
#ifdef DEBUG
else {
cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: raise on item not in layer["<<m_layernum<<"]"<<endl;
return;
}
#endif // DEBUG
itemList().push_front(&item);
// item.setLayerIterator(itemList().begin());
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
}
void XLayer::lower(XLayerItem &item) {
// assume already in this layer
// is it already the lowest?
if (&item == itemList().back())
return; // nothing to do
//!! better stable and slow than buggy!
/*
itemList().erase(item.getLayerIterator());
iterator it = std::find(itemList().begin(), itemList().end(), &item);
if (it != itemList().end())
// remove this item
itemList().erase(it);
#ifdef DEBUG
else {
cerr<<__FILE__<<"("<<__LINE__<<"): WARNING: lower on item not in layer"<<endl;
return;
}
#endif // DEBUG
// add it to the bottom
itemList().push_back(&item);
iterator it = itemList().end();
// find the item we need to stack below
// start at the end
it = itemList().end();
// go up one so we have an object (which must exist, since at least this item is in the layer)
it--;
item.setLayerIterator(it);
it--;
stackBelowItem(&item, *it); // must exist, otherwise item must == itemList().back()
*/
// go down another one
// must exist, otherwise our item must == itemList().back()
it--;
// and restack our window below that one.
stackBelowItem(&item, *it);
}
void XLayer::raiseLayer(XLayerItem &item) {
m_manager.raiseLayer(item);
}
void XLayer::lowerLayer(XLayerItem &item) {
m_manager.lowerLayer(item);
}
void XLayer::moveToLayer(XLayerItem &item, int layernum) {
m_manager.moveToLayer(item, layernum);
}
XLayerItem *XLayer::getLowestItem() {
if (itemList().empty())
return 0;
@ -241,22 +317,27 @@ XLayerItem *XLayer::getLowestItem() {
}
XLayerItem *XLayer::getItemBelow(XLayerItem &item) {
//!! better stable and slow than buggy!
/* iterator it = item.getLayerIterator();
if (it == itemList().begin())
return 0;
else
return *(--it);
*/
}
// get our iterator
iterator it = std::find(itemList().begin(), itemList().end(), &item);
XLayerItem *XLayer::getItemAbove(XLayerItem &item) {
//!! better stable and slow than buggy!
/* iterator it = item.getLayerIterator();
// go one lower
it++;
// if one lower is the end, there is no item below, otherwise we've got it
if (it == itemList().end())
return 0;
else
return *it;
*/
}
XLayerItem *XLayer::getItemAbove(XLayerItem &item) {
// get our iterator
iterator it = std::find(itemList().begin(), itemList().end(), &item);
// if this is the beginning (top-most item), do nothing, otherwise give the next one up
// the list (which must be there since we aren't the beginning)
if (it == itemList().begin())
return 0;
else
return *(--it);
}

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: XLayer.hh,v 1.2 2003/02/02 16:32:41 rathnor Exp $
// $Id: XLayer.hh,v 1.3 2003/02/09 14:11:14 rathnor Exp $
#ifndef FBTK_XLAYER_HH
@ -61,13 +61,22 @@ public:
iterator insert(XLayerItem &item, unsigned int pos=0);
void remove(XLayerItem &item);
// move highest to bottom
void cycleUp();
void cycleDown();
void raise(XLayerItem &item);
void lower(XLayerItem &item);
// just go above the next window up in the current layer (not all the way to the top)
void stepUp(XLayerItem &item);
void stepDown(XLayerItem &item);
// bring to top of layer
void raise(XLayerItem &item);
void lower(XLayerItem &item);
// send to next layer up
void raiseLayer(XLayerItem &item);
void lowerLayer(XLayerItem &item);
void moveToLayer(XLayerItem &item, int layernum);
private:
MultLayers &m_manager;
int m_layernum;

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: XLayerItem.cc,v 1.4 2003/02/03 13:43:46 fluxgen Exp $
// $Id: XLayerItem.cc,v 1.5 2003/02/09 14:11:14 rathnor Exp $
#include "XLayerItem.hh"
#include "XLayer.hh"
@ -29,7 +29,8 @@ using namespace FbTk;
XLayerItem::XLayerItem(Window win, XLayer &layer) :
m_layer(&layer), m_layeriterator(0) {
m_window = win;
m_windows.push_front(win);
m_layer->insert(*this);
}
@ -63,3 +64,33 @@ void XLayerItem::stepDown() {
m_layer->stepDown(*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(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);
}

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: XLayerItem.hh,v 1.4 2003/02/03 13:42:47 fluxgen Exp $
// $Id: XLayerItem.hh,v 1.5 2003/02/09 14:11:14 rathnor Exp $
#ifndef FBTK_XLAYERITEM_HH
#define FBTK_XLAYERITEM_HH
@ -45,19 +45,39 @@ public:
void raise();
void lower();
// go above the next item visible in this layer
void stepUp();
void stepDown();
//!! we don't need this?
// 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; }
Window window() const { return m_window; }
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(Window win);
void removeWindow(Window win);
// using this you can bring one window to the top of this item (equivalent to add then remove)
void bringToTop(Window win);
Windows &getWindows() { return m_windows; }
size_t numWindows() const { return m_windows.size(); }
private:
XLayer *m_layer;
XLayer::iterator m_layeriterator;
Window m_window;
Windows m_windows;
};
};

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Gnome.cc,v 1.8 2003/02/03 13:49:39 fluxgen Exp $
// $Id: Gnome.cc,v 1.9 2003/02/09 14:11:12 rathnor Exp $
#include "Gnome.hh"
@ -376,7 +376,7 @@ void Gnome::setLayer(FluxboxWindow *win, int layer) {
layer = Fluxbox::instance()->getDesktopLayer() - layer;
break;
}
win->getScreen()->setLayer(win->getLayerItem(),layer);
win->moveToLayer(layer);
}

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Screen.cc,v 1.102 2003/02/03 13:52:31 fluxgen Exp $
// $Id: Screen.cc,v 1.103 2003/02/09 14:11:12 rathnor Exp $
#include "Screen.hh"
@ -1087,7 +1087,7 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) {
FluxboxWindow *BScreen::createWindow(Window client) {
FluxboxWindow *win = new FluxboxWindow(client, this, getScreenNumber(), *getImageControl(),
winFrameTheme(), *menuTheme(),
*layerManager().getLayer(0));
*layerManager().getLayer(Fluxbox::instance()->getNormalLayer()));
#ifdef SLIT
if (win->initialState() == WithdrawnState)
@ -1326,7 +1326,7 @@ void BScreen::nextFocus(int opts) {
} while (*it != focused);
if (*it != focused && it != wins.end())
raiseWindow(*it);
(*it)->raise();
}
@ -1369,7 +1369,7 @@ void BScreen::prevFocus(int opts) {
} while (*it != focused);
if (*it != focused && it != wins.end())
raiseWindow(*it);
(*it)->raise();
}
}
@ -1390,7 +1390,7 @@ void BScreen::raiseFocus() {
}
if ((getCurrentWorkspace()->getCount() > 1) && have_focused)
raiseWindow(fb->getFocusedWindow());
fb->getFocusedWindow()->raise();
}
void BScreen::initMenu() {
@ -1938,157 +1938,11 @@ void BScreen::hideGeometry() {
}
}
void BScreen::raise(FbTk::XLayerItem &item) {
item.raise();
}
void BScreen::lower(FbTk::XLayerItem &item) {
item.lower();
}
void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) {
m_layermanager.moveToLayer(item, layernum);
}
void BScreen::raiseWindow(FluxboxWindow *w) {
if (w == 0)
return;
FluxboxWindow *win = w;
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
if (win == 0)
win = w;
if (!win->isIconic()) {
updateNetizenWindowRaise(win->getClientWindow());
win->getLayerItem().raise();
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowRaise((*it)->getClientWindow());
(*it)->getLayerItem().raise();
}
}
}
void BScreen::lowerWindow(FluxboxWindow *w) {
FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w;
while (bottom->getTransientFor()) {
bottom = bottom->getTransientFor();
assert(bottom != bottom->getTransientFor());
}
win = bottom;
if (!win->isIconic()) {
updateNetizenWindowLower(win->getClientWindow());
win->getLayerItem().lower();
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowLower((*it)->getClientWindow());
(*it)->getLayerItem().lower();
}
}
}
void BScreen::raiseWindowLayer(FluxboxWindow *w) {
FluxboxWindow *win = w;
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
if (!win->isIconic()) {
updateNetizenWindowRaise(win->getClientWindow());
win->getLayerItem().raise();
win->setLayerNum(win->getLayerNum()-1);
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowRaise((*it)->getClientWindow());
(*it)->getLayerItem().raise();
(*it)->setLayerNum((*it)->getLayerNum()-1);
}
}
}
void BScreen::lowerWindowLayer(FluxboxWindow *w) {
FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w;
while (bottom->getTransientFor()) {
bottom = bottom->getTransientFor();
assert(bottom != bottom->getTransientFor());
}
win = bottom;
if (!win->isIconic()) {
updateNetizenWindowLower(win->getClientWindow());
win->getLayerItem().lower();
win->setLayerNum(win->getLayerNum()+1);
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowLower((*it)->getClientWindow());
(*it)->getLayerItem().lower();
(*it)->setLayerNum((*it)->getLayerNum()+1);
}
}
}
void BScreen::moveWindowToLayer(FluxboxWindow *win, int layernum) {
Fluxbox * fluxbox = Fluxbox::instance();
// don't let it set its layer into menu area
if (layernum <= fluxbox->getMenuLayer()) {
layernum = fluxbox->getMenuLayer() + 1;
}
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
if (!win->isIconic()) {
updateNetizenWindowRaise(win->getClientWindow());
//!! TODO
//anager->moveToLayer(*win->getLayerItem(),layernum);
win->setLayerNum(layernum);
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowRaise((*it)->getClientWindow());
//!! TODO
//m_layermanager->moveToLayer(*(*it)->getLayerItem(), layernum);
(*it)->setLayerNum(layernum);
}
}
}
/**
Goes to the workspace "right" of the current
*/

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Screen.hh,v 1.65 2003/02/03 13:50:35 fluxgen Exp $
// $Id: Screen.hh,v 1.66 2003/02/09 14:11:12 rathnor Exp $
#ifndef SCREEN_HH
#define SCREEN_HH
@ -277,15 +277,8 @@ public:
void showGeometry(unsigned int, unsigned int);
void hideGeometry();
void raise(FbTk::XLayerItem &item);
void lower(FbTk::XLayerItem &item);
void setLayer(FbTk::XLayerItem &item, int layernum);
void removeLayerItem(FbTk::XLayerItem *item);
void raiseWindow(FluxboxWindow *win);
void lowerWindow(FluxboxWindow *win);
void raiseWindowLayer(FluxboxWindow *win);
void lowerWindowLayer(FluxboxWindow *win);
void moveWindowToLayer(FluxboxWindow *win, int layernum);
// remove? no, items are never removed from their layer until they die
FluxboxWindow* useAutoGroupWindow();

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Tab.cc,v 1.53 2003/02/02 16:32:38 rathnor Exp $
// $Id: Tab.cc,v 1.54 2003/02/09 14:11:12 rathnor Exp $
#include "Tab.hh"
@ -173,7 +173,7 @@ void Tab::lower() {
do {
XLowerWindow(m_display, current->m_tabwin); //lower tabwin and tabs window
win = current->getWindow();
win->getScreen()->lowerWindow(win);
win->lower();
current = current->next(); //get next
if (current == 0)

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Window.cc,v 1.114 2003/02/03 13:55:08 fluxgen Exp $
// $Id: Window.cc,v 1.115 2003/02/09 14:11:13 rathnor Exp $
#include "Window.hh"
@ -112,11 +112,12 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num,
display(0),
lastButtonPressTime(0),
m_windowmenu(menutheme, screen_num, imgctrl),
m_layeritem(getFrameWindow(), layer),
m_layernum(4),
old_decoration(DECOR_NORMAL),
tab(0),
m_frame(tm, imgctrl, screen_num, 0, 0, 100, 100) {
m_frame(tm, imgctrl, screen_num, 0, 0, 100, 100),
m_layeritem(getFrameWindow(), layer),
m_layernum(layer.getLayerNum())
{
@ -156,10 +157,6 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num,
client.transient_for = 0;
client.mwm_hint = 0;
client.blackbox_hint = 0;
Fluxbox *fluxbox = Fluxbox::instance();
// default to normal layer
m_layernum = fluxbox->getNormalLayer();
getBlackboxHints();
if (! client.blackbox_hint) {
@ -190,6 +187,8 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num,
m_frame.move(wattrib.x, wattrib.y);
m_frame.resizeForClient(wattrib.width, wattrib.height);
Fluxbox *fluxbox = Fluxbox::instance();
timer.setTimeout(fluxbox->getAutoRaiseDelay());
timer.fireOnce(true);
@ -263,7 +262,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num,
restoreAttributes(place_window);
screen->moveWindowToLayer(this, m_layernum);
moveToLayer(m_layernum);
screen->getWorkspace(workspace_number)->addWindow(this, place_window);
moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height());
@ -1178,19 +1177,153 @@ void FluxboxWindow::stick() {
setState(current_state);
}
void FluxboxWindow::raise() {
if (isIconic())
deiconify();
FluxboxWindow *win = this;
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
if (win == 0)
win = this;
if (!win->isIconic()) {
screen->updateNetizenWindowRaise(win->getClientWindow());
win->getLayerItem().raise();
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
screen->updateNetizenWindowRaise((*it)->getClientWindow());
(*it)->getLayerItem().raise();
}
}
}
void FluxboxWindow::lower() {
if (isIconic())
deiconify();
screen->lowerWindow(this);
FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = this;
while (bottom->getTransientFor()) {
bottom = bottom->getTransientFor();
assert(bottom != bottom->getTransientFor());
}
win = bottom;
if (!win->isIconic()) {
screen->updateNetizenWindowLower(win->getClientWindow());
win->getLayerItem().lower();
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
screen->updateNetizenWindowLower((*it)->getClientWindow());
(*it)->getLayerItem().lower();
}
}
}
void FluxboxWindow::raise() {
if (isIconic())
deiconify();
screen->raiseWindow(this);
void FluxboxWindow::raiseLayer() {
// don't let it up to menu layer
if (getLayerNum() == (Fluxbox::instance()->getMenuLayer()+1))
return;
FluxboxWindow *win = this;
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
if (!win->isIconic()) {
screen->updateNetizenWindowRaise(win->getClientWindow());
win->getLayerItem().raiseLayer();
win->setLayerNum(win->getLayerItem().getLayerNum());
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
screen->updateNetizenWindowRaise((*it)->getClientWindow());
(*it)->getLayerItem().raiseLayer();
(*it)->setLayerNum((*it)->getLayerItem().getLayerNum());
}
}
}
void FluxboxWindow::lowerLayer() {
FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = this;
while (bottom->getTransientFor()) {
bottom = bottom->getTransientFor();
assert(bottom != bottom->getTransientFor());
}
win = bottom;
if (!win->isIconic()) {
screen->updateNetizenWindowLower(win->getClientWindow());
win->getLayerItem().lowerLayer();
win->setLayerNum(win->getLayerItem().getLayerNum());
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
screen->updateNetizenWindowLower((*it)->getClientWindow());
(*it)->getLayerItem().lowerLayer();
(*it)->setLayerNum((*it)->getLayerItem().getLayerNum());
}
}
}
void FluxboxWindow::moveToLayer(int layernum) {
Fluxbox * fluxbox = Fluxbox::instance();
FluxboxWindow *win = this;
// don't let it set its layer into menu area
if (layernum <= fluxbox->getMenuLayer()) {
layernum = fluxbox->getMenuLayer() + 1;
}
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
if (!win->isIconic()) {
screen->updateNetizenWindowRaise(win->getClientWindow());
win->getLayerItem().moveToLayer(layernum);
win->setLayerNum(win->getLayerItem().getLayerNum());
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
screen->updateNetizenWindowRaise((*it)->getClientWindow());
(*it)->getLayerItem().moveToLayer(layernum);
(*it)->setLayerNum((*it)->getLayerItem().getLayerNum());
}
}
}
void FluxboxWindow::setFocusFlag(bool focus) {
focused = focus;
@ -2325,7 +2458,7 @@ void FluxboxWindow::changeBlackboxHints(const BaseDisplay::BlackboxHints &net) {
if (net.flags & BaseDisplay::ATTRIB_STACK) {
if ((unsigned int) m_layernum != net.stack) {
screen->moveWindowToLayer(this, net.stack);
moveToLayer(net.stack);
}
}

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Window.hh,v 1.44 2003/02/03 13:53:48 fluxgen Exp $
// $Id: Window.hh,v 1.45 2003/02/09 14:11:13 rathnor Exp $
#ifndef WINDOW_HH
#define WINDOW_HH
@ -126,8 +126,11 @@ public:
void shade();
/// toggles sticky
void stick();
void lower();
void raise();
void lower();
void raiseLayer();
void lowerLayer();
void moveToLayer(int layernum);
void reconfigure();
void installColormap(bool);
@ -332,10 +335,6 @@ private:
Time lastButtonPressTime;
FbTk::Menu m_windowmenu;
FbTk::XLayerItem m_layeritem;
int m_layernum;
timeval lastFocusTime;
int button_grab_x, button_grab_y; // handles last button press event for move
@ -388,6 +387,9 @@ private:
m_last_button_y; ///< last known y position of the mouse button
FbWinFrame m_frame;
FbTk::XLayerItem m_layeritem;
int m_layernum;
enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE };
};

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Workspace.cc,v 1.45 2003/02/03 13:56:12 fluxgen Exp $
// $Id: Workspace.cc,v 1.46 2003/02/09 14:11:13 rathnor Exp $
#include "Workspace.hh"
@ -138,8 +138,6 @@ int Workspace::addWindow(FluxboxWindow *w, bool place) {
m_clientmenu.insert(w->getTitle().c_str());
m_windowlist.push_back(w);
w->raise();
//update menugraphics
m_clientmenu.update();
@ -435,7 +433,6 @@ void Workspace::setName(const std::string &name) {
void Workspace::shutdown() {
// note: when the window dies it'll remove it self from the list
while (!m_windowlist.empty()) {
cerr<<m_windowlist.size()<<endl;
m_windowlist.back()->restore(true); // restore with remap
delete m_windowlist.back(); //delete window (the window removes it self from m_windowlist)
}

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: fluxbox.cc,v 1.94 2003/02/03 13:57:08 fluxgen Exp $
// $Id: fluxbox.cc,v 1.95 2003/02/09 14:11:13 rathnor Exp $
#include "fluxbox.hh"
@ -702,7 +702,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
win = tab->getWindow();
if (win->getScreen()->isSloppyFocus() && (! win->isFocused()) &&
(! no_focus)) {
win->getScreen()->raiseWindow(win);
win->raise();
grab();
@ -1122,10 +1122,10 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
if (focused_window && focused_window->getTab()) {
Tab *tab = focused_window->getTab();
if (tab->next()) {
screen->raiseWindow(tab->next()->getWindow());
tab->next()->getWindow()->raise();
tab->next()->getWindow()->setInputFocus();
} else {
screen->raiseWindow(tab->first()->getWindow());
tab->first()->getWindow()->raise();
tab->first()->getWindow()->setInputFocus();
}
}
@ -1134,10 +1134,10 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
if (focused_window && focused_window->getTab()) {
Tab *tab = focused_window->getTab();
if (tab->prev()) {
screen->raiseWindow(tab->prev()->getWindow());
tab->prev()->getWindow()->raise();
tab->prev()->getWindow()->setInputFocus();
} else {
screen->raiseWindow(tab->last()->getWindow());
tab->last()->getWindow()->raise();
tab->last()->getWindow()->setInputFocus();
}
}
@ -1145,14 +1145,14 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
case Keys::FIRSTTAB:
if (focused_window && focused_window->getTab()) {
Tab *tab = focused_window->getTab();
screen->raiseWindow(tab->first()->getWindow());
tab->first()->getWindow()->raise();
tab->first()->getWindow()->setInputFocus();
}
break;
case Keys::LASTTAB:
if (focused_window && focused_window->getTab()) {
Tab *tab = focused_window->getTab();
screen->raiseWindow(tab->last()->getWindow());
tab->last()->getWindow()->raise();
tab->last()->getWindow()->setInputFocus();
}
break;
@ -1250,16 +1250,16 @@ void Fluxbox::doWindowAction(Keys::KeyAction action, const int param) {
focused_window->lower();
break;
case Keys::RAISELAYER:
focused_window->getScreen()->raiseWindowLayer(focused_window);
focused_window->raiseLayer();
break;
case Keys::LOWERLAYER:
focused_window->getScreen()->lowerWindowLayer(focused_window);
focused_window->lowerLayer();
break;
case Keys::TOPLAYER:
focused_window->getScreen()->moveWindowToLayer(focused_window,getBottomLayer());
focused_window->moveToLayer(getBottomLayer());
break;
case Keys::BOTTOMLAYER:
focused_window->getScreen()->moveWindowToLayer(focused_window,getTopLayer());
focused_window->moveToLayer(getTopLayer());
break;
case Keys::CLOSE:
focused_window->close();