- if (config.getValue("session.doubleClickInterval",
- "Session.DoubleClickInterval", l))
- resource.double_click_interval = l;
- else
- resource.double_click_interval = 250;
-
- if (!config.getValue("session.autoRaiseDelay", "Session.AutoRaiseDelay", l))
- resource.auto_raise_delay.tv_usec = l;
- else
- resource.auto_raise_delay.tv_usec = 400;
- resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec / 1000;
- resource.auto_raise_delay.tv_usec -=
- (resource.auto_raise_delay.tv_sec * 1000);
- resource.auto_raise_delay.tv_usec *= 1000;
-
- if (config.getValue("session.cacheLife", "Session.CacheLife", l))
- resource.cache_life = l;
- else
- resource.cache_life = 51;
- resource.cache_life *= 60000;
-
- if (config.getValue("session.cacheMax", "Session.CacheMax", l))
- resource.cache_max = l;
- else
- resource.cache_max = 200;
-}
-
-
-void Openbox::load_rc(BScreen *screen) {
- ASSERT (screen != NULL);
- const int screen_number = screen->getScreenNumber();
- ASSERT (screen_number >= 0);
-
- if (!config.load())
- return;
-
- std::string s;
- long l;
- bool b;
- char name_lookup[1024], class_lookup[1024];
-
- sprintf(name_lookup, "session.screen%d.fullMaximization", screen_number);
- sprintf(class_lookup, "Session.Screen%d.FullMaximization", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveFullMax((Bool)b);
- else
- screen->saveFullMax(False);
-
- sprintf(name_lookup, "session.screen%d.focusNewWindows", screen_number);
- sprintf(class_lookup, "Session.Screen%d.FocusNewWindows", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveFocusNew((Bool)b);
- else
- screen->saveFocusNew(False);
-
- sprintf(name_lookup, "session.screen%d.focusLastWindow", screen_number);
- sprintf(class_lookup, "Session.Screen%d.focusLastWindow", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveFocusLast((Bool)b);
- else
- screen->saveFocusLast(False);
-
- sprintf(name_lookup, "session.screen%d.rowPlacementDirection",
- screen_number);
- sprintf(class_lookup, "Session.Screen%d.RowPlacementDirection",
- screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- if (0 == strncasecmp(s.c_str(), "righttoleft", s.length()))
- screen->saveRowPlacementDirection(BScreen::RightLeft);
- else
- screen->saveRowPlacementDirection(BScreen::LeftRight);
- } else
- screen->saveRowPlacementDirection(BScreen::LeftRight);
-
- sprintf(name_lookup, "session.screen%d.colPlacementDirection",
- screen_number);
- sprintf(class_lookup, "Session.Screen%d.ColPlacementDirection",
- screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- if (0 == strncasecmp(s.c_str(), "bottomtotop", s.length()))
- screen->saveColPlacementDirection(BScreen::BottomTop);
- else
- screen->saveColPlacementDirection(BScreen::TopBottom);
- } else
- screen->saveColPlacementDirection(BScreen::TopBottom);
-
- sprintf(name_lookup, "session.screen%d.workspaces", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Workspaces", screen_number);
- if (config.getValue(name_lookup, class_lookup, l))
- screen->saveWorkspaces(l);
- else
- screen->saveWorkspaces(1);
-
- sprintf(name_lookup, "session.screen%d.toolbar.widthPercent",
- screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.WidthPercent",
- screen_number);
- if (config.getValue(name_lookup, class_lookup, l) && (l > 0 && l <= 100))
- screen->saveToolbarWidthPercent(l);
- else
- screen->saveToolbarWidthPercent(66);
-
- sprintf(name_lookup, "session.screen%d.toolbar.placement", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.Placement", screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- if (0 == strncasecmp(s.c_str(), "TopLeft", s.length()))
- screen->saveToolbarPlacement(Toolbar::TopLeft);
- else if (0 == strncasecmp(s.c_str(), "BottomLeft", s.length()))
- screen->saveToolbarPlacement(Toolbar::BottomLeft);
- else if (0 == strncasecmp(s.c_str(), "TopCenter", s.length()))
- screen->saveToolbarPlacement(Toolbar::TopCenter);
- else if (0 == strncasecmp(s.c_str(), "TopRight", s.length()))
- screen->saveToolbarPlacement(Toolbar::TopRight);
- else if ( 0 == strncasecmp(s.c_str(), "BottomRight", s.length()))
- screen->saveToolbarPlacement(Toolbar::BottomRight);
- else
- screen->saveToolbarPlacement(Toolbar::BottomCenter);
- } else
- screen->saveToolbarPlacement(Toolbar::BottomCenter);
-
- screen->removeWorkspaceNames();
- sprintf(name_lookup, "session.screen%d.workspaceNames", screen_number);
- sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- // for (int i = 0; i < screen->getNumberOfWorkspaces(); i++) {
- std::string::const_iterator it = s.begin(), end = s.end();
- while(1) {
- std::string::const_iterator tmp = it;// current string.begin()
- it = std::find(tmp, end, ','); // look for comma between tmp and end
- std::string name(tmp, it); // name = s[tmp:it]
- screen->addWorkspaceName(name.c_str());
- if (it == end)
- break;
- ++it;
- }
- }
-
- sprintf(name_lookup, "session.screen%d.toolbar.onTop", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.OnTop", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveToolbarOnTop((Bool)b);
- else
- screen->saveToolbarOnTop(False);
-
- sprintf(name_lookup, "session.screen%d.toolbar.hide", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.Hide", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveToolbarHide((Bool)b);
- else
- screen->saveToolbarHide(False);
-
- sprintf(name_lookup, "session.screen%d.toolbar.autoHide", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Toolbar.autoHide", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveToolbarAutoHide((Bool)b);
- else
- screen->saveToolbarAutoHide(False);
-
- sprintf(name_lookup, "session.screen%d.focusModel", screen_number);
- sprintf(class_lookup, "Session.Screen%d.FocusModel", screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- if (0 == strncasecmp(s.c_str(), "clicktofocus", s.length())) {
- screen->saveAutoRaise(False);
- screen->saveSloppyFocus(False);
- } else if (0 == strncasecmp(s.c_str(), "autoraisesloppyfocus",
- s.length())) {
- screen->saveSloppyFocus(True);
- screen->saveAutoRaise(True);
- } else {
- screen->saveSloppyFocus(True);
- screen->saveAutoRaise(False);
- }
- } else {
- screen->saveSloppyFocus(True);
- screen->saveAutoRaise(False);
- }
-
- sprintf(name_lookup, "session.screen%d.windowZones", screen_number);
- sprintf(class_lookup, "Session.Screen%d.WindowZones", screen_number);
- if (config.getValue(name_lookup, class_lookup, l))
- screen->saveWindowZones((l == 1 || l == 2 || l == 4) ? l : 1);
- else
- screen->saveWindowZones(1);
-
- sprintf(name_lookup, "session.screen%d.windowPlacement", screen_number);
- sprintf(class_lookup, "Session.Screen%d.WindowPlacement", screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- if (0 == strncasecmp(s.c_str(), "RowSmartPlacement", s.length()))
- screen->savePlacementPolicy(BScreen::RowSmartPlacement);
- else if (0 == strncasecmp(s.c_str(), "ColSmartPlacement", s.length()))
- screen->savePlacementPolicy(BScreen::ColSmartPlacement);
- else if (0 == strncasecmp(s.c_str(), "BestFitPlacement", s.length()))
- screen->savePlacementPolicy(BScreen::BestFitPlacement);
- else
- screen->savePlacementPolicy(BScreen::CascadePlacement);
- } else
- screen->savePlacementPolicy(BScreen::RowSmartPlacement);
-
-#ifdef SLIT
- sprintf(name_lookup, "session.screen%d.slit.placement", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Slit.Placement", screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- if (0 == strncasecmp(s.c_str(), "TopLeft", s.length()))
- screen->saveSlitPlacement(Slit::TopLeft);
- else if (0 == strncasecmp(s.c_str(), "CenterLeft", s.length()))
- screen->saveSlitPlacement(Slit::CenterLeft);
- else if (0 == strncasecmp(s.c_str(), "BottomLeft", s.length()))
- screen->saveSlitPlacement(Slit::BottomLeft);
- else if (0 == strncasecmp(s.c_str(), "TopCenter", s.length()))
- screen->saveSlitPlacement(Slit::TopCenter);
- else if (0 == strncasecmp(s.c_str(), "BottomCenter", s.length()))
- screen->saveSlitPlacement(Slit::BottomCenter);
- else if (0 == strncasecmp(s.c_str(), "TopRight", s.length()))
- screen->saveSlitPlacement(Slit::TopRight);
- else if (0 == strncasecmp(s.c_str(), "BottomRight", s.length()))
- screen->saveSlitPlacement(Slit::BottomRight);
- else
- screen->saveSlitPlacement(Slit::CenterRight);
- } else
- screen->saveSlitPlacement(Slit::CenterRight);
-
- sprintf(name_lookup, "session.screen%d.slit.direction", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Slit.Direction", screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- if (0 == strncasecmp(s.c_str(), "Horizontal", s.length()))
- screen->saveSlitDirection(Slit::Horizontal);
- else
- screen->saveSlitDirection(Slit::Vertical);
- } else
- screen->saveSlitDirection(Slit::Vertical);
-
- sprintf(name_lookup, "session.screen%d.slit.onTop", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Slit.OnTop", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveSlitOnTop((Bool)b);
- else
- screen->saveSlitOnTop(False);
-
- sprintf(name_lookup, "session.screen%d.slit.autoHide", screen_number);
- sprintf(class_lookup, "Session.Screen%d.Slit.AutoHide", screen_number);
- if (config.getValue(name_lookup, class_lookup, b))
- screen->saveSlitAutoHide((Bool)b);
- else
- screen->saveSlitAutoHide(False);
-#endif // SLIT
-
-#ifdef HAVE_STRFTIME
- sprintf(name_lookup, "session.screen%d.strftimeFormat", screen_number);
- sprintf(class_lookup, "Session.Screen%d.StrftimeFormat", screen_number);
- if (config.getValue(name_lookup, class_lookup, s))
- screen->saveStrftimeFormat(s.c_str());
- else
- screen->saveStrftimeFormat("%I:%M %p");
-
-#else // HAVE_STRFTIME
- sprintf(name_lookup, "session.screen%d.dateFormat", screen_number);
- sprintf(class_lookup, "Session.Screen%d.DateFormat", screen_number);
- if (config.getValue(name_lookup, class_lookup, s)) {
- if (strncasecmp(s.c_str(), "european", s.length()))
- screen->saveDateFormat(B_AmericanDate);
- else
- screen->saveDateFormat(B_EuropeanDate);
- } else
- screen->saveDateFormat(B_AmericanDate);
-
- sprintf(name_lookup, "session.screen%d.clockFormat", screen_number);
- sprintf(class_lookup, "Session.Screen%d.ClockFormat", screen_number);
- if (config.getValue(name_lookup, class_lookup, l)) {
- if (clock == 24)
- screen->saveClock24Hour(True);
- else
- screen->saveClock24Hour(False);
- } else
- screen->saveClock24Hour(False);
-#endif // HAVE_STRFTIME
-
- sprintf(name_lookup, "session.screen%d.edgeSnapThreshold", screen_number);
- sprintf(class_lookup, "Session.Screen%d.EdgeSnapThreshold", screen_number);
- if (config.getValue(name_lookup, class_lookup, l))
- screen->saveEdgeSnapThreshold(l);
- else
- screen->saveEdgeSnapThreshold(4);
-
- sprintf(name_lookup, "session.screen%d.imageDither", screen_number);
- sprintf(class_lookup, "Session.Screen%d.ImageDither", screen_number);
- if (config.getValue("session.imageDither", "Session.ImageDither", b))
- screen->saveImageDither((Bool)b);
- else
- screen->saveImageDither(True);
-
- sprintf(name_lookup, "session.screen%d.rootCommand", screen_number);
- sprintf(class_lookup, "Session.Screen%d.RootCommand", screen_number);
- if (config.getValue(name_lookup, class_lookup, s))
- screen->saveRootCommand(s.c_str());
- else
- screen->saveRootCommand(NULL);
-
- if (config.getValue("session.opaqueMove", "Session.OpaqueMove", b))
- screen->saveOpaqueMove((Bool)b);
- else
- screen->saveOpaqueMove(False);