diff libgui/graphics/Canvas.cc @ 24743:f7e333b12687

Ignore figure "hittest" for executing "buttondownfcn" (bug #52795). * Canvas.cc (Canvas::mousePressEvent): Fallback to executing figure "buttondownfcn" if there is no currentObj with "hittest"-> "on".
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Mon, 12 Feb 2018 17:18:43 +0100
parents 13c207835e79
children 45470049a43f
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc	Mon Feb 12 13:15:10 2018 -0800
+++ b/libgui/graphics/Canvas.cc	Mon Feb 12 17:18:43 2018 +0100
@@ -699,11 +699,16 @@
                                          "windowbuttondownfcn",
                                          button_number (event));
 
-              // Execute the "buttondownfcn" of the selected object
+              // Execute the "buttondownfcn" of the selected object. If the
+              // latter is empty then execute the figure "buttondownfcn"
               if (currentObj && ! currentObj.get ("buttondownfcn").isempty ())
                 gh_manager::post_callback (currentObj.get_handle (),
                                            "buttondownfcn",
                                            button_number (event));
+              else if (figObj && ! figObj.get ("buttondownfcn").isempty ())
+                gh_manager::post_callback (figObj.get_handle (),
+                                           "buttondownfcn",
+                                           button_number (event));
 
               // Show context menu of the selected object
               if (currentObj && event->button () == Qt::RightButton)