From a2297dc594cd7dde81a50282a281a84c55236b71 Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 16 Jan 2011 11:37:54 +0000 Subject: [PATCH] (svn r21819) -Codechange: Swap order of HandleMouseDrag() and HandleDragDrop(), and split the w vardecl in the former. --- src/window.cpp | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 568b1814b6..caa936cb36 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1423,6 +1423,30 @@ static void HandlePlacePresize() w->OnPlacePresize(pt, TileVirtXY(pt.x, pt.y)); } +/** + * Handle dragging in mouse dragging mode (#WSM_DRAGDROP). + * @return State of handling the event. + */ +static EventState HandleMouseDrag() +{ + Window *w; + + if (_special_mouse_mode != WSM_DRAGDROP) return ES_NOT_HANDLED; + if (!_left_button_down || (_cursor.delta.x == 0 && _cursor.delta.y == 0)) return ES_NOT_HANDLED; + + w = _thd.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 ES_HANDLED; +} + /** * Handle drop in mouse dragging mode (#WSM_DRAGDROP). * @return State of handling the event. @@ -1447,28 +1471,6 @@ static EventState HandleDragDrop() return ES_HANDLED; } -/** - * Handle dragging in mouse dragging mode (#WSM_DRAGDROP). - * @return State of handling the event. - */ -static EventState HandleMouseDrag() -{ - if (_special_mouse_mode != WSM_DRAGDROP) return ES_NOT_HANDLED; - if (!_left_button_down || (_cursor.delta.x == 0 && _cursor.delta.y == 0)) return ES_NOT_HANDLED; - - Window *w = _thd.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 ES_HANDLED; -} - /** Report position of the mouse to the underlying window. */ static void HandleMouseOver() {