Bug 1052947 Allow users to disable 4th button and/or 5th button of mouse on Windows r=smaug+jimm

This commit is contained in:
Masayuki Nakano 2016-01-20 19:56:37 +09:00
parent 28f8f114c9
commit eb839af130
2 changed files with 31 additions and 0 deletions

View File

@ -2042,6 +2042,14 @@ pref("clipboard.autocopy", false);
// Clipboard only supports text/plain
pref("clipboard.plainTextOnly", false);
#ifdef XP_WIN
// Setting false you can disable 4th button and/or 5th button of your mouse.
// 4th button is typically mapped to "Back" and 5th button is typically mapped
// to "Forward" button.
pref("mousebutton.4th.enabled", true);
pref("mousebutton.5th.enabled", true);
#endif
// mouse wheel scroll transaction period of time (in milliseconds)
pref("mousewheel.transaction.timeout", 1500);
// mouse wheel scroll transaction is held even if the mouse cursor is moved.

View File

@ -5435,6 +5435,29 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
DispatchPendingEvents();
break;
// Windows doesn't provide to customize the behavior of 4th nor 5th button
// of mouse. If 5-button mouse works with standard mouse deriver of
// Windows, users cannot disable 4th button (browser back) nor 5th button
// (browser forward). We should allow to do it with our prefs since we can
// prevent Windows to generate WM_APPCOMMAND message if WM_XBUTTONUP
// messages are not sent to DefWindowProc.
case WM_XBUTTONDOWN:
case WM_XBUTTONUP:
case WM_NCXBUTTONDOWN:
case WM_NCXBUTTONUP:
*aRetValue = TRUE;
switch (GET_XBUTTON_WPARAM(wParam)) {
case XBUTTON1:
result = !Preferences::GetBool("mousebutton.4th.enabled", true);
break;
case XBUTTON2:
result = !Preferences::GetBool("mousebutton.5th.enabled", true);
break;
default:
break;
}
break;
case WM_SIZING:
{
// When we get WM_ENTERSIZEMOVE we don't know yet if we're in a live