diff -r b9a76937efb0 src/window.cpp --- a/src/window.cpp Fri Mar 19 11:17:52 2010 +0000 +++ b/src/window.cpp Fri Mar 19 13:54:42 2010 +0100 @@ -1377,6 +1377,23 @@ return false; } +static bool HandleMouseDrag() +{ + if (_special_mouse_mode != WSM_DRAGDROP) return true; + if (!_left_button_down || (_cursor.delta.x == 0 && _cursor.delta.y == 0)) return true; + Window *w = GetCallbackWnd(); + + if (w != NULL) { + /* Send an event in client coordinates. */ + Point pt; + pt.x = _cursor.pos.x - w->left; + pt.y = _cursor.pos.y - w->top; + w->OnMouseDrag(pt, GetWidgetFromPos(w, pt.x, pt.y)); + } + + return false; +} + static bool HandleMouseOver() { Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y); @@ -2048,6 +2065,7 @@ UpdateTileSelection(); if (!VpHandlePlaceSizingDrag()) return; + if (!HandleMouseDrag()) return; if (!HandleDragDrop()) return; if (!HandleWindowDragging()) return; if (!HandleScrollbarScrolling()) return; diff -r b9a76937efb0 src/window_gui.h --- a/src/window_gui.h Fri Mar 19 11:17:52 2010 +0000 +++ b/src/window_gui.h Fri Mar 19 13:54:42 2010 +0100 @@ -650,6 +650,13 @@ virtual void OnRightClick(Point pt, int widget) {} /** + * An 'object' is dragged. + * @param pt the point inside the window that the mouse hovers over. + * @param widget the widget the mouse hovers over. + */ + virtual void OnMouseDrag(Point pt, int widget) {} + + /** * A dragged 'object' has been released. * @param pt the point inside the window where the release took place. * @param widget the widget where the release took place.