summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-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;
}