summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_canvas_events.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-04-12 18:00:46 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-04-12 18:00:46 -0400
commit41f63fc61aa74d36db10da3bfce7333502f75b4d (patch)
tree0bfd025b40e8f01cbbef1de98d86565b0f9d3ff7 /gtk2_ardour/editor_canvas_events.cc
parente9a82b67140f9336883fa496034b759cc5855e70 (diff)
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
Diffstat (limited to 'gtk2_ardour/editor_canvas_events.cc')
-rw-r--r--gtk2_ardour/editor_canvas_events.cc10
1 files 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<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value());
+ std::pair<TimeAxisView*, int> 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<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value());
+ std::pair<TimeAxisView*, int> const p = trackview_by_y_position (event_coords.y);
current_stepping_trackview = p.first;
if (!current_stepping_trackview) {
return false;