зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1535140 - Slow down a bit if injecting touch inputs too fast for Windows to digest. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D27598 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7890b4889b
Коммит
4a54e2e98c
|
@ -100,8 +100,21 @@ bool nsWindowBase::InjectTouchPoint(uint32_t aId, LayoutDeviceIntPoint& aPoint,
|
|||
info.rcContact.left = info.pointerInfo.ptPixelLocation.x - 2;
|
||||
info.rcContact.right = info.pointerInfo.ptPixelLocation.x + 2;
|
||||
|
||||
if (!sInjectTouchFuncPtr(1, &info)) {
|
||||
WinUtils::Log("InjectTouchInput failure. GetLastError=%d", GetLastError());
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (sInjectTouchFuncPtr(1, &info)) {
|
||||
break;
|
||||
}
|
||||
DWORD error = GetLastError();
|
||||
if (error == ERROR_NOT_READY && i < 2) {
|
||||
// We sent it too quickly after the previous injection (see bug 1535140
|
||||
// comment 10). On the first loop iteration we just yield (via Sleep(0))
|
||||
// and try again. If it happens again on the second loop iteration we
|
||||
// explicitly Sleep(1) and try again. If that doesn't work either we just
|
||||
// error out.
|
||||
::Sleep(i);
|
||||
continue;
|
||||
}
|
||||
WinUtils::Log("InjectTouchInput failure. GetLastError=%d", error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче