Sync with X server before simulating mouse clicks

Adding a call to XSync() to wxUIActionSimulatorX11Impl seems to fix the
problems with the focus snapping back to the control having it previously
after simulating a mouse click and changing the focus afterwards using
wxWindow::SetFocus(), as the uiaction sample did.

Admittedly, it's not really clear why does doing it help, but at the very
leasy this XSync() call shouldn't do any harm.
This commit is contained in:
Vadim Zeitlin
2016-05-23 01:56:08 +02:00
parent 7cf5804465
commit e2c98afd5a

View File

@@ -106,6 +106,10 @@ bool wxUIActionSimulatorX11Impl::SendButtonEvent(int button, bool isDown)
return false;
}
// Ensure that the event is received by the correct window by processing
// all pending events, notably mouse moves.
XSync(m_display, False /* don't discard */);
return DoX11Button(xbutton, isDown);
}