SL-11592 [Win] Ability to bind extra mouse buttons for push to talk
parent
e9a9f71e56
commit
ba2429163a
|
|
@ -50,6 +50,8 @@ public:
|
|||
CLICK_LEFT,
|
||||
CLICK_MIDDLE,
|
||||
CLICK_RIGHT,
|
||||
CLICK_BUTTON4,
|
||||
CLICK_BUTTON5,
|
||||
CLICK_DOUBLELEFT
|
||||
} EClickType;
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,16 @@ BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL po
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleOtherMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleOtherMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated)
|
||||
{
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ public:
|
|||
virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
virtual BOOL handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button);
|
||||
virtual BOOL handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button);
|
||||
virtual BOOL handleActivate(LLWindow *window, BOOL activated);
|
||||
virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
|
||||
virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
|
|
|
|||
|
|
@ -2539,6 +2539,70 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
|||
}
|
||||
}
|
||||
break;
|
||||
case WM_XBUTTONDOWN:
|
||||
{
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONDOWN");
|
||||
LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
|
||||
S32 button = GET_XBUTTON_WPARAM(w_param);
|
||||
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
|
||||
{
|
||||
window_imp->interruptLanguageTextInput();
|
||||
}
|
||||
|
||||
// Because we move the cursor position in tllviewerhe app, we need to query
|
||||
// to find out where the cursor at the time the event is handled.
|
||||
// If we don't do this, many clicks could get buffered up, and if the
|
||||
// first click changes the cursor position, all subsequent clicks
|
||||
// will occur at the wrong location. JC
|
||||
if (window_imp->mMousePositionModified)
|
||||
{
|
||||
LLCoordWindow cursor_coord_window;
|
||||
window_imp->getCursorPosition(&cursor_coord_window);
|
||||
gl_coord = cursor_coord_window.convert();
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_coord = window_coord.convert();
|
||||
}
|
||||
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))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_XBUTTONUP:
|
||||
{
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONUP");
|
||||
LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
|
||||
S32 button = GET_XBUTTON_WPARAM(w_param);
|
||||
// Because we move the cursor position in the llviewer app, we need to query
|
||||
// to find out where the cursor at the time the event is handled.
|
||||
// If we don't do this, many clicks could get buffered up, and if the
|
||||
// first click changes the cursor position, all subsequent clicks
|
||||
// will occur at the wrong location. JC
|
||||
if (window_imp->mMousePositionModified)
|
||||
{
|
||||
LLCoordWindow cursor_coord_window;
|
||||
window_imp->getCursorPosition(&cursor_coord_window);
|
||||
gl_coord = cursor_coord_window.convert();
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_coord = window_coord.convert();
|
||||
}
|
||||
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))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -124,7 +124,9 @@ char const* const VISIBILITY_DEFAULT = "default";
|
|||
char const* const VISIBILITY_HIDDEN = "hidden";
|
||||
|
||||
//control value for middle mouse as talk2push button
|
||||
const static std::string MIDDLE_MOUSE_CV = "MiddleMouse";
|
||||
const static std::string MIDDLE_MOUSE_CV = "MiddleMouse"; // for voice client and redability
|
||||
const static std::string MOUSE_BUTTON_4_CV = "MouseButton4";
|
||||
const static std::string MOUSE_BUTTON_5_CV = "MouseButton5";
|
||||
|
||||
/// This must equal the maximum value set for the IndirectMaxComplexity slider in panel_preferences_graphics1.xml
|
||||
static const U32 INDIRECT_MAX_ARC_OFF = 101; // all the way to the right == disabled
|
||||
|
|
@ -168,6 +170,7 @@ public:
|
|||
void setParent(LLFloaterPreference* parent) { mParent = parent; }
|
||||
|
||||
BOOL handleKeyHere(KEY key, MASK mask);
|
||||
BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
|
||||
static void onCancel(void* user_data);
|
||||
|
||||
private:
|
||||
|
|
@ -211,6 +214,23 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask)
|
|||
return result;
|
||||
}
|
||||
|
||||
BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
if (down && clicktype >= 3 && mask == 0)
|
||||
{
|
||||
mParent->setMouse(clicktype);
|
||||
result = TRUE;
|
||||
closeFloater();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//static
|
||||
void LLVoiceSetKeyDialog::onCancel(void* user_data)
|
||||
{
|
||||
|
|
@ -1694,6 +1714,40 @@ void LLFloaterPreference::setKey(KEY key)
|
|||
getChild<LLUICtrl>("modifier_combo")->onCommit();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
// We are using text names for readability
|
||||
LLUICtrl* p2t_line_editor = getChild<LLUICtrl>("modifier_combo");
|
||||
p2t_line_editor->setControlValue(ctrl_value);
|
||||
LLPanel* advanced_preferences = dynamic_cast<LLPanel*>(p2t_line_editor->getParent());
|
||||
if (advanced_preferences)
|
||||
{
|
||||
p2t_line_editor->setValue(advanced_preferences->getString(bt_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterPreference::onClickSetMiddleMouse()
|
||||
{
|
||||
LLUICtrl* p2t_line_editor = getChild<LLUICtrl>("modifier_combo");
|
||||
|
|
@ -2431,10 +2485,19 @@ BOOL LLPanelPreference::postBuild()
|
|||
if (hasChild("modifier_combo", TRUE))
|
||||
{
|
||||
//localizing if push2talk button is set to middle mouse
|
||||
if (MIDDLE_MOUSE_CV == getChild<LLUICtrl>("modifier_combo")->getValue().asString())
|
||||
std::string modifier_value = getChild<LLUICtrl>("modifier_combo")->getValue().asString();
|
||||
if (MIDDLE_MOUSE_CV == modifier_value)
|
||||
{
|
||||
getChild<LLUICtrl>("modifier_combo")->setValue(getString("middle_mouse"));
|
||||
}
|
||||
else if (MOUSE_BUTTON_4_CV == modifier_value)
|
||||
{
|
||||
getChild<LLUICtrl>("modifier_combo")->setValue(getString("button4_mouse"));
|
||||
}
|
||||
else if (MOUSE_BUTTON_5_CV == modifier_value)
|
||||
{
|
||||
getChild<LLUICtrl>("modifier_combo")->setValue(getString("button5_mouse"));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////PanelSetup ///////////////////
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ public:
|
|||
void onSelectSkin();
|
||||
void onClickSetKey();
|
||||
void setKey(KEY key);
|
||||
void setMouse(LLMouseHandler::EClickType click);
|
||||
void onClickSetMiddleMouse();
|
||||
void onClickSetSounds();
|
||||
void onClickEnablePopup();
|
||||
|
|
|
|||
|
|
@ -938,6 +938,12 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK
|
|||
mLeftMouseDown = down;
|
||||
buttonname = "Left Double Click";
|
||||
break;
|
||||
case LLMouseHandler::CLICK_BUTTON4:
|
||||
buttonname = "Button 4";
|
||||
break;
|
||||
case LLMouseHandler::CLICK_BUTTON5:
|
||||
buttonname = "Button 5";
|
||||
break;
|
||||
}
|
||||
|
||||
LLView::sMouseHandlerMessage.clear();
|
||||
|
|
@ -1115,7 +1121,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
|
|||
BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||
{
|
||||
BOOL down = TRUE;
|
||||
LLVoiceClient::getInstance()->middleMouseState(true);
|
||||
LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_MIDDLE, true);
|
||||
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
|
||||
|
||||
// Always handled as far as the OS is concerned.
|
||||
|
|
@ -1267,17 +1273,47 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||
{
|
||||
BOOL down = FALSE;
|
||||
LLVoiceClient::getInstance()->middleMouseState(false);
|
||||
LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_MIDDLE, false);
|
||||
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
|
||||
|
||||
// Always handled as far as the OS is concerned.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLViewerWindow::handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down)
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
case 1:
|
||||
LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON4, down);
|
||||
handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON4, down);
|
||||
break;
|
||||
case 2:
|
||||
LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON5, down);
|
||||
handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON5, down);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Always handled as far as the OS is concerned.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLViewerWindow::handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button)
|
||||
{
|
||||
return handleOtherMouse(window, pos, mask, button, TRUE);
|
||||
}
|
||||
|
||||
BOOL LLViewerWindow::handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button)
|
||||
{
|
||||
return handleOtherMouse(window, pos, mask, button, FALSE);
|
||||
}
|
||||
|
||||
// WARNING: this is potentially called multiple times per frame
|
||||
void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -192,7 +192,10 @@ public:
|
|||
/*virtual*/ BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ BOOL handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button);
|
||||
/*virtual*/ BOOL handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button);
|
||||
BOOL handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask, S32 button, bool down);
|
||||
/*virtual*/ LLWindowCallbacks::DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data);
|
||||
void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
void handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ LLVoiceClient::LLVoiceClient()
|
|||
mPTTDirty(true),
|
||||
mPTT(true),
|
||||
mUsePTT(true),
|
||||
mPTTIsMiddleMouse(false),
|
||||
mPTTMouseButton(0),
|
||||
mPTTKey(0),
|
||||
mPTTIsToggle(false),
|
||||
mUserPTTState(false),
|
||||
|
|
@ -638,13 +638,22 @@ bool LLVoiceClient::getPTTIsToggle()
|
|||
|
||||
void LLVoiceClient::setPTTKey(std::string &key)
|
||||
{
|
||||
// Value is stored as text for readability
|
||||
if(key == "MiddleMouse")
|
||||
{
|
||||
mPTTIsMiddleMouse = true;
|
||||
mPTTMouseButton = LLMouseHandler::CLICK_MIDDLE;
|
||||
}
|
||||
else if(key == "MouseButton4")
|
||||
{
|
||||
mPTTMouseButton = LLMouseHandler::CLICK_BUTTON4;
|
||||
}
|
||||
else if (key == "MouseButton5")
|
||||
{
|
||||
mPTTMouseButton = LLMouseHandler::CLICK_BUTTON5;
|
||||
}
|
||||
else
|
||||
{
|
||||
mPTTIsMiddleMouse = false;
|
||||
mPTTMouseButton = 0;
|
||||
if(!LLKeyboard::keyFromString(key, &mPTTKey))
|
||||
{
|
||||
// If the call failed, don't match any key.
|
||||
|
|
@ -681,7 +690,7 @@ void LLVoiceClient::keyDown(KEY key, MASK mask)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!mPTTIsMiddleMouse && LLAgent::isActionAllowed("speak") && (key == mPTTKey))
|
||||
if (mPTTMouseButton == 0 && LLAgent::isActionAllowed("speak") && (key == mPTTKey))
|
||||
{
|
||||
bool down = gKeyboard->getKeyDown(mPTTKey);
|
||||
if (down)
|
||||
|
|
@ -693,7 +702,7 @@ void LLVoiceClient::keyDown(KEY key, MASK mask)
|
|||
}
|
||||
void LLVoiceClient::keyUp(KEY key, MASK mask)
|
||||
{
|
||||
if (!mPTTIsMiddleMouse && (key == mPTTKey))
|
||||
if (mPTTMouseButton == 0 && (key == mPTTKey))
|
||||
{
|
||||
bool down = gKeyboard->getKeyDown(mPTTKey);
|
||||
if (!down)
|
||||
|
|
@ -702,9 +711,9 @@ void LLVoiceClient::keyUp(KEY key, MASK mask)
|
|||
}
|
||||
}
|
||||
}
|
||||
void LLVoiceClient::middleMouseState(bool down)
|
||||
void LLVoiceClient::updateMouseState(S32 click, bool down)
|
||||
{
|
||||
if(mPTTIsMiddleMouse && LLAgent::isActionAllowed("speak"))
|
||||
if(mPTTMouseButton == click && LLAgent::isActionAllowed("speak"))
|
||||
{
|
||||
inputUserControlState(down);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,8 +418,8 @@ public:
|
|||
// PTT key triggering
|
||||
void keyDown(KEY key, MASK mask);
|
||||
void keyUp(KEY key, MASK mask);
|
||||
void middleMouseState(bool down);
|
||||
|
||||
void updateMouseState(S32 click, bool down);
|
||||
|
||||
boost::signals2::connection MicroChangedCallback(const micro_changed_signal_t::slot_type& cb ) { return mMicroChangedSignal.connect(cb); }
|
||||
|
||||
|
||||
|
|
@ -485,7 +485,7 @@ protected:
|
|||
bool mPTT;
|
||||
|
||||
bool mUsePTT;
|
||||
bool mPTTIsMiddleMouse;
|
||||
S32 mPTTMouseButton;
|
||||
KEY mPTTKey;
|
||||
bool mPTTIsToggle;
|
||||
bool mUserPTTState;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,14 @@
|
|||
name="middle_mouse">
|
||||
Middle Mouse
|
||||
</panel.string>
|
||||
<panel.string
|
||||
name="button4_mouse">
|
||||
Mouse Button 4
|
||||
</panel.string>
|
||||
<panel.string
|
||||
name="button5_mouse">
|
||||
Mouse Button 5
|
||||
</panel.string>
|
||||
<slider
|
||||
control_name="AudioLevelMaster"
|
||||
follows="left|top"
|
||||
|
|
|
|||
Loading…
Reference in New Issue