зеркало из https://github.com/mozilla/pjs.git
Bug 594977. Part 2: Disable trackpoint hack for newer Synaptic drivers. r=jmathies,a=blocker
This commit is contained in:
Родитель
dfa6a24785
Коммит
849a2ee365
|
@ -8376,27 +8376,50 @@ PRBool nsWindow::UseTrackPointHack()
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(WINCE)
|
#if !defined(WINCE)
|
||||||
|
static PRBool
|
||||||
|
HasRegistryKey(HKEY aRoot, LPCWSTR aName)
|
||||||
|
{
|
||||||
|
HKEY key;
|
||||||
|
LONG result = ::RegOpenKeyExW(aRoot, aName, 0, KEY_READ, &key);
|
||||||
|
if (result != ERROR_SUCCESS)
|
||||||
|
return PR_FALSE;
|
||||||
|
::RegCloseKey(key);
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PRBool
|
||||||
|
IsObsoleteSynapticsDriver()
|
||||||
|
{
|
||||||
|
HKEY key;
|
||||||
|
LONG result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
|
L"Software\\Synaptics\\SynTP\\Install\\DriverVersion", 0, KEY_READ, &key);
|
||||||
|
if (result != ERROR_SUCCESS)
|
||||||
|
return PR_FALSE;
|
||||||
|
DWORD type;
|
||||||
|
PRUnichar buf[40];
|
||||||
|
DWORD buflen = sizeof(buf);
|
||||||
|
result = ::RegQueryValueExW(key, NULL, NULL, &type, (BYTE*)buf, &buflen);
|
||||||
|
::RegCloseKey(key);
|
||||||
|
if (result != ERROR_SUCCESS || type != REG_SZ)
|
||||||
|
return PR_FALSE;
|
||||||
|
buf[NS_ARRAY_LENGTH(buf) - 1] = 0;
|
||||||
|
|
||||||
|
int majorVersion = wcstol(buf, NULL, 10);
|
||||||
|
return majorVersion < 15;
|
||||||
|
}
|
||||||
|
|
||||||
void nsWindow::InitInputHackDefaults()
|
void nsWindow::InitInputHackDefaults()
|
||||||
{
|
{
|
||||||
// Init Trackpoint Hack
|
if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\TrackPoint")) {
|
||||||
const WCHAR wstrKeys[][40] = {L"Software\\Lenovo\\TrackPoint",
|
sDefaultTrackPointHack = PR_TRUE;
|
||||||
L"Software\\Lenovo\\UltraNav",
|
} else if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\UltraNav")) {
|
||||||
L"Software\\Alps\\Apoint\\TrackPoint",
|
sDefaultTrackPointHack = PR_TRUE;
|
||||||
L"Software\\Synaptics\\SynTPEnh\\UltraNavUSB",
|
} else if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Alps\\Apoint\\TrackPoint")) {
|
||||||
L"Software\\Synaptics\\SynTPEnh\\UltraNavPS2"};
|
sDefaultTrackPointHack = PR_TRUE;
|
||||||
// If anything fails turn the hack off
|
} else if ((HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavUSB") ||
|
||||||
sDefaultTrackPointHack = PR_FALSE;
|
HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavPS2")) &&
|
||||||
for (unsigned i = 0; i < NS_ARRAY_LENGTH(wstrKeys); i++) {
|
IsObsoleteSynapticsDriver()) {
|
||||||
HKEY hKey;
|
|
||||||
long lResult = ::RegOpenKeyExW(HKEY_CURRENT_USER, (LPCWSTR)&wstrKeys[i],
|
|
||||||
0, KEY_READ, &hKey);
|
|
||||||
::RegCloseKey(hKey);
|
|
||||||
if (lResult == ERROR_SUCCESS) {
|
|
||||||
// If we detected a registry key belonging to a TrackPoint driver
|
|
||||||
// Turn on the hack by default
|
|
||||||
sDefaultTrackPointHack = PR_TRUE;
|
sDefaultTrackPointHack = PR_TRUE;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // #if !defined(WINCE)
|
#endif // #if !defined(WINCE)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче