Merge lp:~mc-return/unity/unity.merge.fix-hardcoded-keys-part1 into lp:unity

Proposed by MC Return on 2012-08-28
Status: Merged
Approved by: Sebastien Bacher on 2012-09-05
Approved revision: 2637
Merged at revision: 2664
Proposed branch: lp:~mc-return/unity/unity.merge.fix-hardcoded-keys-part1
Merge into: lp:unity
Diff against target: 350 lines (+113/-66)
2 files modified
plugins/unityshell/src/unityshell.cpp (+110/-62)
shortcuts/StandaloneShortcuts.cpp (+3/-4)
To merge this branch: bzr merge lp:~mc-return/unity/unity.merge.fix-hardcoded-keys-part1
Reviewer Review Type Date Requested Status
Sam Spilsbury (community) 2012-08-28 Approve on 2012-09-02
jenkins continuous-integration Pending
Review via email: mp+121545@code.launchpad.net

Commit Message

"Alt+Space" shortcut to reveal the window menu is not hardcoded, but a Compiz key option
" (Hold)" should also be translated
Made all Compiz plug-in names and all Compiz plug-in option names in unityshell.cpp static constants

Description of the Change

"Alt+Space" shortcut to reveal the window menu is not hardcoded, but a Compiz key option
" (Hold)" should also be translated
Makes all Compiz plug-in names and all Compiz plug-in option names in unityshell.cpp static constants

To post a comment you must log in.
Sam Spilsbury (smspillaz) wrote :

Hi,

8 - * that would make the unity-panel-service to go crazy (see bug #948522)
9 + * that would make the unity-panel-service go crazy (see bug #948522)

You probably don't need to keep that (it is a typographical error in a comment, but not really relevant here)

29 + "core",
30 + "window_menu_key"));

Can you make these two constants somewhere? eg

static const std::string COMPIZ_CORE_PLUGIN_NAME = "core";
static const std::string COMPIZ_CORE_OPTION_WINDOW_MENU_KEY = "window_menu_key";

And then use those constants?

Otherwise looks fine.

Sam Spilsbury (smspillaz) wrote :

LGTM +1

review: Approve
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/1184/console reported an error when processing this lp:~mc-return/unity/unity.merge.fix-hardcoded-keys-part1 branch.
Not merging it.

MC Return (mc-return) wrote :

/tmp/buildd/unity-6.4.0+bzr2656ubuntu0+775/tests/test_previews.cpp:266:1: fatal error: error writing to /tmp/ccjGLHBD.s: No space left on device
compilation terminated.

Jenkins failure :(

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/unityshell.cpp'
2--- plugins/unityshell/src/unityshell.cpp 2012-08-31 13:21:02 +0000
3+++ plugins/unityshell/src/unityshell.cpp 2012-09-02 10:06:20 +0000
4@@ -1889,7 +1889,7 @@
5 CompOption::Vector& options)
6 {
7 /* In order to avoid too many events when keeping the keybinding pressed,
8- * that would make the unity-panel-service to go crazy (see bug #948522)
9+ * that would make the unity-panel-service go crazy (see bug #948522)
10 * we need to filter them, just considering an event every 750 ms */
11 int event_time = options[7].value().i(); // XEvent time in millisec
12
13@@ -3218,78 +3218,124 @@
14 {
15 // TODO move category text into a vector...
16
17+ // Compiz' plug-in names
18+ static const std::string COMPIZ_CORE_PLUGIN_NAME = "core";
19+ static const std::string COMPIZ_EXPO_PLUGIN_NAME = "expo";
20+ static const std::string COMPIZ_GRID_PLUGIN_NAME = "grid";
21+ static const std::string COMPIZ_MOVE_PLUGIN_NAME = "move";
22+ static const std::string COMPIZ_RESIZE_PLUGIN_NAME = "resize";
23+ static const std::string COMPIZ_SCALE_PLUGIN_NAME = "scale";
24+ static const std::string COMPIZ_UNITYSHELL_PLUGIN_NAME = "unityshell";
25+ static const std::string COMPIZ_WALL_PLUGIN_NAME = "wall";
26+
27+ // Compiz Core Options
28+ static const std::string COMPIZ_CORE_OPTION_SHOW_DESKTOP_KEY = "show_desktop_key";
29+ static const std::string COMPIZ_CORE_OPTION_MAXIMIZE_WINDOW_KEY = "maximize_window_key";
30+ static const std::string COMPIZ_CORE_OPTION_UNMAXIMIZE_WINDOW_KEY = "unmaximize_window_key";
31+ static const std::string COMPIZ_CORE_OPTION_CLOSE_WINDOW_KEY = "close_window_key";
32+ static const std::string COMPIZ_CORE_OPTION_WINDOW_MENU_KEY = "window_menu_key";
33+
34+ // Compiz Expo Options
35+ static const std::string COMPIZ_EXPO_OPTION_EXPO_KEY = "expo_key";
36+
37+ // Compiz Grid Options
38+ static const std::string COMPIZ_GRID_OPTION_PUT_LEFT_KEY = "put_left_key";
39+
40+ // Compiz Move Options
41+ static const std::string COMPIZ_MOVE_OPTION_INITIATE_BUTTON = "initiate_button";
42+
43+ // Compiz Resize Options
44+ static const std::string COMPIZ_RESIZE_OPTION_INITIATE_BUTTON = "initiate_button";
45+
46+ // Compiz Scale Options
47+ static const std::string COMPIZ_SCALE_OPTION_INITIATE_ALL_KEY = "initiate_all_key";
48+
49+ // Compiz Unityshell Options
50+ static const std::string COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER = "show_launcher";
51+ static const std::string COMPIZ_UNITYSHELL_OPTION_KEYBOARD_FOCUS = "keyboard_focus";
52+ static const std::string COMPIZ_UNITYSHELL_OPTION_LAUNCHER_SWITCHER_FORWARD = "launcher_switcher_forward";
53+ static const std::string COMPIZ_UNITYSHELL_OPTION_SHOW_HUD = "show_hud";
54+ static const std::string COMPIZ_UNITYSHELL_OPTION_PANEL_FIRST_MENU = "panel_first_menu";
55+ static const std::string COMPIZ_UNITYSHELL_OPTION_ALT_TAB_FORWARD = "alt_tab_forward";
56+ static const std::string COMPIZ_UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW = "alt_tab_next_window";
57+
58+ // Compiz Wall Options
59+ static const std::string COMPIZ_WALL_OPTION_LEFT_KEY = "left_key";
60+ static const std::string COMPIZ_WALL_OPTION_LEFT_WINDOW_KEY = "left_window_key";
61+
62+
63 // Launcher...
64- std::string const launcher(_("Launcher"));
65+ static const std::string launcher(_("Launcher"));
66
67 hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", _(" (Hold)"),
68 _("Opens the Launcher, displays shortcuts."),
69 shortcut::COMPIZ_KEY_OPTION,
70- "unityshell",
71- "show_launcher" ));
72+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
73+ COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER));
74
75 hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", "",
76 _("Opens Launcher keyboard navigation mode."),
77 shortcut::COMPIZ_KEY_OPTION,
78- "unityshell",
79- "keyboard_focus"));
80+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
81+ COMPIZ_UNITYSHELL_OPTION_KEYBOARD_FOCUS));
82
83 hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", "",
84 _("Switches applications via the Launcher."),
85 shortcut::COMPIZ_KEY_OPTION,
86- "unityshell",
87- "launcher_switcher_forward"));
88+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
89+ COMPIZ_UNITYSHELL_OPTION_LAUNCHER_SWITCHER_FORWARD));
90
91 hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", _(" + 1 to 9"),
92 _("Same as clicking on a Launcher icon."),
93 shortcut::COMPIZ_KEY_OPTION,
94- "unityshell",
95- "show_launcher"));
96+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
97+ COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER));
98
99 hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", _(" + Shift + 1 to 9"),
100 _("Opens a new window in the app."),
101 shortcut::COMPIZ_KEY_OPTION,
102- "unityshell",
103- "show_launcher"));
104+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
105+ COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER));
106
107 hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", " + T",
108 _("Opens the Trash."),
109 shortcut::COMPIZ_KEY_OPTION,
110- "unityshell",
111- "show_launcher"));
112+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
113+ COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER));
114
115
116 // Dash...
117- std::string const dash( _("Dash"));
118+ static const std::string dash( _("Dash"));
119
120 hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", _(" (Tap)"),
121 _("Opens the Dash Home."),
122 shortcut::COMPIZ_KEY_OPTION,
123- "unityshell",
124- "show_launcher"));
125+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
126+ COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER));
127
128 hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + A",
129 _("Opens the Dash App Lens."),
130 shortcut::COMPIZ_KEY_OPTION,
131- "unityshell",
132- "show_launcher"));
133+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
134+ COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER));
135
136 hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + F",
137 _("Opens the Dash Files Lens."),
138 shortcut::COMPIZ_KEY_OPTION,
139- "unityshell",
140- "show_launcher"));
141+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
142+ COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER));
143
144 hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + M",
145 _("Opens the Dash Music Lens."),
146 shortcut::COMPIZ_KEY_OPTION,
147- "unityshell",
148- "show_launcher"));
149+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
150+ COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER));
151
152 hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + V",
153 _("Opens the Dash Video Lens."),
154 shortcut::COMPIZ_KEY_OPTION,
155- "unityshell",
156- "show_launcher"));
157+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
158+ COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER));
159
160 hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", "",
161 _("Switches between Lenses."),
162@@ -3307,15 +3353,15 @@
163 _("Enter")));
164
165 // Menu Bar
166- std::string const menubar(_("HUD & Menu Bar"));
167+ static const std::string menubar(_("HUD & Menu Bar"));
168
169 hints_.push_back(std::make_shared<shortcut::Hint>(menubar, "", _(" (Tap)"),
170 _("Opens the HUD."),
171 shortcut::COMPIZ_KEY_OPTION,
172- "unityshell",
173- "show_hud"));
174+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
175+ COMPIZ_UNITYSHELL_OPTION_SHOW_HUD));
176
177- hints_.push_back(std::make_shared<shortcut::Hint>(menubar, "", " (Hold)",
178+ hints_.push_back(std::make_shared<shortcut::Hint>(menubar, "", _(" (Hold)"),
179 _("Reveals the application menu."),
180 shortcut::HARDCODED_OPTION,
181 "Alt"));
182@@ -3323,8 +3369,8 @@
183 hints_.push_back(std::make_shared<shortcut::Hint>(menubar, "", "",
184 _("Opens the indicator menu."),
185 shortcut::COMPIZ_KEY_OPTION,
186- "unityshell",
187- "panel_first_menu"));
188+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
189+ COMPIZ_UNITYSHELL_OPTION_PANEL_FIRST_MENU));
190
191 hints_.push_back(std::make_shared<shortcut::Hint>(menubar, "", "",
192 _("Moves focus between indicators."),
193@@ -3332,19 +3378,19 @@
194 _("Cursor Left or Right")));
195
196 // Switching
197- std::string const switching(_("Switching"));
198+ static const std::string switching(_("Switching"));
199
200 hints_.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
201 _("Switches between applications."),
202 shortcut::COMPIZ_KEY_OPTION,
203- "unityshell",
204- "alt_tab_forward"));
205+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
206+ COMPIZ_UNITYSHELL_OPTION_ALT_TAB_FORWARD));
207
208 hints_.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
209 _("Switches windows of current applications."),
210 shortcut::COMPIZ_KEY_OPTION,
211- "unityshell",
212- "alt_tab_next_window"));
213+ COMPIZ_UNITYSHELL_PLUGIN_NAME,
214+ COMPIZ_UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW));
215
216 hints_.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
217 _("Moves the focus."),
218@@ -3352,69 +3398,71 @@
219 _("Cursor Left or Right")));
220
221 // Workspaces
222- std::string const workspaces(_("Workspaces"));
223+ static const std::string workspaces(_("Workspaces"));
224
225 hints_.push_back(std::make_shared<shortcut::Hint>(workspaces, "", "",
226 _("Switches between workspaces."),
227 shortcut::COMPIZ_KEY_OPTION,
228- "expo",
229- "expo_key"));
230+ COMPIZ_EXPO_PLUGIN_NAME,
231+ COMPIZ_EXPO_OPTION_EXPO_KEY));
232
233 hints_.push_back(std::make_shared<shortcut::Hint>(workspaces, "", _(" + Arrow Keys"),
234 _("Switches workspaces."),
235 shortcut::COMPIZ_METAKEY_OPTION,
236- "wall",
237- "left_key"));
238+ COMPIZ_WALL_PLUGIN_NAME,
239+ COMPIZ_WALL_OPTION_LEFT_KEY));
240
241 hints_.push_back(std::make_shared<shortcut::Hint>(workspaces, "", _(" + Arrow Keys"),
242 _("Moves focused window to another workspace."),
243 shortcut::COMPIZ_METAKEY_OPTION,
244- "wall",
245- "left_window_key"));
246+ COMPIZ_WALL_PLUGIN_NAME,
247+ COMPIZ_WALL_OPTION_LEFT_WINDOW_KEY));
248
249
250 // Windows
251- std::string const windows(_("Windows"));
252+ static const std::string windows(_("Windows"));
253+
254 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
255 _("Spreads all windows in the current workspace."),
256 shortcut::COMPIZ_KEY_OPTION,
257- "scale",
258- "initiate_all_key"));
259+ COMPIZ_SCALE_PLUGIN_NAME,
260+ COMPIZ_SCALE_OPTION_INITIATE_ALL_KEY));
261
262 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
263 _("Minimises all windows."),
264 shortcut::COMPIZ_KEY_OPTION,
265- "core",
266- "show_desktop_key"));
267+ COMPIZ_CORE_PLUGIN_NAME,
268+ COMPIZ_CORE_OPTION_SHOW_DESKTOP_KEY));
269
270 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
271 _("Maximises the current window."),
272 shortcut::COMPIZ_KEY_OPTION,
273- "core",
274- "maximize_window_key"));
275+ COMPIZ_CORE_PLUGIN_NAME,
276+ COMPIZ_CORE_OPTION_MAXIMIZE_WINDOW_KEY));
277
278 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
279 _("Restores or minimises the current window."),
280 shortcut::COMPIZ_KEY_OPTION,
281- "core",
282- "unmaximize_window_key"));
283+ COMPIZ_CORE_PLUGIN_NAME,
284+ COMPIZ_CORE_OPTION_UNMAXIMIZE_WINDOW_KEY));
285
286 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" or Right"),
287 _("Semi-maximise the current window."),
288 shortcut::COMPIZ_KEY_OPTION,
289- "grid",
290- "put_left_key"));
291+ COMPIZ_GRID_PLUGIN_NAME,
292+ COMPIZ_GRID_OPTION_PUT_LEFT_KEY));
293
294 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
295 _("Closes the current window."),
296 shortcut::COMPIZ_KEY_OPTION,
297- "core",
298- "close_window_key"));
299+ COMPIZ_CORE_PLUGIN_NAME,
300+ COMPIZ_CORE_OPTION_CLOSE_WINDOW_KEY));
301
302 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
303 _("Opens the window accessibility menu."),
304- shortcut::HARDCODED_OPTION,
305- _("Alt + Space")));
306+ shortcut::COMPIZ_KEY_OPTION,
307+ COMPIZ_CORE_PLUGIN_NAME,
308+ COMPIZ_CORE_OPTION_WINDOW_MENU_KEY));
309
310 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
311 _("Places the window in corresponding position."),
312@@ -3424,14 +3472,14 @@
313 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" Drag"),
314 _("Moves the window."),
315 shortcut::COMPIZ_MOUSE_OPTION,
316- "move",
317- "initiate_button"));
318+ COMPIZ_MOVE_PLUGIN_NAME,
319+ COMPIZ_MOVE_OPTION_INITIATE_BUTTON));
320
321 hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" Drag"),
322 _("Resizes the window."),
323 shortcut::COMPIZ_MOUSE_OPTION,
324- "resize",
325- "initiate_button"));
326+ COMPIZ_RESIZE_PLUGIN_NAME,
327+ COMPIZ_RESIZE_OPTION_INITIATE_BUTTON));
328 }
329
330 void UnityScreen::InitGesturesSupport()
331
332=== modified file 'shortcuts/StandaloneShortcuts.cpp'
333--- shortcuts/StandaloneShortcuts.cpp 2012-08-27 19:08:38 +0000
334+++ shortcuts/StandaloneShortcuts.cpp 2012-09-02 10:06:20 +0000
335@@ -205,12 +205,11 @@
336 "core",
337 "close_window_key")));
338
339-
340- // I don't know std::shared_ptr<shortcut::AbstractHint>(if it is really hardcoded, but I can't find where this option is stored.
341 hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "",
342 _("Opens the window accessibility menu."),
343- shortcut::HARDCODED_OPTION,
344- "Alt+Space")));
345+ shortcut::COMPIZ_KEY_OPTION,
346+ "core",
347+ "window_menu_key")));
348
349 hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "",
350 _("Places the window in corresponding position."),