Merge lp:~3v1n0/unity/scale-shortcut-hint into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3698
Proposed branch: lp:~3v1n0/unity/scale-shortcut-hint
Merge into: lp:unity
Diff against target: 124 lines (+34/-13)
2 files modified
shortcuts/CompizShortcutModeller.cpp (+32/-11)
shortcuts/CompizShortcutModeller.h (+2/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/scale-shortcut-hint
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Christopher Townsend (community) Approve
Review via email: mp+209326@code.launchpad.net

Commit message

CompizShortcutModeller: use proper keys for Spread and be dependent on workspace setting

Description of the change

Add back Super+W shortcut, and include workspace-depending settings as well.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'shortcuts/CompizShortcutModeller.cpp'
--- shortcuts/CompizShortcutModeller.cpp 2013-12-04 19:42:43 +0000
+++ shortcuts/CompizShortcutModeller.cpp 2014-03-04 18:35:25 +0000
@@ -59,6 +59,7 @@
59 const std::string RESIZE_OPTION_INITIATE_BUTTON = "initiate_button";59 const std::string RESIZE_OPTION_INITIATE_BUTTON = "initiate_button";
6060
61 // Compiz Scale Options61 // Compiz Scale Options
62 const std::string SCALE_OPTION_INITIATE_KEY = "initiate_key";
62 const std::string SCALE_OPTION_INITIATE_ALL_KEY = "initiate_all_key";63 const std::string SCALE_OPTION_INITIATE_ALL_KEY = "initiate_all_key";
6364
64 // Compiz Unityshell Options65 // Compiz Unityshell Options
@@ -68,6 +69,7 @@
68 const std::string UNITYSHELL_OPTION_SHOW_HUD = "show_hud";69 const std::string UNITYSHELL_OPTION_SHOW_HUD = "show_hud";
69 const std::string UNITYSHELL_OPTION_PANEL_FIRST_MENU = "panel_first_menu";70 const std::string UNITYSHELL_OPTION_PANEL_FIRST_MENU = "panel_first_menu";
70 const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD = "alt_tab_forward";71 const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD = "alt_tab_forward";
72 const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD_ALL = "alt_tab_forward_all";
71 const std::string UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW = "alt_tab_next_window";73 const std::string UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW = "alt_tab_next_window";
7274
73 // Compiz Wall Options75 // Compiz Wall Options
@@ -90,27 +92,26 @@
90void CompizModeller::BuildModel(int hsize, int vsize)92void CompizModeller::BuildModel(int hsize, int vsize)
91{93{
92 std::list<shortcut::AbstractHint::Ptr> hints;94 std::list<shortcut::AbstractHint::Ptr> hints;
95 bool workspace_enabled = (hsize * vsize > 1);
9396
94 if (hsize * vsize > 1)97 if (workspace_enabled)
95 {98 {
96 // Workspaces enabled
97 AddLauncherHints(hints);99 AddLauncherHints(hints);
98 AddDashHints(hints);100 AddDashHints(hints);
99 AddMenuHints(hints);101 AddMenuHints(hints);
100 AddSwitcherHints(hints);102 AddSwitcherHints(hints, workspace_enabled);
101 AddWorkspaceHints(hints);103 AddWorkspaceHints(hints);
102 AddWindowsHints(hints);
103 }104 }
104 else105 else
105 {106 {
106 // Workspaces disabled
107 AddLauncherHints(hints);107 AddLauncherHints(hints);
108 AddMenuHints(hints);108 AddMenuHints(hints);
109 AddSwitcherHints(hints);109 AddSwitcherHints(hints, workspace_enabled);
110 AddDashHints(hints);110 AddDashHints(hints);
111 AddWindowsHints(hints);
112 }111 }
113112
113 AddWindowsHints(hints, workspace_enabled);
114
114 model_ = std::make_shared<shortcut::Model>(hints);115 model_ = std::make_shared<shortcut::Model>(hints);
115 model_changed.emit(model_);116 model_changed.emit(model_);
116}117}
@@ -239,7 +240,7 @@
239 _("Cursor Left or Right")));240 _("Cursor Left or Right")));
240}241}
241242
242void CompizModeller::AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hints)243void CompizModeller::AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hints, bool ws_enabled)
243{244{
244 static const std::string switching(_("Switching"));245 static const std::string switching(_("Switching"));
245246
@@ -249,6 +250,15 @@
249 UNITYSHELL_PLUGIN_NAME,250 UNITYSHELL_PLUGIN_NAME,
250 UNITYSHELL_OPTION_ALT_TAB_FORWARD));251 UNITYSHELL_OPTION_ALT_TAB_FORWARD));
251252
253 if (ws_enabled)
254 {
255 hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
256 _("Switches between applications from all workspaces."),
257 shortcut::OptionType::COMPIZ_KEY,
258 UNITYSHELL_PLUGIN_NAME,
259 UNITYSHELL_OPTION_ALT_TAB_FORWARD_ALL));
260 }
261
252 hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",262 hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
253 _("Switches windows of current applications."),263 _("Switches windows of current applications."),
254 shortcut::OptionType::COMPIZ_KEY,264 shortcut::OptionType::COMPIZ_KEY,
@@ -284,15 +294,26 @@
284 WALL_OPTION_LEFT_WINDOW_KEY));294 WALL_OPTION_LEFT_WINDOW_KEY));
285}295}
286296
287void CompizModeller::AddWindowsHints(std::list<shortcut::AbstractHint::Ptr> &hints)297void CompizModeller::AddWindowsHints(std::list<shortcut::AbstractHint::Ptr> &hints, bool ws_enabled)
288{298{
289 static const std::string windows(_("Windows"));299 static const std::string windows(_("Windows"));
290300
291 hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",301 hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
292 _("Spreads all windows in the current workspace."),302 (ws_enabled ?
303 _("Spreads all windows in the current workspace.") :
304 _("Spreads all windows.")),
293 shortcut::OptionType::COMPIZ_KEY,305 shortcut::OptionType::COMPIZ_KEY,
294 SCALE_PLUGIN_NAME,306 SCALE_PLUGIN_NAME,
295 SCALE_OPTION_INITIATE_ALL_KEY));307 SCALE_OPTION_INITIATE_KEY));
308
309 if (ws_enabled)
310 {
311 hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
312 _("Spreads all windows in all the workspaces."),
313 shortcut::OptionType::COMPIZ_KEY,
314 SCALE_PLUGIN_NAME,
315 SCALE_OPTION_INITIATE_ALL_KEY));
316 }
296317
297 hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",318 hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
298 _("Minimises all windows."),319 _("Minimises all windows."),
299320
=== modified file 'shortcuts/CompizShortcutModeller.h'
--- shortcuts/CompizShortcutModeller.h 2013-01-23 14:57:58 +0000
+++ shortcuts/CompizShortcutModeller.h 2014-03-04 18:35:25 +0000
@@ -39,9 +39,9 @@
39 void AddLauncherHints(std::list<shortcut::AbstractHint::Ptr> &hints);39 void AddLauncherHints(std::list<shortcut::AbstractHint::Ptr> &hints);
40 void AddDashHints(std::list<shortcut::AbstractHint::Ptr> &hints);40 void AddDashHints(std::list<shortcut::AbstractHint::Ptr> &hints);
41 void AddMenuHints(std::list<shortcut::AbstractHint::Ptr> &hints);41 void AddMenuHints(std::list<shortcut::AbstractHint::Ptr> &hints);
42 void AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hints);42 void AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hints, bool ws);
43 void AddWorkspaceHints(std::list<shortcut::AbstractHint::Ptr> &hints);43 void AddWorkspaceHints(std::list<shortcut::AbstractHint::Ptr> &hints);
44 void AddWindowsHints(std::list<shortcut::AbstractHint::Ptr> &hints);44 void AddWindowsHints(std::list<shortcut::AbstractHint::Ptr> &hints, bool ws);
4545
46 Model::Ptr model_;46 Model::Ptr model_;
47};47};