Changeset - r17072:ca93cb436c83
[Not reviewed]
master
0 1 0
alberth - 13 years ago 2011-01-16 11:37:54
alberth@openttd.org
(svn r21819) -Codechange: Swap order of HandleMouseDrag() and HandleDragDrop(), and split the w vardecl in the former.
1 file changed with 24 insertions and 22 deletions:
0 comments (0 inline, 0 general)
src/window.cpp
Show inline comments
 
@@ -1424,6 +1424,30 @@ static void HandlePlacePresize()
 
}
 

	
 
/**
 
 * 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 @@ static EventState HandleDragDrop()
 
	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()
 
{
0 comments (0 inline, 0 general)