// Configmenu.cc for Openbox
+// Copyright (c) 2002 - 2002 Ben Jansens <ben@orodu.net>
// Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
//
case 1: // click to focus
configmenu->screen.setSloppyFocus(false);
configmenu->screen.setAutoRaise(false);
-
- if (! configmenu->screen.getOpenbox().focusedWindow())
- XSetInputFocus(configmenu->screen.getOpenbox().getXDisplay(),
- configmenu->screen.getToolbar()->getWindowID(),
- RevertToParent, CurrentTime);
- else
- XSetInputFocus(configmenu->screen.getOpenbox().getXDisplay(),
- configmenu->screen.getOpenbox().
- focusedWindow()->getClientWindow(),
- RevertToParent, CurrentTime);
-
+ // make windows all grab button1 clicks
configmenu->screen.reconfigure();
-
break;
case 2: // sloppy focus
configmenu->screen.setSloppyFocus(true);
-
+ // make windows stop grabbing button1 clicks
configmenu->screen.reconfigure();
-
break;
case 3: // auto raise with sloppy focus
- bool change = ((configmenu->screen.autoRaise()) ? false : true);
- configmenu->screen.setAutoRaise(change);
-
+ configmenu->screen.setAutoRaise(!configmenu->screen.autoRaise());
break;
}
workspaceNames = new LinkedList<char>;
workspacesList = new LinkedList<Workspace>;
- rootmenuList = new LinkedList<Rootmenu>;
- netizenList = new LinkedList<Netizen>;
iconList = new LinkedList<OpenboxWindow>;
image_control =
}
}
- if (! resource.sloppy_focus)
- XSetInputFocus(getBaseDisplay().getXDisplay(), toolbar->getWindowID(),
- RevertToParent, CurrentTime);
+ XSetInputFocus(getBaseDisplay().getXDisplay(),
+ PointerRoot, None, CurrentTime);
XFree(children);
XFlush(getBaseDisplay().getXDisplay());
while (workspacesList->count())
delete workspacesList->remove(0);
- while (rootmenuList->count())
- rootmenuList->remove(0);
+ while (!rootmenuList.empty())
+ rootmenuList.erase(rootmenuList.begin());
while (iconList->count())
delete iconList->remove(0);
- while (netizenList->count())
- delete netizenList->remove(0);
+ while (!netizenList.empty())
+ netizenList.erase(netizenList.begin());
#ifdef HAVE_STRFTIME
if (resource.strftime_format)
delete workspacesList;
delete workspaceNames;
- delete rootmenuList;
delete iconList;
- delete netizenList;
if (resource.wstyle.fontset)
XFreeFontSet(getBaseDisplay().getXDisplay(), resource.wstyle.fontset);
void BScreen::addNetizen(Netizen *n) {
- netizenList->insert(n);
+ netizenList.push_back(n);
n->sendWorkspaceCount();
n->sendCurrentWorkspace();
void BScreen::removeNetizen(Window w) {
- LinkedListIterator<Netizen> it(netizenList);
+ netList::iterator it;
int i = 0;
- for (Netizen *n = it.current(); n; it++, i++, n = it.current())
- if (n->getWindowID() == w) {
- Netizen *tmp = netizenList->remove(i);
+ for (it = netizenList.begin(); it != netizenList.end(); ++it)
+ if ((*it)->getWindowID() == w) {
+ Netizen *tmp = *it;
+ netizenList.erase(it);
delete tmp;
-
break;
}
}
void BScreen::updateNetizenCurrentWorkspace(void) {
- LinkedListIterator<Netizen> it(netizenList);
- for (Netizen *n = it.current(); n; it++, n = it.current())
- n->sendCurrentWorkspace();
+ netList::iterator it;
+ for (it = netizenList.begin(); it != netizenList.end(); ++it)
+ (*it)->sendCurrentWorkspace();
}
void BScreen::updateNetizenWorkspaceCount(void) {
- LinkedListIterator<Netizen> it(netizenList);
- for (Netizen *n = it.current(); n; it++, n = it.current())
- n->sendWorkspaceCount();
+ netList::iterator it;
+ for (it = netizenList.begin(); it != netizenList.end(); ++it)
+ (*it)->sendWorkspaceCount();
}
void BScreen::updateNetizenWindowFocus(void) {
Window f = ((openbox.focusedWindow()) ?
openbox.focusedWindow()->getClientWindow() : None);
- LinkedListIterator<Netizen> it(netizenList);
- for (Netizen *n = it.current(); n; it++, n = it.current())
- n->sendWindowFocus(f);
+ netList::iterator it;
+ for (it = netizenList.begin(); it != netizenList.end(); ++it)
+ (*it)->sendWindowFocus(f);
}
-
void BScreen::updateNetizenWindowAdd(Window w, unsigned long p) {
- LinkedListIterator<Netizen> it(netizenList);
- for (Netizen *n = it.current(); n; it++, n = it.current())
- n->sendWindowAdd(w, p);
+ netList::iterator it;
+ for (it = netizenList.begin(); it != netizenList.end(); ++it)
+ (*it)->sendWindowAdd(w, p);
}
void BScreen::updateNetizenWindowDel(Window w) {
- LinkedListIterator<Netizen> it(netizenList);
- for (Netizen *n = it.current(); n; it++, n = it.current())
- n->sendWindowDel(w);
+ netList::iterator it;
+ for (it = netizenList.begin(); it != netizenList.end(); ++it)
+ (*it)->sendWindowDel(w);
}
void BScreen::updateNetizenWindowRaise(Window w) {
- LinkedListIterator<Netizen> it(netizenList);
- for (Netizen *n = it.current(); n; it++, n = it.current())
- n->sendWindowRaise(w);
+ netList::iterator it;
+ for (it = netizenList.begin(); it != netizenList.end(); ++it)
+ (*it)->sendWindowRaise(w);
}
void BScreen::updateNetizenWindowLower(Window w) {
- LinkedListIterator<Netizen> it(netizenList);
- for (Netizen *n = it.current(); n; it++, n = it.current())
- n->sendWindowLower(w);
+ netList::iterator it;
+ for (it = netizenList.begin(); it != netizenList.end(); ++it)
+ (*it)->sendWindowLower(w);
}
void BScreen::updateNetizenConfigNotify(XEvent *e) {
- LinkedListIterator<Netizen> it(netizenList);
- for (Netizen *n = it.current(); n; it++, n = it.current())
- n->sendConfigNotify(e);
+ netList::iterator it;
+ for (it = netizenList.begin(); it != netizenList.end(); ++it)
+ (*it)->sendConfigNotify(e);
}
void BScreen::raiseWindows(Window *workspace_stack, int num) {
Window *session_stack = new
- Window[(num + workspacesList->count() + rootmenuList->count() + 13)];
+ Window[(num + workspacesList->count() + rootmenuList.size() + 13)];
int i = 0, k = num;
XRaiseWindow(getBaseDisplay().getXDisplay(), iconmenu->getWindowID());
toolbar->getMenu()->getPlacementmenu()->getWindowID();
*(session_stack + i++) = toolbar->getMenu()->getWindowID();
- LinkedListIterator<Rootmenu> rit(rootmenuList);
- for (Rootmenu *tmp = rit.current(); tmp; rit++, tmp = rit.current())
- *(session_stack + i++) = tmp->getWindowID();
+ menuList::iterator rit;
+ for (rit = rootmenuList.begin(); rit != rootmenuList.end(); ++rit)
+ *(session_stack + i++) = (*rit)->getWindowID();
*(session_stack + i++) = rootmenu->getWindowID();
if (toolbar->onTop())
void BScreen::InitMenu(void) {
if (rootmenu) {
- while (rootmenuList->count())
- rootmenuList->remove(0);
+ while (!rootmenuList.empty())
+ rootmenuList.erase(rootmenuList.begin());
while (rootmenu->getCount())
rootmenu->remove(0);
parseMenuFile(file, submenu);
submenu->update();
menu->insert(label, submenu);
- rootmenuList->insert(submenu);
+ rootmenuList.push_back(submenu);
}
break;
if (newmenu) {
stylesmenu->setLabel(label);
menu->insert(label, stylesmenu);
- rootmenuList->insert(stylesmenu);
+ rootmenuList.push_back(stylesmenu);
}
openbox.setMenuFilename(stylesdir);