Replaced LinkedList structures with std::map, std::vector, and std::list.
This commit is contained in:
parent
4d6f6ba54f
commit
30fe2fb8fe
2 changed files with 111 additions and 268 deletions
336
src/fluxbox.cc
336
src/fluxbox.cc
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: fluxbox.cc,v 1.47 2002/04/09 09:42:16 fluxgen Exp $
|
// $Id: fluxbox.cc,v 1.48 2002/04/09 12:09:03 cout Exp $
|
||||||
|
|
||||||
//Use some GNU extensions
|
//Use some GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -333,11 +333,7 @@ key(0)
|
||||||
|
|
||||||
masked = None;
|
masked = None;
|
||||||
|
|
||||||
windowSearchList = new LinkedList<WindowSearch>;
|
|
||||||
menuSearchList = new LinkedList<MenuSearch>;
|
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
slitSearchList = new LinkedList<SlitSearch>;
|
|
||||||
#ifdef KDE
|
#ifdef KDE
|
||||||
//For KDE dock applets
|
//For KDE dock applets
|
||||||
kwm1_dockwindow = XInternAtom(getXDisplay(), "KWM_DOCKWINDOW", False); //KDE v1.x
|
kwm1_dockwindow = XInternAtom(getXDisplay(), "KWM_DOCKWINDOW", False); //KDE v1.x
|
||||||
|
@ -346,18 +342,10 @@ key(0)
|
||||||
|
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
toolbarSearchList = new LinkedList<ToolbarSearch>;
|
|
||||||
tabSearchList = new LinkedList<TabSearch>;
|
|
||||||
groupSearchList = new LinkedList<WindowSearch>;
|
|
||||||
|
|
||||||
menuTimestamps = new LinkedList<MenuTimestamp>;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_GETPID
|
#ifdef HAVE_GETPID
|
||||||
fluxbox_pid = XInternAtom(getXDisplay(), "_BLACKBOX_PID", False);
|
fluxbox_pid = XInternAtom(getXDisplay(), "_BLACKBOX_PID", False);
|
||||||
#endif // HAVE_GETPID
|
#endif // HAVE_GETPID
|
||||||
|
|
||||||
screenList = new LinkedList<BScreen>;
|
|
||||||
int i;
|
int i;
|
||||||
load_rc();
|
load_rc();
|
||||||
//allocate screens
|
//allocate screens
|
||||||
|
@ -372,11 +360,11 @@ key(0)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
screenList->insert(screen);
|
screenList.push_back(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
I18n *i18n = I18n::instance();
|
I18n *i18n = I18n::instance();
|
||||||
if (! screenList->count()) {
|
if (screenList.size() == 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n->
|
i18n->
|
||||||
getMessage(
|
getMessage(
|
||||||
|
@ -404,12 +392,10 @@ key(0)
|
||||||
|
|
||||||
|
|
||||||
Fluxbox::~Fluxbox(void) {
|
Fluxbox::~Fluxbox(void) {
|
||||||
|
std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
|
||||||
while (screenList->count())
|
std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
|
||||||
delete screenList->remove(0);
|
for (; it != it_end; ++it) {
|
||||||
|
MenuTimestamp *ts = *it;
|
||||||
while (menuTimestamps->count()) {
|
|
||||||
MenuTimestamp *ts = menuTimestamps->remove(0);
|
|
||||||
|
|
||||||
if (ts->filename)
|
if (ts->filename)
|
||||||
delete [] ts->filename;
|
delete [] ts->filename;
|
||||||
|
@ -419,19 +405,6 @@ Fluxbox::~Fluxbox(void) {
|
||||||
|
|
||||||
delete key;
|
delete key;
|
||||||
key = 0;
|
key = 0;
|
||||||
|
|
||||||
delete screenList;
|
|
||||||
delete menuTimestamps;
|
|
||||||
|
|
||||||
delete windowSearchList;
|
|
||||||
delete menuSearchList;
|
|
||||||
delete toolbarSearchList;
|
|
||||||
delete tabSearchList;
|
|
||||||
delete groupSearchList;
|
|
||||||
|
|
||||||
#ifdef SLIT
|
|
||||||
delete slitSearchList;
|
|
||||||
#endif // SLIT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------- setupConfigFiles -----------
|
//---------- setupConfigFiles -----------
|
||||||
|
@ -637,10 +610,10 @@ void Fluxbox::process_event(XEvent *e) {
|
||||||
|
|
||||||
if (iskdedockapp) {
|
if (iskdedockapp) {
|
||||||
XSelectInput(getXDisplay(), e->xmaprequest.window, StructureNotifyMask);
|
XSelectInput(getXDisplay(), e->xmaprequest.window, StructureNotifyMask);
|
||||||
LinkedListIterator<BScreen> it(screenList);
|
std::list<BScreen *>::iterator it = screenList.begin();
|
||||||
for (; it.current() == screenList->last(); it++) {
|
std::list<BScreen *>::iterator it_end = screenList.end();
|
||||||
BScreen *screen = it.current();
|
for (; (*it) == screenList->last(); ++it) {
|
||||||
screen->getSlit()->addClient(e->xmaprequest.window);
|
(*it)->getSlit()->addClient(e->xmaprequest.window);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -926,11 +899,12 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
|
||||||
} else if ((tab = searchTab(be.window))) {
|
} else if ((tab = searchTab(be.window))) {
|
||||||
tab->buttonPressEvent(&be);
|
tab->buttonPressEvent(&be);
|
||||||
} else {
|
} else {
|
||||||
LinkedListIterator<BScreen> it(screenList);
|
std::list<BScreen *>::iterator it = screenList.begin();
|
||||||
|
std::list<BScreen *>::iterator it_end = screenList.end();
|
||||||
|
|
||||||
for (; it.current(); it++) {
|
for (; it != it_end; ++it) {
|
||||||
|
|
||||||
BScreen *screen = it.current();
|
BScreen *screen = *it;
|
||||||
if (be.window != screen->getRootWindow())
|
if (be.window != screen->getRootWindow())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1271,11 +1245,12 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
|
||||||
break;
|
break;
|
||||||
case Keys::ROOTMENU: //show root menu
|
case Keys::ROOTMENU: //show root menu
|
||||||
{
|
{
|
||||||
LinkedListIterator<BScreen> it(screenList);
|
std::list<BScreen *>::iterator it = screenList.begin();
|
||||||
|
std::list<BScreen *>::iterator it_end = screenList.end();
|
||||||
|
|
||||||
for (; it.current(); it++) {
|
for (; it != it_end; ++it) {
|
||||||
|
|
||||||
BScreen *screen = it.current();
|
BScreen *screen = (*it);
|
||||||
if (ke.window != screen->getRootWindow())
|
if (ke.window != screen->getRootWindow())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1575,12 +1550,13 @@ Bool Fluxbox::handleSignal(int sig) {
|
||||||
|
|
||||||
BScreen *Fluxbox::searchScreen(Window window) {
|
BScreen *Fluxbox::searchScreen(Window window) {
|
||||||
BScreen *screen = (BScreen *) 0;
|
BScreen *screen = (BScreen *) 0;
|
||||||
LinkedListIterator<BScreen> it(screenList);
|
std::list<BScreen *>::iterator it = screenList.begin();
|
||||||
|
std::list<BScreen *>::iterator it_end = screenList.end();
|
||||||
|
|
||||||
for (; it.current(); it++) {
|
for (; it != it_end; ++it) {
|
||||||
if (it.current()) {
|
if (*it) {
|
||||||
if (it.current()->getRootWindow() == window) {
|
if ((*it)->getRootWindow() == window) {
|
||||||
screen = it.current();
|
screen = (*it);
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1591,228 +1567,100 @@ BScreen *Fluxbox::searchScreen(Window window) {
|
||||||
|
|
||||||
|
|
||||||
FluxboxWindow *Fluxbox::searchWindow(Window window) {
|
FluxboxWindow *Fluxbox::searchWindow(Window window) {
|
||||||
LinkedListIterator<WindowSearch> it(windowSearchList);
|
std::map<Window, FluxboxWindow *>::iterator it = windowSearch.find(window);
|
||||||
|
return it == windowSearch.end() ? 0 : it->second;
|
||||||
for (; it.current(); it++) {
|
|
||||||
WindowSearch *tmp = it.current();
|
|
||||||
if (tmp && tmp->getWindow() == window)
|
|
||||||
return tmp->getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (FluxboxWindow *) 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluxboxWindow *Fluxbox::searchGroup(Window window, FluxboxWindow *win) {
|
FluxboxWindow *Fluxbox::searchGroup(Window window, FluxboxWindow *win) {
|
||||||
FluxboxWindow *w = (FluxboxWindow *) 0;
|
std::map<Window, FluxboxWindow *>::iterator it = groupSearch.find(window);
|
||||||
LinkedListIterator<WindowSearch> it(groupSearchList);
|
return it == groupSearch.end() ? 0 : it->second;
|
||||||
|
|
||||||
for (; it.current(); it++) {
|
|
||||||
WindowSearch *tmp = it.current();
|
|
||||||
if (tmp) {
|
|
||||||
if (tmp->getWindow() == window) {
|
|
||||||
w = tmp->getData();
|
|
||||||
if (w->getClientWindow() != win->getClientWindow())
|
|
||||||
return win;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (FluxboxWindow *) 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Basemenu *Fluxbox::searchMenu(Window window) {
|
Basemenu *Fluxbox::searchMenu(Window window) {
|
||||||
Basemenu *menu = (Basemenu *) 0;
|
std::map<Window, Basemenu *>::iterator it = menuSearch.find(window);
|
||||||
LinkedListIterator<MenuSearch> it(menuSearchList);
|
return it == menuSearch.end() ? 0 : it->second;
|
||||||
|
|
||||||
for (; it.current(); it++) {
|
|
||||||
MenuSearch *tmp = it.current();
|
|
||||||
|
|
||||||
if (tmp) {
|
|
||||||
if (tmp->getWindow() == window) {
|
|
||||||
menu = tmp->getData();
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (Basemenu *) 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Toolbar *Fluxbox::searchToolbar(Window window) {
|
Toolbar *Fluxbox::searchToolbar(Window window) {
|
||||||
Toolbar *tbar = (Toolbar *) 0;
|
std::map<Window, Toolbar *>::iterator it = toolbarSearch.find(window);
|
||||||
LinkedListIterator<ToolbarSearch> it(toolbarSearchList);
|
return it == toolbarSearch.end() ? 0 : it->second;
|
||||||
|
|
||||||
for (; it.current(); it++) {
|
|
||||||
ToolbarSearch *tmp = it.current();
|
|
||||||
|
|
||||||
if (tmp) {
|
|
||||||
if (tmp->getWindow() == window) {
|
|
||||||
tbar = tmp->getData();
|
|
||||||
return tbar;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (Toolbar *) 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Tab *Fluxbox::searchTab(Window window) {
|
Tab *Fluxbox::searchTab(Window window) {
|
||||||
LinkedListIterator<TabSearch> it(tabSearchList);
|
std::map<Window, Tab *>::iterator it = tabSearch.find(window);
|
||||||
|
return it == tabSearch.end() ? 0 : it->second;
|
||||||
for (; it.current(); it++) {
|
|
||||||
TabSearch *tmp = it.current();
|
|
||||||
if (tmp && tmp->getWindow() == window)
|
|
||||||
return tmp->getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
Slit *Fluxbox::searchSlit(Window window) {
|
Slit *Fluxbox::searchSlit(Window window) {
|
||||||
Slit *s = (Slit *) 0;
|
std::map<Window, Slit *>::iterator it = slitSearch.find(window);
|
||||||
LinkedListIterator<SlitSearch> it(slitSearchList);
|
return it == slitSearch.end() ? 0 : it->second;
|
||||||
|
|
||||||
for (; it.current(); it++) {
|
|
||||||
SlitSearch *tmp = it.current();
|
|
||||||
|
|
||||||
if (tmp) {
|
|
||||||
if (tmp->getWindow() == window) {
|
|
||||||
s = tmp->getData();
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (Slit *) 0;
|
|
||||||
}
|
}
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::saveWindowSearch(Window window, FluxboxWindow *data) {
|
void Fluxbox::saveWindowSearch(Window window, FluxboxWindow *data) {
|
||||||
windowSearchList->insert(new WindowSearch(window, data));
|
windowSearch[window] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::saveGroupSearch(Window window, FluxboxWindow *data) {
|
void Fluxbox::saveGroupSearch(Window window, FluxboxWindow *data) {
|
||||||
groupSearchList->insert(new WindowSearch(window, data));
|
groupSearch[window] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::saveMenuSearch(Window window, Basemenu *data) {
|
void Fluxbox::saveMenuSearch(Window window, Basemenu *data) {
|
||||||
menuSearchList->insert(new MenuSearch(window, data));
|
menuSearch[window] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::saveToolbarSearch(Window window, Toolbar *data) {
|
void Fluxbox::saveToolbarSearch(Window window, Toolbar *data) {
|
||||||
toolbarSearchList->insert(new ToolbarSearch(window, data));
|
toolbarSearch[window] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::saveTabSearch(Window window, Tab *data) {
|
void Fluxbox::saveTabSearch(Window window, Tab *data) {
|
||||||
tabSearchList->insert(new TabSearch(window, data));
|
tabSearch[window] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
void Fluxbox::saveSlitSearch(Window window, Slit *data) {
|
void Fluxbox::saveSlitSearch(Window window, Slit *data) {
|
||||||
slitSearchList->insert(new SlitSearch(window, data));
|
slitSearch[window] = data;
|
||||||
}
|
}
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::removeWindowSearch(Window window) {
|
void Fluxbox::removeWindowSearch(Window window) {
|
||||||
LinkedListIterator<WindowSearch> it(windowSearchList);
|
windowSearch.erase(window);
|
||||||
for (; it.current(); it++) {
|
|
||||||
WindowSearch *tmp = it.current();
|
|
||||||
|
|
||||||
if (tmp) {
|
|
||||||
if (tmp->getWindow() == window) {
|
|
||||||
windowSearchList->remove(tmp);
|
|
||||||
delete tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::removeGroupSearch(Window window) {
|
void Fluxbox::removeGroupSearch(Window window) {
|
||||||
LinkedListIterator<WindowSearch> it(groupSearchList);
|
groupSearch.erase(window);
|
||||||
for (; it.current(); it++) {
|
|
||||||
WindowSearch *tmp = it.current();
|
|
||||||
|
|
||||||
if (tmp) {
|
|
||||||
if (tmp->getWindow() == window) {
|
|
||||||
groupSearchList->remove(tmp);
|
|
||||||
delete tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::removeMenuSearch(Window window) {
|
void Fluxbox::removeMenuSearch(Window window) {
|
||||||
LinkedListIterator<MenuSearch> it(menuSearchList);
|
menuSearch.erase(window);
|
||||||
for (; it.current(); it++) {
|
|
||||||
MenuSearch *tmp = it.current();
|
|
||||||
|
|
||||||
if (tmp) {
|
|
||||||
if (tmp->getWindow() == window) {
|
|
||||||
menuSearchList->remove(tmp);
|
|
||||||
delete tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::removeToolbarSearch(Window window) {
|
void Fluxbox::removeToolbarSearch(Window window) {
|
||||||
LinkedListIterator<ToolbarSearch> it(toolbarSearchList);
|
toolbarSearch.erase(window);
|
||||||
for (; it.current(); it++) {
|
|
||||||
ToolbarSearch *tmp = it.current();
|
|
||||||
if (tmp) {
|
|
||||||
if (tmp->getWindow() == window) {
|
|
||||||
toolbarSearchList->remove(tmp);
|
|
||||||
delete tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::removeTabSearch(Window window) {
|
void Fluxbox::removeTabSearch(Window window) {
|
||||||
LinkedListIterator<TabSearch> it(tabSearchList);
|
tabSearch.erase(window);
|
||||||
for (; it.current(); it++) {
|
|
||||||
TabSearch *tmp = it.current();
|
|
||||||
if (tmp && tmp->getWindow() == window) {
|
|
||||||
tabSearchList->remove(tmp);
|
|
||||||
delete tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
void Fluxbox::removeSlitSearch(Window window) {
|
void Fluxbox::removeSlitSearch(Window window) {
|
||||||
LinkedListIterator<SlitSearch> it(slitSearchList);
|
slitSearch.erase(window);
|
||||||
for (; it.current(); it++) {
|
|
||||||
SlitSearch *tmp = it.current();
|
|
||||||
|
|
||||||
if (tmp) {
|
|
||||||
if (tmp->getWindow() == window) {
|
|
||||||
slitSearchList->remove(tmp);
|
|
||||||
delete tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
|
@ -1836,10 +1684,13 @@ void Fluxbox::shutdown(void) {
|
||||||
|
|
||||||
XSetInputFocus(getXDisplay(), PointerRoot, None, CurrentTime);
|
XSetInputFocus(getXDisplay(), PointerRoot, None, CurrentTime);
|
||||||
|
|
||||||
LinkedListIterator<BScreen> it(screenList);
|
std::list<BScreen *>::iterator it = screenList.begin();
|
||||||
for (; it.current(); it++)
|
std::list<BScreen *>::iterator it_end = screenList.end();
|
||||||
if(it.current())
|
for (; it != it_end; ++it) {
|
||||||
it.current()->shutdown();
|
if(*it) {
|
||||||
|
(*it)->shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XSync(getXDisplay(), False);
|
XSync(getXDisplay(), False);
|
||||||
|
|
||||||
|
@ -1878,12 +1729,13 @@ void Fluxbox::save_rc(void) {
|
||||||
(resource.auto_raise_delay.tv_usec / 1000)));
|
(resource.auto_raise_delay.tv_usec / 1000)));
|
||||||
XrmPutLineResource(&new_blackboxrc, rc_string);
|
XrmPutLineResource(&new_blackboxrc, rc_string);
|
||||||
|
|
||||||
LinkedListIterator<BScreen> it(screenList);
|
std::list<BScreen *>::iterator it = screenList.begin();
|
||||||
|
std::list<BScreen *>::iterator it_end = screenList.end();
|
||||||
|
|
||||||
//Save screen resources
|
//Save screen resources
|
||||||
|
|
||||||
for (; it.current(); it++) {
|
for (; it != it_end; ++it) {
|
||||||
BScreen *screen = it.current();
|
BScreen *screen = *it;
|
||||||
int screen_number = screen->getScreenNumber();
|
int screen_number = screen->getScreenNumber();
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
|
@ -2398,8 +2250,10 @@ void Fluxbox::real_reconfigure(void) {
|
||||||
if (old_blackboxrc)
|
if (old_blackboxrc)
|
||||||
XrmDestroyDatabase(old_blackboxrc);
|
XrmDestroyDatabase(old_blackboxrc);
|
||||||
|
|
||||||
for (int i = 0, n = menuTimestamps->count(); i < n; i++) {
|
std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
|
||||||
MenuTimestamp *ts = menuTimestamps->remove(0);
|
std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
|
||||||
|
for (; it != it_end; ++it) {
|
||||||
|
MenuTimestamp *ts = *it;
|
||||||
|
|
||||||
if (ts) {
|
if (ts) {
|
||||||
if (ts->filename)
|
if (ts->filename)
|
||||||
|
@ -2408,12 +2262,12 @@ void Fluxbox::real_reconfigure(void) {
|
||||||
delete ts;
|
delete ts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
menuTimestamps.erase(menuTimestamps.begin(), menuTimestamps.end());
|
||||||
|
|
||||||
LinkedListIterator<BScreen> it(screenList);
|
std::list<BScreen *>::iterator sit = screenList.begin();
|
||||||
for (; it.current(); it++) {
|
std::list<BScreen *>::iterator sit_end = screenList.end();
|
||||||
BScreen *screen = it.current();
|
for (; sit != sit_end; ++sit) {
|
||||||
|
(*sit)->reconfigure();
|
||||||
screen->reconfigure();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//reconfigure keys
|
//reconfigure keys
|
||||||
|
@ -2432,18 +2286,16 @@ void Fluxbox::real_reconfigure(void) {
|
||||||
// ---------------------------------------
|
// ---------------------------------------
|
||||||
void Fluxbox::reconfigureTabs(void) {
|
void Fluxbox::reconfigureTabs(void) {
|
||||||
//tab reconfiguring
|
//tab reconfiguring
|
||||||
LinkedListIterator<TabSearch> it(tabSearchList);
|
std::map<Window, Tab *>::iterator it = tabSearch.begin();
|
||||||
|
std::map<Window, Tab *>::iterator it_end = tabSearch.end();
|
||||||
//setting all to unconfigured
|
//setting all to unconfigured
|
||||||
for (; it.current(); it++) {
|
for (; it != it_end; ++it) {
|
||||||
TabSearch *tmp = it.current();
|
it->second->setConfigured(false);
|
||||||
if (tmp)
|
|
||||||
tmp->getData()->setConfigured(false);
|
|
||||||
}
|
}
|
||||||
it.reset(); // resetting list and start configure tabs
|
it = tabSearch.begin(); // resetting list and start configure tabs
|
||||||
//reconfiguring
|
//reconfiguring
|
||||||
for (; it.current(); it++) {
|
for (; it != it_end; ++it) {
|
||||||
TabSearch *tmp = it.current();
|
Tab *tab = it->second;
|
||||||
Tab *tab = tmp->getData();
|
|
||||||
if (!tab->configured()) {
|
if (!tab->configured()) {
|
||||||
tab->setConfigured(true);
|
tab->setConfigured(true);
|
||||||
tab->resizeGroup();
|
tab->resizeGroup();
|
||||||
|
@ -2455,12 +2307,13 @@ void Fluxbox::reconfigureTabs(void) {
|
||||||
|
|
||||||
void Fluxbox::checkMenu(void) {
|
void Fluxbox::checkMenu(void) {
|
||||||
Bool reread = False;
|
Bool reread = False;
|
||||||
LinkedListIterator<MenuTimestamp> it(menuTimestamps);
|
std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
|
||||||
for (; it.current() && (! reread); it++) {
|
std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
|
||||||
|
for (; it != it_end && (! reread); ++it) {
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
if (! stat(it.current()->filename, &buf)) {
|
if (! stat((*it)->filename, &buf)) {
|
||||||
if (it.current()->timestamp != buf.st_ctime)
|
if ((*it)->timestamp != buf.st_ctime)
|
||||||
reread = True;
|
reread = True;
|
||||||
} else
|
} else
|
||||||
reread = True;
|
reread = True;
|
||||||
|
@ -2478,28 +2331,35 @@ void Fluxbox::rereadMenu(void) {
|
||||||
|
|
||||||
|
|
||||||
void Fluxbox::real_rereadMenu(void) {
|
void Fluxbox::real_rereadMenu(void) {
|
||||||
for (int i = 0, n = menuTimestamps->count(); i < n; i++) {
|
std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
|
||||||
MenuTimestamp *ts = menuTimestamps->remove(0);
|
std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
|
||||||
|
for (; it != it_end; ++it) {
|
||||||
|
MenuTimestamp *ts = *it;
|
||||||
|
|
||||||
if (ts) {
|
if (ts) {
|
||||||
if (ts->filename)
|
if (ts->filename)
|
||||||
delete [] ts->filename;
|
delete [] ts->filename;
|
||||||
|
|
||||||
delete ts;
|
delete ts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
menuTimestamps.erase(menuTimestamps.begin(), menuTimestamps.end());
|
||||||
|
|
||||||
LinkedListIterator<BScreen> it(screenList);
|
std::list<BScreen *>::iterator sit = screenList.begin();
|
||||||
for (; it.current(); it++)
|
std::list<BScreen *>::iterator sit_end = screenList.end();
|
||||||
it.current()->rereadMenu();
|
for (; sit != sit_end; ++it) {
|
||||||
|
(*sit)->rereadMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fluxbox::saveMenuFilename(const char *filename) {
|
void Fluxbox::saveMenuFilename(const char *filename) {
|
||||||
Bool found = False;
|
Bool found = False;
|
||||||
|
|
||||||
LinkedListIterator<MenuTimestamp> it(menuTimestamps);
|
std::list<MenuTimestamp *>::iterator it = menuTimestamps.begin();
|
||||||
for (; it.current() && (! found); it++)
|
std::list<MenuTimestamp *>::iterator it_end = menuTimestamps.end();
|
||||||
if (! strcmp(it.current()->filename, filename)) found = True;
|
for (; it != it_end; ++it) {
|
||||||
|
if (! strcmp((*it)->filename, filename)) found = True;
|
||||||
|
}
|
||||||
|
|
||||||
if (! found) {
|
if (! found) {
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
@ -2510,7 +2370,7 @@ void Fluxbox::saveMenuFilename(const char *filename) {
|
||||||
ts->filename = StringUtil::strdup(filename);
|
ts->filename = StringUtil::strdup(filename);
|
||||||
ts->timestamp = buf.st_ctime;
|
ts->timestamp = buf.st_ctime;
|
||||||
|
|
||||||
menuTimestamps->insert(ts);
|
menuTimestamps.push_back(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: fluxbox.hh,v 1.14 2002/03/19 00:16:44 fluxgen Exp $
|
// $Id: fluxbox.hh,v 1.15 2002/04/09 12:09:03 cout Exp $
|
||||||
|
|
||||||
#ifndef FLUXBOX_HH
|
#ifndef FLUXBOX_HH
|
||||||
#define FLUXBOX_HH
|
#define FLUXBOX_HH
|
||||||
|
@ -49,7 +49,6 @@
|
||||||
#include "Keys.hh"
|
#include "Keys.hh"
|
||||||
#include "BaseDisplay.hh"
|
#include "BaseDisplay.hh"
|
||||||
#include "Image.hh"
|
#include "Image.hh"
|
||||||
#include "LinkedList.hh"
|
|
||||||
#include "Timer.hh"
|
#include "Timer.hh"
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
#include "Tab.hh"
|
#include "Tab.hh"
|
||||||
|
@ -60,6 +59,8 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
class Fluxbox : public BaseDisplay, public TimeoutHandler {
|
class Fluxbox : public BaseDisplay, public TimeoutHandler {
|
||||||
public:
|
public:
|
||||||
|
@ -161,20 +162,6 @@ public:
|
||||||
enum { B_AMERICANDATE = 1, B_EUROPEANDATE };
|
enum { B_AMERICANDATE = 1, B_EUROPEANDATE };
|
||||||
#endif // HAVE_STRFTIME
|
#endif // HAVE_STRFTIME
|
||||||
|
|
||||||
template <class Z>
|
|
||||||
class DataSearch {
|
|
||||||
private:
|
|
||||||
Window window;
|
|
||||||
Z *data;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
DataSearch(Window w, Z *d) { window = w; data = d; }
|
|
||||||
|
|
||||||
inline const Window &getWindow(void) const { return window; }
|
|
||||||
inline Z *getData(void) { return data; }
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector<Fluxbox::Titlebar> TitlebarList;
|
typedef std::vector<Fluxbox::Titlebar> TitlebarList;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -214,27 +201,23 @@ private:
|
||||||
//std::vector<std::string> parseTitleArgs(const char *arg);
|
//std::vector<std::string> parseTitleArgs(const char *arg);
|
||||||
void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg);
|
void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg);
|
||||||
|
|
||||||
typedef DataSearch<FluxboxWindow> WindowSearch;
|
std::map<Window, FluxboxWindow *> windowSearch;
|
||||||
LinkedList<WindowSearch> *windowSearchList, *groupSearchList;
|
std::map<Window, FluxboxWindow *> groupSearch;
|
||||||
typedef DataSearch<Basemenu> MenuSearch;
|
std::map<Window, Basemenu *> menuSearch;
|
||||||
LinkedList<MenuSearch> *menuSearchList;
|
std::map<Window, Toolbar *> toolbarSearch;
|
||||||
typedef DataSearch<Toolbar> ToolbarSearch;
|
std::map<Window, Tab *> tabSearch;
|
||||||
LinkedList<ToolbarSearch> *toolbarSearchList;
|
|
||||||
typedef DataSearch<Tab> TabSearch;
|
|
||||||
LinkedList<TabSearch> *tabSearchList;
|
|
||||||
|
|
||||||
#ifdef SLIT
|
#ifdef SLIT
|
||||||
typedef DataSearch<Slit> SlitSearch;
|
std::map<Window, Slit *> slitSearch;
|
||||||
LinkedList<SlitSearch> *slitSearchList;
|
# ifdef KDE
|
||||||
#ifdef KDE
|
|
||||||
//For KDE dock applets
|
//For KDE dock applets
|
||||||
Atom kwm1_dockwindow; //KDE v1.x
|
Atom kwm1_dockwindow; //KDE v1.x
|
||||||
Atom kwm2_dockwindow; //KDE v2.x
|
Atom kwm2_dockwindow; //KDE v2.x
|
||||||
#endif//KDE
|
# endif//KDE
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
LinkedList<MenuTimestamp> *menuTimestamps;
|
std::list<MenuTimestamp *> menuTimestamps;
|
||||||
LinkedList<BScreen> *screenList;
|
std::list<BScreen *> screenList;
|
||||||
|
|
||||||
FluxboxWindow *focused_window, *masked_window;
|
FluxboxWindow *focused_window, *masked_window;
|
||||||
BTimer timer;
|
BTimer timer;
|
||||||
|
|
Loading…
Reference in a new issue