Mouse wheel scrolling broken with Katmouse enabled - bug 514927 r+a=roc

This commit is contained in:
Kyle Huey 2009-10-07 00:19:04 -04:00
parent e87cfe5946
commit 4b65ce7eff
3 changed files with 63 additions and 1 deletions

View File

@ -1625,6 +1625,10 @@ pref("ui.panel.default_level_parent", false);
pref("mousewheel.system_scroll_override_on_root_content.enabled", true);
// Bug 514927
// Enables or disabled the TrackPoint hack, -1 is autodetect, 0 is off,
// and 1 is on. Set this to 1 if TrackPoint scrolling is not working.
pref("ui.trackpoint_hack.enabled", -1);
# WINNT
#endif

View File

@ -262,6 +262,9 @@ BYTE nsWindow::sLastMouseButton = 0;
// Trim heap on minimize. (initialized, but still true.)
int nsWindow::sTrimOnMinimize = 2;
// Default Trackpoint Hack to off
PRBool nsWindow::sTrackPointHack = PR_FALSE;
#ifdef ACCESSIBILITY
BOOL nsWindow::sIsAccessibilityOn = FALSE;
// Accessibility wm_getobject handler
@ -423,6 +426,10 @@ nsWindow::nsWindow() : nsBaseWidget()
#if defined(HEAP_DUMP_EVENT)
InitHeapDump();
#endif
#if !defined(WINCE)
InitTrackPointHack();
#endif
} // !sInstanceCount
// Set gLastInputEventTime to some valid number
@ -578,7 +585,8 @@ nsWindow::Create(nsIWidget *aParent,
if (!mWnd)
return NS_ERROR_FAILURE;
if (mWindowType != eWindowType_plugin &&
if (nsWindow::sTrackPointHack &&
mWindowType != eWindowType_plugin &&
mWindowType != eWindowType_invisible) {
// Ugly Thinkpad Driver Hack (Bug 507222)
// We create an invisible scrollbar to trick the
@ -6816,6 +6824,52 @@ PRBool nsWindow::CanTakeFocus()
return PR_FALSE;
}
#if !defined(WINCE)
void nsWindow::InitTrackPointHack()
{
// Init Trackpoint Hack
nsresult rv;
PRInt32 lHackValue;
long lResult;
const WCHAR wstrKeys[][40] = {L"Software\\Lenovo\\TrackPoint",
L"Software\\Lenovo\\UltraNav"};
// If anything fails turn the hack off
sTrackPointHack = false;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if(NS_SUCCEEDED(rv) && prefs) {
prefs->GetIntPref("ui.trackpoint_hack.enabled", &lHackValue);
switch (lHackValue) {
// 0 means hack disabled
case 0:
break;
// 1 means hack enabled
case 1:
sTrackPointHack = true;
break;
// -1 means autodetect
case -1:
for(int i = 0; i < 2; i++) {
HKEY hKey;
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
sTrackPointHack = true;
break;
}
}
break;
// Shouldn't be any other values, but treat them as disabled
default:
break;
}
}
return;
}
#endif // #if !defined(WINCE)
LPARAM nsWindow::lParamToScreen(LPARAM lParam)
{
POINT pt;

View File

@ -269,6 +269,9 @@ protected:
virtual void SubclassWindow(BOOL bState);
void GetNonClientBounds(nsIntRect &aRect);
PRBool CanTakeFocus();
#if !defined(WINCE)
static void InitTrackPointHack();
#endif
/**
* Event processing helpers
@ -435,6 +438,7 @@ protected:
static PRBool sJustGotDeactivate;
static PRBool sJustGotActivate;
static int sTrimOnMinimize;
static PRBool sTrackPointHack;
// Hook Data Memebers for Dropdowns. sProcessHook Tells the
// hook methods whether they should be processing the hook