Merge lp:~3v1n0/unity/switcher-alt+key-right-to-tab into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4041
Proposed branch: lp:~3v1n0/unity/switcher-alt+key-right-to-tab
Merge into: lp:unity
Prerequisite: lp:~3v1n0/unity/near-tab-key-support
Diff against target: 133 lines (+46/-9)
4 files modified
launcher/SwitcherView.cpp (+13/-3)
launcher/SwitcherView.h (+1/-0)
shortcuts/CompizShortcutModeller.cpp (+32/-5)
unity-shared/XKeyboardUtil.h (+0/-1)
To merge this branch: bzr merge lp:~3v1n0/unity/switcher-alt+key-right-to-tab
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+276440@code.launchpad.net

Commit message

SwitcherView: Add support to Alt+Key-right-to-tab to close the selected app/window

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1

Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/SwitcherView.cpp'
2--- launcher/SwitcherView.cpp 2015-11-04 14:53:55 +0000
3+++ launcher/SwitcherView.cpp 2015-11-04 14:53:55 +0000
4@@ -24,6 +24,7 @@
5 #include "unity-shared/IconRenderer.h"
6 #include "unity-shared/TimeUtil.h"
7 #include "unity-shared/UScreen.h"
8+#include "unity-shared/XKeyboardUtil.h"
9
10 #include <Nux/Nux.h>
11
12@@ -72,6 +73,7 @@
13 , last_detail_icon_selected_(-1)
14 , last_mouse_scroll_time_(0)
15 , check_mouse_first_time_(true)
16+ , key_right_to_tab_(NUX_VK_q)
17 {
18 icon_renderer_->pip_style = OVER_TILE;
19 icon_renderer_->monitor = monitors::MAX;
20@@ -105,6 +107,14 @@
21 return geo;
22 });
23
24+ if (Display* dpy = nux::GetGraphicsDisplay()->GetX11Display())
25+ {
26+ KeySym sym = keyboard::get_key_right_to_key_symbol(dpy, XStringToKeysym("Tab"));
27+
28+ if (sym != NoSymbol)
29+ key_right_to_tab_ = sym;
30+ }
31+
32 animation_.updated.connect(sigc::hide(sigc::mem_fun(this, &SwitcherView::PreLayoutManagement)));
33 }
34
35@@ -500,9 +510,9 @@
36 case NUX_VK_DOWN:
37 switcher_start_detail.emit();
38 break;
39- case NUX_VK_q:
40- switcher_close_current.emit();
41- break;
42+ default:
43+ if (keysym == key_right_to_tab_)
44+ switcher_close_current.emit();
45 }
46 }
47
48
49=== modified file 'launcher/SwitcherView.h'
50--- launcher/SwitcherView.h 2015-11-04 14:53:55 +0000
51+++ launcher/SwitcherView.h 2015-11-04 14:53:55 +0000
52@@ -160,6 +160,7 @@
53 int last_detail_icon_selected_;
54 uint64_t last_mouse_scroll_time_;
55 bool check_mouse_first_time_;
56+ KeySym key_right_to_tab_;
57
58 DeltaTracker delta_tracker_;
59
60
61=== modified file 'shortcuts/CompizShortcutModeller.cpp'
62--- shortcuts/CompizShortcutModeller.cpp 2014-09-10 17:19:16 +0000
63+++ shortcuts/CompizShortcutModeller.cpp 2015-11-04 14:53:55 +0000
64@@ -21,7 +21,9 @@
65 #include <glib/gi18n-lib.h>
66 #include "CompizShortcutModeller.h"
67 #include "ShortcutHint.h"
68+#include "ShortcutHintPrivate.h"
69 #include "unity-shared/WindowManager.h"
70+#include "unity-shared/XKeyboardUtil.h"
71
72 namespace unity
73 {
74@@ -244,11 +246,12 @@
75 {
76 static const std::string switching(_("Switching"));
77
78- hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
79- _("Switches between applications."),
80- shortcut::OptionType::COMPIZ_KEY,
81- UNITYSHELL_PLUGIN_NAME,
82- UNITYSHELL_OPTION_ALT_TAB_FORWARD));
83+ auto switcher_init = std::make_shared<shortcut::Hint>(switching, "", "",
84+ _("Switches between applications."),
85+ shortcut::OptionType::COMPIZ_KEY,
86+ UNITYSHELL_PLUGIN_NAME,
87+ UNITYSHELL_OPTION_ALT_TAB_FORWARD);
88+ hints.push_back(switcher_init);
89
90 if (ws_enabled)
91 {
92@@ -269,6 +272,30 @@
93 _("Moves the focus."),
94 shortcut::OptionType::HARDCODED,
95 _("Cursor Left or Right")));
96+
97+ hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
98+ _("Enter / Exit from spread mode or Select windows."),
99+ shortcut::OptionType::HARDCODED,
100+ _("Cursor Up or Down")));
101+
102+ if (Display *dpy = nux::GetGraphicsDisplay()->GetX11Display())
103+ {
104+ if (const char* key = XKeysymToString(keyboard::get_key_right_to_key_symbol(dpy, XStringToKeysym("Tab"))))
105+ {
106+ std::string closekey = key;
107+ switcher_init->Fill();
108+ auto const& switcher_init_key = switcher_init->shortkey();
109+ auto meta_separator = switcher_init_key.find("+");
110+
111+ if (meta_separator != std::string::npos)
112+ closekey = switcher_init_key.substr(0, meta_separator-1) + " + " + closekey;
113+
114+ hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
115+ _("Closes the selected application / window."),
116+ shortcut::OptionType::HARDCODED,
117+ impl::ProperCase(closekey)));
118+ }
119+ }
120 }
121
122 void CompizModeller::AddWorkspaceHints(std::list<shortcut::AbstractHint::Ptr> &hints)
123
124=== modified file 'unity-shared/XKeyboardUtil.h'
125--- unity-shared/XKeyboardUtil.h 2015-11-04 14:53:55 +0000
126+++ unity-shared/XKeyboardUtil.h 2015-11-04 14:53:55 +0000
127@@ -32,7 +32,6 @@
128 KeySym get_key_right_to_key_symbol(Display* display, KeySym key_symbol);
129 KeySym get_key_left_to_key_symbol(Display* display, KeySym key_symbol);
130
131-
132 }
133 }
134