From 9fe9028476bec5abe57e620fd0758ce70c07259b Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 2 Nov 2017 19:07:07 +0100 Subject: [PATCH] FIRE-21625: Add option to remap special shortcuts on Linux already in use by the operating system; based on a patch by Thickbrick Sleaford --- indra/llui/llmenugl.cpp | 10 ++++++++ indra/llui/llmenugl.h | 1 + indra/newview/app_settings/settings.xml | 11 +++++++++ indra/newview/llfloaterpreference.cpp | 8 ++++++- .../default/xui/de/panel_preferences_UI.xml | 1 + .../skins/default/xui/en/menu_viewer.xml | 24 ++++++++++++------- .../default/xui/en/panel_preferences_UI.xml | 10 ++++++++ 7 files changed, 56 insertions(+), 9 deletions(-) diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index a6f23cab5e..ec71f8ba69 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -127,6 +127,7 @@ static LLDefaultChildRegistry::Register register_menu_default("menu"); LLMenuItemGL::Params::Params() : shortcut("shortcut"), + shortcut_linux("shortcut_linux"), // Remap shortcuts on Linux jump_key("jump_key", KEY_NONE), use_mac_ctrl("use_mac_ctrl", false), allow_key_repeat("allow_key_repeat", false), @@ -171,6 +172,15 @@ LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) #endif // LL_DARWIN std::string shortcut = p.shortcut; +// Remap shortcuts on Linux +#ifdef LL_LINUX + static LLUICachedControl fsRemapLinuxShortcuts("FSRemapLinuxShortcuts", false); + if (fsRemapLinuxShortcuts && p.shortcut_linux.isProvided()) + { + shortcut = p.shortcut_linux; + } +#endif // LL_LINUX +// if (shortcut.find("control") != shortcut.npos) { #ifdef LL_DARWIN diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 3f35c3dd97..a0213dcda3 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -55,6 +55,7 @@ public: struct Params : public LLInitParam::Block { Optional shortcut; + Optional shortcut_linux; // Remap shortcuts on Linux Optional jump_key; Optional use_mac_ctrl, allow_key_repeat; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3fe426a907..12f4e89fb2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -24478,6 +24478,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 + FSRemapLinuxShortcuts + + Comment + If enabled, use the special shortcuts on Linux to remap shortcuts that are already in use by the operating system (e.g. CTRL-ALT-Fx) + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7445d944ea..a641ac8b43 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -793,13 +793,19 @@ BOOL LLFloaterPreference::postBuild() #endif // - // Disable options only available on Windows on other platforms + // Disable options only available on Windows and not on other platforms #ifndef LL_WINDOWS childSetEnabled("FSEnableAutomaticUIScaling", FALSE); childSetEnabled("FSDisableWMIProbing", FALSE); #endif // + // Disable options only available on Linux and not on other platforms +#ifndef LL_LINUX + childSetEnabled("FSRemapLinuxShortcuts", FALSE); +#endif + // + return TRUE; } diff --git a/indra/newview/skins/default/xui/de/panel_preferences_UI.xml b/indra/newview/skins/default/xui/de/panel_preferences_UI.xml index 23ccdcd55a..4dca3f0bf7 100644 --- a/indra/newview/skins/default/xui/de/panel_preferences_UI.xml +++ b/indra/newview/skins/default/xui/de/panel_preferences_UI.xml @@ -73,6 +73,7 @@ (Erfordert Neustart) + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 3792630864..6f990ce144 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2779,7 +2779,8 @@ + shortcut="control|alt|F1" + shortcut_linux="control|shift|F1"> @@ -2790,7 +2791,8 @@ + shortcut="control|alt|F2" + shortcut_linux="control|shift|F2"> @@ -2801,7 +2803,8 @@ + shortcut="control|alt|F3" + shortcut_linux="control|shift|F3"> @@ -2812,7 +2815,8 @@ + shortcut="control|alt|F4" + shortcut_linux="control|shift|F4"> @@ -2823,7 +2827,8 @@ + shortcut="control|alt|F5" + shortcut_linux="control|shift|F5"> @@ -2834,7 +2839,8 @@ + shortcut="control|alt|F6" + shortcut_linux="control|shift|F6"> @@ -2845,7 +2851,8 @@ + shortcut="control|alt|F8" + shortcut_linux="control|shift|F8"> @@ -2856,7 +2863,8 @@ + shortcut="control|alt|F9" + shortcut_linux="control|shift|F9"> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_UI.xml b/indra/newview/skins/default/xui/en/panel_preferences_UI.xml index 4c187e0b0a..9084b5fe13 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_UI.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_UI.xml @@ -498,6 +498,16 @@ name="FSLegacyNotificationWellRequiresRestart"> (requires restart) +