From b87ab79d6d1e785b44199eecd99f348abf2fce77 Mon Sep 17 00:00:00 2001 From: Andrew Zonenberg Date: Sun, 12 Jul 2015 12:54:11 -0700 Subject: [PATCH] Reverting last commit since it causes regressions --- common/view/wx_view_controls.cpp | 33 +++--------------------- include/gal/graphics_abstraction_layer.h | 10 ------- include/view/wx_view_controls.h | 13 ---------- 3 files changed, 3 insertions(+), 53 deletions(-) diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index 0f1c734c8d..7bb333004a 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -36,8 +36,7 @@ using namespace KIGFX; const wxEventType WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE = wxNewEventType(); WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel ) : - VIEW_CONTROLS( aView ), m_state( IDLE ), m_parentPanel( aParentPanel ), m_scrollScale( 1.0, 1.0 ), - m_mouseIsInView(false), m_cursorWasDisplayedOnLeave(false) + VIEW_CONTROLS( aView ), m_state( IDLE ), m_parentPanel( aParentPanel ), m_scrollScale( 1.0, 1.0 ) { m_parentPanel->Connect( wxEVT_MOTION, wxMouseEventHandler( WX_VIEW_CONTROLS::onMotion ), NULL, this ); @@ -55,8 +54,10 @@ WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxScrolledCanvas* aParentPanel wxMouseEventHandler( WX_VIEW_CONTROLS::onButton ), NULL, this ); m_parentPanel->Connect( wxEVT_LEFT_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 m_parentPanel->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( WX_VIEW_CONTROLS::onLeave ), NULL, this ); m_parentPanel->Connect( wxEVT_SCROLLWIN_THUMBTRACK, @@ -211,28 +212,12 @@ void WX_VIEW_CONTROLS::onButton( wxMouseEvent& aEvent ) void WX_VIEW_CONTROLS::onEnter( wxMouseEvent& aEvent ) { - //If the cursor was enabled when we left, turn it on now - m_mouseIsInView = true; - m_view->GetGAL()->SetCursorEnabled(m_cursorWasDisplayedOnLeave); - -#if defined _WIN32 || defined _WIN64 m_parentPanel->SetFocus(); -#endif } void WX_VIEW_CONTROLS::onLeave( wxMouseEvent& aEvent ) { - // Always hide the cursor when the mouse leaves the window to avoid confusing the user - // But we may need to re-enable it, so keep track of whether it was visible - m_mouseIsInView = false; - m_cursorWasDisplayedOnLeave = m_view->GetGAL()->GetCursorEnabled(); - m_view->GetGAL()->SetCursorEnabled(false); - - // If we hid the cursor, redraw the window to get rid of it - if(m_cursorWasDisplayedOnLeave) - m_view->Redraw(); - if( m_cursorCaptured ) { bool warp = false; @@ -449,15 +434,3 @@ void WX_VIEW_CONTROLS::UpdateScrollbars() ( viewport.Centre().x - boundary.GetLeft() ) / boundary.GetWidth() * m_scrollScale.x, ( viewport.Centre().y - boundary.GetTop() ) / boundary.GetHeight() * m_scrollScale.y ); } - -void WX_VIEW_CONTROLS::ShowCursor( bool aEnabled ) -{ - // If the mouse is outside the view (on a toolbar etc), don't show the cursor - // until the mouse enters the view again. Just remember we want to show it now - if(!m_mouseIsInView) - m_cursorWasDisplayedOnLeave = aEnabled; - - // but if it's in the view, we want to show it right now - else - m_view->GetGAL()->SetCursorEnabled( aEnabled ); -} diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h index 281b7d6fc9..6c478e8558 100644 --- a/include/gal/graphics_abstraction_layer.h +++ b/include/gal/graphics_abstraction_layer.h @@ -762,16 +762,6 @@ public: { isCursorEnabled = aCursorEnabled; } - - /** - * @brief Returns the cursor enable state - * - * @return True if the cursor is being drawn, else false - */ - inline bool GetCursorEnabled() const - { - return isCursorEnabled; - } /** * @brief Set the cursor color. diff --git a/include/view/wx_view_controls.h b/include/view/wx_view_controls.h index 33710be6de..67ad9b4567 100644 --- a/include/view/wx_view_controls.h +++ b/include/view/wx_view_controls.h @@ -84,13 +84,6 @@ public: if( m_state == AUTO_PANNING ) m_state = IDLE; } - - /** - * Function ShowCursor() - * Enables or disables display of cursor. - * @param aEnabled decides if the cursor should be shown. - */ - virtual void ShowCursor( bool aEnabled ); /// @copydoc VIEW_CONTROLS::GetMousePosition() VECTOR2D GetMousePosition() const; @@ -147,12 +140,6 @@ private: /// Ratio used for scaling world coordinates to scrollbar position. VECTOR2D m_scrollScale; - - /// Indicates whether the mouse is inside the window - bool m_mouseIsInView; - - /// Indicates whether the cursor was being displayed at the time the mouse left the window - bool m_cursorWasDisplayedOnLeave; }; } // namespace KIGFX