diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp
index e1a75d7ef79eab7420d3e87877cdf40a92c0ac4a..4aacc0108f876ce1f4cf9dc2f0b0c8fcf6c20f5e 100644
--- a/Fltk/Opengl.cpp
+++ b/Fltk/Opengl.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl.cpp,v 1.54 2005-10-09 17:45:37 geuzaine Exp $
+// $Id: Opengl.cpp,v 1.55 2005-10-09 18:00:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -195,13 +195,6 @@ void Draw_OnScreenMessages()
 
 // Select entity routines
 
-int check_type(int type, Vertex * v, Curve * c, Surface * s)
-{
-  return ((type == ENT_POINT && v) ||
-          (type == ENT_LINE && c) || 
-	  (type == ENT_SURFACE && s));
-}
-
 char SelectEntity(int type, Vertex ** v, Curve ** c, Surface ** s)
 {
   int numhits;
diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp
index d1adadcc4dd00058b7aa40593187d454ae253e62..0a20247daebc29a0d48d34ce08fba4c1fdbb1286 100644
--- a/Fltk/Opengl_Window.cpp
+++ b/Fltk/Opengl_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl_Window.cpp,v 1.49 2005-10-09 15:58:41 geuzaine Exp $
+// $Id: Opengl_Window.cpp,v 1.50 2005-10-09 18:00:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -35,8 +35,6 @@ extern GUI *WID;
 extern Mesh M;
 extern Context_T CTX;
 
-int check_type(int type, Vertex *v, Curve *c, Surface *s);
-
 void Opengl_Window::draw()
 {
   static int locked = 0;
@@ -325,7 +323,9 @@ int Opengl_Window::handle(int event)
       s = NULL;
       Filter_SelectionBuffer(WID->selection, numhits, hits, &v, &c, &s, &M);
       if(ov != v || oc != c || os != s) {
-        if(check_type(WID->selection, v, c, s))
+        if((WID->selection == ENT_POINT && v) ||
+	   (WID->selection == ENT_LINE && c) || 
+	   (WID->selection == ENT_SURFACE && s))
           WID->g_window->cursor(FL_CURSOR_CROSS, FL_BLACK, FL_WHITE);
         else
           WID->g_window->cursor(FL_CURSOR_DEFAULT, FL_BLACK, FL_WHITE);
diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index 73628233e1991dfc5ba3253de0a5bacab9ec732b..0219eefd9c4c70956aa393c485eaf844cef92f14 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-// $Id: Draw.cpp,v 1.78 2005-10-09 15:58:41 geuzaine Exp $
+// $Id: Draw.cpp,v 1.79 2005-10-09 18:00:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -328,7 +328,8 @@ void Process_SelectionBuffer(int x, int y, int *n, hit *hits)
     hits[i].depth = (mindepth+maxdepth)/2;
     for(int j = 0; j < names; j++) {
       if(j == 0)
-        hits[i].type = *ptr; // type of entity (0, 1, 2 for point, line, surf)
+        hits[i].type = *ptr; // type of entity (0, 1, 2, ... for
+			     // point, line, surf, ...)
       else if(j == 1)
         hits[i].ient = *ptr; // num of entity
       ptr++;
diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp
index 205c8ee3b7608e3a28ab2dd6bde5aa087530258b..4062c70d93cf8ce1c9dfd3e7281eb03f3801bb93 100644
--- a/Graphics/Mesh.cpp
+++ b/Graphics/Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Mesh.cpp,v 1.139 2005-10-09 17:45:37 geuzaine Exp $
+// $Id: Mesh.cpp,v 1.140 2005-10-09 18:00:54 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -307,6 +307,8 @@ void Draw_Mesh(Mesh * M)
       glDisable((GLenum)(GL_CLIP_PLANE0 + i));
   }
 
+  if(CTX.render_mode == GMSH_SELECT) return;
+  
   // draw any plugin-specific stuff
   
   if(CTX.post.plugin_draw_function)