Fix dragging grid lines when you move the mouse outside of the grid during the drag.
[ardour.git] / gtk2_ardour / port_matrix_body.cc
index 3d961baa5ce8b9f95e624c1be05ec0cbd2fa80c7..79efd22b7cf3c8cc35eaf71e25a8a03dc0a87ef6 100644 (file)
@@ -328,14 +328,19 @@ PortMatrixBody::on_button_press_event (GdkEventButton* ev)
 bool
 PortMatrixBody::on_button_release_event (GdkEventButton* ev)
 {
-       if (Gdk::Region (_grid->parent_rectangle()).point_in (ev->x, ev->y)) {
-
-               _grid->button_release (
-                       _grid->parent_to_component_x (ev->x),
-                       _grid->parent_to_component_y (ev->y),
-                       ev->button, ev->time
-                       );
-
+       for (list<PortMatrixComponent*>::iterator i = _components.begin(); i != _components.end(); ++i) {
+               if (Gdk::Region ((*i)->parent_rectangle()).point_in (ev->x, ev->y)) {
+                       (*i)->button_release (
+                               (*i)->parent_to_component_x (ev->x),
+                               (*i)->parent_to_component_y (ev->y),
+                               ev->button, ev->time
+                               );
+               } else {
+                       (*i)->button_release (
+                               -1, -1,
+                               ev->button, ev->time
+                               );
+               }
        }
 
        return true;