mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r21819) -Codechange: Swap order of HandleMouseDrag() and HandleDragDrop(), and split the w vardecl in the former.
This commit is contained in:
parent
b8559492b5
commit
a2297dc594
|
@ -1423,6 +1423,30 @@ static void HandlePlacePresize()
|
||||||
w->OnPlacePresize(pt, TileVirtXY(pt.x, pt.y));
|
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).
|
* Handle drop in mouse dragging mode (#WSM_DRAGDROP).
|
||||||
* @return State of handling the event.
|
* @return State of handling the event.
|
||||||
|
@ -1447,28 +1471,6 @@ static EventState HandleDragDrop()
|
||||||
return ES_HANDLED;
|
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. */
|
/** Report position of the mouse to the underlying window. */
|
||||||
static void HandleMouseOver()
|
static void HandleMouseOver()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue