diff libgui/graphics/Canvas.cc @ 20629:46edfbd31ad7

Fix execution of "windowbuttonmotionfcn" with uipanels (bug #46151) * Canvas.cc (Canvas::canvasMouseMoveEvent): decide here to update the currentpoint and run "windowbuttonmotionfcn" if the latter is not empty * Canvas.h: remove unused "enableCurrentPointUpdates" method and "m_updateCurrentPoint" attribute * Figure.h: declare a new private method "enableMouseTracking" * Figure.cc (Figure::Figure): use "enableMouseTracking" instead of "update" on "windowbuttonmotionfcn". * Figure.cc (Figure::update): mouse tracking is now enabled unconditionally so remove unused case "windowbuttonmotionfcn". *Figure.cc(Figure::eventNotifyAfter): enable mouse tracking on new children widgets.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sat, 10 Oct 2015 12:21:37 +0200
parents dcfbf4c1c3c8
children 69270256b879
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc	Fri Oct 09 16:25:27 2015 +0200
+++ b/libgui/graphics/Canvas.cc	Sat Oct 10 12:21:37 2015 +0200
@@ -507,7 +507,7 @@
           break;
         }
     }
-  else if (m_mouseMode == NoMode && m_updateCurrentPoint)
+  else if (m_mouseMode == NoMode)
     {
       graphics_object obj = gh_manager::get_object (m_handle);
 
@@ -515,9 +515,13 @@
         {
           graphics_object figObj (obj.get_ancestor ("figure"));
 
-          updateCurrentPoint (figObj, obj, event);
-          gh_manager::post_callback (figObj.get_handle (),
-                                     "windowbuttonmotionfcn");
+          if (figObj.valid_object () &&
+              ! figObj.get ("windowbuttonmotionfcn").is_empty ())
+            {
+              updateCurrentPoint (figObj, obj, event);
+              gh_manager::post_callback (figObj.get_handle (),
+                                         "windowbuttonmotionfcn");
+            }
         }
     }