Commit 87da6a8a authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Fixed hanging up of menu loop when user never moves mouse cursor into popup menu area.

parent d0749a3a
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -60,8 +60,15 @@ CONTEXT_MENU::CONTEXT_MENU()
	m_tool = NULL;
	m_tool = NULL;
	m_menu = new wxMenu();
	m_menu = new wxMenu();
	m_handler = new CMEventHandler( this );
	m_handler = new CMEventHandler( this );
	m_menu->Connect( wxEVT_MENU_HIGHLIGHT, wxEventHandler( CMEventHandler::onEvent ), NULL, m_handler );
	m_menu->Connect( wxEVT_MENU_HIGHLIGHT, wxEventHandler( CMEventHandler::onEvent ),
	m_menu->Connect( wxEVT_COMMAND_MENU_SELECTED, wxEventHandler( CMEventHandler::onEvent ), NULL, m_handler );
	                 NULL, m_handler );
	m_menu->Connect( wxEVT_COMMAND_MENU_SELECTED, wxEventHandler( CMEventHandler::onEvent ),
	                 NULL, m_handler );

	// Workaround for the case when mouse cursor never reaches menu (it hangs up tools using menu)
	wxMenuEvent menuEvent( wxEVT_MENU_HIGHLIGHT, 0, m_menu );
	m_menu->AddPendingEvent( menuEvent );

	m_titleSet = false;
	m_titleSet = false;
}
}


@@ -75,6 +82,7 @@ CONTEXT_MENU::~CONTEXT_MENU()


void CONTEXT_MENU::SetTitle( const wxString& aTitle )
void CONTEXT_MENU::SetTitle( const wxString& aTitle )
{
{
    // Unfortunately wxMenu::SetTitle() does nothing..
	if( m_titleSet )
	if( m_titleSet )
	{
	{
        m_menu->Delete( m_menu->FindItemByPosition( 0 ) ); // fixme: this is LAME!
        m_menu->Delete( m_menu->FindItemByPosition( 0 ) ); // fixme: this is LAME!
+2 −2

File changed.

Contains only whitespace changes.