* Handle dragging and dropping in mouse dragging mode (#WSM_DRAGDROP). * @return State of handling the event. */
| 1958 | * @return State of handling the event. |
| 1959 | */ |
| 1960 | static EventState HandleMouseDragDrop() |
| 1961 | { |
| 1962 | if (_special_mouse_mode != WSM_DRAGDROP) return ES_NOT_HANDLED; |
| 1963 | |
| 1964 | if (_left_button_down && _cursor.delta.x == 0 && _cursor.delta.y == 0) return ES_HANDLED; // Dragging, but the mouse did not move. |
| 1965 | |
| 1966 | Window *w = _thd.GetCallbackWnd(); |
| 1967 | if (w != nullptr) { |
| 1968 | /* Send an event in client coordinates. */ |
| 1969 | Point pt; |
| 1970 | pt.x = _cursor.pos.x - w->left; |
| 1971 | pt.y = _cursor.pos.y - w->top; |
| 1972 | if (_left_button_down) { |
| 1973 | w->OnMouseDrag(pt, GetWidgetFromPos(w, pt.x, pt.y)); |
| 1974 | } else { |
| 1975 | w->OnDragDrop(pt, GetWidgetFromPos(w, pt.x, pt.y)); |
| 1976 | } |
| 1977 | } |
| 1978 | |
| 1979 | if (!_left_button_down) ResetObjectToPlace(); // Button released, finished dragging. |
| 1980 | return ES_HANDLED; |
| 1981 | } |
| 1982 | |
| 1983 | /** Report position of the mouse to the underlying window. */ |
| 1984 | static void HandleMouseOver() |
no test coverage detected