1
0
Fork 0

(svn r12166) -Fix [FS#337]: when drag&drop mode was cancelled by keyboard input, depot/group window wasn't updated (original patch by GrimRC)

release/0.6
smatz 2008-02-17 12:21:05 +00:00
parent 16e23a75fe
commit 291931bf50
4 changed files with 17 additions and 5 deletions

View File

@ -860,8 +860,13 @@ static void DepotWndProc(Window *w, WindowEvent *e)
} break; } break;
case WE_ABORT_PLACE_OBJ: { case WE_ABORT_PLACE_OBJ: {
/* abort clone */
w->RaiseWidget(DEPOT_WIDGET_CLONE); w->RaiseWidget(DEPOT_WIDGET_CLONE);
w->InvalidateWidget(DEPOT_WIDGET_CLONE); w->InvalidateWidget(DEPOT_WIDGET_CLONE);
/* abort drag & drop */
WP(w, depot_d).sel = INVALID_VEHICLE;
w->InvalidateWidget(DEPOT_WIDGET_MATRIX);
} break; } break;
/* check if a vehicle in a depot was clicked.. */ /* check if a vehicle in a depot was clicked.. */

View File

@ -761,6 +761,13 @@ static void GroupWndProc(Window *w, WindowEvent *e)
SetWindowDirty(w); SetWindowDirty(w);
} }
break; 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;
} }
} }

View File

@ -2847,9 +2847,8 @@ void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, W
{ {
Window *w; Window *w;
/* undo clicking on button */ /* undo clicking on button and drag & drop */
if (_thd.place_mode != VHM_NONE) { if (_thd.place_mode != VHM_NONE || _special_mouse_mode == WSM_DRAGDROP) {
_thd.place_mode = VHM_NONE;
w = FindWindowById(_thd.window_class, _thd.window_number); w = FindWindowById(_thd.window_class, _thd.window_number);
if (w != NULL) CallWindowEventNP(w, WE_ABORT_PLACE_OBJ); if (w != NULL) CallWindowEventNP(w, WE_ABORT_PLACE_OBJ);
} }

View File

@ -1085,8 +1085,6 @@ static bool HandleDragDrop()
w = GetCallbackWnd(); w = GetCallbackWnd();
ResetObjectToPlace();
if (w != NULL) { if (w != NULL) {
/* send an event in client coordinates. */ /* send an event in client coordinates. */
e.event = WE_DRAGDROP; 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); e.we.dragdrop.widget = GetWidgetFromPos(w, e.we.dragdrop.pt.x, e.we.dragdrop.pt.y);
w->wndproc(w, &e); w->wndproc(w, &e);
} }
ResetObjectToPlace();
return false; return false;
} }