diff --git a/Common/Makefile b/Common/Makefile
index 24e190ce01066ae3718cd97af66161ee97338167..6909e7d310dc42f63863f932b80df7cd41896f37 100644
--- a/Common/Makefile
+++ b/Common/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.88 2006-04-01 22:05:19 geuzaine Exp $
+# $Id: Makefile,v 1.89 2006-04-01 23:02:20 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -118,7 +118,7 @@ Options.o: Options.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
   ../Mesh/Matrix.h ../Graphics/Draw.h Context.h Options.h \
   ../Fltk/Solvers.h ../Fltk/GUI.h ../Fltk/Opengl_Window.h \
-  ../Fltk/Colorbar_Window.h ../Common/GmshUI.h
+  ../Fltk/Colorbar_Window.h ../Common/GmshUI.h ../Fltk/Popup_Button.h
 # 1 "/Users/geuzaine/.gmsh/Common//"
 CommandLine.o: CommandLine.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 56ac71920b7e8ba76fa8432ba17dae721393b308..09ea88f3c391d352468097e2b6f3c910bdd859ee 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.497 2006-04-01 22:05:19 geuzaine Exp $
+// $Id: GUI.cpp,v 1.498 2006-04-01 23:02:20 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -970,7 +970,7 @@ void GUI::wait(double time)
 
 // Create the menu window
 
-void GUI::add_post_plugins(Fl_Menu_Button * button, int iView)
+void GUI::add_post_plugins(Popup_Button * button, int iView)
 {
   char name[256], menuname[256];
   for(GMSH_PluginManager::iter it = GMSH_PluginManager::instance()->begin();
@@ -1145,43 +1145,59 @@ void GUI::set_context(Context_Item * menu_asked, int flag)
 
   Msg(STATUS2N, menu[0].label + 1);
 
-  // We can only delete widgets at the very end of the callback, to
-  // avoid running into potential race conditions where a widget can
-  // be accessed after its callback is called---even when using
-  // Fl::delete_widget. (We thus need to make a temporary copy of the
-  // vectors holding references to the widgets that will be deleted
-  // later on. Note that in any case, we cannot use m_scroll->clear(),
-  // which is broken in < 1.1.5, and is a potential crasher in >=
-  // 1.1.5.)
-  std::vector<Fl_Button*>       tmp_push_butt(m_push_butt);
-  std::vector<Fl_Light_Button*> tmp_toggle_butt(m_toggle_butt);
-  std::vector<Fl_Button*>       tmp_toggle2_butt(m_toggle2_butt);
-  std::vector<Fl_Menu_Button*>  tmp_popup_butt(m_popup_butt);
-  std::vector<Fl_Menu_Button*>  tmp_popup2_butt(m_popup2_butt);
+  // Remove all the children (m_push*, m_toggle*, m_pop*). FLTK <=
+  // 1.1.4 should be OK with this. FLTK 1.1.5 may crash as it may
+  // access a widget's data after its callback is executed (we call
+  // set_context in the button callbacks!). FLTK 1.1.6 introduced a
+  // fix (Fl::delete_widget) to delay the deletion until the next
+  // Fl::wait call. In any case, we cannot use m_scroll->clear()
+  // (broken in < 1.1.5, potential crasher in >= 1.1.5).
   for(unsigned int i = 0; i < m_push_butt.size(); i++){
     m_scroll->remove(m_push_butt[i]);
-    m_push_butt[i]->hide();
+#if defined(HAVE_FLTK_1_1_6_OR_ABOVE)
+    Fl::delete_widget(m_push_butt[i]);
+#else
+    delete m_push_butt[i];
+#endif
   }
-  m_push_butt.clear();
   for(unsigned int i = 0; i < m_toggle_butt.size(); i++){
     m_scroll->remove(m_toggle_butt[i]);
-    m_toggle_butt[i]->hide();
+#if defined(HAVE_FLTK_1_1_6_OR_ABOVE)
+    Fl::delete_widget(m_toggle_butt[i]);
+#else
+    delete m_toggle_butt[i];
+#endif
   }
-  m_toggle_butt.clear();
   for(unsigned int i = 0; i < m_toggle2_butt.size(); i++){
     m_scroll->remove(m_toggle2_butt[i]);
-    m_toggle2_butt[i]->hide();
+#if defined(HAVE_FLTK_1_1_6_OR_ABOVE)
+    Fl::delete_widget(m_toggle2_butt[i]);
+#else
+    delete m_toggle2_butt[i];
+#endif
   }
-  m_toggle2_butt.clear();
   for(unsigned int i = 0; i < m_popup_butt.size(); i++){
     m_scroll->remove(m_popup_butt[i]);
-    m_popup_butt[i]->hide();
+#if defined(HAVE_FLTK_1_1_6_OR_ABOVE)
+    Fl::delete_widget(m_popup_butt[i]);
+#else
+    delete m_popup_butt[i];
+#endif
   }
-  m_popup_butt.clear();
   for(unsigned int i = 0; i < m_popup2_butt.size(); i++){
     m_scroll->remove(m_popup2_butt[i]);
-    m_popup2_butt[i]->hide();
+#if defined(HAVE_FLTK_1_1_6_OR_ABOVE)
+    Fl::delete_widget(m_popup2_butt[i]);
+#else
+    delete m_popup2_butt[i];
+#endif
   }
+
+  // reset the vectors
+  m_push_butt.clear();
+  m_toggle_butt.clear();
+  m_toggle2_butt.clear();
+  m_popup_butt.clear();
   m_popup2_butt.clear();
   for(unsigned int i = 0; i < m_pop_label.size(); i++)
     delete [] m_pop_label[i];
@@ -1190,9 +1206,10 @@ void GUI::set_context(Context_Item * menu_asked, int flag)
     delete m_pop_plugin[i]; 	 
   m_pop_plugin.clear();
 
-  // construct the dynamic menu
   int width = m_window->w();
   int popw = 4 * fontsize + 3;
+
+  // construct the dynamic menu
   int nb = 0;
   if(m_module_butt->value() == 3){ // post-processing context
     for(nb = 0; nb < List_Nbr(CTX.post.list); nb++) {
@@ -1212,10 +1229,10 @@ void GUI::set_context(Context_Item * menu_asked, int flag)
       b2->align(FL_ALIGN_RIGHT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
       b2->tooltip("Show view option menu (Shift+w)");
   
-      Fl_Menu_Button *p[2];
-      p[0] = new Fl_Menu_Button(width - popw, MH + nb * BH, popw, BH);
+      Popup_Button *p[2];
+      p[0] = new Popup_Button(width - popw, MH + nb * BH, popw, BH);
       p[0]->type(Fl_Menu_Button::POPUP123);
-      p[1] = new Fl_Menu_Button(0, MH + nb * BH, width - popw, BH);
+      p[1] = new Popup_Button(0, MH + nb * BH, width - popw, BH);
       p[1]->type(Fl_Menu_Button::POPUP3);
   
       for(int j = 0; j < 2; j++) {
@@ -1305,38 +1322,6 @@ void GUI::set_context(Context_Item * menu_asked, int flag)
     m_window->size(width, MH + nb * BH);
   else
     m_window->size(width, MH + NB_BUTT_SCROLL * BH);
-
-  // Delete the old widgets at the very end of the callback. Note: in
-  // FLTK <= 1.1.4 we could simply delete a widget anywhere in its
-  // callback. FLTK 1.1.5 broke this, as it could access a widget's
-  // data after its callback is executed (and we call set_context in a
-  // button's callback precisely to delete it!). FLTK 1.1.6 introduced
-  // a fix (Fl::delete_widget) to delay the deletion until the next
-  // Fl::wait call. But FLTK 1.1.7 broke this again by introducing
-  // extra redraw() calls in the menu button widget. Sigh.
-#if defined(HAVE_FLTK_1_1_6_OR_ABOVE)
-  for(unsigned int i = 0; i < tmp_push_butt.size(); i++) 
-    Fl::delete_widget(tmp_push_butt[i]);
-  for(unsigned int i = 0; i < tmp_toggle_butt.size(); i++) 
-    Fl::delete_widget(tmp_toggle_butt[i]);
-  for(unsigned int i = 0; i < tmp_toggle2_butt.size(); i++)
-    Fl::delete_widget(tmp_toggle2_butt[i]);
-  for(unsigned int i = 0; i < tmp_popup_butt.size(); i++)
-    Fl::delete_widget(tmp_popup_butt[i]);
-  for(unsigned int i = 0; i < tmp_popup2_butt.size(); i++)
-    Fl::delete_widget(tmp_popup2_butt[i]);
-#else
-  for(unsigned int i = 0; i < tmp_push_butt.size(); i++) 
-    delete tmp_push_butt[i];
-  for(unsigned int i = 0; i < tmp_toggle_butt.size(); i++) 
-    delete tmp_toggle_butt[i];
-  for(unsigned int i = 0; i < tmp_toggle2_butt.size(); i++)
-    delete tmp_toggle2_butt[i];
-  for(unsigned int i = 0; i < tmp_popup_butt.size(); i++)
-    delete tmp_popup_butt[i];
-  for(unsigned int i = 0; i < tmp_popup2_butt.size(); i++)
-    delete tmp_popup2_butt[i];
-#endif
 }
 
 int GUI::get_context()
diff --git a/Fltk/GUI.h b/Fltk/GUI.h
index 027938480c17179142ccc3bc33887c2ccacc94d6..9a353d52a9e484dd0c58858abe5b3e0ab2296206 100644
--- a/Fltk/GUI.h
+++ b/Fltk/GUI.h
@@ -34,7 +34,6 @@
 #include <FL/Fl_Repeat_Button.H>
 #include <FL/Fl_Light_Button.H>
 #include <FL/Fl_Check_Button.H>
-#include <FL/Fl_Menu_Button.H>
 #include <FL/Fl_Input.H>
 #include <FL/Fl_Value_Input.H>
 #include <FL/Fl_Output.H>
@@ -58,6 +57,7 @@
 
 #include "Opengl_Window.h"
 #include "Colorbar_Window.h"
+#include "Popup_Button.h"
 
 // The dynamic contexts
 
@@ -129,7 +129,7 @@ class GUI{
 
   // Bitmaps
   Fl_Bitmap  *abort_bmp, *start_bmp, *stop_bmp, *rewind_bmp, *rotate_bmp, *ortho_bmp ;
-  void add_post_plugins(Fl_Menu_Button *button , int iView);
+  void add_post_plugins(Popup_Button *button , int iView);
   void add_multiline_in_browser(Fl_Browser *o, char* prefix, char *str);
 
 public:
@@ -145,8 +145,8 @@ public:
   std::vector<Fl_Button*>       m_push_butt ;
   std::vector<Fl_Light_Button*> m_toggle_butt ;
   std::vector<Fl_Button*>       m_toggle2_butt ;
-  std::vector<Fl_Menu_Button*>  m_popup_butt ;
-  std::vector<Fl_Menu_Button*>  m_popup2_butt ;
+  std::vector<Popup_Button*>    m_popup_butt ;
+  std::vector<Popup_Button*>    m_popup2_butt ;
   std::vector<char*>            m_pop_label ;
   std::vector<std::pair<int, GMSH_Plugin*>*> m_pop_plugin;
 
diff --git a/Fltk/Makefile b/Fltk/Makefile
index 5088f8cbf519e403dc6eb9876c85ed0130f6424b..de649caf1b7ccdb6ffe66f11e6b99724e2175b6d 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.85 2006-04-01 22:05:21 geuzaine Exp $
+# $Id: Makefile,v 1.86 2006-04-01 23:02:22 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -72,9 +72,9 @@ Main.o: Main.cpp GUI.h Opengl_Window.h ../Mesh/Mesh.h ../DataStr/List.h \
   ../Common/VertexArray.h ../Common/SmoothNormals.h ../Numeric/Numeric.h \
   ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
   ../Mesh/Matrix.h Colorbar_Window.h ../Common/GmshUI.h \
-  ../Common/ColorTable.h ../Plugin/PluginManager.h ../Plugin/Plugin.h \
-  ../Common/Options.h ../Common/Message.h ../Common/Views.h \
-  ../Common/ColorTable.h ../Common/VertexArray.h \
+  ../Common/ColorTable.h Popup_Button.h ../Plugin/PluginManager.h \
+  ../Plugin/Plugin.h ../Common/Options.h ../Common/Message.h \
+  ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
   ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/Tools.h \
@@ -92,8 +92,8 @@ Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Geo/ExtrudeParams.h \
   ../Common/VertexArray.h ../Common/SmoothNormals.h ../Numeric/Numeric.h \
   ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
-  ../Mesh/Matrix.h Colorbar_Window.h ../Common/ColorTable.h GUI_Extras.h \
-  ../Common/OS.h
+  ../Mesh/Matrix.h Colorbar_Window.h ../Common/ColorTable.h \
+  Popup_Button.h GUI_Extras.h ../Common/OS.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 GUI.o: GUI.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
@@ -109,7 +109,7 @@ GUI.o: GUI.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
   ../Geo/ExtrudeParams.h ../Graphics/Draw.h GUI.h Opengl_Window.h \
-  Colorbar_Window.h Callbacks.h Bitmaps.h Win32Icon.h \
+  Colorbar_Window.h Popup_Button.h Callbacks.h Bitmaps.h Win32Icon.h \
   ../Parser/OpenFile.h ../Common/CommandLine.h Solvers.h \
   Shortcut_Window.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
@@ -143,9 +143,9 @@ Callbacks.o: Callbacks.cpp ../Mesh/BDS.h ../Common/Views.h \
   ../Geo/ExtrudeParams.h ../Geo/ExtractContour.h ../Graphics/Draw.h \
   ../Graphics/CreateFile.h ../Parser/OpenFile.h ../Common/CommandLine.h \
   ../Common/Context.h ../Common/Options.h GUI.h Opengl_Window.h \
-  Colorbar_Window.h GUI_Extras.h Callbacks.h ../Plugin/Plugin.h \
-  ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Common/Visibility.h \
-  Solvers.h ../Common/OS.h
+  Colorbar_Window.h Popup_Button.h GUI_Extras.h Callbacks.h \
+  ../Plugin/Plugin.h ../Plugin/PluginManager.h ../Plugin/Plugin.h \
+  ../Common/Visibility.h Solvers.h ../Common/OS.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
@@ -160,7 +160,8 @@ Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h \
   ../Common/VertexArray.h ../Common/SmoothNormals.h \
   ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \
-  GUI.h Opengl_Window.h Colorbar_Window.h ../Graphics/gl2ps.h
+  GUI.h Opengl_Window.h Colorbar_Window.h Popup_Button.h \
+  ../Graphics/gl2ps.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Opengl_Window.o: Opengl_Window.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
@@ -175,7 +176,7 @@ Opengl_Window.o: Opengl_Window.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h \
   ../Common/VertexArray.h ../Common/SmoothNormals.h \
   ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \
-  GUI.h Opengl_Window.h Colorbar_Window.h
+  GUI.h Opengl_Window.h Colorbar_Window.h Popup_Button.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Colorbar_Window.o: Colorbar_Window.cpp ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
@@ -187,7 +188,8 @@ Colorbar_Window.o: Colorbar_Window.cpp ../Common/Gmsh.h \
   ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Common/VertexArray.h \
   ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Mesh/Metric.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
-  Colorbar_Window.h ../Common/ColorTable.h ../Common/Context.h
+  Colorbar_Window.h ../Common/ColorTable.h Popup_Button.h \
+  ../Common/Context.h
 # 1 "/Users/geuzaine/.gmsh/Fltk//"
 Solvers.o: Solvers.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
@@ -200,7 +202,7 @@ Solvers.o: Solvers.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../Common/VertexArray.h ../Common/SmoothNormals.h ../Numeric/Numeric.h \
   ../Mesh/Metric.h ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h \
   ../Mesh/Matrix.h Colorbar_Window.h ../Common/ColorTable.h \
-  ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Common/VertexArray.h ../Common/SmoothNormals.h \
-  ../Common/GmshMatrix.h ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \
-  ../Common/Context.h
+  Popup_Button.h ../Graphics/Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Common/VertexArray.h \
+  ../Common/SmoothNormals.h ../Common/GmshMatrix.h \
+  ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Context.h
diff --git a/Fltk/Popup_Button.cpp b/Fltk/Popup_Button.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5a9bf0bef2846d96ca6265bf0c282036d3c1941b
--- /dev/null
+++ b/Fltk/Popup_Button.cpp
@@ -0,0 +1,68 @@
+// $Id: Popup_Button.cpp,v 1.4 2006-04-01 23:02:22 geuzaine Exp $
+//
+// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+// 
+// Please report all bugs and problems to <gmsh@geuz.org>.
+
+#include "Gmsh.h"
+#include "GmshUI.h"
+#include "Popup_Button.h"
+
+const Fl_Menu_Item* Popup_Button::popup() {
+  const Fl_Menu_Item* m;
+  redraw();
+  m = menu()->popup(Fl::event_x(), Fl::event_y(), label(), mvalue(), this);
+  picked(m);
+  return m;
+}
+
+int Popup_Button::handle(int e) {
+  if (!menu() || !menu()->text) return 0;
+  switch (e) {
+  case FL_ENTER:
+  case FL_LEAVE:
+    return (box() && !type()) ? 1 : 0;
+  case FL_PUSH:
+    if (!box()) {
+      if (Fl::event_button() != 3) return 0;
+    } else if (type()) {
+      if (!(type() & (1 << (Fl::event_button()-1)))) return 0;
+    }
+    if (Fl::visible_focus()) Fl::focus(this);
+    popup();
+    return 1;
+  case FL_KEYBOARD:
+    if (!box()) return 0;
+    if (Fl::event_key() == ' ' &&
+        !(Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META))) {
+      popup();
+      return 1;
+    } else return 0;
+  case FL_SHORTCUT:
+    if (Fl_Widget::test_shortcut()) {popup(); return 1;}
+    return test_shortcut() != 0;
+  case FL_FOCUS:
+  case FL_UNFOCUS:
+    if (box() && Fl::visible_focus()) {
+      redraw();
+      return 1;
+    }
+  default:
+    return 0;
+  }
+}
diff --git a/Fltk/Popup_Button.h b/Fltk/Popup_Button.h
new file mode 100644
index 0000000000000000000000000000000000000000..959c3b162c8494d5a7ab9c00c4cea38d34ae7708
--- /dev/null
+++ b/Fltk/Popup_Button.h
@@ -0,0 +1,39 @@
+#ifndef _POPUP_BUTTON_H
+#define _POPUP_BUTTON_H
+
+// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+// 
+// Please report all bugs and problems to <gmsh@geuz.org>.
+
+#include "GmshUI.h"
+#include <FL/Fl_Menu_Button.H>
+
+// We need to define our own popup button to fix a bug in FLTK 1.1.7
+// (popup() in 1.1.7 calls redraw() after picked(), which can cause a
+// crash if the button was deleted by the callback)
+
+class Popup_Button : public Fl_Menu_Button {
+ public:
+  Popup_Button(int x, int y, int w, int h, char *label=0) 
+    : Fl_Menu_Button(x, y, w, h, label) {}
+  void draw(){ Fl_Menu_Button::draw(); }
+  int handle(int e);
+  const Fl_Menu_Item* popup();
+};
+
+#endif
diff --git a/Parser/Makefile b/Parser/Makefile
index 9d13a7c6675f8e310a2d0541634a6300f9891644..86ba304e98ab6e367d0b9a5c3f3763de0ee15ceb 100644
--- a/Parser/Makefile
+++ b/Parser/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.84 2006-04-01 22:05:21 geuzaine Exp $
+# $Id: Makefile,v 1.85 2006-04-01 23:02:22 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -123,6 +123,6 @@ OpenFile.o: OpenFile.cpp ../Mesh/BDS.h ../Common/Views.h \
   ../Mesh/Matrix.h ../Geo/MinMax.h ../Common/Visibility.h \
   ../Graphics/ReadImg.h ../Common/OS.h ../Common/GmshUI.h \
   ../Graphics/Draw.h ../Fltk/GUI.h ../Fltk/Opengl_Window.h \
-  ../Fltk/Colorbar_Window.h
+  ../Fltk/Colorbar_Window.h ../Fltk/Popup_Button.h
 # 1 "/Users/geuzaine/.gmsh/Parser//"
 FunctionManager.o: FunctionManager.cpp FunctionManager.h
diff --git a/Plugin/Makefile b/Plugin/Makefile
index 450086fcbe4eccc1d31c1e2afc089014ce33d199..4fe3959d087b4a89831f27f01947e5bb8c973d5d 100644
--- a/Plugin/Makefile
+++ b/Plugin/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.95 2006-04-01 22:05:21 geuzaine Exp $
+# $Id: Makefile,v 1.96 2006-04-01 23:02:23 geuzaine Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -321,7 +321,7 @@ Annotate.o: Annotate.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Edge.h ../Mesh/Vertex.h \
   ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h \
   ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \
-  ../Fltk/Colorbar_Window.h ../Graphics/Draw.h
+  ../Fltk/Colorbar_Window.h ../Fltk/Popup_Button.h ../Graphics/Draw.h
 # 1 "/Users/geuzaine/.gmsh/Plugin//"
 Remove.o: Remove.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
   ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \