#include <X11/Xatom.h>
#include <X11/keysym.h>
-#include <iostream>
#include "i18n.h"
#include "openbox.h"
workspaceNames = new LinkedList<char>;
workspacesList = new LinkedList<Workspace>;
- rootmenuList = new LinkedList<Rootmenu>;
- netizenList = new LinkedList<Netizen>;
iconList = new LinkedList<OpenboxWindow>;
image_control =
for (int i = 0; i < resource.workspaces; ++i) {
wkspc = new Workspace(*this, workspacesList->count());
workspacesList->insert(wkspc);
- saveWorkspaceNames();
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
}
} else {
wkspc = new Workspace(*this, workspacesList->count());
workspacesList->insert(wkspc);
- saveWorkspaceNames();
workspacemenu->insert(wkspc->getName(), wkspc->getMenu());
}
+ saveWorkspaceNames();
workspacemenu->insert(i18n->getMessage(IconSet, IconIcons, "Icons"),
iconmenu);
}
}
- 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);
BTexture *texture,
unsigned long default_pixel)
{
- string s;
+ std::string s;
if (resource.styleconfig.getValue(rname, rclass, s))
image_control->parseTexture(texture, s.c_str());
void BScreen::readDatabaseColor(const char *rname, const char *rclass,
BColor *color, unsigned long default_pixel)
{
- string s;
+ std::string s;
if (resource.styleconfig.getValue(rname, rclass, s))
image_control->parseColor(color, s.c_str());
else {
- // parsing with no color string just deallocates the color, if it has
+ // parsing with no color std::string just deallocates the color, if it has
// been previously allocated
image_control->parseColor(color);
color->setPixel(default_pixel);
static char *defaultFont = "fixed";
bool load_default = false;
- string s;
+ std::string s;
if (*fontset)
XFreeFontSet(getBaseDisplay().getXDisplay(), *fontset);
static char *defaultFont = "fixed";
bool load_default = false;
- string s;
+ std::string s;
if (*font)
XFreeFont(getBaseDisplay().getXDisplay(), *font);
void BScreen::setImageDither(bool d, bool reconfig) {
- resource.image_dither = d;
image_control->setDither(d);
ostrstream s;
s << "session.screen" << getScreenNumber() << ".imageDither" << ends;
- config.setValue(s.str(), resource.image_dither);
+ config.setValue(s.str(), imageDither());
if (reconfig)
reconfigure();
s.rdbuf()->freeze(0);
if (w != NULL) {
names << w->getName();
if (i < resource.workspaces-1)
- names << ',';
+ names << ",";
}
}
names << ends;
void BScreen::save() {
setSloppyFocus(resource.sloppy_focus);
setAutoRaise(resource.auto_raise);
- setImageDither(resource.image_dither, false);
+ setImageDither(imageDither(), false);
setOpaqueMove(resource.opaque_move);
setFullMax(resource.full_max);
setFocusNew(resource.focus_new);
#ifdef HAVE_STRFTIME
// it deletes the current value before setting the new one, so we have to
// duplicate the current value.
- string s = resource.strftime_format;
+ std::string s = resource.strftime_format;
setStrftimeFormat(s.c_str());
#else // !HAVE_STRFTIME
setDateFormat(resource.date_format);
setHideToolbar(resource.hide_toolbar);
}
+
void BScreen::load() {
ostrstream rscreen, rname, rclass;
- string s;
+ std::string s;
bool b;
long l;
rscreen << "session.screen" << getScreenNumber() << '.' << ends;
}
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "fullMaximization" << ends;
rclass << rscreen.str() << "FullMaximization" << ends;
if (config.getValue(rname.str(), rclass.str(), b))
resource.full_max = false;
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "focusNewWindows" << ends;
rclass << rscreen.str() << "FocusNewWindows" << ends;
if (config.getValue(rname.str(), rclass.str(), b))
resource.focus_new = false;
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "focusLastWindow" << ends;
rclass << rscreen.str() << "FocusLastWindow" << ends;
if (config.getValue(rname.str(), rclass.str(), b))
resource.focus_last = false;
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "rowPlacementDirection" << ends;
rclass << rscreen.str() << "RowPlacementDirection" << ends;
if (config.getValue(rname.str(), rclass.str(), s)) {
resource.row_direction = LeftRight;
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "colPlacementDirection" << ends;
rclass << rscreen.str() << "ColPlacementDirection" << ends;
if (config.getValue(rname.str(), rclass.str(), s)) {
resource.col_direction = TopBottom;
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "workspaces" << ends;
rclass << rscreen.str() << "Workspaces" << ends;
- if (config.getValue(rname.str(), rclass.str(), l))
+ if (config.getValue(rname.str(), rclass.str(), l)) {
resource.workspaces = l;
- else
+ } else
resource.workspaces = 1;
removeWorkspaceNames();
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "workspaceNames" << ends;
rclass << rscreen.str() << "WorkspaceNames" << ends;
if (config.getValue(rname.str(), rclass.str(), s)) {
while(1) {
string::const_iterator tmp = it;// current string.begin()
it = std::find(tmp, end, ','); // look for comma between tmp and end
- string name(tmp, it); // name = s[tmp:it]
+ std::string name(tmp, it); // name = s[tmp:it]
addWorkspaceName(name.c_str());
if (it == end)
break;
}
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "focusModel" << ends;
rclass << rscreen.str() << "FocusModel" << ends;
if (config.getValue(rname.str(), rclass.str(), s)) {
}
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "windowZones" << ends;
rclass << rscreen.str() << "WindowZones" << ends;
if (config.getValue(rname.str(), rclass.str(), l))
resource.zones = 4;
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "windowPlacement" << ends;
rclass << rscreen.str() << "WindowPlacement" << ends;
if (config.getValue(rname.str(), rclass.str(), s)) {
#ifdef HAVE_STRFTIME
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "strftimeFormat" << ends;
rclass << rscreen.str() << "StrftimeFormat" << ends;
resource.strftime_format = bstrdup("%I:%M %p");
#else // !HAVE_STRFTIME
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "dateFormat" << ends;
rclass << rscreen.str() << "DateFormat" << ends;
if (config.getValue(rname.str(), rclass.str(), s)) {
resource.date_format = B_AmericanDate;
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "clockFormat" << ends;
rclass << rscreen.str() << "ClockFormat" << ends;
if (config.getValue(rname.str(), rclass.str(), l)) {
#endif // HAVE_STRFTIME
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "edgeSnapThreshold" << ends;
rclass << rscreen.str() << "EdgeSnapThreshold" << ends;
if (config.getValue(rname.str(), rclass.str(), l))
resource.edge_snap_threshold = 4;
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "imageDither" << ends;
rclass << rscreen.str() << "ImageDither" << ends;
if (config.getValue(rname.str(), rclass.str(), b))
- resource.image_dither = b;
+ image_control->setDither(b);
else
- resource.image_dither = true;
+ image_control->setDither(true);
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "rootCommand" << ends;
rclass << rscreen.str() << "RootCommand" << ends;
resource.root_command = NULL;
rname.seekp(0); rclass.seekp(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
rname << rscreen.str() << "opaqueMove" << ends;
rclass << rscreen.str() << "OpaqueMove" << ends;
if (config.getValue(rname.str(), rclass.str(), b))
resource.opaque_move = false;
rscreen.rdbuf()->freeze(0);
- rname.rdbuf()->freeze(0);
- rclass.rdbuf()->freeze(0);
+ rname.rdbuf()->freeze(0); rclass.rdbuf()->freeze(0);
}
void BScreen::reconfigure(void) {
}
}
- string s;
+ std::string s;
long l;
// load fonts/fontsets
int BScreen::addWorkspace(void) {
Workspace *wkspc = new Workspace(*this, workspacesList->count());
workspacesList->insert(wkspc);
+ setWorkspaceCount(workspaceCount()+1);
saveWorkspaceNames();
workspacemenu->insert(wkspc->getName(), wkspc->getMenu(),
workspacesList->remove(wkspc);
delete wkspc;
+ setWorkspaceCount(workspaceCount()-1);
+ saveWorkspaceNames();
toolbar->reconfigure();
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);