summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/depot_gui.cpp5
-rw-r--r--src/group_gui.cpp7
-rw-r--r--src/viewport.cpp5
-rw-r--r--src/window.cpp5
4 files changed, 17 insertions, 5 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 98097817c..f9605dd65 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -860,8 +860,13 @@ static void DepotWndProc(Window *w, WindowEvent *e)
} break;
case WE_ABORT_PLACE_OBJ: {
+ /* abort clone */
w->RaiseWidget(DEPOT_WIDGET_CLONE);
w->InvalidateWidget(DEPOT_WIDGET_CLONE);
+
+ /* abort drag & drop */
+ WP(w, depot_d).sel = INVALID_VEHICLE;
+ w->InvalidateWidget(DEPOT_WIDGET_MATRIX);
} break;
/* check if a vehicle in a depot was clicked.. */
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 34169479a..818b73479 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -761,6 +761,13 @@ static void GroupWndProc(Window *w, WindowEvent *e)
SetWindowDirty(w);
}
break;
+
+ case WE_ABORT_PLACE_OBJ: // called when new object to place is selected from keyboard
+ /* abort drag & drop */
+ gv->vehicle_sel = INVALID_VEHICLE;
+ w->InvalidateWidget(GRP_WIDGET_LIST_VEHICLE);
+ break;
+
}
}
diff --git a/src/viewport.cpp b/src/viewport.cpp
index f4c20c3e5..cc7b7a519 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2847,9 +2847,8 @@ void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, W
{
Window *w;
- /* undo clicking on button */
- if (_thd.place_mode != VHM_NONE) {
- _thd.place_mode = VHM_NONE;
+ /* undo clicking on button and drag & drop */
+ if (_thd.place_mode != VHM_NONE || _special_mouse_mode == WSM_DRAGDROP) {
w = FindWindowById(_thd.window_class, _thd.window_number);
if (w != NULL) CallWindowEventNP(w, WE_ABORT_PLACE_OBJ);
}
diff --git a/src/window.cpp b/src/window.cpp
index d7fbfea3d..1ee8da60b 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1085,8 +1085,6 @@ static bool HandleDragDrop()
w = GetCallbackWnd();
- ResetObjectToPlace();
-
if (w != NULL) {
/* send an event in client coordinates. */
e.event = WE_DRAGDROP;
@@ -1095,6 +1093,9 @@ static bool HandleDragDrop()
e.we.dragdrop.widget = GetWidgetFromPos(w, e.we.dragdrop.pt.x, e.we.dragdrop.pt.y);
w->wndproc(w, &e);
}
+
+ ResetObjectToPlace();
+
return false;
}