diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index 1990499459d966dcea3bb2c2760354469a1f06e7..decbd15efcde14c6953da756447b2617226d9627 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -444,7 +444,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
     NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
     mMousePos[0] = mPoint.x;
     mMousePos[1] = mPoint.y;
-	callMiddleMouseDown(mMousePos, [theEvent modifierFlags]);
+    callOtherMouseDown(mMousePos, [theEvent modifierFlags], [theEvent buttonNumber]);
 }
 
 - (void) otherMouseUp:(NSEvent *)theEvent
@@ -452,7 +452,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
     NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
     mMousePos[0] = mPoint.x;
     mMousePos[1] = mPoint.y;
-	callMiddleMouseUp(mMousePos, [theEvent modifierFlags]);
+    callOtherMouseUp(mMousePos, [theEvent modifierFlags], [theEvent buttonNumber]);
 }
 
 - (void) rightMouseDragged:(NSEvent *)theEvent
diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h
index 99af16110289c47d38327994d0a095fc91b0e80f..0f77ebe7a47490a3e3760d39b71931b7401b78cc 100644
--- a/indra/llwindow/llwindowmacosx-objc.h
+++ b/indra/llwindow/llwindowmacosx-objc.h
@@ -150,8 +150,8 @@ void callWindowHide();
 void callWindowUnhide();
 void callWindowDidChangeScreen();
 void callDeltaUpdate(float *delta, unsigned int mask);
-void callMiddleMouseDown(float *pos, unsigned int mask);
-void callMiddleMouseUp(float *pos, unsigned int mask);
+void callOtherMouseDown(float *pos, unsigned int mask, int button);
+void callOtherMouseUp(float *pos, unsigned int mask, int button);
 void callFocus();
 void callFocusLost();
 void callModifier(unsigned int mask);
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 3554f90be8c558f600888849b26c2f616cfa1321..6749b3be3bf12dad41408234a96ebcc2d1037e17 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -417,7 +417,7 @@ void callDeltaUpdate(float *delta, MASK mask)
 	gWindowImplementation->updateMouseDeltas(delta);
 }
 
-void callMiddleMouseDown(float *pos, MASK mask)
+void callOtherMouseDown(float *pos, MASK mask, int button)
 {
 	LLCoordGL		outCoords;
 	outCoords.mX = ll_round(pos[0]);
@@ -426,10 +426,17 @@ void callMiddleMouseDown(float *pos, MASK mask)
 	gWindowImplementation->getMouseDeltas(deltas);
 	outCoords.mX += deltas[0];
 	outCoords.mY += deltas[1];
-	gWindowImplementation->getCallbacks()->handleMiddleMouseDown(gWindowImplementation, outCoords, mask);
+    if (button == 3)
+    {
+        gWindowImplementation->getCallbacks()->handleMiddleMouseDown(gWindowImplementation, outCoords, mask);
+    }
+    else
+    {
+        gWindowImplementation->getCallbacks()->handleOtherMouseDown(gWindowImplementation, outCoords, mask, button);
+    }
 }
 
-void callMiddleMouseUp(float *pos, MASK mask)
+void callOtherMouseUp(float *pos, MASK mask, int button)
 {
 	LLCoordGL outCoords;
 	outCoords.mX = ll_round(pos[0]);
@@ -437,8 +444,15 @@ void callMiddleMouseUp(float *pos, MASK mask)
 	float deltas[2];
 	gWindowImplementation->getMouseDeltas(deltas);
 	outCoords.mX += deltas[0];
-	outCoords.mY += deltas[1];
-	gWindowImplementation->getCallbacks()->handleMiddleMouseUp(gWindowImplementation, outCoords, mask);
+    outCoords.mY += deltas[1];
+    if (button == 3)
+    {
+        gWindowImplementation->getCallbacks()->handleMiddleMouseUp(gWindowImplementation, outCoords, mask);
+    }
+    else
+    {
+        gWindowImplementation->getCallbacks()->handleOtherMouseUp(gWindowImplementation, outCoords, mask, button);
+    }
 }
 
 void callModifier(MASK mask)
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 25286ee61ccbf317b285cc246d2c5494501ef7dc..5fe907d240b50601182cac8741848f9a338a489e 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -2567,7 +2567,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
 				window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
-				if (window_imp->mCallbacks->handleOtherMouseDown(window_imp, gl_coord, mask, button))
+				// Windows uses numbers 1 and 2 for buttons, remap to 4, 5
+				if (window_imp->mCallbacks->handleOtherMouseDown(window_imp, gl_coord, mask, button + 3))
 				{
 					return 0;
 				}
@@ -2597,7 +2598,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
 				window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
-				if (window_imp->mCallbacks->handleOtherMouseUp(window_imp, gl_coord, mask, button))
+				// Windows uses numbers 1 and 2 for buttons, remap to 4, 5
+				if (window_imp->mCallbacks->handleOtherMouseUp(window_imp, gl_coord, mask, button + 3))
 				{
 					return 0;
 				}
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 5f74aaa5dd48528431725f1e46e29f4cc14ee4ed..27a597a631f6b3bffc250f6abbe9ace887e64466 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -217,7 +217,9 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask)
 BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
 {
     BOOL result = FALSE;
-    if (down && clicktype >= 3 && mask == 0)
+    if (down
+        && (clicktype == LLMouseHandler::CLICK_MIDDLE || clicktype == LLMouseHandler::CLICK_BUTTON4 || clicktype == LLMouseHandler::CLICK_BUTTON5)
+        && mask == 0)
     {
         mParent->setMouse(clicktype);
         result = TRUE;
@@ -1716,29 +1718,30 @@ void LLFloaterPreference::setKey(KEY key)
 
 void LLFloaterPreference::setMouse(LLMouseHandler::EClickType click)
 {
-    if (click >= LLMouseHandler::CLICK_MIDDLE)
+    std::string bt_name;
+    std::string ctrl_value;
+    switch (click)
+    {
+        case LLMouseHandler::CLICK_MIDDLE:
+            bt_name = "middle_mouse";
+            ctrl_value = MIDDLE_MOUSE_CV;
+            break;
+        case LLMouseHandler::CLICK_BUTTON4:
+            bt_name = "button4_mouse";
+            ctrl_value = MOUSE_BUTTON_4_CV;
+            break;
+        case LLMouseHandler::CLICK_BUTTON5:
+            bt_name = "button5_mouse";
+            ctrl_value = MOUSE_BUTTON_5_CV;
+            break;
+        default:
+            break;
+    }
+
+    if (!ctrl_value.empty())
     {
-        std::string bt_name;
-        std::string ctrl_value;
-        switch (click)
-        {
-            case LLMouseHandler::CLICK_MIDDLE:
-                bt_name = "middle_mouse";
-                ctrl_value = MIDDLE_MOUSE_CV;
-                break;
-            case LLMouseHandler::CLICK_BUTTON4:
-                bt_name = "button4_mouse";
-                ctrl_value = MOUSE_BUTTON_4_CV;
-                break;
-            case LLMouseHandler::CLICK_BUTTON5:
-                bt_name = "button5_mouse";
-                ctrl_value = MOUSE_BUTTON_5_CV;
-                break;
-            default:
-                break;
-        }
-        // We are using text names for readability
         LLUICtrl* p2t_line_editor = getChild<LLUICtrl>("modifier_combo");
+        // We are using text control names for readability and compatibility with voice
         p2t_line_editor->setControlValue(ctrl_value);
         LLPanel* advanced_preferences = dynamic_cast<LLPanel*>(p2t_line_editor->getParent());
         if (advanced_preferences)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 643a011ebcd3e12ff839df3c0a929b52e48ad1ed..9afe85a6f5983b3aac7d26cb9d32767d1fa680b5 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1288,11 +1288,11 @@ BOOL LLViewerWindow::handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask
 {
     switch (button)
     {
-    case 1:
+    case 4:
         LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON4, down);
         handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON4, down);
         break;
-    case 2:
+    case 5:
         LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON5, down);
         handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON5, down);
         break;