Index: gtk2_ardour/midi_region_view.h
===================================================================
--- gtk2_ardour/midi_region_view.h	(Revision 3146)
+++ gtk2_ardour/midi_region_view.h	(Arbeitskopie)
@@ -132,8 +132,34 @@
 	void move_selection(double dx, double dy);
 	void note_dropped(ArdourCanvas::CanvasMidiEvent* ev, double dt, uint8_t dnote);
 
+	/**
+	 * This function is needed to subtract the region start in pixels
+	 * from world coordinates submitted by the mouse
+	 */
+	double get_position_pixels(void);
+
+	/**
+	 * This function is called by CanvasMidiNote when resizing starts,
+	 * i.e. when the user presses mouse-2 on the note
+	 * @param note_end which end of the note, NOTE_ON or NOTE_OFF
+	 */
 	void  begin_resizing(ArdourCanvas::CanvasNote::NoteEnd note_end);
-	void update_resizing(ArdourCanvas::CanvasNote::NoteEnd note_end, double dx, bool relative);
+
+	/**
+	 * This function is called while the user moves the mouse when resizing notes
+	 * @param note_end which end of the note, NOTE_ON or NOTE_OFF
+	 * @param x the difference in mouse motion, ie the motion difference if relative=true
+	 *           or the absolute mouse position (track-relative) if relative is false
+	 * @param relative true if relative resizing is taking place, false if absolute resizing
+	 */
+	void update_resizing(ArdourCanvas::CanvasNote::NoteEnd note_end, double x, bool relative);
+
+	/**
+	 * This function is called while the user releases the mouse button when resizing notes
+	 * @param note_end which end of the note, NOTE_ON or NOTE_OFF
+	 * @param event_x the absolute mouse position (track-relative)
+	 * @param relative true if relative resizing is taking place, false if absolute resizing
+	 */
 	void commit_resizing(ArdourCanvas::CanvasNote::NoteEnd note_end, double event_x, bool relative);
 
 	enum MouseState { None, Pressed, SelectTouchDragging, SelectRectDragging, AddDragging, EraseTouchDragging };
@@ -147,11 +173,11 @@
 
   protected:
 
-    /* this constructor allows derived types
-       to specify their visibility requirements
-       to the TimeAxisViewItem parent class
-    */
-
+    /**
+     * this constructor allows derived types
+     * to specify their visibility requirements
+     * to the TimeAxisViewItem parent class
+     */
     MidiRegionView (ArdourCanvas::Group *,
 	                RouteTimeAxisView&,
 	                boost::shared_ptr<ARDOUR::MidiRegion>,
@@ -177,6 +203,11 @@
 	void clear_selection_except(ArdourCanvas::CanvasMidiEvent* ev);
 	void clear_selection() { clear_selection_except(NULL); }
 	void update_drag_selection(double last_x, double x, double last_y, double y);
+
+	/**
+	 * This function provides the snap function for pixel units (double)
+	 * instead of nframes_t
+	 */
 	double snap_to(double x);
 
 	double _default_note_length;
Index: gtk2_ardour/canvas-note.cc
===================================================================
--- gtk2_ardour/canvas-note.cc	(Revision 3146)
+++ gtk2_ardour/canvas-note.cc	(Arbeitskopie)
@@ -12,23 +12,22 @@
 CanvasNote::on_event(GdkEvent* ev)
 {
 	double          event_x;
-	static double   middle_point, pressed_x, last_x;
+	static double   middle_point, last_x;
 	Gdk::Cursor     cursor;
 	static NoteEnd  note_end;
 
 	switch(ev->type) {
 	case GDK_BUTTON_PRESS:
 		if (ev->button.button == 2) {
+			double region_start = _region.get_position_pixels();
 			event_x = ev->button.x;
-			middle_point = x1() + (x2() - x1()) / 2.0L;
+			middle_point = region_start + x1() + (x2() - x1()) / 2.0L;
 
 			if(event_x <= middle_point) {
 				cursor = Gdk::Cursor(Gdk::LEFT_SIDE);
-				last_x = x1();
 				note_end = NOTE_ON;
 			} else {
 				cursor = Gdk::Cursor(Gdk::RIGHT_SIDE);
-				last_x = x2();
 				note_end = NOTE_OFF;
 			}
 
@@ -40,10 +39,9 @@
 				_mouse2_state = RelativeResize;
 			}
 
-			pressed_x = event_x;
-
 			_region.note_selected(this, true);
 			_region.begin_resizing(note_end);
+			last_x = event_x;
 
 			return true;
 		}
Index: gtk2_ardour/midi_region_view.cc
===================================================================
--- gtk2_ardour/midi_region_view.cc	(Revision 3146)
+++ gtk2_ardour/midi_region_view.cc	(Arbeitskopie)
@@ -840,6 +840,26 @@
 	}
 }
 
+
+double
+MidiRegionView::snap_to(double x)
+{
+	PublicEditor &editor = trackview.editor;
+
+	nframes_t frame = editor.pixel_to_frame(x);
+	editor.snap_to(frame);
+	return (double) editor.frame_to_pixel(frame);
+}
+
+double
+MidiRegionView::get_position_pixels(void)
+{
+	PublicEditor &editor = trackview.editor;
+
+	nframes_t  region_frame  = get_position();
+	return editor.frame_to_pixel(region_frame);
+}
+
 void
 MidiRegionView::begin_resizing(CanvasNote::NoteEnd note_end)
 {
@@ -853,7 +873,13 @@
 			NoteResizeData *resize_data = new NoteResizeData();
 			resize_data->canvas_note = note;
 
-			SimpleRect *resize_rect = new SimpleRect(*group, note->x1(), note->y1(), note->x2(), note->y2());
+			SimpleRect *resize_rect =
+				new SimpleRect(
+						*group,
+						note->x1(),
+						note->y1(),
+						note->x2(),
+						note->y2());
 
 			uint fill_color = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_MidiNoteSelectedOutline.get(), 128);
 			fill_color = UINT_INTERPOLATE(fill_color, 0xFFFFFF40, 0.5);
@@ -878,29 +904,19 @@
 	}
 }
 
-double
-MidiRegionView::snap_to(double x)
-{
-	PublicEditor &editor = trackview.editor;
-
-	nframes_t frame = editor.pixel_to_frame(x);
-	editor.snap_to(frame);
-	return (double) editor.frame_to_pixel(frame);
-}
-
 void
-MidiRegionView::update_resizing(CanvasNote::NoteEnd note_end, double dx, bool relative)
+MidiRegionView::update_resizing(CanvasNote::NoteEnd note_end, double x, bool relative)
 {
-
-
 	for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
 		SimpleRect     *resize_rect = (*i)->resize_rect;
 		CanvasNote     *canvas_note = (*i)->canvas_note;
 
 		if(relative) {
-			(*i)->current_x = (*i)->current_x + dx;
+			cerr << "update: relative\n";
+			(*i)->current_x = (*i)->current_x + x;
 		} else {
-			(*i)->current_x = dx;
+			// x is in track relative, transform it to region relative
+			(*i)->current_x = x - get_position_pixels();
 		}
 
 		double current_x = (*i)->current_x;
@@ -927,8 +943,10 @@
 
 
 		if(!relative) {
-			current_x = event_x;
-		}
+			// event_x is in track relative, transform it to region relative
+			current_x = event_x - get_position_pixels();
+			cerr << "commit: absolute\n";
+		} else cerr << "commit: relative\n";
 
 		nframes_t current_frame = trackview.editor.pixel_to_frame(current_x);
 		trackview.editor.snap_to(current_frame);
