]> Dogcows Code - chaz/openbox/commitdiff
on reconfigure, if an option isn't specified in the rc file, then it will revert...
authorDana Jansens <danakj@orodu.net>
Sat, 20 Apr 2002 18:24:12 +0000 (18:24 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 20 Apr 2002 18:24:12 +0000 (18:24 +0000)
src/Screen.cc
src/Slit.cc
src/Toolbar.cc
src/openbox.cc

index 10c092d3a177514c378a79106a500e8c1f7252da..e20aa375b1c1a7c5e803950ce65e6f613de86cc8 100644 (file)
@@ -189,28 +189,6 @@ static const char *getFontSize(const char *pattern, int *size) {
 BScreen::BScreen(Openbox &ob, int scrn, Resource &conf) : ScreenInfo(ob, scrn),
   openbox(ob), config(conf)
 {
-  // default values
-  resource.full_max = false;
-  resource.focus_new = false;
-  resource.focus_last = false;
-  resource.row_direction = LeftRight;
-  resource.col_direction = TopBottom;
-  resource.workspaces = 1;
-  resource.sloppy_focus = true;
-  resource.auto_raise = false;
-  resource.zones = 1;
-  resource.placement_policy = CascadePlacement;
-#ifdef    HAVE_STRFTIME
-  resource.strftime_format = bstrdup("%I:%M %p");
-#else // !have_strftime
-  resource.date_format = B_AmericanDate;
-  resource.clock24hour =  false;
-#endif // HAVE_STRFTIME
-  resource.edge_snap_threshold = 4;
-  resource.image_dither = true;
-  resource.root_command = NULL;
-  resource.opaque_move = false;
-
   event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
               SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
               ButtonPressMask | ButtonReleaseMask;
@@ -1098,6 +1076,8 @@ void BScreen::load() {
   rclass << rscreen.str() << "HideToolbar" << ends;
   if (config.getValue(rname.str(), rclass.str(), b))
     resource.hide_toolbar = b;
+  else
+    resource.hide_toolbar = false;
   Toolbar *t = getToolbar();
   if (t != NULL) {
     if (resource.hide_toolbar)
@@ -1111,18 +1091,24 @@ void BScreen::load() {
   rclass << rscreen.str() << "FullMaximization" << ends;
   if (config.getValue(rname.str(), rclass.str(), b))
     resource.full_max = b;
+  else
+    resource.full_max = false;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "focusNewWindows" << ends;
   rclass << rscreen.str() << "FocusNewWindows" << ends;
   if (config.getValue(rname.str(), rclass.str(), b))
     resource.focus_new = b;
+  else
+    resource.focus_new = false;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "focusLastWindow" << ends;
   rclass << rscreen.str() << "FocusLastWindow" << ends;
   if (config.getValue(rname.str(), rclass.str(), b))
     resource.focus_last = b;
+  else
+    resource.focus_last = false;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "rowPlacementDirection" << ends;
@@ -1132,7 +1118,8 @@ void BScreen::load() {
       resource.row_direction = RightLeft;
     else if (0 == strncasecmp(s.c_str(), "LeftToRight", s.length()))
       resource.row_direction = LeftRight;
-  }
+  } else
+    resource.row_direction = LeftRight;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "colPlacementDirection" << ends;
@@ -1142,13 +1129,16 @@ void BScreen::load() {
       resource.col_direction = BottomTop;
     else if (0 == strncasecmp(s.c_str(), "TopToBottom", s.length()))
       resource.col_direction = TopBottom;
-  }
+  } else
+    resource.col_direction = TopBottom;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "workspaces" << ends;
   rclass << rscreen.str() << "Workspaces" << ends;
   if (config.getValue(rname.str(), rclass.str(), l))
     resource.workspaces = l;
+  else
+    resource.workspaces = 1;
 
   removeWorkspaceNames();
   rname.seekp(0); rclass.seekp(0);
@@ -1182,6 +1172,9 @@ void BScreen::load() {
       resource.sloppy_focus = true;
       resource.auto_raise = false;
     }
+  } else {
+    resource.sloppy_focus = true;
+    resource.auto_raise = false;
   }
 
   rname.seekp(0); rclass.seekp(0);
@@ -1189,6 +1182,8 @@ void BScreen::load() {
   rclass << rscreen.str() << "WindowZones" << ends;
   if (config.getValue(rname.str(), rclass.str(), l))
     resource.zones = (l == 1 || l == 2 || l == 4) ? l : 1;
+  else
+    resource.zones = 4;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "windowPlacement" << ends;
@@ -1202,21 +1197,21 @@ void BScreen::load() {
       resource.placement_policy = BestFitPlacement;
     else if (0 == strncasecmp(s.c_str(), "CascadePlacement", s.length()))
       resource.placement_policy = CascadePlacement;
-  }
+  } else
+    resource.placement_policy = CascadePlacement;
 
 #ifdef    HAVE_STRFTIME
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "strftimeFormat" << ends;
   rclass << rscreen.str() << "StrftimeFormat" << ends;
 
-  if (resource.strftime_format != NULL){
+  if (resource.strftime_format != NULL)
     delete [] resource.strftime_format;
-    resource.strftime_format=NULL;
-  }
 
-  if (config.getValue(rname.str(), rclass.str(), s)) {
+  if (config.getValue(rname.str(), rclass.str(), s))
     resource.strftime_format = bstrdup(s.c_str());
-  }
+  else
+    resource.strftime_format = bstrdup("%I:%M %p");
 #else // !HAVE_STRFTIME
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "dateFormat" << ends;
@@ -1226,7 +1221,8 @@ void BScreen::load() {
       resource.date_format = B_EuropeanDate;
     else if (strncasecmp(s.c_str(), "American", s.length()))
       resource.date_format = B_AmericanDate;
-  }
+  } else
+    resource.date_format = B_AmericanDate;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "clockFormat" << ends;
@@ -1236,6 +1232,8 @@ void BScreen::load() {
       resource.clock24hour = true;
     else if (clock == 12)
       resource.clock24hour =  false;
+  } else
+    resource.clock24hour =  false;
 #endif // HAVE_STRFTIME
 
   rname.seekp(0); rclass.seekp(0);
@@ -1243,30 +1241,37 @@ void BScreen::load() {
   rclass << rscreen.str() << "EdgeSnapThreshold" << ends;
   if (config.getValue(rname.str(), rclass.str(), l))
     resource.edge_snap_threshold = l;
+  else
+    resource.edge_snap_threshold = 4;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "imageDither" << ends;
   rclass << rscreen.str() << "ImageDither" << ends;
   if (config.getValue(rname.str(), rclass.str(), b))
     resource.image_dither = b;
+  else
+    resource.image_dither = true;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "rootCommand" << ends;
   rclass << rscreen.str() << "RootCommand" << ends;
 
-  if (resource.root_command != NULL){
+  if (resource.root_command != NULL)
     delete [] resource.root_command;
-    resource.root_command=NULL;
-  }
-  if (config.getValue(rname.str(), rclass.str(), s)) {
+  
+  if (config.getValue(rname.str(), rclass.str(), s))
     resource.root_command = bstrdup(s.c_str());
-  }
+  else
+    resource.root_command = NULL;
 
   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;
+  else
+    resource.opaque_move = false;
+
   rscreen.rdbuf()->freeze(0);
   rname.rdbuf()->freeze(0);
   rclass.rdbuf()->freeze(0);
index 38af8b93ffce389f104cc4c97a1eb3fa2f9b59bf..c803d48b3c0f35f138015767f4867e365daa09fb 100644 (file)
 Slit::Slit(BScreen &scr, Resource &conf) : screen(scr),
   openbox(scr.getOpenbox()), config(conf)
 {
-  // default values
-  m_placement = CenterRight;
-  m_direction = Vertical;
-  m_ontop = false;
-  m_hidden = m_autohide = false;
   load();
   
   display = screen.getBaseDisplay().getXDisplay();
@@ -293,7 +288,8 @@ void Slit::load() {
       m_placement = BottomRight;
     else if (0 == strncasecmp(s.c_str(), "CenterRight", s.length()))
       m_placement = CenterRight;
-  }
+  } else
+    m_placement = CenterRight;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "slit.direction" << ends;
@@ -303,19 +299,25 @@ void Slit::load() {
       m_direction = Horizontal;
     else if (0 == strncasecmp(s.c_str(), "Vertical", s.length()))
       m_direction = Vertical;
-  }
+  } else
+    m_direction = Vertical;
  
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "slit.onTop" << ends;
   rclass << rscreen.str() << "Slit.OnTop" << ends;
   if (config.getValue(rname.str(), rclass.str(), b))
     m_ontop = b;
+  else
+    m_ontop = false;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "slit.autoHide" << ends;
   rclass << rscreen.str() << "Slit.AutoHide" << ends;
   if (config.getValue(rname.str(), rclass.str(), b))
     m_hidden = m_autohide = b;
+  else
+    m_hidden = m_autohide = false;
+
   rscreen.rdbuf()->freeze(0);
   rname.rdbuf()->freeze(0);
   rclass.rdbuf()->freeze(0);
index a6da46a96ad26899172c964a40586a393313c338..5f226c2d089938bbd7da9d26516d515d9ff98247 100644 (file)
 Toolbar::Toolbar(BScreen &scrn, Resource &conf) : screen(scrn),
   openbox(scrn.getOpenbox()), config(conf)
 {
-  // default values
-  m_width_percent =66;
-  m_placement = BottomCenter;
-  m_ontop = false;
-  m_hidden = m_autohide = false;
   load();
 
   // get the clock updating every minute
@@ -280,6 +275,8 @@ void Toolbar::load() {
   rclass << rscreen.str() << "Toolbar.WidthPercent" << ends;
   if (config.getValue(rname.str(), rclass.str(), l) && (l > 0 && l <= 100))
     m_width_percent = l;
+  else
+    m_width_percent =66;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "toolbar.placement" << ends;
@@ -297,19 +294,25 @@ void Toolbar::load() {
       m_placement = BottomRight;
     else if ( 0 == strncasecmp(s.c_str(), "BottomCenter", s.length()))
       m_placement = BottomCenter;
-  }
+  } else
+    m_placement = BottomCenter;
   
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "toolbar.onTop" << ends;
   rclass << rscreen.str() << "Toolbar.OnTop" << ends;
   if (config.getValue(rname.str(), rclass.str(), b))
     m_ontop = b;
+  else
+    m_ontop = false;
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "toolbar.autoHide" << ends;
   rclass << rscreen.str() << "Toolbar.AutoHide" << ends;
   if (config.getValue(rname.str(), rclass.str(), b))
     m_hidden = m_autohide = b;
+  else
+    m_hidden = m_autohide = false;
+
   rscreen.rdbuf()->freeze(0);
   rname.rdbuf()->freeze(0);
   rclass.rdbuf()->freeze(0);
index d048837875b1a0107c9d374d970cb60a2ac833c0..70d1d920f30f08f7a96f88117ed62627cb5af534 100644 (file)
@@ -182,11 +182,11 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc)
 
   no_focus = False;
 
-  resource.menu_file = resource.style_file = (char *) 0;
-  resource.titlebar_layout = (char *) NULL;
+  resource.menu_file = resource.style_file = NULL;
+  resource.titlebar_layout = NULL;
   resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0;
 
-  focused_window = masked_window = (OpenboxWindow *) 0;
+  focused_window = masked_window = NULL;
   masked = None;
 
   windowSearchList = new LinkedList<WindowSearch>;
This page took 0.038198 seconds and 4 git commands to generate.