Slightly improve proxying of events by crossfade views; doesn't really have any posit...
authorCarl Hetherington <carl@carlh.net>
Sat, 31 Dec 2011 13:25:56 +0000 (13:25 +0000)
committerCarl Hetherington <carl@carlh.net>
Sat, 31 Dec 2011 13:25:56 +0000 (13:25 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11127 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_canvas_events.cc

index 07ae84031fedff43bb5faecd25a66012ff8bf3c6..215cea347043ef18a0568d5a6e052c6d1aa5c175 100644 (file)
@@ -554,6 +554,8 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item,
 
        /* XXX really need to check if we are in the name highlight,
           and proxy to that when required.
+
+          XXX or in the trim rectangles
        */
 
        TimeAxisView& tv (xfv->get_time_axis_view());
@@ -587,13 +589,30 @@ Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item,
 
                                                /* we're in stacked mode; proxy to the region view under the mouse */
 
-                                               /* XXX: FIXME: this is an evil hack; it assumes that any event for which
-                                                  this proxy is being used has its GdkEvent laid out such that the y
-                                                  member is in the same place as that for a GdkEventButton */
+                                               double cx = 0;
+                                               double cy = 0;
+                                               switch (event->type) {
+                                               case GDK_BUTTON_PRESS:
+                                               case GDK_BUTTON_RELEASE:
+                                                       cx = event->button.x;
+                                                       cy = event->button.y;
+                                                       break;
+                                               case GDK_MOTION_NOTIFY:
+                                                       cx = event->motion.x;
+                                                       cy = event->motion.y;
+                                                       break;
+                                               case GDK_ENTER_NOTIFY:
+                                               case GDK_LEAVE_NOTIFY:
+                                                       cx = event->crossing.x;
+                                                       cy = event->crossing.y;
+                                                       break;
+                                               default:
+                                                       /* XXX: this may be wrong for some events */
+                                                       cx = event->button.x;
+                                                       cy = event->button.y;
+                                               }
 
                                                /* position of the event within the track */
-                                               double cx = event->button.x;
-                                               double cy = event->button.y;
                                                atv->view()->canvas_item()->w2i (cx, cy);
 
                                                /* hence layer that we're over */