summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-05-23 14:53:39 +0000
committeralberth <alberth@openttd.org>2010-05-23 14:53:39 +0000
commitae560aeb8b38bc32b05f9af7e3230de712ee5b5c (patch)
tree5d2967cb0f4ffffd6b68aeeb11656f6a02b44ea3 /src/window.cpp
parent75856967a04b275eed7dd5c52a021da022565d28 (diff)
downloadopenttd-ae560aeb8b38bc32b05f9af7e3230de712ee5b5c.tar.xz
(svn r19886) -Add [FS#3705]: Perform window callback during mouse dragging for the purpose of highlighting the destination (sbr).
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 447f247d6..9fa5655ae 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1382,6 +1382,24 @@ static bool HandleDragDrop()
return false;
}
+static bool HandleMouseDrag()
+{
+ if (_special_mouse_mode != WSM_DRAGDROP) return true;
+ if (!_left_button_down || (_cursor.delta.x == 0 && _cursor.delta.y == 0)) return true;
+
+ Window *w = 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 false;
+}
+
static bool HandleMouseOver()
{
Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
@@ -2057,6 +2075,7 @@ static void MouseLoop(MouseClick click, int mousewheel)
UpdateTileSelection();
if (!VpHandlePlaceSizingDrag()) return;
+ if (!HandleMouseDrag()) return;
if (!HandleDragDrop()) return;
if (!HandleWindowDragging()) return;
if (!HandleScrollbarScrolling()) return;