return fs;
}
+
void BScreen::setSloppyFocus(bool b) {
resource.sloppy_focus = b;
ostrstream s;
(resource.sloppy_focus ?
(resource.auto_raise ? "AutoRaiseSloppyFocus" : "SloppyFocus")
: "ClickToFocus"));
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setAutoRaise(bool a) {
resource.auto_raise = a;
ostrstream s;
(resource.sloppy_focus ?
(resource.auto_raise ? "AutoRaiseSloppyFocus" : "SloppyFocus")
: "ClickToFocus"));
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setImageDither(bool d) {
resource.image_dither = d;
ostrstream s;
s << "session.screen" << getScreenNumber() << ".imageDither" << ends;
config.setValue(s.str(), resource.image_dither);
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setOpaqueMove(bool o) {
resource.opaque_move = o;
ostrstream s;
s << "session.screen" << getScreenNumber() << ".opaqueMove" << ends;
config.setValue(s.str(), resource.opaque_move);
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setFullMax(bool f) {
resource.full_max = f;
ostrstream s;
s << "session.screen" << getScreenNumber() << ".fullMaximization" << ends;
config.setValue(s.str(), resource.full_max);
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setFocusNew(bool f) {
resource.focus_new = f;
ostrstream s;
s << "session.screen" << getScreenNumber() << ".focusNewWindows" << ends;
config.setValue(s.str(), resource.focus_new);
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setFocusLast(bool f) {
resource.focus_last = f;
ostrstream s;
s << "session.screen" << getScreenNumber() << ".focusLastWindow" << ends;
config.setValue(s.str(), resource.focus_last);
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setWindowZones(int z) {
resource.zones = z;
ostrstream s;
s << "session.screen" << getScreenNumber() << ".windowZones" << ends;
config.setValue(s.str(), resource.zones);
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setWorkspaceCount(int w) {
resource.workspaces = w;
ostrstream s;
s << "session.screen" << getScreenNumber() << ".workspaces" << ends;
config.setValue(s.str(), resource.workspaces);
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setPlacementPolicy(int p) {
resource.placement_policy = p;
ostrstream s;
case RowSmartPlacement: placement = "RowSmartPlacement"; break;
}
config.setValue(s.str(), placement);
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setEdgeSnapThreshold(int t) {
resource.edge_snap_threshold = t;
ostrstream s;
s << "session.screen" << getScreenNumber() << ".edgeSnapThreshold" << ends;
config.setValue(s.str(), resource.edge_snap_threshold);
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setRowPlacementDirection(int d) {
resource.row_direction = d;
ostrstream s;
config.setValue(s.str(),
resource.row_direction == LeftRight ?
"LeftToRight" : "RightToLeft");
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setColPlacementDirection(int d) {
resource.col_direction = d;
ostrstream s;
config.setValue(s.str(),
resource.col_direction == TopBottom ?
"TopToBottom" : "BottomToTop");
+ s.rdbuf()->freeze(0);
}
+
void BScreen::setRootCommand(const char *cmd) {
if (resource.root_command != NULL)
delete [] resource.root_command;
resource.root_command = NULL;
// this doesn't save to the Resources config because it can't be changed
// inside Openbox, and this way we dont add an empty command which would over-
- // ride the styles commend when none has been specified
+ // ride the styles command when none has been specified
}
+
+
#ifdef HAVE_STRFTIME
void BScreen::setStrftimeFormat(const char *f) {
if (resource.strftime_format != NULL)
ostrstream s;
s << "session.screen" << getScreenNumber() << ".strftimeFormat" << ends;
config.setValue(s.str(), resource.strftime_format);
+ s.rdbuf()->freeze(0);
}
#else // !HAVE_STRFTIME
s << "session.screen" << getScreenNumber() << ".dateFormat" << ends;
config.setValue(s.str(), resource.date_format == B_EuropeanDate ?
"European" : "American");
+ s.rdbuf()->freeze(0);
}
void BScreen::setClock24Hour(Bool c) {
ostrstream s;
s << "session.screen" << getScreenNumber() << ".clockFormat" << ends;
config.setValue(s.str(), resource.clock24hour ? 24 : 12);
+ s.rdbuf()->freeze(0);
}
#endif // HAVE_STRFTIME
ostrstream s;
s << "session.screen" << getScreenNumber() << ".hideToolbar" << ends;
config.setValue(s.str(), resource.hide_toolbar ? "True" : "False");
+ s.rdbuf()->freeze(0);
}
void BScreen::saveWorkspaceNames() {
- ostrstream rc, names;
-
- for (int i = 0; i < resource.workspaces; i++) {
- Workspace *w = getWorkspace(i);
- if (w != NULL) {
- names << w->getName();
- if (i < resource.workspaces-1)
- names << ',';
- }
+ ostrstream rc, names;
+
+ for (int i = 0; i < resource.workspaces; i++) {
+ Workspace *w = getWorkspace(i);
+ if (w != NULL) {
+ names << w->getName();
+ if (i < resource.workspaces-1)
+ names << ',';
}
- names << ends;
+ }
+ names << ends;
- rc << "session.screen" << getScreenNumber() << ".workspaceNames" << ends;
- config.setValue(rc.str(), names.str());
+ rc << "session.screen" << getScreenNumber() << ".workspaceNames" << ends;
+ config.setValue(rc.str(), names.str());
+ rc.rdbuf()->freeze(0);
+ names.rdbuf()->freeze(0);
}
void BScreen::save() {
rname.seekp(0); rclass.seekp(0);
rname << rscreen.str() << "strftimeFormat" << ends;
rclass << rscreen.str() << "StrftimeFormat" << ends;
- if (config.getValue(rname.str(), rclass.str(), s))
+
+ if (resource.strftime_format != NULL){
+ delete [] resource.strftime_format;
+ resource.strftime_format=NULL;
+ }
+
+ if (config.getValue(rname.str(), rclass.str(), s)) {
resource.strftime_format = bstrdup(s.c_str());
+ }
#else // !HAVE_STRFTIME
rname.seekp(0); rclass.seekp(0);
rname << rscreen.str() << "dateFormat" << ends;
rname.seekp(0); rclass.seekp(0);
rname << rscreen.str() << "rootCommand" << ends;
rclass << rscreen.str() << "RootCommand" << ends;
- if (config.getValue(rname.str(), rclass.str(), s))
+
+ if (resource.root_command != NULL){
+ delete [] resource.root_command;
+ resource.root_command=NULL;
+ }
+ if (config.getValue(rname.str(), rclass.str(), s)) {
resource.root_command = bstrdup(s.c_str());
+ }
rname.seekp(0); rclass.seekp(0);
rname << rscreen.str() << "opaqueMove" << ends;
rclass << rscreen.str() << "OpaqueMove" << ends;
if (config.getValue(rname.str(), rclass.str(), b))
resource.opaque_move = b;
+ rscreen.rdbuf()->freeze(0);
+ rname.rdbuf()->freeze(0);
+ rclass.rdbuf()->freeze(0);
}
void BScreen::reconfigure(void) {
void BScreen::LoadStyle(void) {
Resource &conf = resource.styleconfig;
- conf.setFile(openbox.getStyleFilename());
- if (!conf.load()) {
+ const char *sfile = openbox.getStyleFilename();
+ bool loaded = false;
+ if (sfile != NULL) {
+ conf.setFile(sfile);
+ loaded = conf.load();
+ }
+ if (!loaded) {
conf.setFile(DEFAULTSTYLE);
if (!conf.load()) {
fprintf(stderr, i18n->getMessage(ScreenSet, ScreenDefaultStyleLoadFail,