Fixes Atlas double-click behavior in simulation test, by handling the events in Canvas and recognizing wxWidgets' ButtonDown and ButtonDClick events are mutually exclusive.

This was SVN commit r11035.
This commit is contained in:
historic_bruno 2012-02-07 00:40:55 +00:00
parent 5c69809fe0
commit 046729dfa7
2 changed files with 16 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games. /* Copyright (C) 2012 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -96,14 +96,17 @@ void Canvas::OnMouse(wxMouseEvent& evt)
} }
BEGIN_EVENT_TABLE(Canvas, wxGLCanvas) BEGIN_EVENT_TABLE(Canvas, wxGLCanvas)
EVT_SIZE (Canvas::OnResize) EVT_SIZE (Canvas::OnResize)
EVT_LEFT_DOWN (Canvas::OnMouse) EVT_LEFT_DCLICK (Canvas::OnMouse)
EVT_LEFT_UP (Canvas::OnMouse) EVT_LEFT_DOWN (Canvas::OnMouse)
EVT_RIGHT_DOWN (Canvas::OnMouse) EVT_LEFT_UP (Canvas::OnMouse)
EVT_RIGHT_UP (Canvas::OnMouse) EVT_RIGHT_DCLICK (Canvas::OnMouse)
EVT_MIDDLE_DOWN(Canvas::OnMouse) EVT_RIGHT_DOWN (Canvas::OnMouse)
EVT_MIDDLE_UP (Canvas::OnMouse) EVT_RIGHT_UP (Canvas::OnMouse)
EVT_MOUSEWHEEL (Canvas::OnMouse) EVT_MIDDLE_DCLICK (Canvas::OnMouse)
EVT_MOTION (Canvas::OnMouse) EVT_MIDDLE_DOWN (Canvas::OnMouse)
EVT_MIDDLE_UP (Canvas::OnMouse)
EVT_MOUSEWHEEL (Canvas::OnMouse)
EVT_MOTION (Canvas::OnMouse)
EVT_MOUSE_CAPTURE_LOST(Canvas::OnMouseCaptureLost) EVT_MOUSE_CAPTURE_LOST(Canvas::OnMouseCaptureLost)
END_EVENT_TABLE() END_EVENT_TABLE()

View File

@ -267,7 +267,9 @@ private:
} }
} }
if (evt.ButtonDown()) // Button down and double click appear to be mutually exclusive events,
// meaning a second button down event is not sent before a double click
if (evt.ButtonDown() || evt.ButtonDClick())
POST_MESSAGE(GuiMouseButtonEvent, (evt.GetButton(), true, evt.GetPosition())); POST_MESSAGE(GuiMouseButtonEvent, (evt.GetButton(), true, evt.GetPosition()));
else if (evt.ButtonUp()) else if (evt.ButtonUp())
POST_MESSAGE(GuiMouseButtonEvent, (evt.GetButton(), false, evt.GetPosition())); POST_MESSAGE(GuiMouseButtonEvent, (evt.GetButton(), false, evt.GetPosition()));