зеркало из https://github.com/mozilla/pjs.git
Bug 672175 part.4 Move HasRegistryKey() in nsWindow.cpp to WinUtils r=jimm
This commit is contained in:
Родитель
f87e92733d
Коммит
27c474c6ff
|
@ -122,6 +122,26 @@ WinUtils::GetRegistryKey(HKEY aRoot,
|
|||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
WinUtils::HasRegistryKey(HKEY aRoot, const PRUnichar* aKeyName)
|
||||
{
|
||||
MOZ_ASSERT(aRoot, "aRoot must not be NULL");
|
||||
MOZ_ASSERT(aKeyName, "aKeyName must not be NULL");
|
||||
HKEY key;
|
||||
LONG result =
|
||||
::RegOpenKeyExW(aRoot, aKeyName, 0, KEY_READ | KEY_WOW64_32KEY, &key);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
result =
|
||||
::RegOpenKeyExW(aRoot, aKeyName, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
::RegCloseKey(key);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
HWND
|
||||
WinUtils::GetTopLevelHWND(HWND aWnd,
|
||||
|
|
|
@ -93,6 +93,17 @@ public:
|
|||
PRUnichar* aBuffer,
|
||||
DWORD aBufferLength);
|
||||
|
||||
/**
|
||||
* Checks whether the registry key exists in either 32bit or 64bit branch on
|
||||
* the environment.
|
||||
*
|
||||
* @param aRoot The registry root of aName.
|
||||
* @param aKeyName The name of the registry key to check.
|
||||
* @return TRUE if it exists and is readable. Otherwise, FALSE.
|
||||
*/
|
||||
static bool HasRegistryKey(HKEY aRoot,
|
||||
const PRUnichar* aKeyName);
|
||||
|
||||
/**
|
||||
* GetTopLevelHWND() returns a window handle of the top level window which
|
||||
* aWnd belongs to. Note that the result may not be our window, i.e., it
|
||||
|
|
|
@ -8662,20 +8662,6 @@ bool nsWindow::UseTrackPointHack()
|
|||
sDefaultTrackPointHack);
|
||||
}
|
||||
|
||||
static bool
|
||||
HasRegistryKey(HKEY aRoot, PRUnichar* aName)
|
||||
{
|
||||
HKEY key;
|
||||
LONG result = ::RegOpenKeyExW(aRoot, aName, 0, KEY_READ | KEY_WOW64_32KEY, &key);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
result = ::RegOpenKeyExW(aRoot, aName, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
||||
if (result != ERROR_SUCCESS)
|
||||
return false;
|
||||
}
|
||||
::RegCloseKey(key);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsObsoleteSynapticsDriver()
|
||||
{
|
||||
|
@ -8732,14 +8718,19 @@ void nsWindow::InitInputWorkaroundPrefDefaults()
|
|||
{
|
||||
PRUint32 elantechDriverVersion = GetElantechDriverMajorVersion();
|
||||
|
||||
if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\TrackPoint")) {
|
||||
if (WinUtils::HasRegistryKey(HKEY_CURRENT_USER,
|
||||
L"Software\\Lenovo\\TrackPoint")) {
|
||||
sDefaultTrackPointHack = true;
|
||||
} else if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\UltraNav")) {
|
||||
} else if (WinUtils::HasRegistryKey(HKEY_CURRENT_USER,
|
||||
L"Software\\Lenovo\\UltraNav")) {
|
||||
sDefaultTrackPointHack = true;
|
||||
} else if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Alps\\Apoint\\TrackPoint")) {
|
||||
} else if (WinUtils::HasRegistryKey(HKEY_CURRENT_USER,
|
||||
L"Software\\Alps\\Apoint\\TrackPoint")) {
|
||||
sDefaultTrackPointHack = true;
|
||||
} else if ((HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavUSB") ||
|
||||
HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavPS2")) &&
|
||||
} else if ((WinUtils::HasRegistryKey(HKEY_CURRENT_USER,
|
||||
L"Software\\Synaptics\\SynTPEnh\\UltraNavUSB") ||
|
||||
WinUtils::HasRegistryKey(HKEY_CURRENT_USER,
|
||||
L"Software\\Synaptics\\SynTPEnh\\UltraNavPS2")) &&
|
||||
IsObsoleteSynapticsDriver()) {
|
||||
sDefaultTrackPointHack = true;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче