diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index f0ffccaed57aceb65f38b56cd56d246c695ad393..79c2305245a53a97946a646f433b2601d6b86af4 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -1384,6 +1384,8 @@ StringXNumber ViewOptions_Number[] = {
     "Center glyphs (arrows, numbers, etc.)? (0=left, 1=centered, 2=right)" },
   { F,   "Clip" , opt_view_clip , 0.,
     "Enable clipping planes? (Plane[i]=2^i, i=0,...,5)" },
+  { F|O, "Closed" , opt_view_closed , 0,
+    "Close the subtree containing this view" },
   { F|O, "ColormapAlpha" , opt_view_colormap_alpha , 1.0 ,
     "Colormap alpha channel value (used only if != 1)" },
   { F|O, "ColormapAlphaPower" , opt_view_colormap_alpha_power , 0.0 ,
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 89b28e1c9b3980843edd030d0cdecfbdd1f08e79..914f0834a2a1b0752723e3f096b954b608710b4e 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -8788,6 +8788,24 @@ double opt_view_component_map6(OPT_ARGS_NUM){ return ovcm(num, action, val, 6);
 double opt_view_component_map7(OPT_ARGS_NUM){ return ovcm(num, action, val, 7); }
 double opt_view_component_map8(OPT_ARGS_NUM){ return ovcm(num, action, val, 8); }
 
+double opt_view_closed(OPT_ARGS_NUM)
+{
+#if defined(HAVE_POST)
+  GET_VIEWo(0.);
+  if(action & GMSH_SET) {
+    opt->closed = (int)val;
+  }
+#if defined(HAVE_FLTK)
+  if(FlGui::available() && (action & GMSH_GUI) && num >= 0){
+    FlGui::instance()->onelab->openCloseViewButton(num);
+  }
+#endif
+  return opt->closed;
+#else
+  return 0.;
+#endif
+}
+
 double opt_print_file_format(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
diff --git a/Common/Options.h b/Common/Options.h
index d0e5dc3b1db58aec3041543027a896c1f18aa535..8825ef141671876c32849d858b94cb64d7f380c6 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -677,6 +677,7 @@ double opt_view_component_map5(OPT_ARGS_NUM);
 double opt_view_component_map6(OPT_ARGS_NUM);
 double opt_view_component_map7(OPT_ARGS_NUM);
 double opt_view_component_map8(OPT_ARGS_NUM);
+double opt_view_closed(OPT_ARGS_NUM);
 double opt_print_file_format(OPT_ARGS_NUM);
 double opt_print_eps_compress(OPT_ARGS_NUM);
 double opt_print_eps_ps3shading(OPT_ARGS_NUM);
diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp
index 97219a2a9d2c7a8cb4687cea9b70ef74a47c9338..49ca7370f64645fa8f2d4eb5f655b7cb3c692f09 100644
--- a/Fltk/onelabGroup.cpp
+++ b/Fltk/onelabGroup.cpp
@@ -376,8 +376,10 @@ static void onelab_subtree_cb(Fl_Widget *w, void *data)
 
 void onelabGroup::_computeWidths()
 {
-  _baseWidth = (int)(_tree->w() - _tree->marginleft());
-  _indent = (int)(_tree->connectorwidth() / 2. + _tree->openicon()->w() / 2.);
+  _baseWidth = _tree->w() - _tree->marginleft();
+  // not sure why we have the "-2" correction at the end, but this is what is
+  // needed to make things pixel-correct.
+  _indent = _tree->connectorwidth() / 2. + _tree->openicon()->w() / 2. - 2.;
 }
 
 #if !defined(__APPLE__)
@@ -513,11 +515,10 @@ void onelabGroup::_addParameter(T &p)
   Fl_Tree_Item *n = _tree->add(p.getName().c_str());
   n->labelsize(FL_NORMAL_SIZE + 4);
   _tree->begin();
-  int ww = _baseWidth - (n->depth() + 1) * _indent;
-  ww *= _widgetLabelRatio; // FIXME CHANGE THIS
+  int ww = (int)(_baseWidth - (n->depth() + 1) * _indent);
   int hh = n->labelsize() + 4;
   Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
-  Fl_Widget *widget = _addParameterWidget(p, ww, hh, n, highlight, c);
+  Fl_Widget *widget = _addParameterWidget(p, ww * _widgetLabelRatio, hh, n, highlight, c);
   grp->end();
   if(!_enableTreeWidgetResize) grp->resizable(0);
   _treeWidgets.push_back(grp);
@@ -534,7 +535,7 @@ void onelabGroup::_addMenu(const std::string &path, Fl_Callback *callback, void
   Fl_Tree_Item *n = _tree->add(path.c_str());
   //n->labelsize(FL_NORMAL_SIZE + 4);
   _tree->begin();
-  int ww = _baseWidth - (n->depth() + 1) * _indent;
+  int ww = (int)(_baseWidth - (n->depth() + 1) * _indent);
   int hh = n->labelsize() + 4;
   Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
   Fl_Button *but = new Fl_Button(1, 1, ww, hh);
@@ -559,7 +560,7 @@ void onelabGroup::_addSolverMenu(int num)
   std::ostringstream path;
   path << "0Modules/Solver/Solver" << num;
   Fl_Tree_Item *n = _tree->add(path.str().c_str());
-  int ww = _baseWidth - (n->depth() + 1) * _indent;
+  int ww = (int)(_baseWidth - (n->depth() + 1) * _indent);
   int hh = n->labelsize() + 4;
   _tree->begin();
   Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
@@ -571,16 +572,23 @@ void onelabGroup::_addSolverMenu(int num)
   _tree->end();
 }
 
-void onelabGroup::_addViewMenu(int num)
+static std::string _getViewPathName(int num)
 {
+  if(num < 0 || num >= (int)PView::list.size()) return "";
+  PViewOptions *opt = PView::list[num]->getOptions();
   std::ostringstream path;
   path << "0Modules/Post-processing/";
-  if(num >= 0 && num < PView::list.size() &&
-     PView::list[num]->getOptions()->group.size())
-    path << PView::list[num]->getOptions()->group << "/";
+  if(opt->group.size()) path << opt->group << "/";
   path << "View" << num;
-  Fl_Tree_Item *n = _tree->add(path.str().c_str());
-  int ww = _baseWidth - (n->depth() + 1) * _indent;
+  return path.str();
+}
+
+void onelabGroup::_addViewMenu(int num)
+{
+  std::string path = _getViewPathName(num);
+  if(path.empty()) return;
+  Fl_Tree_Item *n = _tree->add(path.c_str());
+  int ww = (int)(_baseWidth - (n->depth() + 1) * _indent);
   int hh = n->labelsize() + 4;
   _tree->begin();
   Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
@@ -590,18 +598,14 @@ void onelabGroup::_addViewMenu(int num)
   _treeWidgets.push_back(grp);
   n->widget(grp);
   _tree->end();
+  if(PView::list[num]->getOptions()->closed) n->parent()->close();
 }
 
 viewButton *onelabGroup::getViewButton(int num)
 {
-  char tmp[256];
-  if(num >= 0 && num < PView::list.size() &&
-     PView::list[num]->getOptions()->group.size())
-    sprintf(tmp, "0Modules/Post-processing/%s/View%d",
-            PView::list[num]->getOptions()->group.c_str(), num);
-  else
-    sprintf(tmp, "0Modules/Post-processing/View%d", num);
-  Fl_Tree_Item *n = _tree->find_item(tmp);
+  std::string path = _getViewPathName(num);
+  if(path.empty()) return 0;
+  Fl_Tree_Item *n = _tree->find_item(path.c_str());
   if(n){
     Fl_Group *grp = (Fl_Group*)n->widget();
     return (viewButton*)grp->child(0);
@@ -609,6 +613,20 @@ viewButton *onelabGroup::getViewButton(int num)
   return 0;
 }
 
+void onelabGroup::openCloseViewButton(int num)
+{
+  std::string path = _getViewPathName(num);
+  if(path.empty()) return;
+  Fl_Tree_Item *n = _tree->find_item(path.c_str());
+  if(n){
+    if(PView::list[num]->getOptions()->closed)
+      n->parent()->close();
+    else
+      n->parent()->open();
+    _tree->redraw();
+  }
+}
+
 template <class T>
 static void setGmshOption(T &n)
 {
@@ -1126,7 +1144,7 @@ void onelabGroup::rebuildTree(bool deleteWidgets)
 
   for(Fl_Tree_Item *n = _tree->first(); n; n = n->next()){
     if(n->has_children()){
-      int ww = _baseWidth - (n->depth() + 1) * _indent;
+      int ww = (int)(_baseWidth - (n->depth() + 1) * _indent);
       int hh = n->labelsize() + 4;
       _tree->begin();
 #if 0 // FIXME this can crash FLTK when submenus are intially closed (somehow
@@ -1138,9 +1156,7 @@ void onelabGroup::rebuildTree(bool deleteWidgets)
       but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
       but->callback(onelab_subtree_cb, (void*)n);
 #else
-      // FIXME: if view group, add special widget with on/off switch
       Fl_Box *but = new Fl_Box(1, 1, ww, hh);
-      //but->labelfont(FL_HELVETICA_ITALIC);
       but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
 #endif
       _treeWidgets.push_back(but);
diff --git a/Fltk/onelabGroup.h b/Fltk/onelabGroup.h
index 801517dfcb1680c071848a5be0365d52bb9061fc..483e2ac08d9bf2d4dc52cad181d781085963f7bb 100644
--- a/Fltk/onelabGroup.h
+++ b/Fltk/onelabGroup.h
@@ -25,7 +25,7 @@ class onelabGroup : public Fl_Group{
   std::vector<Fl_Widget*> _treeWidgets;
   std::vector<char*> _treeStrings;
   bool _stop;
-  int _baseWidth, _indent;
+  double _baseWidth, _indent;
   int _minWindowWidth, _minWindowHeight;
   double _widgetLabelRatio;
   std::set<std::string> _manuallyClosed;
@@ -72,6 +72,7 @@ class onelabGroup : public Fl_Group{
     return _manuallyClosed.find(path) != _manuallyClosed.end();
   }
   viewButton *getViewButton(int num);
+  void openCloseViewButton(int num);
   void addSolver(const std::string &name, const std::string &exe,
                  const std::string &hostName, int index);
   void removeSolver(const std::string &name);
diff --git a/Fltk/viewButton.cpp b/Fltk/viewButton.cpp
index a003528e177e986940c212dd60ef9375fe1a1048..f58afa13f6397e91749cac95e0c40c0582d5b471 100644
--- a/Fltk/viewButton.cpp
+++ b/Fltk/viewButton.cpp
@@ -268,7 +268,8 @@ viewButton::viewButton(int x, int y, int w, int h, int num, Fl_Color col)
   PViewData *data = view->getData();
   PViewOptions *opt = view->getOptions();
 
-  _toggle = new Fl_Check_Button(x, y, w - popw, h);
+  // "-4" to leave a bit of white space to the right
+  _toggle = new Fl_Check_Button(x, y, w - popw - 4, h);
   _toggle->box(FL_FLAT_BOX);
   _toggle->color(col);
   _toggle->callback(view_toggle_cb, (void *)num);
@@ -280,13 +281,13 @@ viewButton::viewButton(int x, int y, int w, int h, int num, Fl_Color col)
   strcpy(_tooltip, data->getFileName().c_str());
   _toggle->tooltip(_tooltip);
 
-  _butt = new Fl_Button(x + w - popw, y, popw, h, "@>");
+  _butt = new Fl_Button(x + w - popw - 4, y, popw, h, "@>");
   _butt->align(FL_ALIGN_RIGHT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
   _butt->tooltip("Show view options (Shift+w)");
   _butt->box(FL_FLAT_BOX);
   _butt->color(col);
   _butt->selection_color(col);
-  _popup = new Fl_Menu_Button(x + w - popw, y, popw, h);
+  _popup = new Fl_Menu_Button(x + w - popw - 4, y, popw, h);
   _popup->type(Fl_Menu_Button::POPUP123);
 
   _popup->add("Options", 'o',
diff --git a/Post/PViewOptions.h b/Post/PViewOptions.h
index 186cee64478ea81d140ca768ca65646edb0976a2..a5ebaa5224415e578fc513d914815c5543c1f653 100644
--- a/Post/PViewOptions.h
+++ b/Post/PViewOptions.h
@@ -100,6 +100,7 @@ class PViewOptions {
   int forceNumComponents, componentMap[9];
   int sampling;
   std::string attributes, doubleClickedCommand, group;
+  int closed;
   struct{
     unsigned int point, line, triangle, quadrangle;
     unsigned int tetrahedron, hexahedron, prism, pyramid;
diff --git a/doc/texinfo/opt_view.texi b/doc/texinfo/opt_view.texi
index 338faf94377caeaaddc29030b58b608e6f4fa798..9628f5fb9e04b244f9ad9bc3668a283823d0cd7b 100644
--- a/doc/texinfo/opt_view.texi
+++ b/doc/texinfo/opt_view.texi
@@ -234,6 +234,11 @@ Enable clipping planes? (Plane[i]=2^i, i=0,...,5)@*
 Default value: @code{0}@*
 Saved in: @code{-}
 
+@item View.Closed
+Close the subtree containing this view@*
+Default value: @code{0}@*
+Saved in: @code{General.OptionsFileName}
+
 @item View.ColormapAlpha
 Colormap alpha channel value (used only if != 1)@*
 Default value: @code{1}@*