summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-09-19 16:55:28 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-09-19 16:55:28 +0300
commitdcb1bea0f6086d963fba8b374d0294223bf66a11 (patch)
tree803b4f0bb74333edcf26d7f9669dfd30a7f117a9 /indra
parentfc238f6ca06b6fc71ed3bb7c3968f48406bb2c09 (diff)
SL-6109 Implement keybindings
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/CMakeLists.txt2
-rw-r--r--indra/llcommon/indra_constants.h10
-rw-r--r--indra/llcommon/llkeybind.cpp147
-rw-r--r--indra/llcommon/llkeybind.h70
-rw-r--r--indra/llwindow/llmousehandler.cpp2
-rw-r--r--indra/llwindow/llmousehandler.h12
-rw-r--r--indra/llxml/CMakeLists.txt1
-rw-r--r--indra/llxml/llcontrol.h2
-rw-r--r--indra/llxml/llcontrolgroupreader.h80
-rw-r--r--indra/newview/llfloaterpreference.cpp14
-rw-r--r--indra/newview/llfloaterpreference.h2
-rw-r--r--indra/newview/lltool.cpp2
-rw-r--r--indra/newview/lltool.h2
-rw-r--r--indra/newview/lltoolpie.cpp2
-rw-r--r--indra/newview/lltoolpie.h2
-rw-r--r--indra/newview/llviewerwindow.cpp39
-rw-r--r--indra/newview/llviewerwindow.h2
-rw-r--r--indra/newview/llvoiceclient.cpp8
-rw-r--r--indra/newview/llvoiceclient.h2
19 files changed, 268 insertions, 133 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index af41b9e460..7e52a620db 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -73,6 +73,7 @@ set(llcommon_SOURCE_FILES
llinitparam.cpp
llinitdestroyclass.cpp
llinstancetracker.cpp
+ llkeybind.cpp
llleap.cpp
llleaplistener.cpp
llliveappconfig.cpp
@@ -183,6 +184,7 @@ set(llcommon_HEADER_FILES
llinitdestroyclass.h
llinitparam.h
llinstancetracker.h
+ llkeybind.h
llkeythrottle.h
llleap.h
llleaplistener.h
diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h
index 0fbf4b966b..e763d413e5 100644
--- a/indra/llcommon/indra_constants.h
+++ b/indra/llcommon/indra_constants.h
@@ -54,6 +54,16 @@ enum ETerrainBrushType
E_LANDBRUSH_INVALID = 6
};
+enum EMouseClickType{
+ CLICK_NONE = -1,
+ CLICK_LEFT = 0,
+ CLICK_MIDDLE,
+ CLICK_RIGHT,
+ CLICK_BUTTON4,
+ CLICK_BUTTON5,
+ CLICK_DOUBLELEFT
+};
+
// keys
// Bit masks for various keyboard modifier keys.
const MASK MASK_NONE = 0x0000;
diff --git a/indra/llcommon/llkeybind.cpp b/indra/llcommon/llkeybind.cpp
new file mode 100644
index 0000000000..f227c0a1a5
--- /dev/null
+++ b/indra/llcommon/llkeybind.cpp
@@ -0,0 +1,147 @@
+/**
+ * @file llkeybind.cpp
+ * @brief Information about key combinations.
+ *
+ * $LicenseInfo:firstyear=2019&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2019, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "llkeybind.h"
+
+#include "llsd.h"
+#include "llsdutil.h"
+
+LLKeyData::LLKeyData()
+ : mMouse(CLICK_NONE), mKey(KEY_NONE), mMask(MASK_NONE)
+{
+}
+
+LLKeyData::LLKeyData(const LLSD &key_data)
+{
+ mMouse = (EMouseClickType)key_data["mouse"].asInteger();
+ mKey = key_data["key"].asInteger();
+ mMask = key_data["mask"].asInteger();
+}
+
+LLSD LLKeyData::asLLSD() const
+{
+ LLSD data;
+ data["mouse"] = (LLSD::Integer)mMouse;
+ data["key"] = (LLSD::Integer)mKey;
+ data["mask"] = (LLSD::Integer)mMask;
+ return data;
+}
+
+bool LLKeyData::isEmpty() const
+{
+ return mMouse == CLICK_NONE && mKey == KEY_NONE && mMask == MASK_NONE;
+}
+
+void LLKeyData::reset()
+{
+ mMouse = CLICK_NONE;
+ mKey = KEY_NONE;
+ mMask = MASK_NONE;
+}
+
+LLKeyData& LLKeyData::operator=(const LLKeyData& rhs)
+{
+ mMouse = rhs.mMouse;
+ mKey = rhs.mKey;
+ mMask = rhs.mMask;
+ return *this;
+}
+
+// LLKeyBind
+
+LLKeyBind::LLKeyBind(const LLSD &key_bind)
+{
+ if (key_bind.has("DataPrimary"))
+ {
+ mDataPrimary = LLKeyData(key_bind["DataPrimary"]);
+ }
+ if (key_bind.has("DataSecondary"))
+ {
+ mDataSecondary = LLKeyData(key_bind["DataSecondary"]);
+ }
+}
+
+bool LLKeyBind::operator==(const LLKeyBind& rhs)
+{
+ if (mDataPrimary.mMouse != rhs.mDataPrimary.mMouse) return false;
+ if (mDataPrimary.mKey != rhs.mDataPrimary.mKey) return false;
+ if (mDataPrimary.mMask != rhs.mDataPrimary.mMask) return false;
+ if (mDataSecondary.mMouse != rhs.mDataSecondary.mMouse) return false;
+ if (mDataSecondary.mKey != rhs.mDataSecondary.mKey) return false;
+ if (mDataSecondary.mMask != rhs.mDataSecondary.mMask) return false;
+ return true;
+}
+
+bool LLKeyBind::empty()
+{
+ if (mDataPrimary.mMouse != CLICK_NONE) return false;
+ if (mDataPrimary.mKey != KEY_NONE) return false;
+ if (mDataPrimary.mMask != MASK_NONE) return false;
+ if (mDataSecondary.mMouse != CLICK_NONE) return false;
+ if (mDataSecondary.mKey != KEY_NONE) return false;
+ if (mDataSecondary.mMask != MASK_NONE) return false;
+ return false;
+}
+
+LLSD LLKeyBind::asLLSD() const
+{
+ LLSD data;
+ if (!mDataPrimary.isEmpty())
+ {
+ data["DataPrimary"] = mDataPrimary.asLLSD();
+ }
+ if (!mDataSecondary.isEmpty())
+ {
+ data["DataSecondary"] = mDataSecondary.asLLSD();
+ }
+ return data;
+}
+
+bool LLKeyBind::canHandle(EMouseClickType mouse, KEY key, MASK mask) const
+{
+ if (mDataPrimary.mKey == key && mDataPrimary.mMask == mask && mDataPrimary.mMouse == mouse)
+ {
+ return true;
+ }
+ if (mDataSecondary.mKey == key && mDataSecondary.mMask == mask && mDataSecondary.mMouse == mouse)
+ {
+ return true;
+ }
+ return false;
+}
+
+bool LLKeyBind::canHandleKey(KEY key, MASK mask) const
+{
+ return canHandle(CLICK_NONE, key, mask);
+}
+
+bool LLKeyBind::canHandleMouse(EMouseClickType mouse, MASK mask) const
+{
+ return canHandle(mouse, KEY_NONE, mask);
+}
+
diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h
new file mode 100644
index 0000000000..4fe622fb79
--- /dev/null
+++ b/indra/llcommon/llkeybind.h
@@ -0,0 +1,70 @@
+/**
+ * @file llkeybind.h
+ * @brief Information about key combinations.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_KEYBIND_H
+#define LL_KEYBIND_H
+
+#include "indra_constants.h"
+
+// KeyData - single key combination (mouse/mask/keyboard)
+class LL_COMMON_API LLKeyData
+{
+public:
+ LLKeyData();
+ LLKeyData(const LLSD &key_data);
+
+ LLSD asLLSD() const;
+ bool isEmpty() const;
+ void reset();
+ LLKeyData& operator=(const LLKeyData& rhs);
+
+ EMouseClickType mMouse;
+ KEY mKey;
+ MASK mMask;
+};
+
+// One function can bind to multiple Key options
+class LLKeyBind
+{
+public:
+ LLKeyBind() {}
+ LLKeyBind(const LLSD &key_bind);
+
+ bool operator==(const LLKeyBind& rhs);
+ bool empty();
+
+ LLSD asLLSD() const;
+
+ bool canHandle(EMouseClickType mouse, KEY key, MASK mask) const;
+ bool canHandleKey(KEY key, MASK mask) const;
+ bool canHandleMouse(EMouseClickType mouse, MASK mask) const;
+
+ LLKeyData mDataPrimary;
+ LLKeyData mDataSecondary;
+};
+
+
+#endif // LL_KEYBIND_H
diff --git a/indra/llwindow/llmousehandler.cpp b/indra/llwindow/llmousehandler.cpp
index d5fa65fe4b..e41ebd42f3 100644
--- a/indra/llwindow/llmousehandler.cpp
+++ b/indra/llwindow/llmousehandler.cpp
@@ -27,7 +27,7 @@
#include "llmousehandler.h"
//virtual
-BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down)
+BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down)
{
BOOL handled = FALSE;
if (down)
diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h
index 1dcd0348d8..d221dd117c 100644
--- a/indra/llwindow/llmousehandler.h
+++ b/indra/llwindow/llmousehandler.h
@@ -29,6 +29,7 @@
#include "linden_common.h"
#include "llrect.h"
+#include "indra_constants.h"
// Mostly-abstract interface.
// Intended for use via multiple inheritance.
@@ -46,16 +47,7 @@ public:
SHOW_ALWAYS,
} EShowToolTip;
- typedef enum {
- CLICK_LEFT,
- CLICK_MIDDLE,
- CLICK_RIGHT,
- CLICK_BUTTON4,
- CLICK_BUTTON5,
- CLICK_DOUBLELEFT
- } EClickType;
-
- virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down);
+ virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0;
virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0;
diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt
index 17400a203e..013a422d35 100644
--- a/indra/llxml/CMakeLists.txt
+++ b/indra/llxml/CMakeLists.txt
@@ -28,7 +28,6 @@ set(llxml_HEADER_FILES
CMakeLists.txt
llcontrol.h
- llcontrolgroupreader.h
llxmlnode.h
llxmlparser.h
llxmltree.h
diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h
index de0d366492..9312bbc91a 100644
--- a/indra/llxml/llcontrol.h
+++ b/indra/llxml/llcontrol.h
@@ -34,8 +34,6 @@
#include "llrefcount.h"
#include "llinstancetracker.h"
-#include "llcontrolgroupreader.h"
-
#include <vector>
// *NOTE: boost::visit_each<> generates warning 4675 on .net 2003
diff --git a/indra/llxml/llcontrolgroupreader.h b/indra/llxml/llcontrolgroupreader.h
deleted file mode 100644
index 6a27a65499..0000000000
--- a/indra/llxml/llcontrolgroupreader.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * @file llcontrolgroupreader.h
- * @brief Interface providing readonly access to LLControlGroup (intended for unit testing)
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLCONTROLGROUPREADER_H
-#define LL_LLCONTROLGROUPREADER_H
-
-#include "stdtypes.h"
-#include <string>
-
-#include "v3math.h"
-#include "v3dmath.h"
-#include "v3color.h"
-#include "v4color.h"
-#include "llrect.h"
-
-class LLControlGroupReader
-{
-public:
- LLControlGroupReader() {}
- virtual ~LLControlGroupReader() {}
-
- virtual std::string getString(const std::string& name) { return ""; }
- virtual LLWString getWString(const std::string& name) { return LLWString(); }
- virtual std::string getText(const std::string& name) { return ""; }
- virtual LLVector3 getVector3(const std::string& name) { return LLVector3(); }
- virtual LLVector3d getVector3d(const std::string& name) { return LLVector3d(); }
- virtual LLRect getRect(const std::string& name) { return LLRect(); }
- virtual BOOL getBOOL(const std::string& name) { return FALSE; }
- virtual S32 getS32(const std::string& name) { return 0; }
- virtual F32 getF32(const std::string& name) {return 0.0f; }
- virtual U32 getU32(const std::string& name) {return 0; }
- virtual LLSD getLLSD(const std::string& name) { return LLSD(); }
-
- virtual LLColor4 getColor(const std::string& name) { return LLColor4(); }
- virtual LLColor4 getColor4(const std::string& name) { return LLColor4(); }
- virtual LLColor3 getColor3(const std::string& name) { return LLColor3(); }
-
- virtual void setBOOL(const std::string& name, BOOL val) {}
- virtual void setS32(const std::string& name, S32 val) {}
- virtual void setF32(const std::string& name, F32 val) {}
- virtual void setU32(const std::string& name, U32 val) {}
- virtual void setString(const std::string& name, const std::string& val) {}
- virtual void setVector3(const std::string& name, const LLVector3 &val) {}
- virtual void setVector3d(const std::string& name, const LLVector3d &val) {}
- virtual void setRect(const std::string& name, const LLRect &val) {}
- virtual void setColor4(const std::string& name, const LLColor4 &val) {}
- virtual void setLLSD(const std::string& name, const LLSD& val) {}
-};
-
-#endif /* LL_LLCONTROLGROUPREADER_H */
-
-
-
-
-
-
-
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index b48495b5b2..9282196b86 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -170,7 +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);
+ BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down);
static void onCancel(void* user_data);
private:
@@ -214,11 +214,11 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask)
return result;
}
-BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
+BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down)
{
BOOL result = FALSE;
if (down
- && (clicktype == LLMouseHandler::CLICK_MIDDLE || clicktype == LLMouseHandler::CLICK_BUTTON4 || clicktype == LLMouseHandler::CLICK_BUTTON5)
+ && (clicktype == CLICK_MIDDLE || clicktype == CLICK_BUTTON4 || clicktype == CLICK_BUTTON5)
&& mask == 0)
{
mParent->setMouse(clicktype);
@@ -1717,21 +1717,21 @@ void LLFloaterPreference::setKey(KEY key)
getChild<LLUICtrl>("modifier_combo")->onCommit();
}
-void LLFloaterPreference::setMouse(LLMouseHandler::EClickType click)
+void LLFloaterPreference::setMouse(EMouseClickType click)
{
std::string bt_name;
std::string ctrl_value;
switch (click)
{
- case LLMouseHandler::CLICK_MIDDLE:
+ case CLICK_MIDDLE:
bt_name = "middle_mouse";
ctrl_value = MIDDLE_MOUSE_CV;
break;
- case LLMouseHandler::CLICK_BUTTON4:
+ case CLICK_BUTTON4:
bt_name = "button4_mouse";
ctrl_value = MOUSE_BUTTON_4_CV;
break;
- case LLMouseHandler::CLICK_BUTTON5:
+ case CLICK_BUTTON5:
bt_name = "button5_mouse";
ctrl_value = MOUSE_BUTTON_5_CV;
break;
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 4412c95473..9190ef8ebd 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -148,7 +148,7 @@ public:
void onSelectSkin();
void onClickSetKey();
void setKey(KEY key);
- void setMouse(LLMouseHandler::EClickType click);
+ void setMouse(EMouseClickType click);
void onClickSetMiddleMouse();
void onClickSetSounds();
void onClickEnablePopup();
diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp
index c5e31ff8e6..0038138078 100644
--- a/indra/newview/lltool.cpp
+++ b/indra/newview/lltool.cpp
@@ -60,7 +60,7 @@ LLTool::~LLTool()
}
}
-BOOL LLTool::handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
+BOOL LLTool::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down)
{
BOOL result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down);
diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h
index 308983afda..41a38804ce 100644
--- a/indra/newview/lltool.h
+++ b/indra/newview/lltool.h
@@ -49,7 +49,7 @@ public:
virtual BOOL isView() const { return FALSE; }
// Virtual functions inherited from LLMouseHandler
- virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
+ virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 6c1ae7159b..0b569b4fe8 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -91,7 +91,7 @@ LLToolPie::LLToolPie()
{
}
-BOOL LLToolPie::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down)
+BOOL LLToolPie::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down)
{
BOOL result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down);
diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h
index fe0acfe473..6d0e25eaeb 100644
--- a/indra/newview/lltoolpie.h
+++ b/indra/newview/lltoolpie.h
@@ -42,7 +42,7 @@ class LLToolPie : public LLTool, public LLSingleton<LLToolPie>
public:
// Virtual functions inherited from LLMouseHandler
- virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down);
+ virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 1e2b2c37d0..2c58295814 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -898,7 +898,7 @@ LLViewerWindow::Params::Params()
{}
-BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
+BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down)
{
const char* buttonname = "";
const char* buttonstatestr = "";
@@ -907,6 +907,8 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK
x = ll_round((F32)x / mDisplayScale.mV[VX]);
y = ll_round((F32)y / mDisplayScale.mV[VY]);
+ LLVoiceClient::getInstance()->updateMouseState(clicktype, mask, down);
+
// only send mouse clicks to UI if UI is visible
if(gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
{
@@ -922,26 +924,26 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK
switch (clicktype)
{
- case LLMouseHandler::CLICK_LEFT:
+ case CLICK_LEFT:
mLeftMouseDown = down;
buttonname = "Left";
break;
- case LLMouseHandler::CLICK_RIGHT:
+ case CLICK_RIGHT:
mRightMouseDown = down;
buttonname = "Right";
break;
- case LLMouseHandler::CLICK_MIDDLE:
+ case CLICK_MIDDLE:
mMiddleMouseDown = down;
buttonname = "Middle";
break;
- case LLMouseHandler::CLICK_DOUBLELEFT:
+ case CLICK_DOUBLELEFT:
mLeftMouseDown = down;
buttonname = "Left Double Click";
break;
- case LLMouseHandler::CLICK_BUTTON4:
+ case CLICK_BUTTON4:
buttonname = "Button 4";
break;
- case LLMouseHandler::CLICK_BUTTON5:
+ case CLICK_BUTTON5:
buttonname = "Button 5";
break;
}
@@ -1059,7 +1061,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
mMouseDownTimer.reset();
}
BOOL down = TRUE;
- return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down);
+ return handleAnyMouseClick(window, pos, mask, CLICK_LEFT, down);
}
BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask)
@@ -1067,8 +1069,7 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma
// try handling as a double-click first, then a single-click if that
// wasn't handled.
BOOL down = TRUE;
- if (handleAnyMouseClick(window, pos, mask,
- LLMouseHandler::CLICK_DOUBLELEFT, down))
+ if (handleAnyMouseClick(window, pos, mask, CLICK_DOUBLELEFT, down))
{
return TRUE;
}
@@ -1082,7 +1083,7 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
mMouseDownTimer.stop();
}
BOOL down = FALSE;
- return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down);
+ return handleAnyMouseClick(window, pos, mask, CLICK_LEFT, down);
}
@@ -1094,7 +1095,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
y = ll_round((F32)y / mDisplayScale.mV[VY]);
BOOL down = TRUE;
- BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down);
+ BOOL handle = handleAnyMouseClick(window, pos, mask, CLICK_RIGHT, down);
if (handle)
return handle;
@@ -1115,14 +1116,13 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = FALSE;
- return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down);
+ return handleAnyMouseClick(window, pos, mask, CLICK_RIGHT, down);
}
BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = TRUE;
- LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_MIDDLE, true);
- handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
+ handleAnyMouseClick(window, pos, mask, CLICK_MIDDLE, down);
// Always handled as far as the OS is concerned.
return TRUE;
@@ -1277,8 +1277,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = FALSE;
- LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_MIDDLE, false);
- handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
+ handleAnyMouseClick(window, pos, mask, CLICK_MIDDLE, down);
// Always handled as far as the OS is concerned.
return TRUE;
@@ -1289,12 +1288,10 @@ BOOL LLViewerWindow::handleOtherMouse(LLWindow *window, LLCoordGL pos, MASK mask
switch (button)
{
case 4:
- LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON4, down);
- handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON4, down);
+ handleAnyMouseClick(window, pos, mask, CLICK_BUTTON4, down);
break;
case 5:
- LLVoiceClient::getInstance()->updateMouseState(LLMouseHandler::CLICK_BUTTON5, down);
- handleAnyMouseClick(window, pos, mask, LLMouseHandler::CLICK_BUTTON5, down);
+ handleAnyMouseClick(window, pos, mask, CLICK_BUTTON5, down);
break;
default:
break;
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 385bbd57e5..5f03685cee 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -176,7 +176,7 @@ public:
void setUIVisibility(bool);
bool getUIVisibility();
- BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
+ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, EMouseClickType clicktype, BOOL down);
//
// LLWindowCallback interface implementation
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index bce399a940..e7a8a78c14 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -641,15 +641,15 @@ void LLVoiceClient::setPTTKey(std::string &key)
// Value is stored as text for readability
if(key == "MiddleMouse")
{
- mPTTMouseButton = LLMouseHandler::CLICK_MIDDLE;
+ mPTTMouseButton = CLICK_MIDDLE;
}
else if(key == "MouseButton4")
{
- mPTTMouseButton = LLMouseHandler::CLICK_BUTTON4;
+ mPTTMouseButton = CLICK_BUTTON4;
}
else if (key == "MouseButton5")
{
- mPTTMouseButton = LLMouseHandler::CLICK_BUTTON5;
+ mPTTMouseButton = CLICK_BUTTON5;
}
else
{
@@ -711,7 +711,7 @@ void LLVoiceClient::keyUp(KEY key, MASK mask)
}
}
}
-void LLVoiceClient::updateMouseState(S32 click, bool down)
+void LLVoiceClient::updateMouseState(S32 click, MASK mask, bool down)
{
if(mPTTMouseButton == click && LLAgent::isActionAllowed("speak"))
{
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index fbc85fd977..e3285b0c9b 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -418,7 +418,7 @@ public:
// PTT key triggering
void keyDown(KEY key, MASK mask);
void keyUp(KEY key, MASK mask);
- void updateMouseState(S32 click, bool down);
+ void updateMouseState(S32 click, MASK mask, bool down);
boost::signals2::connection MicroChangedCallback(const micro_changed_signal_t::slot_type& cb ) { return mMicroChangedSignal.connect(cb); }