changeset 17082:35d166b470fa draft

(svn r21819) -Codechange: Swap order of HandleMouseDrag() and HandleDragDrop(), and split the w vardecl in the former.
author alberth <alberth@openttd.org>
date Sun, 16 Jan 2011 11:37:54 +0000
parents bad424083a9b
children b7d04eec5e11
files src/window.cpp
diffstat 1 files changed, 24 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1424,6 +1424,30 @@
 }
 
 /**
+ * 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 @@
 	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()
 {