From ffae659b3ecc080fdd98c8825d8e643cc66ccf27 Mon Sep 17 00:00:00 2001 From: simonb Date: Thu, 23 Mar 2006 02:06:51 +0000 Subject: external tab fixes, plus aligning items properly --- ChangeLog | 4 ++++ src/FbTk/XLayer.cc | 35 ++++++++++++++++++++++------------- src/FbTk/XLayerItem.cc | 2 +- src/FbTk/XLayerItem.hh | 1 - src/FbWinFrame.cc | 10 ++++------ 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0fdce70..7e6e99d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ (Format: Year/Month/Day) Changes for 0.9.16: +*06/03/23: + * Fix some tab stacking alignment and rendering on tab resize (Simon) + (and very minor tidying) + FbWinFrame.cc FbTk/XLayer.cc FbTk/XLayerItem.hh/cc *06/03/22: * More external tabs work (Simon) - Can now be placed TopLeft/TopRight/BottomLeft/BottomRight diff --git a/src/FbTk/XLayer.cc b/src/FbTk/XLayer.cc index 63881d3..8d1d80a 100644 --- a/src/FbTk/XLayer.cc +++ b/src/FbTk/XLayer.cc @@ -131,24 +131,33 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) { } +// 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 - size_t winnum = 0, - num = item.numWindows(); - Window *winlist = new Window[num]; + // get our item + iterator myit = std::find(itemList().begin(), itemList().end(), &item); + iterator it = myit; - // 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) { - if ((*it)->window()) { - winlist[winnum++] = (*it)->window(); - } - } + // 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); - XRestackWindows(FbTk::App::instance()->display(), winlist, winnum); - delete [] winlist; } XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) { diff --git a/src/FbTk/XLayerItem.cc b/src/FbTk/XLayerItem.cc index 95befe7..ff554ad 100644 --- a/src/FbTk/XLayerItem.cc +++ b/src/FbTk/XLayerItem.cc @@ -28,7 +28,7 @@ using namespace FbTk; XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) : - m_layer(&layer), m_layeriterator(0) { + m_layer(&layer) { m_windows.push_front(&win); m_layer->insert(*this); } diff --git a/src/FbTk/XLayerItem.hh b/src/FbTk/XLayerItem.hh index 3cca8a9..3d778bb 100644 --- a/src/FbTk/XLayerItem.hh +++ b/src/FbTk/XLayerItem.hh @@ -79,7 +79,6 @@ public: private: XLayer *m_layer; - XLayer::iterator m_layeriterator; Windows m_windows; }; diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 736e049..0e61492 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -207,10 +207,12 @@ bool FbWinFrame::setTabMode(TabMode tabmode) { applyTabContainer(); m_tab_container.clear(); + m_tab_container.raise(); + m_tab_container.show(); + if (!m_use_tabs) - m_tab_container.show(); - else ret = false; + m_label.hide(); // reconfigure(); } @@ -1296,10 +1298,6 @@ void FbWinFrame::init() { m_label.setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask); - m_label.show(); - - m_tab_container.show(); - m_tab_container.raise(); showHandle(); showTitlebar(); -- cgit v0.11.2