From 6ae2a4b72f92c807a59d407c8061416bf310900f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 4 Apr 2007 13:38:37 +0000 Subject: [PATCH] don't call OnMouseEnter(-1) twice when the mouse leaves the toolbar but wasn't over a tool before git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45246 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/tbar95.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index e08d46d3d8..f2c24ec171 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -258,7 +258,7 @@ void wxToolBar::Init() m_defaultWidth = DEFAULTBITMAPX; m_defaultHeight = DEFAULTBITMAPY; - m_pInTool = 0; + m_pInTool = NULL; } bool wxToolBar::Create(wxWindow *parent, @@ -1455,9 +1455,14 @@ void wxToolBar::OnSysColourChanged(wxSysColourChangedEvent& event) void wxToolBar::OnMouseEvent(wxMouseEvent& event) { - if (event.Leaving() && m_pInTool) + if ( event.Leaving() ) { - OnMouseEnter( -1 ); + if ( m_pInTool ) + { + OnMouseEnter(wxID_ANY); + m_pInTool = NULL; + } + event.Skip(); return; } @@ -1688,18 +1693,11 @@ void wxToolBar::HandleMouseMove(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam) y = GET_Y_LPARAM(lParam); wxToolBarToolBase* tool = FindToolForPosition( x, y ); - // cursor left current tool - if ( tool != m_pInTool && !tool ) - { - m_pInTool = 0; - OnMouseEnter( -1 ); - } - - // cursor entered a tool - if ( tool != m_pInTool && tool ) + // has the current tool changed? + if ( tool != m_pInTool ) { m_pInTool = tool; - OnMouseEnter( tool->GetId() ); + OnMouseEnter(tool ? tool->GetId() : wxID_ANY); } } -- 2.50.0