summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Productengine <adyukov@productengine.com>2010-11-18 23:09:05 +0200
committerAndrew Productengine <adyukov@productengine.com>2010-11-18 23:09:05 +0200
commitf0a0831954475a2f49fe7473046f0ba657fb2405 (patch)
tree238d00655cb7041e0012fbc72f049b22eb2bf0ed
parentd76e0dd87f64258ade944323eb5cb6063bca7444 (diff)
STORM-560 FIXED Implemented preference that allows users to select default behavior when pressing letter keys.
- Added check to LLViewerWindow::handleKey() that gives focus to nearby chat if "Pressing letter keys starts local chat" option is selected, key is not special (and no modifier key is held except Shift), camera is not in mouselook and no view currently has keyboard focus. - The choice of what should happen when letter keys are pressed is saved in new setting added in this fix- "LetterKeysFocusChatBar".
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llviewerwindow.cpp14
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_general.xml9
3 files changed, 30 insertions, 4 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 561456c9d6..51e3b4e7c8 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1365,6 +1365,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>LetterKeysFocusChatBar</key>
+ <map>
+ <key>Comment</key>
+ <string>When printable characters keys (possibly with Shift held) are pressed, the chatbar takes focus</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>ChatBubbleOpacity</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 743def4a0c..a7790243ed 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2266,6 +2266,20 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
return TRUE;
}
+ // If "Pressing letter keys starts local chat" option is selected, we are not in mouselook,
+ // no view has keyboard focus, this is a printable character key (and no modifier key is
+ // pressed except shift), then give focus to nearby chat (STORM-560)
+ if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() &&
+ !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) )
+ {
+ LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL;
+ if (chat_editor)
+ {
+ // passing NULL here, character will be added later when it is handled by character handler.
+ LLBottomTray::getInstance()->getNearbyChatBar()->startChat(NULL);
+ return TRUE;
+ }
+ }
// give menus a chance to handle unmodified accelerator keys
if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
index a660b5d785..36f8f99178 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
@@ -331,6 +331,7 @@
Pressing letter keys:
</text>
<radio_group
+ control_name="LetterKeysFocusChatBar"
height="20"
layout="topleft"
left="35"
@@ -338,12 +339,12 @@
name="inworld_typing_preference">
<radio_item
label="Starts local chat"
- name="radio_button1"
+ name="radio_start_chat"
top_delta="20"
layout="topleft"
height="16"
left="0"
- value="0"
+ value="1"
width="150" />
<radio_item
label="Affects movement (i.e. WASD)"
@@ -351,8 +352,8 @@
layout="topleft"
top_delta="0"
height="16"
- name="radio_button2"
- value="1"
+ name="radio_move"
+ value="0"
width="75" />
</radio_group>