diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 5d72954acb..1c68aa54a6 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -61,6 +61,9 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) ); Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) ); Connect( wxEVT_LEFT_UP, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) ); +#if defined _WIN32 || defined _WIN64 + Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CAIRO_GAL::skipMouseEvent ) ); +#endif // Initialize line attributes map lineCapMap[LINE_CAP_BUTT] = CAIRO_LINE_CAP_BUTT; diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 6a23f844d4..c97d5f307a 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -90,6 +90,9 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); Connect( wxEVT_LEFT_UP, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); +#if defined _WIN32 || defined _WIN64 + Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); +#endif } diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index f24a71aa50..e3b75799b2 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -46,28 +46,30 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) : WX_VIEW_CONTROLS::onButton ), NULL, this ); m_parentPanel->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this ); +#if defined _WIN32 || defined _WIN64 + m_parentPanel->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( + WX_VIEW_CONTROLS::onEnter ), NULL, this ); +#endif } void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& event ) { - VECTOR2D mousePoint( event.GetX(), event.GetY() ); + // workaround for wxmsw.. + //if( event.Entering() ) + //m_parentPanel->SetFocus(); - if( event.Dragging() ) + if( event.Dragging() && m_isDragPanning ) { - if( m_isDragPanning ) - { - VECTOR2D d = m_dragStartPoint - mousePoint; - VECTOR2D delta = m_view->ToWorld( d, false ); + VECTOR2D mousePoint( event.GetX(), event.GetY() ); + VECTOR2D d = m_dragStartPoint - mousePoint; + VECTOR2D delta = m_view->ToWorld( d, false ); - m_view->SetCenter( m_lookStartPoint + delta ); - m_parentPanel->Refresh(); - } - else - { - event.Skip(); - } + m_view->SetCenter( m_lookStartPoint + delta ); + m_parentPanel->Refresh(); } + + event.Skip(); } @@ -117,6 +119,8 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& event ) m_view->SetCenter( m_view->GetCenter() + delta ); m_parentPanel->Refresh(); } + + event.Skip(); } @@ -135,3 +139,9 @@ void WX_VIEW_CONTROLS::onButton( wxMouseEvent& event ) event.Skip(); } + + +void WX_VIEW_CONTROLS::onEnter( wxMouseEvent& event ) +{ + m_parentPanel->SetFocus(); +} diff --git a/include/view/wx_view_controls.h b/include/view/wx_view_controls.h index 0848f0c10b..df7b2f7bb7 100644 --- a/include/view/wx_view_controls.h +++ b/include/view/wx_view_controls.h @@ -54,6 +54,7 @@ public: void onWheel( wxMouseEvent& event ); void onMotion( wxMouseEvent& event ); void onButton( wxMouseEvent& event ); + void onEnter( wxMouseEvent& event ); private: