From 980c154145f95414600172bc4d1be54faadbaab0 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 13 Dec 2016 22:37:17 +0000
Subject: [PATCH] by default, disable tooltip when hovering over views: this
 seems to pose problems on some Linux machines (cf. Jon)

---
 Fltk/openglWindow.cpp    | 9 +++++----
 Fltk/openglWindow.h      | 2 +-
 Fltk/optionWindow.cpp    | 2 +-
 Graphics/drawContext.cpp | 4 ++--
 Graphics/drawContext.h   | 2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp
index 2d90a691cb..f212cdb7f4 100644
--- a/Fltk/openglWindow.cpp
+++ b/Fltk/openglWindow.cpp
@@ -358,7 +358,7 @@ int openglWindow::handle(int event)
       std::vector<MElement*> elements;
       std::vector<SPoint2> points;
       std::vector<PView*> views;
-      _select(ENT_ALL, false, false, Fl::event_x(), Fl::event_y(), 5, 5,
+      _select(ENT_ALL, false, false, true, Fl::event_x(), Fl::event_y(), 5, 5,
               vertices, edges, faces, regions, elements, points, views);
       if(vertices.size() && CTX::instance()->geom.doubleClickedPointCommand.size()){
         CTX::instance()->geom.doubleClickedEntityTag = vertices[0]->tag();
@@ -651,6 +651,7 @@ int openglWindow::handle(int event)
         std::vector<SPoint2> points;
         std::vector<PView*> views;
         bool res = _select(_selection, false, CTX::instance()->mouseHoverMeshes,
+                           CTX::instance()->mouseHoverMeshes,
                            (int)_curr.win[0], (int)_curr.win[1], 5, 5,
                            vertices, edges, faces, regions, elements, points, views);
         if((_selection == ENT_ALL && res) ||
@@ -730,7 +731,7 @@ int openglWindow::pixel_h()
 #endif
 }
 
-bool openglWindow::_select(int type, bool multiple, bool mesh,
+bool openglWindow::_select(int type, bool multiple, bool mesh, bool post,
                            int x, int y, int w, int h,
                            std::vector<GVertex*> &vertices,
                            std::vector<GEdge*> &edges,
@@ -746,7 +747,7 @@ bool openglWindow::_select(int type, bool multiple, bool mesh,
   if(_lock) return false;
   _lock = true;
   make_current();
-  bool ret = _ctx->select(type, multiple, mesh, x, y, w, h,
+  bool ret = _ctx->select(type, multiple, mesh, post, x, y, w, h,
                           vertices, edges, faces, regions, elements,
                           points, views);
   _lock = false;
@@ -808,7 +809,7 @@ char openglWindow::selectEntity(int type,
         selectionMode = false;
         return 'c';
       }
-      else if(_select(_selection, multi, true, _trySelectionXYWH[0],
+      else if(_select(_selection, multi, true, false, _trySelectionXYWH[0],
                       _trySelectionXYWH[1], _trySelectionXYWH[2],
                       _trySelectionXYWH[3], vertices, edges, faces,
                       regions, elements, points, views)){
diff --git a/Fltk/openglWindow.h b/Fltk/openglWindow.h
index bbcb70581d..9080b8cc1c 100644
--- a/Fltk/openglWindow.h
+++ b/Fltk/openglWindow.h
@@ -32,7 +32,7 @@ class openglWindow : public Fl_Gl_Window {
   double _lassoXY[2];
   void _drawScreenMessage();
   void _drawBorder();
-  bool _select(int type, bool multiple, bool mesh, int x, int y, int w, int h,
+  bool _select(int type, bool multiple, bool mesh, bool post, int x, int y, int w, int h,
                std::vector<GVertex*> &vertices, std::vector<GEdge*> &edges,
                std::vector<GFace*> &faces, std::vector<GRegion*> &regions,
                std::vector<MElement*> &elements, std::vector<SPoint2> &points,
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index 8756a4a3e2..9534184e0b 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -1389,7 +1389,7 @@ optionWindow::optionWindow(int deltaFontSize)
       general.butt[2]->callback(general_options_ok_cb, (void*)"fast_redraw");
 
       general.butt[11] = new Fl_Check_Button
-        (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Enable mouse hover over meshes");
+        (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Enable mouse hover over meshes and views");
       general.butt[11]->type(FL_TOGGLE_BUTTON);
       general.butt[11]->callback(general_options_ok_cb);
 
diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp
index b7ab50a120..ca3e443a40 100644
--- a/Graphics/drawContext.cpp
+++ b/Graphics/drawContext.cpp
@@ -860,7 +860,7 @@ static MElement *getElement(GEntity *e, int va_type, int index)
   return 0;
 }
 
-bool drawContext::select(int type, bool multiple, bool mesh,
+bool drawContext::select(int type, bool multiple, bool mesh, bool post,
                          int x, int y, int w, int h,
                          std::vector<GVertex*> &vertices,
                          std::vector<GEdge*> &edges,
@@ -903,7 +903,7 @@ bool drawContext::select(int type, bool multiple, bool mesh,
   initPosition();
   drawGeom();
   if(mesh) drawMesh();
-  drawPost();
+  if(post) drawPost();
   drawGraph2d(true);
 
   // 2d stuff
diff --git a/Graphics/drawContext.h b/Graphics/drawContext.h
index e973add3e9..49ea2df157 100644
--- a/Graphics/drawContext.h
+++ b/Graphics/drawContext.h
@@ -200,7 +200,7 @@ class drawContext {
   void unproject(double winx, double winy, double p[3], double d[3]);
   void viewport2World(double vp[3], double xyz[3]);
   void world2Viewport(double xyz[3], double vp[3]);
-  bool select(int type, bool multiple, bool mesh, int x, int y, int w, int h,
+  bool select(int type, bool multiple, bool mesh, bool post, int x, int y, int w, int h,
               std::vector<GVertex*> &vertices, std::vector<GEdge*> &edges,
               std::vector<GFace*> &faces, std::vector<GRegion*> &regions,
               std::vector<MElement*> &elements, std::vector<SPoint2> &points,
-- 
GitLab