Fix #413 (mouse crosshair on video not disappearing when mouse leaves video display) and some minor code cleanup.

Originally committed to SVN as r1199.
This commit is contained in:
Niels Martin Hansen 2007-05-28 18:45:57 +00:00
parent ea3c386aa2
commit 508d3d9a52
3 changed files with 8 additions and 16 deletions

View file

@ -85,7 +85,6 @@ enum {
// Event table // Event table
BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas) BEGIN_EVENT_TABLE(VideoDisplay, wxGLCanvas)
EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent) EVT_MOUSE_EVENTS(VideoDisplay::OnMouseEvent)
EVT_LEAVE_WINDOW(VideoDisplay::OnMouseLeave)
EVT_KEY_DOWN(VideoDisplay::OnKey) EVT_KEY_DOWN(VideoDisplay::OnKey)
EVT_PAINT(VideoDisplay::OnPaint) EVT_PAINT(VideoDisplay::OnPaint)
EVT_SIZE(VideoDisplay::OnSizeEvent) EVT_SIZE(VideoDisplay::OnSizeEvent)
@ -373,9 +372,7 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
// OnMouseLeave isn't called as long as we have an OnMouseEvent // OnMouseLeave isn't called as long as we have an OnMouseEvent
// Just check for it and call it manually instead // Just check for it and call it manually instead
if (event.Leaving()) { if (event.Leaving()) {
OnMouseLeave(event); if (tracker) tracker->bTrackerEditing = 0;
event.Skip(true);
return;
} }
// Right click // Right click
@ -420,16 +417,6 @@ void VideoDisplay::OnKey(wxKeyEvent &event) {
//////////////////////
// Mouse left display
void VideoDisplay::OnMouseLeave(wxMouseEvent& event) {
if (VideoContext::Get()->IsPlaying()) return;
wxASSERT(visual);
visual->OnMouseEvent(event);
if (tracker) tracker->bTrackerEditing = 0;
}
/////////////////// ///////////////////
// Sets zoom level // Sets zoom level
void VideoDisplay::SetZoom(double value) { void VideoDisplay::SetZoom(double value) {

View file

@ -74,8 +74,7 @@ private:
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnKey(wxKeyEvent &event); void OnKey(wxKeyEvent &event);
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);
void OnMouseLeave(wxMouseEvent& event);
void OnEraseBackground(wxEraseEvent &event) {} void OnEraseBackground(wxEraseEvent &event) {}
void OnSizeEvent(wxSizeEvent &event); void OnSizeEvent(wxSizeEvent &event);

View file

@ -1103,6 +1103,10 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
mouseY = y; mouseY = y;
hasOverlay = true; hasOverlay = true;
} }
if (event.Leaving()) {
mouseX = -1;
mouseY = -1;
}
// Has something to draw // Has something to draw
if (hasOverlay) { if (hasOverlay) {
@ -1115,6 +1119,8 @@ void VideoDisplayVisual::OnMouseEvent (wxMouseEvent &event) {
///////////// /////////////
// Key event // Key event
void VideoDisplayVisual::OnKeyEvent(wxKeyEvent &event) { void VideoDisplayVisual::OnKeyEvent(wxKeyEvent &event) {
// FIXME: should these beconfigurable?
// Think of the frenchmen and other people not using qwerty layout
if (event.GetKeyCode() == 'A') SetMode(0); if (event.GetKeyCode() == 'A') SetMode(0);
if (event.GetKeyCode() == 'S') SetMode(1); if (event.GetKeyCode() == 'S') SetMode(1);
if (event.GetKeyCode() == 'D') SetMode(2); if (event.GetKeyCode() == 'D') SetMode(2);