diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 719535861615..0517b207aa63 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2387,7 +2387,7 @@ pref("middlemouse.scrollbarPosition", false); // Clipboard only supports text/plain pref("clipboard.plainTextOnly", false); -#ifdef XP_WIN +#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) // 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. diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 00677d496fef..3929f3da1f0a 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -3027,9 +3027,15 @@ void nsWindow::OnButtonPressEvent(GdkEventButton* aEvent) { return; // Map buttons 8-9 to back/forward case 8: + if (!Preferences::GetBool("mousebutton.4th.enabled", true)) { + return; + } DispatchCommandEvent(nsGkAtoms::Back); return; case 9: + if (!Preferences::GetBool("mousebutton.5th.enabled", true)) { + return; + } DispatchCommandEvent(nsGkAtoms::Forward); return; default: