From 18b08f01058208799aeeb1ce5274fae03b5caa65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 4 Nov 2015 13:42:13 +0100 Subject: CompizShortcutModeller: add Alt+key_right_to_Tab and Up/Down arrows (bzr r3983.14.3) --- shortcuts/CompizShortcutModeller.cpp | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'shortcuts') diff --git a/shortcuts/CompizShortcutModeller.cpp b/shortcuts/CompizShortcutModeller.cpp index bc1f64fc9..8692e10ee 100644 --- a/shortcuts/CompizShortcutModeller.cpp +++ b/shortcuts/CompizShortcutModeller.cpp @@ -19,9 +19,12 @@ #include "config.h" #include +#include #include "CompizShortcutModeller.h" #include "ShortcutHint.h" +#include "ShortcutHintPrivate.h" #include "unity-shared/WindowManager.h" +#include "unity-shared/XKeyboardUtil.h" namespace unity { @@ -244,11 +247,12 @@ void CompizModeller::AddSwitcherHints(std::list &hi { static const std::string switching(_("Switching")); - hints.push_back(std::make_shared(switching, "", "", - _("Switches between applications."), - shortcut::OptionType::COMPIZ_KEY, - UNITYSHELL_PLUGIN_NAME, - UNITYSHELL_OPTION_ALT_TAB_FORWARD)); + auto switcher_init = std::make_shared(switching, "", "", + _("Switches between applications."), + shortcut::OptionType::COMPIZ_KEY, + UNITYSHELL_PLUGIN_NAME, + UNITYSHELL_OPTION_ALT_TAB_FORWARD); + hints.push_back(switcher_init); if (ws_enabled) { @@ -269,6 +273,27 @@ void CompizModeller::AddSwitcherHints(std::list &hi _("Moves the focus."), shortcut::OptionType::HARDCODED, _("Cursor Left or Right"))); + + hints.push_back(std::make_shared(switching, "", "", + _("Enter / Exit from spread mode or Select windows."), + shortcut::OptionType::HARDCODED, + _("Cursor Up or Down"))); + + if (const char* key = XKeysymToString(keyboard::get_key_right_to_key_symbol(screen->dpy(), XStringToKeysym("Tab")))) + { + std::string closekey = key; + switcher_init->Fill(); + auto const& switcher_init_key = switcher_init->shortkey(); + auto meta_separator = switcher_init_key.find("+"); + + if (meta_separator != std::string::npos) + closekey = switcher_init_key.substr(0, meta_separator-1) + " + " + closekey; + + hints.push_back(std::make_shared(switching, "", "", + _("Closes the selected application / window."), + shortcut::OptionType::HARDCODED, + impl::ProperCase(closekey))); + } } void CompizModeller::AddWorkspaceHints(std::list &hints) -- cgit v1.2.3 From a3c3932812a5b9eb4595e66601000d69aa0acdd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 4 Nov 2015 15:53:42 +0100 Subject: CompizShortcutModeller: get display from nux (bzr r3983.14.4) --- shortcuts/CompizShortcutModeller.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'shortcuts') diff --git a/shortcuts/CompizShortcutModeller.cpp b/shortcuts/CompizShortcutModeller.cpp index 8692e10ee..e611ae55f 100644 --- a/shortcuts/CompizShortcutModeller.cpp +++ b/shortcuts/CompizShortcutModeller.cpp @@ -19,7 +19,6 @@ #include "config.h" #include -#include #include "CompizShortcutModeller.h" #include "ShortcutHint.h" #include "ShortcutHintPrivate.h" @@ -279,20 +278,23 @@ void CompizModeller::AddSwitcherHints(std::list &hi shortcut::OptionType::HARDCODED, _("Cursor Up or Down"))); - if (const char* key = XKeysymToString(keyboard::get_key_right_to_key_symbol(screen->dpy(), XStringToKeysym("Tab")))) + if (Display *dpy = nux::GetGraphicsDisplay()->GetX11Display()) { - std::string closekey = key; - switcher_init->Fill(); - auto const& switcher_init_key = switcher_init->shortkey(); - auto meta_separator = switcher_init_key.find("+"); - - if (meta_separator != std::string::npos) - closekey = switcher_init_key.substr(0, meta_separator-1) + " + " + closekey; - - hints.push_back(std::make_shared(switching, "", "", - _("Closes the selected application / window."), - shortcut::OptionType::HARDCODED, - impl::ProperCase(closekey))); + if (const char* key = XKeysymToString(keyboard::get_key_right_to_key_symbol(dpy, XStringToKeysym("Tab")))) + { + std::string closekey = key; + switcher_init->Fill(); + auto const& switcher_init_key = switcher_init->shortkey(); + auto meta_separator = switcher_init_key.find("+"); + + if (meta_separator != std::string::npos) + closekey = switcher_init_key.substr(0, meta_separator-1) + " + " + closekey; + + hints.push_back(std::make_shared(switching, "", "", + _("Closes the selected application / window."), + shortcut::OptionType::HARDCODED, + impl::ProperCase(closekey))); + } } } -- cgit v1.2.3