Don't let CaptureCursor fight modal dialog

This commit is contained in:
Marek Roszko 2024-05-24 18:56:47 -04:00
parent 1971faa81e
commit e9fde0051f
1 changed files with 6 additions and 2 deletions

View File

@ -45,7 +45,7 @@
#include <wx/log.h>
#ifdef __WXMSW__
#define USE_MOUSE_CAPTURE
#define USE_MOUSE_CAPTURE
#endif
using namespace KIGFX;
@ -691,7 +691,11 @@ void WX_VIEW_CONTROLS::CaptureCursor( bool aEnabled )
// Note: for some reason, m_parentPanel->HasCapture() can be false even if CaptureMouse()
// was called (i.e. mouse was captured, so when need to test m_MouseCapturedLost to be
// sure a wxEVT_MOUSE_CAPTURE_LOST event was fired before. Otherwise wxMSW complains
if( aEnabled && !m_parentPanel->HasCapture() && m_parentPanel->m_MouseCapturedLost )
// The IsModalDialogFocused is checked because it's possible to start a capture
// due to event ordering while a modal dialog was just opened, the mouse capture steels focus
// from the modal and causes odd behavior
if( aEnabled && !m_parentPanel->HasCapture() && m_parentPanel->m_MouseCapturedLost
&& !KIUI::IsModalDialogFocused() )
{
m_parentPanel->CaptureMouse();