Revert "Revert "patch for waflib internals to allow tarball to be created even when...
[ardour.git] / gtk2_ardour / editor_drag.cc
index 07f6c23d71e7e4d2dc7c723d0c9713718ccc4dd7..0c046e56ab1eb188144e6edf6882619417760672 100644 (file)
@@ -264,15 +264,6 @@ Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
        /* we set up x/y dragging constraints on first move */
        _constraint_pressed = ArdourKeyboard::indicates_constraint (event->button.state);
 
-       if (_constraint_pressed) {
-               /* if constraint was indicated at the beginning of the drag, constrain x.
-                  if the user presses these modifiers after this point in time (first move),
-                  the drag will be constrained to the first direction of motion.
-               */
-               _x_constrained = true;
-               _y_constrained = false;
-       }
-
        _raw_grab_frame = _editor->canvas_event_sample (event, &_grab_x, &_grab_y);
 
        setup_pointer_frame_offset ();
@@ -438,7 +429,7 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
                                                        _x_constrained = true;
                                                        _y_constrained = false;
                                                }
-                                       } else if (!_constraint_pressed && ArdourKeyboard::indicates_constraint (event->button.state)) {
+                                       } else if (_constraint_pressed) {
                                                // if dragging normally, the motion is constrained to the first direction of movement.
                                                if (_initially_vertical) {
                                                        _x_constrained = true;
@@ -3364,11 +3355,21 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
                show_verbose_cursor_text (strs.str());
 
        } else if (_movable && !_real_section->locked_to_meter()) {
-               const framepos_t pf = adjusted_current_frame (event);
+               framepos_t pf;
+
+               if (_editor->snap_musical()) {
+                       /* we can't snap to a grid that we are about to move.
+                        * gui_move_tempo() will sort out snap using the supplied beat divisions.
+                       */
+                       pf = adjusted_current_frame (event, false);
+               } else {
+                       pf = adjusted_current_frame (event);
+               }
+
                TempoMap& map (_editor->session()->tempo_map());
 
                /* snap to beat is 1, snap to bar is -1 (sorry) */
-               int sub_num = _editor->get_grid_music_divisions (event->button.state);
+               const int sub_num = _editor->get_grid_music_divisions (event->button.state);
 
                map.gui_move_tempo (_real_section, pf, sub_num);