diff --git a/Common/Options.cpp b/Common/Options.cpp
index c732125712b6c5355dc6b2006e2cd3e08498d887..0a0ae3c905b3d7cbea25c713a944a873bca79db5 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -3124,14 +3124,17 @@ double opt_general_mouse_selection(OPT_ARGS_NUM)
     if(CTX.mouse_selection){
       if(GUI::available())
         Msg::StatusBar(2, false, "Mouse selection ON");
-      GUI::instance()->graph[0]->butt[9]->color(FL_BACKGROUND_COLOR);
+      for(unsigned int i = 0; i < GUI::instance()->graph.size(); i++)
+        GUI::instance()->graph[i]->butt[9]->color(FL_BACKGROUND_COLOR);
     }
     else{
       if(GUI::available())
         Msg::StatusBar(2, false, "Mouse selection OFF");
-      GUI::instance()->graph[0]->butt[9]->color(FL_RED);
+      for(unsigned int i = 0; i < GUI::instance()->graph.size(); i++)
+        GUI::instance()->graph[i]->butt[9]->color(FL_RED);
     }
-    GUI::instance()->graph[0]->butt[9]->redraw();
+    for(unsigned int i = 0; i < GUI::instance()->graph.size(); i++)
+      GUI::instance()->graph[i]->butt[9]->redraw();
   }
 #endif
   return CTX.mouse_selection;
@@ -3410,7 +3413,8 @@ double opt_general_double_buffer(OPT_ARGS_NUM)
     if(GUI::available()) {
       int mode = FL_RGB | FL_DEPTH | (CTX.db ? FL_DOUBLE : FL_SINGLE);
       if(CTX.antialiasing) mode |= FL_MULTISAMPLE;
-      GUI::instance()->graph[0]->gl->mode(mode);
+      for(unsigned int i = 0; i < GUI::instance()->graph.size(); i++)
+        GUI::instance()->graph[i]->gl->mode(mode);
     }
 #endif
   }
@@ -3429,7 +3433,8 @@ double opt_general_antialiasing(OPT_ARGS_NUM)
     if(GUI::available()) {
       int mode = FL_RGB | FL_DEPTH | (CTX.db ? FL_DOUBLE : FL_SINGLE);
       if(CTX.antialiasing) mode |= FL_MULTISAMPLE;
-      GUI::instance()->graph[0]->gl->mode(mode);
+      for(unsigned int i = 0; i < GUI::instance()->graph.size(); i++)
+        GUI::instance()->graph[i]->gl->mode(mode);
     }
 #endif
   }
@@ -5873,7 +5878,8 @@ double opt_post_anim_cycle(OPT_ARGS_NUM)
   if(GUI::available() && (action & GMSH_GUI))
     GUI::instance()->options->post.butt[0]->value(CTX.post.anim_cycle);
   if(GUI::available())
-    GUI::instance()->graph[0]->checkAnimButtons();
+    for(unsigned int i = 0; i < GUI::instance()->graph.size(); i++)
+      GUI::instance()->graph[i]->checkAnimButtons();
 #endif
   return CTX.post.anim_cycle;
 }
@@ -5921,7 +5927,8 @@ double opt_view_nb_timestep(OPT_ARGS_NUM)
   if(_gui_action_valid(action, num))
     GUI::instance()->options->view.value[50]->maximum(data->getNumTimeSteps() - 1);
   if(GUI::available())
-    GUI::instance()->graph[0]->checkAnimButtons();
+    for(unsigned int i = 0; i < GUI::instance()->graph.size(); i++)
+      GUI::instance()->graph[i]->checkAnimButtons();
 #endif
   return data->getNumTimeSteps();
 #else
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 899503016d191edd70afc3612234acc1d60f1a90..045c27747c40492b684f35ffd9879e2bc30deae6 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -128,10 +128,9 @@ GUI::GUI(int argc, char **argv)
   // e.g. directly loop through time steps with the keyboard)
   graph[0]->gl->take_focus();
 
-  // test: create another graphic window, with a coordinate
-  // transformation
+  // test: create another graphic window with a coordinate transform
   //graph.push_back(new graphicWindow(_fontsize));
-  //drawTransform *tr = new drawTransformScaled(2,1,0, 0,1,0, 0,0,1);
+  //drawTransform *tr = new drawTransformScaled(2,0,0, 0,1,0, 0,0,1);
   //graph.back()->gl->getDrawContext()->setTransform(tr);
   //graph.back()->win->show();
 
diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp
index 350e0320a9bcb19a41fd3821212407f343b6710c..455f17bbc67d108517a61480bdf4d96fcff9eb2b 100644
--- a/Fltk/openglWindow.cpp
+++ b/Fltk/openglWindow.cpp
@@ -71,18 +71,19 @@ static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &cl
 openglWindow::openglWindow(int x, int y, int w, int h, const char *l)
   : Fl_Gl_Window(x, y, w, h, l)
 {
-  addPointMode = lassoMode = selectionMode = false;
-  selection = ENT_NONE;
-  trySelection = quitSelection = endSelection = 0;
-  undoSelection = invertSelection = 0;
-  for(int i = 0; i < 4; i++) trySelectionXYWH[i] = 0;
-  _point[0] = _point[1] = _point[2] = 0.;
   _ctx = new drawContext();
+  for(int i = 0; i < 3; i++) _point[i] = 0.;
+  _selection = ENT_NONE;
+  _trySelection = 0;
+  for(int i = 0; i < 4; i++) _trySelectionXYWH[i] = 0;
+  
+  addPointMode = lassoMode = selectionMode = false;
+  endSelection = undoSelection = invertSelection = quitSelection = 0;
 }
 
 openglWindow::~openglWindow()
 { 
-  delete _ctx;
+  delete _ctx; 
 }
 
 void openglWindow::draw()
@@ -209,11 +210,11 @@ int openglWindow::handle(int event)
         lassoMode = false;
         if(selectionMode && CTX.mouse_selection){
           // will try to select multiple entities
-          trySelection = 2;
-          trySelectionXYWH[0] = (int)(_click.win[0] + _curr.win[0]) / 2;
-          trySelectionXYWH[1] = (int)(_click.win[1] + _curr.win[1]) / 2;
-          trySelectionXYWH[2] = (int)fabs(_click.win[0] - _curr.win[0]);
-          trySelectionXYWH[3] = (int)fabs(_click.win[1] - _curr.win[1]);
+          _trySelection = 2;
+          _trySelectionXYWH[0] = (int)(_click.win[0] + _curr.win[0]) / 2;
+          _trySelectionXYWH[1] = (int)(_click.win[1] + _curr.win[1]) / 2;
+          _trySelectionXYWH[2] = (int)fabs(_click.win[0] - _curr.win[0]);
+          _trySelectionXYWH[3] = (int)fabs(_click.win[1] - _curr.win[1]);
         }
         else{
           lassoZoom(_ctx, _click, _curr);
@@ -221,11 +222,11 @@ int openglWindow::handle(int event)
       }
       else if(CTX.mouse_selection){
         // will try to select clicked entity
-        trySelection = 1;
-        trySelectionXYWH[0] = (int)_curr.win[0];
-        trySelectionXYWH[1] = (int)_curr.win[1];
-        trySelectionXYWH[2] = 5;
-        trySelectionXYWH[3] = 5;
+        _trySelection = 1;
+        _trySelectionXYWH[0] = (int)_curr.win[0];
+        _trySelectionXYWH[1] = (int)_curr.win[1];
+        _trySelectionXYWH[2] = 5;
+        _trySelectionXYWH[3] = 5;
       }
     }
     else if(Fl::event_button() == 2 || 
@@ -240,11 +241,11 @@ int openglWindow::handle(int event)
         lassoMode = false;
         if(selectionMode && CTX.mouse_selection){
           // will try to unselect multiple entities
-          trySelection = -2;
-          trySelectionXYWH[0] = (int)(_click.win[0] + _curr.win[0]) / 2;
-          trySelectionXYWH[1] = (int)(_click.win[1] + _curr.win[1]) / 2;
-          trySelectionXYWH[2] = (int)fabs(_click.win[0] - _curr.win[0]);
-          trySelectionXYWH[3] = (int)fabs(_click.win[1] - _curr.win[1]);
+          _trySelection = -2;
+          _trySelectionXYWH[0] = (int)(_click.win[0] + _curr.win[0]) / 2;
+          _trySelectionXYWH[1] = (int)(_click.win[1] + _curr.win[1]) / 2;
+          _trySelectionXYWH[2] = (int)fabs(_click.win[0] - _curr.win[0]);
+          _trySelectionXYWH[3] = (int)fabs(_click.win[1] - _curr.win[1]);
         }
         else{
           lassoZoom(_ctx, _click, _curr);
@@ -252,11 +253,11 @@ int openglWindow::handle(int event)
       }
       else if(CTX.mouse_selection){
         // will try to unselect clicked entity
-        trySelection = -1;
-        trySelectionXYWH[0] = (int)_curr.win[0];
-        trySelectionXYWH[1] = (int)_curr.win[1];
-        trySelectionXYWH[2] = 5;
-        trySelectionXYWH[3] = 5;
+        _trySelection = -1;
+        _trySelectionXYWH[0] = (int)_curr.win[0];
+        _trySelectionXYWH[1] = (int)_curr.win[1];
+        _trySelectionXYWH[2] = 5;
+        _trySelectionXYWH[3] = 5;
       }
     }
     else {
@@ -313,11 +314,11 @@ int openglWindow::handle(int event)
       else {
         if(Fl::event_state(FL_META)) {
           // will try to select or unselect entities on the fly
-          trySelection = Fl::event_state(FL_SHIFT) ? -1 : 1; 
-          trySelectionXYWH[0] = (int)_curr.win[0];
-          trySelectionXYWH[1] = (int)_curr.win[1];
-          trySelectionXYWH[2] = 5;
-          trySelectionXYWH[3] = 5;
+          _trySelection = Fl::event_state(FL_SHIFT) ? -1 : 1; 
+          _trySelectionXYWH[0] = (int)_curr.win[0];
+          _trySelectionXYWH[1] = (int)_curr.win[1];
+          _trySelectionXYWH[2] = 5;
+          _trySelectionXYWH[3] = 5;
         }
         else if(Fl::event_button() == 1 && 
                 !Fl::event_state(FL_SHIFT) && !Fl::event_state(FL_ALT)) {
@@ -399,14 +400,14 @@ int openglWindow::handle(int event)
         std::vector<GFace*> faces;
         std::vector<GRegion*> regions;
         std::vector<MElement*> elements;
-        bool res = processSelectionBuffer(selection, false, CTX.mouse_hover_meshes, 
+        bool res = processSelectionBuffer(_selection, false, CTX.mouse_hover_meshes, 
                                           (int)_curr.win[0], (int)_curr.win[1], 5, 5,
                                           vertices, edges, faces, regions, elements);
-        if((selection == ENT_ALL && res) ||
-           (selection == ENT_POINT && vertices.size()) ||
-           (selection == ENT_LINE && edges.size()) || 
-           (selection == ENT_SURFACE && faces.size()) ||
-           (selection == ENT_VOLUME && regions.size()))
+        if((_selection == ENT_ALL && res) ||
+           (_selection == ENT_POINT && vertices.size()) ||
+           (_selection == ENT_LINE && edges.size()) || 
+           (_selection == ENT_SURFACE && faces.size()) ||
+           (_selection == ENT_VOLUME && regions.size()))
           cursor(FL_CURSOR_CROSS, FL_BLACK, FL_WHITE);
         else
           cursor(FL_CURSOR_DEFAULT, FL_BLACK, FL_WHITE);
@@ -641,10 +642,9 @@ char openglWindow::selectEntity(int type,
 {
   // force keyboard focus in GL window 
   take_focus();
-
+  _selection = type;
+  _trySelection = 0;
   selectionMode = true;
-  selection = type;
-  trySelection = 0;
   quitSelection = 0;
   endSelection = 0;
   undoSelection = 0;
@@ -658,7 +658,7 @@ char openglWindow::selectEntity(int type,
     elements.clear();
     GUI::instance()->wait();
     if(quitSelection) {
-      selection = ENT_NONE;
+      _selection = ENT_NONE;
       selectionMode = false;
       lassoMode = false;
       addPointMode = false;
@@ -666,7 +666,7 @@ char openglWindow::selectEntity(int type,
       return 'q';
     }
     if(endSelection) {
-      selection = ENT_NONE;
+      _selection = ENT_NONE;
       endSelection = 0;
       return 'e';
     }
@@ -678,19 +678,19 @@ char openglWindow::selectEntity(int type,
       invertSelection = 0;
       return 'i';
     }
-    if(trySelection) {
-      bool add = (trySelection > 0) ? true : false;
-      bool multi = (abs(trySelection) > 1) ? true : false;
-      trySelection = 0;
-      if(selection == ENT_NONE){ // just report the mouse click
+    if(_trySelection) {
+      bool add = (_trySelection > 0) ? true : false;
+      bool multi = (abs(_trySelection) > 1) ? true : false;
+      _trySelection = 0;
+      if(_selection == ENT_NONE){ // just report the mouse click
         selectionMode = false;
         return 'c';
       }
-      else if(processSelectionBuffer(selection, multi, true, trySelectionXYWH[0],
-                                     trySelectionXYWH[1], trySelectionXYWH[2],
-                                     trySelectionXYWH[3], vertices, edges, faces, 
+      else if(processSelectionBuffer(_selection, multi, true, _trySelectionXYWH[0],
+                                     _trySelectionXYWH[1], _trySelectionXYWH[2],
+                                     _trySelectionXYWH[3], vertices, edges, faces, 
                                      regions, elements)){
-        selection = ENT_NONE;
+        _selection = ENT_NONE;
         selectionMode = false;
         if(add)
           return 'l';
diff --git a/Fltk/openglWindow.h b/Fltk/openglWindow.h
index 762e06f08dac7399bbd2529c6f8b8aee2f70cbe6..730b3935677e8ec9d9cca61c80d3a3406f8e40dd 100644
--- a/Fltk/openglWindow.h
+++ b/Fltk/openglWindow.h
@@ -46,7 +46,7 @@ class openglWindow : public Fl_Gl_Window {
   mousePosition _click, _curr, _prev, _lasso;
   drawContext *_ctx;
   double _point[3];
-  int selection, trySelection, trySelectionXYWH[4];
+  int _selection, _trySelection, _trySelectionXYWH[4];
   void draw();
   int handle(int);
   bool processSelectionBuffer(int type,