Fix window positioning bug when context menu is open. (fixes lp:1606378)

* When a context menu was open and a left mouse click event in the window title
  bar occurred, the window would shift from the title bar click position to the
  context menu select position.  This only seemed to effect windows.
This commit is contained in:
Jean-Pierre Charras 2016-08-05 10:46:36 -04:00 committed by Wayne Stambaugh
parent 5f98fc0591
commit 7aca6174d6
1 changed files with 11 additions and 0 deletions

View File

@ -893,6 +893,17 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
pos = event.GetPosition();
m_ignoreMouseEvents = true;
PopupMenu( &MasterMenu, pos );
// here, we are waiting for popup menu closing.
// Among different ways, it can be closed by clicking on the left mouse button.
// The expected behavior is to move the mouse cursor to its initial
// location, where the right click was made.
// However there is a case where the move cursor does not work as expected:
// when the user left clicks on the caption frame: the entire window is moved.
// Calling wxSafeYield avoid this behavior because it allows the left click
// to be proceeded before moving the mouse
wxSafeYield();
// Move the mouse cursor to its initial position:
MoveCursorToCrossHair();
m_ignoreMouseEvents = false;