Use a hack to work around mouse click emulation bug with GTK 3

Somehow, mouse release events generated immediately after the mouse
press ones are sometimes (not always, but often enough to reliably
prevent the test suite from passing) simply lost, i.e. not received by
the GTK event loop.

The only workaround seems to be to introduce an artificial delay, which
does avoid the problem, at the price of making the tests run longer and,
worse, not really solving the underlying problem, whatever it is. But
it's still better than nothing.
This commit is contained in:
Vadim Zeitlin
2019-10-17 22:05:17 +02:00
parent 57d2be63fc
commit 8ed116bdc6

View File

@@ -28,6 +28,8 @@
#include "wx/unix/utilsx11.h"
#ifdef __WXGTK3__
#include "wx/utils.h"
#include "wx/gtk/private/wrapgtk.h"
GtkWidget* wxGetTopLevelGTK();
#endif
@@ -333,6 +335,13 @@ bool wxUIActionSimulatorX11Impl::MouseMove(long x, long y)
bool wxUIActionSimulatorX11Impl::MouseUp(int button)
{
#ifdef __WXGTK3__
// This is a horrible hack, but some mouse click events are just lost
// without any apparent reason when using GTK 3 without this, i.e. they
// simply never reach GTK in some runs of the tests.
wxMilliSleep(10);
#endif
return SendButtonEvent(button, false);
}