зеркало из https://github.com/mozilla/pjs.git
Bug 640587 - Disable the swipe gesture half of the Elantech hack for driver versions < 8. r=jimm
This commit is contained in:
Родитель
39836938cc
Коммит
e0759926e6
|
@ -274,8 +274,10 @@ int nsWindow::sTrimOnMinimize = 2;
|
|||
PRBool nsWindow::sDefaultTrackPointHack = PR_FALSE;
|
||||
// Default value for general window class (used when the pref is the empty string).
|
||||
const char* nsWindow::sDefaultMainWindowClass = kClassNameGeneral;
|
||||
// Whether to enable the Elantech gesture hack.
|
||||
PRBool nsWindow::sUseElantechGestureHacks = PR_FALSE;
|
||||
// Whether to enable the Elantech swipe gesture hack.
|
||||
PRBool nsWindow::sUseElantechSwipeHack = PR_FALSE;
|
||||
// Whether to enable the Elantech pinch-to-zoom gesture hack.
|
||||
PRBool nsWindow::sUseElantechPinchHack = PR_FALSE;
|
||||
|
||||
// If we're using D3D9, this will not be allowed during initial 5 seconds.
|
||||
bool nsWindow::sAllowD3D9 = false;
|
||||
|
@ -6651,7 +6653,7 @@ LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
|
|||
aMsg.wParam != VK_PROCESSKEY ? aMsg.wParam : ::ImmGetVirtualKey(mWnd);
|
||||
gKbdLayout.OnKeyDown(virtualKeyCode);
|
||||
|
||||
if (sUseElantechGestureHacks) {
|
||||
if (sUseElantechSwipeHack) {
|
||||
PerformElantechSwipeGestureHack(virtualKeyCode, aModKeyState);
|
||||
}
|
||||
|
||||
|
@ -6994,9 +6996,11 @@ LRESULT nsWindow::OnKeyUp(const MSG &aMsg,
|
|||
{
|
||||
UINT virtualKeyCode = aMsg.wParam;
|
||||
|
||||
if (sUseElantechGestureHacks) {
|
||||
if (sUseElantechSwipeHack) {
|
||||
PerformElantechSwipeGestureHack(virtualKeyCode, aModKeyState);
|
||||
}
|
||||
|
||||
if (sUseElantechPinchHack) {
|
||||
// Version 8 of the Elantech touchpad driver sends these messages for
|
||||
// zoom gestures:
|
||||
//
|
||||
|
@ -7609,7 +7613,7 @@ PRBool nsWindow::HandleScrollingPlugins(UINT aMsg, WPARAM aWParam,
|
|||
// is another app's window or no window under the
|
||||
// pointer.
|
||||
|
||||
if (sUseElantechGestureHacks && IsElantechHelperWindow(destWnd)) {
|
||||
if (sUseElantechPinchHack && IsElantechHelperWindow(destWnd)) {
|
||||
// The Elantech driver places a window right underneath the cursor
|
||||
// when sending a WM_MOUSEWHEEL event to us as part of a pinch-to-zoom
|
||||
// gesture. We detect that here, and search for our window that would
|
||||
|
@ -8883,8 +8887,8 @@ IsObsoleteSynapticsDriver()
|
|||
return majorVersion < 15;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsObsoleteElantechDriver()
|
||||
static PRInt32
|
||||
GetElantechDriverMajorVersion()
|
||||
{
|
||||
PRUnichar buf[40];
|
||||
// The driver version is found in one of these two registry keys.
|
||||
|
@ -8907,18 +8911,17 @@ IsObsoleteElantechDriver()
|
|||
// or at the start of the string.
|
||||
for (PRUnichar* p = buf; *p; p++) {
|
||||
if (*p >= L'0' && *p <= L'9' && (p == buf || *(p - 1) == L' ')) {
|
||||
int majorVersion = wcstol(p, NULL, 10);
|
||||
// Versions 7 and 8 need the hack.
|
||||
if (majorVersion == 7 || majorVersion == 8)
|
||||
return PR_TRUE;
|
||||
return wcstol(p, NULL, 10);
|
||||
}
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nsWindow::InitInputWorkaroundPrefDefaults()
|
||||
{
|
||||
PRUint32 elantechDriverVersion = GetElantechDriverMajorVersion();
|
||||
|
||||
if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\TrackPoint")) {
|
||||
sDefaultTrackPointHack = PR_TRUE;
|
||||
} else if (HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\UltraNav")) {
|
||||
|
@ -8927,13 +8930,15 @@ void nsWindow::InitInputWorkaroundPrefDefaults()
|
|||
sDefaultTrackPointHack = PR_TRUE;
|
||||
} else if ((HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavUSB") ||
|
||||
HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavPS2")) &&
|
||||
IsObsoleteSynapticsDriver()) {
|
||||
elantechDriverVersion != 0 && elantechDriverVersion <= 8) {
|
||||
sDefaultTrackPointHack = PR_TRUE;
|
||||
}
|
||||
|
||||
sUseElantechGestureHacks =
|
||||
PRBool useElantechGestureHacks =
|
||||
GetInputWorkaroundPref("ui.elantech_gesture_hacks.enabled",
|
||||
IsObsoleteElantechDriver());
|
||||
elantechDriverVersion != 0);
|
||||
sUseElantechSwipeHack = useElantechGestureHacks && elantechDriverVersion <= 7;
|
||||
sUseElantechPinchHack = useElantechGestureHacks && elantechDriverVersion <= 8;
|
||||
}
|
||||
|
||||
LPARAM nsWindow::lParamToScreen(LPARAM lParam)
|
||||
|
|
|
@ -526,7 +526,8 @@ protected:
|
|||
static int sTrimOnMinimize;
|
||||
static PRBool sDefaultTrackPointHack;
|
||||
static const char* sDefaultMainWindowClass;
|
||||
static PRBool sUseElantechGestureHacks;
|
||||
static PRBool sUseElantechSwipeHack;
|
||||
static PRBool sUseElantechPinchHack;
|
||||
static bool sAllowD3D9;
|
||||
|
||||
// Always use the helper method to read this property. See bug 603793.
|
||||
|
|
Загрузка…
Ссылка в новой задаче