зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1318839 - Add polling interval for direct input polling r=qDot
This commit is contained in:
Родитель
eed5a0f529
Коммит
726f692233
|
@ -46,9 +46,10 @@ const unsigned kButtonUsagePage = 0x9;
|
||||||
// Therefore, we wait a bit after receiving one before looking for
|
// Therefore, we wait a bit after receiving one before looking for
|
||||||
// device changes.
|
// device changes.
|
||||||
const uint32_t kDevicesChangedStableDelay = 200;
|
const uint32_t kDevicesChangedStableDelay = 200;
|
||||||
// XInput is a purely polling-driven API, so we need to
|
// Both DirectInput and XInput are polling-driven here,
|
||||||
// poll it periodically. 50ms is arbitrarily chosen.
|
// so we need to poll it periodically.
|
||||||
const uint32_t kXInputPollInterval = 50;
|
// 50ms is arbitrarily chosen.
|
||||||
|
const uint32_t kWindowsGamepadPollInterval = 50;
|
||||||
|
|
||||||
const UINT kRawInputError = (UINT)-1;
|
const UINT kRawInputError = (UINT)-1;
|
||||||
|
|
||||||
|
@ -414,7 +415,7 @@ WindowsGamepadService::XInputMessageLoopOnceCallback(nsITimer *aTimer,
|
||||||
if (self->mIsXInputMonitoring) {
|
if (self->mIsXInputMonitoring) {
|
||||||
aTimer->Cancel();
|
aTimer->Cancel();
|
||||||
aTimer->InitWithFuncCallback(XInputMessageLoopOnceCallback, self,
|
aTimer->InitWithFuncCallback(XInputMessageLoopOnceCallback, self,
|
||||||
kXInputPollInterval, nsITimer::TYPE_ONE_SHOT);
|
kWindowsGamepadPollInterval, nsITimer::TYPE_ONE_SHOT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +502,7 @@ WindowsGamepadService::ScanForDevices()
|
||||||
if (ScanForXInputDevices()) {
|
if (ScanForXInputDevices()) {
|
||||||
mIsXInputMonitoring = true;
|
mIsXInputMonitoring = true;
|
||||||
mXInputTimer->InitWithFuncCallback(XInputMessageLoopOnceCallback, this,
|
mXInputTimer->InitWithFuncCallback(XInputMessageLoopOnceCallback, this,
|
||||||
kXInputPollInterval,
|
kWindowsGamepadPollInterval,
|
||||||
nsITimer::TYPE_ONE_SHOT);
|
nsITimer::TYPE_ONE_SHOT);
|
||||||
} else {
|
} else {
|
||||||
mIsXInputMonitoring = false;
|
mIsXInputMonitoring = false;
|
||||||
|
@ -976,7 +977,9 @@ public:
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
if (!sIsShutdown) {
|
if (!sIsShutdown) {
|
||||||
NS_DispatchToCurrentThread(new WindowGamepadMessageLoopOnceRunnable());
|
nsCOMPtr<nsIRunnable> runnable = new WindowGamepadMessageLoopOnceRunnable();
|
||||||
|
NS_DelayedDispatchToCurrentThread(runnable.forget(),
|
||||||
|
kWindowsGamepadPollInterval);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче