From 9c7c7a5e58b692f34d7efe3819eb22df90352d80 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 9 Nov 2012 08:36:14 +0000
Subject: [PATCH] fix saved height of graphic win with menu bar

---
 Fltk/FlGui.cpp         |  4 ++--
 Fltk/graphicWindow.cpp | 12 ++++++++++++
 Fltk/graphicWindow.h   |  2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp
index 5df8332504..6ef75f4b73 100644
--- a/Fltk/FlGui.cpp
+++ b/Fltk/FlGui.cpp
@@ -796,8 +796,8 @@ void FlGui::storeCurrentWindowsInfo()
 {
   CTX::instance()->glPosition[0] = graph[0]->win->x();
   CTX::instance()->glPosition[1] = graph[0]->win->y();
-  CTX::instance()->glSize[0] = graph[0]->win->w();
-  CTX::instance()->glSize[1] = (graph[0]->win->h() - graph[0]->bottom->h());
+  CTX::instance()->glSize[0] = graph[0]->getGlWidth();
+  CTX::instance()->glSize[1] = graph[0]->getGlHeight();
   CTX::instance()->msgSize = graph[0]->getMessageHeight();
   CTX::instance()->menuSize = graph[0]->getMenuWidth();
   CTX::instance()->optPosition[0] = options->win->x();
diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp
index e80cf6824e..1b848ec40e 100644
--- a/Fltk/graphicWindow.cpp
+++ b/Fltk/graphicWindow.cpp
@@ -3026,6 +3026,18 @@ void graphicWindow::resizeMenu(int dh)
   onelab->redraw();
 }
 
+int graphicWindow::getGlHeight()
+{
+  int h = win->h() - bottom->h(); // yes, ignore message browser
+  if(bar) h -= bar->h();
+  return h;
+}
+
+int graphicWindow::getGlWidth()
+{
+  return win->w();
+}
+
 void graphicWindow::showMenu()
 {
   if(!onelab || !win->shown()) return;
diff --git a/Fltk/graphicWindow.h b/Fltk/graphicWindow.h
index f3d807ccda..d0bbcd2c42 100644
--- a/Fltk/graphicWindow.h
+++ b/Fltk/graphicWindow.h
@@ -46,6 +46,8 @@ class graphicWindow{
   void setTitle(std::string str);
   void setAutoScroll(bool val){ _autoScrollMessages = val; }
   bool getAutoScroll(){ return _autoScrollMessages; }
+  int getGlHeight();
+  int getGlWidth();
   int getMessageHeight();
   void split(openglWindow *g, char how);
   void setAnimButtons(int mode);
-- 
GitLab