summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2011-01-16 11:37:54 +0000
committeralberth <alberth@openttd.org>2011-01-16 11:37:54 +0000
commita2297dc594cd7dde81a50282a281a84c55236b71 (patch)
tree38cdd8a06d6b583e9e381186f3855a7a49abe493 /src
parentb8559492b5db041e9943cf5142655e5b929f4b70 (diff)
downloadopenttd-a2297dc594cd7dde81a50282a281a84c55236b71.tar.xz
(svn r21819) -Codechange: Swap order of HandleMouseDrag() and HandleDragDrop(), and split the w vardecl in the former.
Diffstat (limited to 'src')
-rw-r--r--src/window.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 568b1814b..caa936cb3 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1424,48 +1424,50 @@ static void HandlePlacePresize()
}
/**
- * Handle drop in mouse dragging mode (#WSM_DRAGDROP).
+ * Handle dragging in mouse dragging mode (#WSM_DRAGDROP).
* @return State of handling the event.
*/
-static EventState HandleDragDrop()
+static EventState HandleMouseDrag()
{
+ Window *w;
+
if (_special_mouse_mode != WSM_DRAGDROP) return ES_NOT_HANDLED;
- if (_left_button_down) return ES_HANDLED;
+ if (!_left_button_down || (_cursor.delta.x == 0 && _cursor.delta.y == 0)) return ES_NOT_HANDLED;
- Window *w = _thd.GetCallbackWnd();
+ w = _thd.GetCallbackWnd();
if (w != NULL) {
- /* send an event in client coordinates. */
+ /* Send an event in client coordinates. */
Point pt;
pt.x = _cursor.pos.x - w->left;
pt.y = _cursor.pos.y - w->top;
- w->OnDragDrop(pt, GetWidgetFromPos(w, pt.x, pt.y));
+ w->OnMouseDrag(pt, GetWidgetFromPos(w, pt.x, pt.y));
}
- ResetObjectToPlace();
-
return ES_HANDLED;
}
/**
- * Handle dragging in mouse dragging mode (#WSM_DRAGDROP).
+ * Handle drop in mouse dragging mode (#WSM_DRAGDROP).
* @return State of handling the event.
*/
-static EventState HandleMouseDrag()
+static EventState HandleDragDrop()
{
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;
+ if (_left_button_down) return ES_HANDLED;
Window *w = _thd.GetCallbackWnd();
if (w != NULL) {
- /* Send an event in client coordinates. */
+ /* 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));
+ w->OnDragDrop(pt, GetWidgetFromPos(w, pt.x, pt.y));
}
+ ResetObjectToPlace();
+
return ES_HANDLED;
}