From 088cab2cf2c73aa5f838482e83e121ef60770cb3 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 18 Jan 2005 19:03:07 +0000
Subject: [PATCH] Create windows as Fl_Double_Window (double-buffered) instead
 of Fl_Window. This makes the GUI "smoother" on Windows and Linux. The Mac
 port of FLTK actually always uses Fl_Double_Window, even when one asks for an
 Fl_Window...

---
 Fltk/Colorbar_Window.h |  2 ++
 Fltk/GUI.cpp           |  8 ++++----
 Fltk/GUI.h             |  1 +
 Fltk/GUI_Extras.cpp    | 14 +++++++-------
 Fltk/Shortcut_Window.h | 22 +++++++++++-----------
 5 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/Fltk/Colorbar_Window.h b/Fltk/Colorbar_Window.h
index fb8655a966..9843e9e92e 100644
--- a/Fltk/Colorbar_Window.h
+++ b/Fltk/Colorbar_Window.h
@@ -23,6 +23,8 @@
 #include "GmshUI.h"
 #include "ColorTable.h"
 
+#include <FL/Fl_Window.H>
+
 class Colorbar_Window : public Fl_Window {
   void draw();
   int  handle(int);
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 6c32094ce7..33e2e0956e 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.415 2005-01-18 06:48:28 geuzaine Exp $
+// $Id: GUI.cpp,v 1.416 2005-01-18 19:03:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -3508,7 +3508,7 @@ void GUI::create_visibility_window()
   };
 
   int width = cols[0] + cols[1] + cols[2] + cols[3] + 4 * WB;
-  int height = 16 * BH;
+  int height = 18 * BH;
 
   vis_window = new Dialog_Window(width, height, "Visibility");
   vis_window->box(GMSH_WINDOW_BOX);
@@ -3566,7 +3566,7 @@ void GUI::create_visibility_window()
     Fl_Group::current()->resizable(o);
   }
   {
-    Fl_Group *o = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 3 * WB - BH, "Direct Numeric Input");
+    Fl_Group *o = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 3 * WB - BH, "Numeric Input");
     o->resizable(NULL);
 
     for(int i = 0; i < 6; i++){
@@ -3722,7 +3722,7 @@ void GUI::create_about_window()
   int height = 15 * BH;
 
   // not a "Dialog_Window" since it is modal 
-  about_window = new Fl_Window(width, height, "About Gmsh");
+  about_window = new Fl_Double_Window(width, height, "About Gmsh");
   about_window->box(GMSH_WINDOW_BOX);
 
   {
diff --git a/Fltk/GUI.h b/Fltk/GUI.h
index 4fd4baafb5..11d0bb988d 100644
--- a/Fltk/GUI.h
+++ b/Fltk/GUI.h
@@ -21,6 +21,7 @@
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
 #include <FL/Fl_Window.H>
+#include <FL/Fl_Double_Window.H>
 #include <FL/Fl_Box.H>
 #include <FL/Fl_Menu_Bar.H>
 #include <FL/fl_draw.H>
diff --git a/Fltk/GUI_Extras.cpp b/Fltk/GUI_Extras.cpp
index c3674c2312..7ef0e090b3 100644
--- a/Fltk/GUI_Extras.cpp
+++ b/Fltk/GUI_Extras.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI_Extras.cpp,v 1.6 2005-01-08 20:15:11 geuzaine Exp $
+// $Id: GUI_Extras.cpp,v 1.7 2005-01-18 19:03:07 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -175,7 +175,7 @@ int jpeg_dialog(char *name, int TeX)
     dialog = new _jpeg_dialog;
     int h = 3*10 + 25 + 2*25, y = 0;
     // not a "Dialog_Window" since it is modal 
-    dialog->window = new Fl_Window(200, h, "JPEG Options"); y = 10;
+    dialog->window = new Fl_Double_Window(200, h, "JPEG Options"); y = 10;
     dialog->window->box(GMSH_WINDOW_BOX);
     dialog->s[0] = new Fl_Value_Slider(10, y, 100, 25, "Quality"); y += 25;
     dialog->s[0]->type(FL_HOR_SLIDER);
@@ -236,7 +236,7 @@ int gif_dialog(char *name)
     dialog = new _gif_dialog;
     int h = 3*10 + 25 + 4*25, y = 0;
     // not a "Dialog_Window" since it is modal 
-    dialog->window = new Fl_Window(200, h, "GIF Options"); y = 10;
+    dialog->window = new Fl_Double_Window(200, h, "GIF Options"); y = 10;
     dialog->window->box(GMSH_WINDOW_BOX);
     dialog->b[0] = new Fl_Check_Button(10, y, 180, 25, "Dither"); y += 25;
     dialog->b[1] = new Fl_Check_Button(10, y, 180, 25, "Interlace"); y += 25;
@@ -329,7 +329,7 @@ int gl2ps_dialog(char *name, char *title, int format, int TeX)
     dialog = new _gl2ps_dialog;
     int h = 3*10 + 25 + 6*25, y = 0;
     // not a "Dialog_Window" since it is modal 
-    dialog->window = new Fl_Window(200, h); y = 10;
+    dialog->window = new Fl_Double_Window(200, h); y = 10;
     dialog->window->box(GMSH_WINDOW_BOX);
     dialog->c = new Fl_Choice(10, y, 145, 25, "Type"); y+= 25;
     dialog->c->menu(sortmenu);
@@ -408,7 +408,7 @@ int options_dialog(char *name)
     dialog = new _options_dialog;
     int h = 3*10 + 25 + 1*25, y = 0;
     // not a "Dialog_Window" since it is modal 
-    dialog->window = new Fl_Window(200, h, "Options"); y = 10;
+    dialog->window = new Fl_Double_Window(200, h, "Options"); y = 10;
     dialog->window->box(GMSH_WINDOW_BOX);
     dialog->b = new Fl_Check_Button(10, y, 180, 25, "Save only modified options"); y += 25;
     dialog->b->value(1);
@@ -465,7 +465,7 @@ int msh_dialog(char *name)
     dialog = new _msh_dialog;
     int h = 3*10 + 25 + 2*25, y = 0;
     // not a "Dialog_Window" since it is modal 
-    dialog->window = new Fl_Window(200, h, "MSH Options"); y = 10;
+    dialog->window = new Fl_Double_Window(200, h, "MSH Options"); y = 10;
     dialog->window->box(GMSH_WINDOW_BOX);
     dialog->c = new Fl_Choice(10, y, 130, 25, "Format"); y+= 25;
     dialog->c->menu(versionmenu);
@@ -521,7 +521,7 @@ int geo_dialog(char *name)
     dialog = new _geo_dialog;
     int h = 3*10 + 25 + 1*25, y = 0;
     // not a "Dialog_Window" since it is modal 
-    dialog->window = new Fl_Window(200, h, "GEO options"); y = 10;
+    dialog->window = new Fl_Double_Window(200, h, "GEO options"); y = 10;
     dialog->window->box(GMSH_WINDOW_BOX);
     dialog->b = new Fl_Check_Button(10, y, 180, 25, "Save discrete surfaces"); y += 25;
     dialog->b->value(1);
diff --git a/Fltk/Shortcut_Window.h b/Fltk/Shortcut_Window.h
index 591433f737..58cec1316a 100644
--- a/Fltk/Shortcut_Window.h
+++ b/Fltk/Shortcut_Window.h
@@ -22,13 +22,13 @@
 
 #include "GmshUI.h"
 
-#include <FL/Fl_Window.H>
+#include <FL/Fl_Double_Window.H>
 #include <FL/fl_ask.H>
 
-// Derive special windows from Fl_Window to correctly process the
-// OS-specific shorcuts (Cmd-w on Mac, Alt+F4 on Windows)
+// Derive special windows from Fl_Double_Window to correctly process
+// the OS-specific shorcuts (Cmd-w on Mac, Alt+F4 on Windows)
 
-class Dialog_Window : public Fl_Window {
+class Dialog_Window : public Fl_Double_Window {
   int  handle(int event){
     switch (event) {
     case FL_SHORTCUT:
@@ -46,16 +46,16 @@ class Dialog_Window : public Fl_Window {
 #endif
       break;
     }
-    return Fl_Window::handle(event);
+    return Fl_Double_Window::handle(event);
   }
  public:
   Dialog_Window(int x,int y,int w,int h,const char *l=0) :
-    Fl_Window(x, y, w, h, l) {}
+    Fl_Double_Window(x, y, w, h, l) {}
   Dialog_Window(int w,int h,const char *l=0) :
-    Fl_Window(w, h, l) {}
+    Fl_Double_Window(w, h, l) {}
 };
 
-class Main_Window : public Fl_Window {
+class Main_Window : public Fl_Double_Window {
   int  handle(int event){
     switch (event) {
     case FL_SHORTCUT:
@@ -75,13 +75,13 @@ class Main_Window : public Fl_Window {
 #endif
       break;
     }
-    return Fl_Window::handle(event);
+    return Fl_Double_Window::handle(event);
   }
  public:
   Main_Window(int x,int y,int w,int h,const char *l=0) :
-    Fl_Window(x, y, w, h, l) {}
+    Fl_Double_Window(x, y, w, h, l) {}
   Main_Window(int w,int h,const char *l=0) :
-    Fl_Window(w, h, l) {}
+    Fl_Double_Window(w, h, l) {}
 };
 
 #endif
-- 
GitLab