From 41f63fc61aa74d36db10da3bfce7333502f75b4d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 12 Apr 2013 18:00:46 -0400 Subject: [PATCH] manual translate events in Editor::track_canvas_scroll() to canvas space, because the event arrives there directly, not via the canvas. no other similar eventhandler in that code uses the event coordinates --- gtk2_ardour/editor_canvas_events.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 86577f44af..abc6ea96ad 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -63,6 +63,12 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) framepos_t xdelta; int direction = ev->direction; + /* this event arrives without transformation by the canvas, so we have + * to transform the coordinates to be able to look things up. + */ + + Duple event_coords = _track_canvas->window_to_canvas (Duple (ev->x, ev->y)); + retry: switch (direction) { case GDK_SCROLL_UP: @@ -79,7 +85,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { if (!current_stepping_trackview) { step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500); - std::pair const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value()); + std::pair const p = trackview_by_y_position (event_coords.y); current_stepping_trackview = p.first; if (!current_stepping_trackview) { return false; @@ -108,7 +114,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { if (!current_stepping_trackview) { step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500); - std::pair const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value()); + std::pair const p = trackview_by_y_position (event_coords.y); current_stepping_trackview = p.first; if (!current_stepping_trackview) { return false;