Merge lp:~3v1n0/unity/shortcuts-modeller into lp:unity
- shortcuts-modeller
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Andrea Azzarone |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3058 |
Proposed branch: | lp:~3v1n0/unity/shortcuts-modeller |
Merge into: | lp:unity |
Diff against target: |
1568 lines (+689/-523) 14 files modified
plugins/unityshell/src/unityshell.cpp (+7/-277) plugins/unityshell/src/unityshell.h (+0/-6) po/POTFILES.in (+1/-0) shortcuts/AbstractShortcutModeller.h (+46/-0) shortcuts/CMakeLists.txt (+2/-0) shortcuts/CompizShortcutModeller.cpp (+301/-0) shortcuts/CompizShortcutModeller.h (+43/-0) shortcuts/ShortcutController.cpp (+22/-15) shortcuts/ShortcutController.h (+3/-4) shortcuts/ShortcutModel.cpp (+0/-1) shortcuts/ShortcutView.cpp (+12/-7) shortcuts/StandaloneShortcuts.cpp (+214/-200) tests/test_shortcut_controller.cpp (+30/-13) tests/test_shortcut_view.cpp (+8/-0) |
To merge this branch: | bzr merge lp:~3v1n0/unity/shortcuts-modeller |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Andrea Azzarone (community) | Approve | ||
Review via email: mp+144414@code.launchpad.net |
Commit message
ShortcutModeller: added a modeller that generates the shortcuts models for both compiz and standalone view
Description of the change
Using an abstract modeller to be passed to the ShortcutController to generate a model in a more dynamical way.
Added and updated tests.
Andrea Azzarone (azzar1) wrote : | # |
Andrea Azzarone (azzar1) wrote : | # |
793 + sigc::signal<void, Model::Ptr const&> model_changed;
? :)
Andrea Azzarone (azzar1) wrote : | # |
Code looks good. Tests pass.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
Preview Diff
1 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
2 | --- plugins/unityshell/src/unityshell.cpp 2013-01-21 14:38:56 +0000 | |||
3 | +++ plugins/unityshell/src/unityshell.cpp 2013-01-23 00:09:20 +0000 | |||
4 | @@ -45,6 +45,7 @@ | |||
5 | 45 | #include "launcher/XdndCollectionWindowImp.h" | 45 | #include "launcher/XdndCollectionWindowImp.h" |
6 | 46 | #include "launcher/XdndManagerImp.h" | 46 | #include "launcher/XdndManagerImp.h" |
7 | 47 | #include "launcher/XdndStartStopNotifierImp.h" | 47 | #include "launcher/XdndStartStopNotifierImp.h" |
8 | 48 | #include "CompizShortcutModeller.h" | ||
9 | 48 | 49 | ||
10 | 49 | #include <glib/gi18n-lib.h> | 50 | #include <glib/gi18n-lib.h> |
11 | 50 | #include <gtk/gtk.h> | 51 | #include <gtk/gtk.h> |
12 | @@ -128,7 +129,6 @@ | |||
13 | 128 | , cScreen(CompositeScreen::get(screen)) | 129 | , cScreen(CompositeScreen::get(screen)) |
14 | 129 | , gScreen(GLScreen::get(screen)) | 130 | , gScreen(GLScreen::get(screen)) |
15 | 130 | , debugger_(this) | 131 | , debugger_(this) |
16 | 131 | , enable_shortcut_overlay_(true) | ||
17 | 132 | , needsRelayout(false) | 132 | , needsRelayout(false) |
18 | 133 | , _in_paint(false) | 133 | , _in_paint(false) |
19 | 134 | , super_keypressed_(false) | 134 | , super_keypressed_(false) |
20 | @@ -1787,7 +1787,7 @@ | |||
21 | 1787 | launcher_controller_->HandleLauncherKeyRelease(was_tap, when); | 1787 | launcher_controller_->HandleLauncherKeyRelease(was_tap, when); |
22 | 1788 | EnableCancelAction(CancelActionTarget::LAUNCHER_SWITCHER, false); | 1788 | EnableCancelAction(CancelActionTarget::LAUNCHER_SWITCHER, false); |
23 | 1789 | 1789 | ||
25 | 1790 | shortcut_controller_->SetEnabled(enable_shortcut_overlay_); | 1790 | shortcut_controller_->SetEnabled(optionGetShortcutOverlay()); |
26 | 1791 | shortcut_controller_->Hide(); | 1791 | shortcut_controller_->Hide(); |
27 | 1792 | LOG_DEBUG(logger) << "Hiding shortcut controller"; | 1792 | LOG_DEBUG(logger) << "Hiding shortcut controller"; |
28 | 1793 | EnableCancelAction(CancelActionTarget::SHORTCUT_HINT, false); | 1793 | EnableCancelAction(CancelActionTarget::SHORTCUT_HINT, false); |
29 | @@ -2983,8 +2983,7 @@ | |||
30 | 2983 | screen->leaveShowDesktopModeSetEnabled (this, optionGetShowMinimizedWindows ()); | 2983 | screen->leaveShowDesktopModeSetEnabled (this, optionGetShowMinimizedWindows ()); |
31 | 2984 | break; | 2984 | break; |
32 | 2985 | case UnityshellOptions::ShortcutOverlay: | 2985 | case UnityshellOptions::ShortcutOverlay: |
35 | 2986 | enable_shortcut_overlay_ = optionGetShortcutOverlay(); | 2986 | shortcut_controller_->SetEnabled(optionGetShortcutOverlay()); |
34 | 2987 | shortcut_controller_->SetEnabled(enable_shortcut_overlay_); | ||
36 | 2988 | break; | 2987 | break; |
37 | 2989 | case UnityshellOptions::DecayRate: | 2988 | case UnityshellOptions::DecayRate: |
38 | 2990 | launcher_options->edge_decay_rate = optionGetDecayRate() * 100; | 2989 | launcher_options->edge_decay_rate = optionGetDecayRate() * 100; |
39 | @@ -3130,6 +3129,7 @@ | |||
40 | 3130 | /* Setup Places */ | 3129 | /* Setup Places */ |
41 | 3131 | dash_controller_ = std::make_shared<dash::Controller>(); | 3130 | dash_controller_ = std::make_shared<dash::Controller>(); |
42 | 3132 | dash_controller_->on_realize.connect(sigc::mem_fun(this, &UnityScreen::OnDashRealized)); | 3131 | dash_controller_->on_realize.connect(sigc::mem_fun(this, &UnityScreen::OnDashRealized)); |
43 | 3132 | AddChild(dash_controller_.get()); | ||
44 | 3133 | 3133 | ||
45 | 3134 | /* Setup Hud */ | 3134 | /* Setup Hud */ |
46 | 3135 | hud_controller_ = std::make_shared<hud::Controller>(); | 3135 | hud_controller_ = std::make_shared<hud::Controller>(); |
47 | @@ -3142,13 +3142,11 @@ | |||
48 | 3142 | LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s"; | 3142 | LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s"; |
49 | 3143 | 3143 | ||
50 | 3144 | // Setup Shortcut Hint | 3144 | // Setup Shortcut Hint |
54 | 3145 | InitHints(); | 3145 | auto base_window_raiser = std::make_shared<shortcut::BaseWindowRaiserImp>(); |
55 | 3146 | auto base_window_raiser_ = std::make_shared<shortcut::BaseWindowRaiserImp>(); | 3146 | auto shortcuts_modeller = std::make_shared<shortcut::CompizModeller>(); |
56 | 3147 | shortcut_controller_ = std::make_shared<shortcut::Controller>(hints_, base_window_raiser_); | 3147 | shortcut_controller_ = std::make_shared<shortcut::Controller>(base_window_raiser, shortcuts_modeller); |
57 | 3148 | AddChild(shortcut_controller_.get()); | 3148 | AddChild(shortcut_controller_.get()); |
58 | 3149 | 3149 | ||
59 | 3150 | AddChild(dash_controller_.get()); | ||
60 | 3151 | |||
61 | 3152 | launcher_controller_->launcher().size_changed.connect([this] (nux::Area*, int w, int h) { | 3150 | launcher_controller_->launcher().size_changed.connect([this] (nux::Area*, int w, int h) { |
62 | 3153 | /* The launcher geometry includes 1px used to draw the right margin | 3151 | /* The launcher geometry includes 1px used to draw the right margin |
63 | 3154 | * that must not be considered when drawing an overlay */ | 3152 | * that must not be considered when drawing an overlay */ |
64 | @@ -3172,274 +3170,6 @@ | |||
65 | 3172 | return launcher_controller_; | 3170 | return launcher_controller_; |
66 | 3173 | } | 3171 | } |
67 | 3174 | 3172 | ||
68 | 3175 | void UnityScreen::InitHints() | ||
69 | 3176 | { | ||
70 | 3177 | // TODO move category text into a vector... | ||
71 | 3178 | |||
72 | 3179 | // Compiz' plug-in names | ||
73 | 3180 | static const std::string COMPIZ_CORE_PLUGIN_NAME = "core"; | ||
74 | 3181 | static const std::string COMPIZ_EXPO_PLUGIN_NAME = "expo"; | ||
75 | 3182 | static const std::string COMPIZ_GRID_PLUGIN_NAME = "grid"; | ||
76 | 3183 | static const std::string COMPIZ_MOVE_PLUGIN_NAME = "move"; | ||
77 | 3184 | static const std::string COMPIZ_RESIZE_PLUGIN_NAME = "resize"; | ||
78 | 3185 | static const std::string COMPIZ_SCALE_PLUGIN_NAME = "scale"; | ||
79 | 3186 | static const std::string COMPIZ_UNITYSHELL_PLUGIN_NAME = "unityshell"; | ||
80 | 3187 | static const std::string COMPIZ_WALL_PLUGIN_NAME = "wall"; | ||
81 | 3188 | |||
82 | 3189 | // Compiz Core Options | ||
83 | 3190 | static const std::string COMPIZ_CORE_OPTION_SHOW_DESKTOP_KEY = "show_desktop_key"; | ||
84 | 3191 | static const std::string COMPIZ_CORE_OPTION_MAXIMIZE_WINDOW_KEY = "maximize_window_key"; | ||
85 | 3192 | static const std::string COMPIZ_CORE_OPTION_UNMAXIMIZE_WINDOW_KEY = "unmaximize_window_key"; | ||
86 | 3193 | static const std::string COMPIZ_CORE_OPTION_CLOSE_WINDOW_KEY = "close_window_key"; | ||
87 | 3194 | static const std::string COMPIZ_CORE_OPTION_WINDOW_MENU_KEY = "window_menu_key"; | ||
88 | 3195 | |||
89 | 3196 | // Compiz Expo Options | ||
90 | 3197 | static const std::string COMPIZ_EXPO_OPTION_EXPO_KEY = "expo_key"; | ||
91 | 3198 | |||
92 | 3199 | // Compiz Grid Options | ||
93 | 3200 | static const std::string COMPIZ_GRID_OPTION_PUT_LEFT_KEY = "put_left_key"; | ||
94 | 3201 | |||
95 | 3202 | // Compiz Move Options | ||
96 | 3203 | static const std::string COMPIZ_MOVE_OPTION_INITIATE_BUTTON = "initiate_button"; | ||
97 | 3204 | |||
98 | 3205 | // Compiz Resize Options | ||
99 | 3206 | static const std::string COMPIZ_RESIZE_OPTION_INITIATE_BUTTON = "initiate_button"; | ||
100 | 3207 | |||
101 | 3208 | // Compiz Scale Options | ||
102 | 3209 | static const std::string COMPIZ_SCALE_OPTION_INITIATE_ALL_KEY = "initiate_all_key"; | ||
103 | 3210 | |||
104 | 3211 | // Compiz Unityshell Options | ||
105 | 3212 | static const std::string COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER = "show_launcher"; | ||
106 | 3213 | static const std::string COMPIZ_UNITYSHELL_OPTION_KEYBOARD_FOCUS = "keyboard_focus"; | ||
107 | 3214 | static const std::string COMPIZ_UNITYSHELL_OPTION_LAUNCHER_SWITCHER_FORWARD = "launcher_switcher_forward"; | ||
108 | 3215 | static const std::string COMPIZ_UNITYSHELL_OPTION_SHOW_HUD = "show_hud"; | ||
109 | 3216 | static const std::string COMPIZ_UNITYSHELL_OPTION_PANEL_FIRST_MENU = "panel_first_menu"; | ||
110 | 3217 | static const std::string COMPIZ_UNITYSHELL_OPTION_ALT_TAB_FORWARD = "alt_tab_forward"; | ||
111 | 3218 | static const std::string COMPIZ_UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW = "alt_tab_next_window"; | ||
112 | 3219 | |||
113 | 3220 | // Compiz Wall Options | ||
114 | 3221 | static const std::string COMPIZ_WALL_OPTION_LEFT_KEY = "left_key"; | ||
115 | 3222 | static const std::string COMPIZ_WALL_OPTION_LEFT_WINDOW_KEY = "left_window_key"; | ||
116 | 3223 | |||
117 | 3224 | |||
118 | 3225 | // Launcher... | ||
119 | 3226 | static const std::string launcher(_("Launcher")); | ||
120 | 3227 | |||
121 | 3228 | hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", _(" (Hold)"), | ||
122 | 3229 | _("Opens the Launcher, displays shortcuts."), | ||
123 | 3230 | shortcut::OptionType::COMPIZ_KEY, | ||
124 | 3231 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
125 | 3232 | COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
126 | 3233 | |||
127 | 3234 | hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", "", | ||
128 | 3235 | _("Opens Launcher keyboard navigation mode."), | ||
129 | 3236 | shortcut::OptionType::COMPIZ_KEY, | ||
130 | 3237 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
131 | 3238 | COMPIZ_UNITYSHELL_OPTION_KEYBOARD_FOCUS)); | ||
132 | 3239 | |||
133 | 3240 | hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", "", | ||
134 | 3241 | _("Switches applications via the Launcher."), | ||
135 | 3242 | shortcut::OptionType::COMPIZ_KEY, | ||
136 | 3243 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
137 | 3244 | COMPIZ_UNITYSHELL_OPTION_LAUNCHER_SWITCHER_FORWARD)); | ||
138 | 3245 | |||
139 | 3246 | hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", _(" + 1 to 9"), | ||
140 | 3247 | _("Same as clicking on a Launcher icon."), | ||
141 | 3248 | shortcut::OptionType::COMPIZ_KEY, | ||
142 | 3249 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
143 | 3250 | COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
144 | 3251 | |||
145 | 3252 | hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", _(" + Shift + 1 to 9"), | ||
146 | 3253 | _("Opens a new window in the app."), | ||
147 | 3254 | shortcut::OptionType::COMPIZ_KEY, | ||
148 | 3255 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
149 | 3256 | COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
150 | 3257 | |||
151 | 3258 | hints_.push_back(std::make_shared<shortcut::Hint>(launcher, "", " + T", | ||
152 | 3259 | _("Opens the Trash."), | ||
153 | 3260 | shortcut::OptionType::COMPIZ_KEY, | ||
154 | 3261 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
155 | 3262 | COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
156 | 3263 | |||
157 | 3264 | |||
158 | 3265 | // Dash... | ||
159 | 3266 | static const std::string dash( _("Dash")); | ||
160 | 3267 | |||
161 | 3268 | hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", _(" (Tap)"), | ||
162 | 3269 | _("Opens the Dash Home."), | ||
163 | 3270 | shortcut::OptionType::COMPIZ_KEY, | ||
164 | 3271 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
165 | 3272 | COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
166 | 3273 | |||
167 | 3274 | hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + A", | ||
168 | 3275 | _("Opens the Dash App Lens."), | ||
169 | 3276 | shortcut::OptionType::COMPIZ_KEY, | ||
170 | 3277 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
171 | 3278 | COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
172 | 3279 | |||
173 | 3280 | hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + F", | ||
174 | 3281 | _("Opens the Dash Files Lens."), | ||
175 | 3282 | shortcut::OptionType::COMPIZ_KEY, | ||
176 | 3283 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
177 | 3284 | COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
178 | 3285 | |||
179 | 3286 | hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + M", | ||
180 | 3287 | _("Opens the Dash Music Lens."), | ||
181 | 3288 | shortcut::OptionType::COMPIZ_KEY, | ||
182 | 3289 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
183 | 3290 | COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
184 | 3291 | |||
185 | 3292 | hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + V", | ||
186 | 3293 | _("Opens the Dash Video Lens."), | ||
187 | 3294 | shortcut::OptionType::COMPIZ_KEY, | ||
188 | 3295 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
189 | 3296 | COMPIZ_UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
190 | 3297 | |||
191 | 3298 | hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", "", | ||
192 | 3299 | _("Switches between Lenses."), | ||
193 | 3300 | shortcut::OptionType::HARDCODED, | ||
194 | 3301 | _("Ctrl + Tab"))); | ||
195 | 3302 | |||
196 | 3303 | hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", "", | ||
197 | 3304 | _("Moves the focus."), | ||
198 | 3305 | shortcut::OptionType::HARDCODED, | ||
199 | 3306 | _("Arrow Keys"))); | ||
200 | 3307 | |||
201 | 3308 | hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", "", | ||
202 | 3309 | _("Opens the currently focused item."), | ||
203 | 3310 | shortcut::OptionType::HARDCODED, | ||
204 | 3311 | _("Enter"))); | ||
205 | 3312 | |||
206 | 3313 | // Menu Bar | ||
207 | 3314 | static const std::string menubar(_("HUD & Menu Bar")); | ||
208 | 3315 | |||
209 | 3316 | hints_.push_back(std::make_shared<shortcut::Hint>(menubar, "", _(" (Tap)"), | ||
210 | 3317 | _("Opens the HUD."), | ||
211 | 3318 | shortcut::OptionType::COMPIZ_KEY, | ||
212 | 3319 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
213 | 3320 | COMPIZ_UNITYSHELL_OPTION_SHOW_HUD)); | ||
214 | 3321 | |||
215 | 3322 | hints_.push_back(std::make_shared<shortcut::Hint>(menubar, "", _(" (Hold)"), | ||
216 | 3323 | _("Reveals the application menu."), | ||
217 | 3324 | shortcut::OptionType::HARDCODED, | ||
218 | 3325 | "Alt")); | ||
219 | 3326 | |||
220 | 3327 | hints_.push_back(std::make_shared<shortcut::Hint>(menubar, "", "", | ||
221 | 3328 | _("Opens the indicator menu."), | ||
222 | 3329 | shortcut::OptionType::COMPIZ_KEY, | ||
223 | 3330 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
224 | 3331 | COMPIZ_UNITYSHELL_OPTION_PANEL_FIRST_MENU)); | ||
225 | 3332 | |||
226 | 3333 | hints_.push_back(std::make_shared<shortcut::Hint>(menubar, "", "", | ||
227 | 3334 | _("Moves focus between indicators."), | ||
228 | 3335 | shortcut::OptionType::HARDCODED, | ||
229 | 3336 | _("Cursor Left or Right"))); | ||
230 | 3337 | |||
231 | 3338 | // Switching | ||
232 | 3339 | static const std::string switching(_("Switching")); | ||
233 | 3340 | |||
234 | 3341 | hints_.push_back(std::make_shared<shortcut::Hint>(switching, "", "", | ||
235 | 3342 | _("Switches between applications."), | ||
236 | 3343 | shortcut::OptionType::COMPIZ_KEY, | ||
237 | 3344 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
238 | 3345 | COMPIZ_UNITYSHELL_OPTION_ALT_TAB_FORWARD)); | ||
239 | 3346 | |||
240 | 3347 | hints_.push_back(std::make_shared<shortcut::Hint>(switching, "", "", | ||
241 | 3348 | _("Switches windows of current applications."), | ||
242 | 3349 | shortcut::OptionType::COMPIZ_KEY, | ||
243 | 3350 | COMPIZ_UNITYSHELL_PLUGIN_NAME, | ||
244 | 3351 | COMPIZ_UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW)); | ||
245 | 3352 | |||
246 | 3353 | hints_.push_back(std::make_shared<shortcut::Hint>(switching, "", "", | ||
247 | 3354 | _("Moves the focus."), | ||
248 | 3355 | shortcut::OptionType::HARDCODED, | ||
249 | 3356 | _("Cursor Left or Right"))); | ||
250 | 3357 | |||
251 | 3358 | // Workspaces | ||
252 | 3359 | static const std::string workspaces(_("Workspaces")); | ||
253 | 3360 | |||
254 | 3361 | hints_.push_back(std::make_shared<shortcut::Hint>(workspaces, "", "", | ||
255 | 3362 | _("Switches between workspaces."), | ||
256 | 3363 | shortcut::OptionType::COMPIZ_KEY, | ||
257 | 3364 | COMPIZ_EXPO_PLUGIN_NAME, | ||
258 | 3365 | COMPIZ_EXPO_OPTION_EXPO_KEY)); | ||
259 | 3366 | |||
260 | 3367 | hints_.push_back(std::make_shared<shortcut::Hint>(workspaces, "", _(" + Arrow Keys"), | ||
261 | 3368 | _("Switches workspaces."), | ||
262 | 3369 | shortcut::OptionType::COMPIZ_KEY, | ||
263 | 3370 | COMPIZ_WALL_PLUGIN_NAME, | ||
264 | 3371 | COMPIZ_WALL_OPTION_LEFT_KEY)); | ||
265 | 3372 | |||
266 | 3373 | hints_.push_back(std::make_shared<shortcut::Hint>(workspaces, "", _(" + Arrow Keys"), | ||
267 | 3374 | _("Moves focused window to another workspace."), | ||
268 | 3375 | shortcut::OptionType::COMPIZ_KEY, | ||
269 | 3376 | COMPIZ_WALL_PLUGIN_NAME, | ||
270 | 3377 | COMPIZ_WALL_OPTION_LEFT_WINDOW_KEY)); | ||
271 | 3378 | |||
272 | 3379 | |||
273 | 3380 | // Windows | ||
274 | 3381 | static const std::string windows(_("Windows")); | ||
275 | 3382 | |||
276 | 3383 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
277 | 3384 | _("Spreads all windows in the current workspace."), | ||
278 | 3385 | shortcut::OptionType::COMPIZ_KEY, | ||
279 | 3386 | COMPIZ_SCALE_PLUGIN_NAME, | ||
280 | 3387 | COMPIZ_SCALE_OPTION_INITIATE_ALL_KEY)); | ||
281 | 3388 | |||
282 | 3389 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
283 | 3390 | _("Minimises all windows."), | ||
284 | 3391 | shortcut::OptionType::COMPIZ_KEY, | ||
285 | 3392 | COMPIZ_CORE_PLUGIN_NAME, | ||
286 | 3393 | COMPIZ_CORE_OPTION_SHOW_DESKTOP_KEY)); | ||
287 | 3394 | |||
288 | 3395 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
289 | 3396 | _("Maximises the current window."), | ||
290 | 3397 | shortcut::OptionType::COMPIZ_KEY, | ||
291 | 3398 | COMPIZ_CORE_PLUGIN_NAME, | ||
292 | 3399 | COMPIZ_CORE_OPTION_MAXIMIZE_WINDOW_KEY)); | ||
293 | 3400 | |||
294 | 3401 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
295 | 3402 | _("Restores or minimises the current window."), | ||
296 | 3403 | shortcut::OptionType::COMPIZ_KEY, | ||
297 | 3404 | COMPIZ_CORE_PLUGIN_NAME, | ||
298 | 3405 | COMPIZ_CORE_OPTION_UNMAXIMIZE_WINDOW_KEY)); | ||
299 | 3406 | |||
300 | 3407 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" or Right"), | ||
301 | 3408 | _("Semi-maximise the current window."), | ||
302 | 3409 | shortcut::OptionType::COMPIZ_KEY, | ||
303 | 3410 | COMPIZ_GRID_PLUGIN_NAME, | ||
304 | 3411 | COMPIZ_GRID_OPTION_PUT_LEFT_KEY)); | ||
305 | 3412 | |||
306 | 3413 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
307 | 3414 | _("Closes the current window."), | ||
308 | 3415 | shortcut::OptionType::COMPIZ_KEY, | ||
309 | 3416 | COMPIZ_CORE_PLUGIN_NAME, | ||
310 | 3417 | COMPIZ_CORE_OPTION_CLOSE_WINDOW_KEY)); | ||
311 | 3418 | |||
312 | 3419 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
313 | 3420 | _("Opens the window accessibility menu."), | ||
314 | 3421 | shortcut::OptionType::COMPIZ_KEY, | ||
315 | 3422 | COMPIZ_CORE_PLUGIN_NAME, | ||
316 | 3423 | COMPIZ_CORE_OPTION_WINDOW_MENU_KEY)); | ||
317 | 3424 | |||
318 | 3425 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
319 | 3426 | _("Places the window in corresponding position."), | ||
320 | 3427 | shortcut::OptionType::HARDCODED, | ||
321 | 3428 | _("Ctrl + Alt + Num"))); | ||
322 | 3429 | |||
323 | 3430 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" Drag"), | ||
324 | 3431 | _("Moves the window."), | ||
325 | 3432 | shortcut::OptionType::COMPIZ_MOUSE, | ||
326 | 3433 | COMPIZ_MOVE_PLUGIN_NAME, | ||
327 | 3434 | COMPIZ_MOVE_OPTION_INITIATE_BUTTON)); | ||
328 | 3435 | |||
329 | 3436 | hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" Drag"), | ||
330 | 3437 | _("Resizes the window."), | ||
331 | 3438 | shortcut::OptionType::COMPIZ_MOUSE, | ||
332 | 3439 | COMPIZ_RESIZE_PLUGIN_NAME, | ||
333 | 3440 | COMPIZ_RESIZE_OPTION_INITIATE_BUTTON)); | ||
334 | 3441 | } | ||
335 | 3442 | |||
336 | 3443 | void UnityScreen::InitGesturesSupport() | 3173 | void UnityScreen::InitGesturesSupport() |
337 | 3444 | { | 3174 | { |
338 | 3445 | std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker); | 3175 | std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker); |
339 | 3446 | 3176 | ||
340 | === modified file 'plugins/unityshell/src/unityshell.h' | |||
341 | --- plugins/unityshell/src/unityshell.h 2012-12-19 09:45:55 +0000 | |||
342 | +++ plugins/unityshell/src/unityshell.h 2013-01-23 00:09:20 +0000 | |||
343 | @@ -43,7 +43,6 @@ | |||
344 | 43 | #include "FavoriteStoreGSettings.h" | 43 | #include "FavoriteStoreGSettings.h" |
345 | 44 | #include "FontSettings.h" | 44 | #include "FontSettings.h" |
346 | 45 | #include "ShortcutController.h" | 45 | #include "ShortcutController.h" |
347 | 46 | #include "ShortcutHint.h" | ||
348 | 47 | #include "LauncherController.h" | 46 | #include "LauncherController.h" |
349 | 48 | #include "PanelController.h" | 47 | #include "PanelController.h" |
350 | 49 | #include "PanelStyle.h" | 48 | #include "PanelStyle.h" |
351 | @@ -240,8 +239,6 @@ | |||
352 | 240 | void RestoreWindow(GVariant* data); | 239 | void RestoreWindow(GVariant* data); |
353 | 241 | bool SaveInputThenFocus(const guint xid); | 240 | bool SaveInputThenFocus(const guint xid); |
354 | 242 | 241 | ||
355 | 243 | void InitHints(); | ||
356 | 244 | |||
357 | 245 | void OnPanelStyleChanged(); | 242 | void OnPanelStyleChanged(); |
358 | 246 | 243 | ||
359 | 247 | void InitGesturesSupport(); | 244 | void InitGesturesSupport(); |
360 | @@ -273,9 +270,6 @@ | |||
361 | 273 | shortcut::Controller::Ptr shortcut_controller_; | 270 | shortcut::Controller::Ptr shortcut_controller_; |
362 | 274 | debug::DebugDBusInterface debugger_; | 271 | debug::DebugDBusInterface debugger_; |
363 | 275 | 272 | ||
364 | 276 | std::list<shortcut::AbstractHint::Ptr> hints_; | ||
365 | 277 | bool enable_shortcut_overlay_; | ||
366 | 278 | |||
367 | 279 | /* Subscription for gestures that manipulate Unity launcher */ | 273 | /* Subscription for gestures that manipulate Unity launcher */ |
368 | 280 | std::unique_ptr<nux::GesturesSubscription> gestures_sub_launcher_; | 274 | std::unique_ptr<nux::GesturesSubscription> gestures_sub_launcher_; |
369 | 281 | 275 | ||
370 | 282 | 276 | ||
371 | === modified file 'po/POTFILES.in' | |||
372 | --- po/POTFILES.in 2012-11-29 01:25:12 +0000 | |||
373 | +++ po/POTFILES.in 2013-01-23 00:09:20 +0000 | |||
374 | @@ -31,6 +31,7 @@ | |||
375 | 31 | plugins/unityshell/unityshell.xml.in | 31 | plugins/unityshell/unityshell.xml.in |
376 | 32 | shortcuts/ShortcutHintPrivate.cpp | 32 | shortcuts/ShortcutHintPrivate.cpp |
377 | 33 | shortcuts/ShortcutView.cpp | 33 | shortcuts/ShortcutView.cpp |
378 | 34 | shortcuts/CompizShortcutsModeller.cpp | ||
379 | 34 | services/panel-service.c | 35 | services/panel-service.c |
380 | 35 | unity-shared/DashStyle.cpp | 36 | unity-shared/DashStyle.cpp |
381 | 36 | unity-shared/SearchBar.cpp | 37 | unity-shared/SearchBar.cpp |
382 | 37 | 38 | ||
383 | === added file 'shortcuts/AbstractShortcutModeller.h' | |||
384 | --- shortcuts/AbstractShortcutModeller.h 1970-01-01 00:00:00 +0000 | |||
385 | +++ shortcuts/AbstractShortcutModeller.h 2013-01-23 00:09:20 +0000 | |||
386 | @@ -0,0 +1,46 @@ | |||
387 | 1 | /* | ||
388 | 2 | * Copyright 2013 Canonical Ltd. | ||
389 | 3 | * | ||
390 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
391 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
392 | 6 | * by the Free Software Foundation. | ||
393 | 7 | * | ||
394 | 8 | * This program is distributed in the hope that it will be useful, but | ||
395 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
396 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
397 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
398 | 12 | * | ||
399 | 13 | * You should have received a copy of the GNU General Public License | ||
400 | 14 | * version 3 along with this program. If not, see | ||
401 | 15 | * <http://www.gnu.org/licenses/> | ||
402 | 16 | * | ||
403 | 17 | * Authored by: Marco Trevisan <marco.trevisan@canonical.com> | ||
404 | 18 | */ | ||
405 | 19 | |||
406 | 20 | #ifndef UNITYSHELL_ABSTRACT_SHORTCUT_MODELLER_H | ||
407 | 21 | #define UNITYSHELL_ABSTRACT_SHORTCUT_MODELLER_H | ||
408 | 22 | |||
409 | 23 | #include "ShortcutModel.h" | ||
410 | 24 | |||
411 | 25 | namespace unity | ||
412 | 26 | { | ||
413 | 27 | namespace shortcut | ||
414 | 28 | { | ||
415 | 29 | |||
416 | 30 | class AbstractModeller : boost::noncopyable | ||
417 | 31 | { | ||
418 | 32 | public: | ||
419 | 33 | typedef std::shared_ptr<AbstractModeller> Ptr; | ||
420 | 34 | |||
421 | 35 | AbstractModeller() {} | ||
422 | 36 | virtual ~AbstractModeller() {} | ||
423 | 37 | |||
424 | 38 | virtual Model::Ptr GetCurrentModel() const = 0; | ||
425 | 39 | |||
426 | 40 | sigc::signal<void, Model::Ptr const&> model_changed; | ||
427 | 41 | }; | ||
428 | 42 | |||
429 | 43 | } | ||
430 | 44 | } | ||
431 | 45 | |||
432 | 46 | #endif | ||
433 | 0 | 47 | ||
434 | === modified file 'shortcuts/CMakeLists.txt' | |||
435 | --- shortcuts/CMakeLists.txt 2012-12-19 20:53:12 +0000 | |||
436 | +++ shortcuts/CMakeLists.txt 2013-01-23 00:09:20 +0000 | |||
437 | @@ -18,7 +18,9 @@ | |||
438 | 18 | # | 18 | # |
439 | 19 | set (SHORTCUTS_SOURCES | 19 | set (SHORTCUTS_SOURCES |
440 | 20 | AbstractShortcutHint.h | 20 | AbstractShortcutHint.h |
441 | 21 | AbstractShortcutModeller.h | ||
442 | 21 | BaseWindowRaiserImp.cpp | 22 | BaseWindowRaiserImp.cpp |
443 | 23 | CompizShortcutModeller.cpp | ||
444 | 22 | MockShortcutHint.h | 24 | MockShortcutHint.h |
445 | 23 | ShortcutController.cpp | 25 | ShortcutController.cpp |
446 | 24 | ShortcutController.h | 26 | ShortcutController.h |
447 | 25 | 27 | ||
448 | === added file 'shortcuts/CompizShortcutModeller.cpp' | |||
449 | --- shortcuts/CompizShortcutModeller.cpp 1970-01-01 00:00:00 +0000 | |||
450 | +++ shortcuts/CompizShortcutModeller.cpp 2013-01-23 00:09:20 +0000 | |||
451 | @@ -0,0 +1,301 @@ | |||
452 | 1 | /* | ||
453 | 2 | * Copyright 2013 Canonical Ltd. | ||
454 | 3 | * | ||
455 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
456 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
457 | 6 | * by the Free Software Foundation. | ||
458 | 7 | * | ||
459 | 8 | * This program is distributed in the hope that it will be useful, but | ||
460 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
461 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
462 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
463 | 12 | * | ||
464 | 13 | * You should have received a copy of the GNU General Public License | ||
465 | 14 | * version 3 along with this program. If not, see | ||
466 | 15 | * <http://www.gnu.org/licenses/> | ||
467 | 16 | * | ||
468 | 17 | * Authored by: Marco Trevisan <marco.trevisan@canonical.com> | ||
469 | 18 | */ | ||
470 | 19 | |||
471 | 20 | #include "config.h" | ||
472 | 21 | #include <glib/gi18n-lib.h> | ||
473 | 22 | #include "CompizShortcutModeller.h" | ||
474 | 23 | #include "ShortcutHint.h" | ||
475 | 24 | |||
476 | 25 | namespace unity | ||
477 | 26 | { | ||
478 | 27 | namespace shortcut | ||
479 | 28 | { | ||
480 | 29 | namespace | ||
481 | 30 | { | ||
482 | 31 | // Compiz' plug-in names | ||
483 | 32 | const std::string CORE_PLUGIN_NAME = "core"; | ||
484 | 33 | const std::string EXPO_PLUGIN_NAME = "expo"; | ||
485 | 34 | const std::string GRID_PLUGIN_NAME = "grid"; | ||
486 | 35 | const std::string MOVE_PLUGIN_NAME = "move"; | ||
487 | 36 | const std::string RESIZE_PLUGIN_NAME = "resize"; | ||
488 | 37 | const std::string SCALE_PLUGIN_NAME = "scale"; | ||
489 | 38 | const std::string UNITYSHELL_PLUGIN_NAME = "unityshell"; | ||
490 | 39 | const std::string WALL_PLUGIN_NAME = "wall"; | ||
491 | 40 | |||
492 | 41 | // Compiz Core Options | ||
493 | 42 | const std::string CORE_OPTION_SHOW_DESKTOP_KEY = "show_desktop_key"; | ||
494 | 43 | const std::string CORE_OPTION_MAXIMIZE_WINDOW_KEY = "maximize_window_key"; | ||
495 | 44 | const std::string CORE_OPTION_UNMAXIMIZE_WINDOW_KEY = "unmaximize_window_key"; | ||
496 | 45 | const std::string CORE_OPTION_CLOSE_WINDOW_KEY = "close_window_key"; | ||
497 | 46 | const std::string CORE_OPTION_WINDOW_MENU_KEY = "window_menu_key"; | ||
498 | 47 | |||
499 | 48 | // Compiz Expo Options | ||
500 | 49 | const std::string EXPO_OPTION_EXPO_KEY = "expo_key"; | ||
501 | 50 | |||
502 | 51 | // Compiz Grid Options | ||
503 | 52 | const std::string GRID_OPTION_PUT_LEFT_KEY = "put_left_key"; | ||
504 | 53 | |||
505 | 54 | // Compiz Move Options | ||
506 | 55 | const std::string MOVE_OPTION_INITIATE_BUTTON = "initiate_button"; | ||
507 | 56 | |||
508 | 57 | // Compiz Resize Options | ||
509 | 58 | const std::string RESIZE_OPTION_INITIATE_BUTTON = "initiate_button"; | ||
510 | 59 | |||
511 | 60 | // Compiz Scale Options | ||
512 | 61 | const std::string SCALE_OPTION_INITIATE_ALL_KEY = "initiate_all_key"; | ||
513 | 62 | |||
514 | 63 | // Compiz Unityshell Options | ||
515 | 64 | const std::string UNITYSHELL_OPTION_SHOW_LAUNCHER = "show_launcher"; | ||
516 | 65 | const std::string UNITYSHELL_OPTION_KEYBOARD_FOCUS = "keyboard_focus"; | ||
517 | 66 | const std::string UNITYSHELL_OPTION_LAUNCHER_SWITCHER_FORWARD = "launcher_switcher_forward"; | ||
518 | 67 | const std::string UNITYSHELL_OPTION_SHOW_HUD = "show_hud"; | ||
519 | 68 | const std::string UNITYSHELL_OPTION_PANEL_FIRST_MENU = "panel_first_menu"; | ||
520 | 69 | const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD = "alt_tab_forward"; | ||
521 | 70 | const std::string UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW = "alt_tab_next_window"; | ||
522 | 71 | |||
523 | 72 | // Compiz Wall Options | ||
524 | 73 | const std::string WALL_OPTION_LEFT_KEY = "left_key"; | ||
525 | 74 | const std::string WALL_OPTION_LEFT_WINDOW_KEY = "left_window_key"; | ||
526 | 75 | } | ||
527 | 76 | |||
528 | 77 | CompizModeller::CompizModeller() | ||
529 | 78 | { | ||
530 | 79 | // Launcher... | ||
531 | 80 | const std::string launcher(_("Launcher")); | ||
532 | 81 | |||
533 | 82 | std::list<shortcut::AbstractHint::Ptr> hints; | ||
534 | 83 | hints.push_back(std::make_shared<shortcut::Hint>(launcher, "", _(" (Hold)"), | ||
535 | 84 | _("Opens the Launcher, displays shortcuts."), | ||
536 | 85 | shortcut::OptionType::COMPIZ_KEY, | ||
537 | 86 | UNITYSHELL_PLUGIN_NAME, | ||
538 | 87 | UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
539 | 88 | |||
540 | 89 | hints.push_back(std::make_shared<shortcut::Hint>(launcher, "", "", | ||
541 | 90 | _("Opens Launcher keyboard navigation mode."), | ||
542 | 91 | shortcut::OptionType::COMPIZ_KEY, | ||
543 | 92 | UNITYSHELL_PLUGIN_NAME, | ||
544 | 93 | UNITYSHELL_OPTION_KEYBOARD_FOCUS)); | ||
545 | 94 | |||
546 | 95 | hints.push_back(std::make_shared<shortcut::Hint>(launcher, "", "", | ||
547 | 96 | _("Switches applications via the Launcher."), | ||
548 | 97 | shortcut::OptionType::COMPIZ_KEY, | ||
549 | 98 | UNITYSHELL_PLUGIN_NAME, | ||
550 | 99 | UNITYSHELL_OPTION_LAUNCHER_SWITCHER_FORWARD)); | ||
551 | 100 | |||
552 | 101 | hints.push_back(std::make_shared<shortcut::Hint>(launcher, "", _(" + 1 to 9"), | ||
553 | 102 | _("Same as clicking on a Launcher icon."), | ||
554 | 103 | shortcut::OptionType::COMPIZ_KEY, | ||
555 | 104 | UNITYSHELL_PLUGIN_NAME, | ||
556 | 105 | UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
557 | 106 | |||
558 | 107 | hints.push_back(std::make_shared<shortcut::Hint>(launcher, "", _(" + Shift + 1 to 9"), | ||
559 | 108 | _("Opens a new window in the app."), | ||
560 | 109 | shortcut::OptionType::COMPIZ_KEY, | ||
561 | 110 | UNITYSHELL_PLUGIN_NAME, | ||
562 | 111 | UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
563 | 112 | |||
564 | 113 | hints.push_back(std::make_shared<shortcut::Hint>(launcher, "", " + T", | ||
565 | 114 | _("Opens the Trash."), | ||
566 | 115 | shortcut::OptionType::COMPIZ_KEY, | ||
567 | 116 | UNITYSHELL_PLUGIN_NAME, | ||
568 | 117 | UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
569 | 118 | |||
570 | 119 | |||
571 | 120 | // Dash... | ||
572 | 121 | static const std::string dash( _("Dash")); | ||
573 | 122 | |||
574 | 123 | hints.push_back(std::make_shared<shortcut::Hint>(dash, "", _(" (Tap)"), | ||
575 | 124 | _("Opens the Dash Home."), | ||
576 | 125 | shortcut::OptionType::COMPIZ_KEY, | ||
577 | 126 | UNITYSHELL_PLUGIN_NAME, | ||
578 | 127 | UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
579 | 128 | |||
580 | 129 | hints.push_back(std::make_shared<shortcut::Hint>(dash, "", " + A", | ||
581 | 130 | _("Opens the Dash App Lens."), | ||
582 | 131 | shortcut::OptionType::COMPIZ_KEY, | ||
583 | 132 | UNITYSHELL_PLUGIN_NAME, | ||
584 | 133 | UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
585 | 134 | |||
586 | 135 | hints.push_back(std::make_shared<shortcut::Hint>(dash, "", " + F", | ||
587 | 136 | _("Opens the Dash Files Lens."), | ||
588 | 137 | shortcut::OptionType::COMPIZ_KEY, | ||
589 | 138 | UNITYSHELL_PLUGIN_NAME, | ||
590 | 139 | UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
591 | 140 | |||
592 | 141 | hints.push_back(std::make_shared<shortcut::Hint>(dash, "", " + M", | ||
593 | 142 | _("Opens the Dash Music Lens."), | ||
594 | 143 | shortcut::OptionType::COMPIZ_KEY, | ||
595 | 144 | UNITYSHELL_PLUGIN_NAME, | ||
596 | 145 | UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
597 | 146 | |||
598 | 147 | hints.push_back(std::make_shared<shortcut::Hint>(dash, "", " + V", | ||
599 | 148 | _("Opens the Dash Video Lens."), | ||
600 | 149 | shortcut::OptionType::COMPIZ_KEY, | ||
601 | 150 | UNITYSHELL_PLUGIN_NAME, | ||
602 | 151 | UNITYSHELL_OPTION_SHOW_LAUNCHER)); | ||
603 | 152 | |||
604 | 153 | hints.push_back(std::make_shared<shortcut::Hint>(dash, "", "", | ||
605 | 154 | _("Switches between Lenses."), | ||
606 | 155 | shortcut::OptionType::HARDCODED, | ||
607 | 156 | _("Ctrl + Tab"))); | ||
608 | 157 | |||
609 | 158 | hints.push_back(std::make_shared<shortcut::Hint>(dash, "", "", | ||
610 | 159 | _("Moves the focus."), | ||
611 | 160 | shortcut::OptionType::HARDCODED, | ||
612 | 161 | _("Arrow Keys"))); | ||
613 | 162 | |||
614 | 163 | hints.push_back(std::make_shared<shortcut::Hint>(dash, "", "", | ||
615 | 164 | _("Opens the currently focused item."), | ||
616 | 165 | shortcut::OptionType::HARDCODED, | ||
617 | 166 | _("Enter"))); | ||
618 | 167 | |||
619 | 168 | // Menu Bar | ||
620 | 169 | static const std::string menubar(_("HUD & Menu Bar")); | ||
621 | 170 | |||
622 | 171 | hints.push_back(std::make_shared<shortcut::Hint>(menubar, "", _(" (Tap)"), | ||
623 | 172 | _("Opens the HUD."), | ||
624 | 173 | shortcut::OptionType::COMPIZ_KEY, | ||
625 | 174 | UNITYSHELL_PLUGIN_NAME, | ||
626 | 175 | UNITYSHELL_OPTION_SHOW_HUD)); | ||
627 | 176 | |||
628 | 177 | hints.push_back(std::make_shared<shortcut::Hint>(menubar, "", _(" (Hold)"), | ||
629 | 178 | _("Reveals the application menu."), | ||
630 | 179 | shortcut::OptionType::HARDCODED, | ||
631 | 180 | "Alt")); | ||
632 | 181 | |||
633 | 182 | hints.push_back(std::make_shared<shortcut::Hint>(menubar, "", "", | ||
634 | 183 | _("Opens the indicator menu."), | ||
635 | 184 | shortcut::OptionType::COMPIZ_KEY, | ||
636 | 185 | UNITYSHELL_PLUGIN_NAME, | ||
637 | 186 | UNITYSHELL_OPTION_PANEL_FIRST_MENU)); | ||
638 | 187 | |||
639 | 188 | hints.push_back(std::make_shared<shortcut::Hint>(menubar, "", "", | ||
640 | 189 | _("Moves focus between indicators."), | ||
641 | 190 | shortcut::OptionType::HARDCODED, | ||
642 | 191 | _("Cursor Left or Right"))); | ||
643 | 192 | |||
644 | 193 | // Switching | ||
645 | 194 | static const std::string switching(_("Switching")); | ||
646 | 195 | |||
647 | 196 | hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "", | ||
648 | 197 | _("Switches between applications."), | ||
649 | 198 | shortcut::OptionType::COMPIZ_KEY, | ||
650 | 199 | UNITYSHELL_PLUGIN_NAME, | ||
651 | 200 | UNITYSHELL_OPTION_ALT_TAB_FORWARD)); | ||
652 | 201 | |||
653 | 202 | hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "", | ||
654 | 203 | _("Switches windows of current applications."), | ||
655 | 204 | shortcut::OptionType::COMPIZ_KEY, | ||
656 | 205 | UNITYSHELL_PLUGIN_NAME, | ||
657 | 206 | UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW)); | ||
658 | 207 | |||
659 | 208 | hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "", | ||
660 | 209 | _("Moves the focus."), | ||
661 | 210 | shortcut::OptionType::HARDCODED, | ||
662 | 211 | _("Cursor Left or Right"))); | ||
663 | 212 | |||
664 | 213 | // Workspaces | ||
665 | 214 | static const std::string workspaces(_("Workspaces")); | ||
666 | 215 | |||
667 | 216 | hints.push_back(std::make_shared<shortcut::Hint>(workspaces, "", "", | ||
668 | 217 | _("Switches between workspaces."), | ||
669 | 218 | shortcut::OptionType::COMPIZ_KEY, | ||
670 | 219 | EXPO_PLUGIN_NAME, | ||
671 | 220 | EXPO_OPTION_EXPO_KEY)); | ||
672 | 221 | |||
673 | 222 | hints.push_back(std::make_shared<shortcut::Hint>(workspaces, "", _(" + Arrow Keys"), | ||
674 | 223 | _("Switches workspaces."), | ||
675 | 224 | shortcut::OptionType::COMPIZ_KEY, | ||
676 | 225 | WALL_PLUGIN_NAME, | ||
677 | 226 | WALL_OPTION_LEFT_KEY)); | ||
678 | 227 | |||
679 | 228 | hints.push_back(std::make_shared<shortcut::Hint>(workspaces, "", _(" + Arrow Keys"), | ||
680 | 229 | _("Moves focused window to another workspace."), | ||
681 | 230 | shortcut::OptionType::COMPIZ_KEY, | ||
682 | 231 | WALL_PLUGIN_NAME, | ||
683 | 232 | WALL_OPTION_LEFT_WINDOW_KEY)); | ||
684 | 233 | |||
685 | 234 | |||
686 | 235 | // Windows | ||
687 | 236 | static const std::string windows(_("Windows")); | ||
688 | 237 | |||
689 | 238 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
690 | 239 | _("Spreads all windows in the current workspace."), | ||
691 | 240 | shortcut::OptionType::COMPIZ_KEY, | ||
692 | 241 | SCALE_PLUGIN_NAME, | ||
693 | 242 | SCALE_OPTION_INITIATE_ALL_KEY)); | ||
694 | 243 | |||
695 | 244 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
696 | 245 | _("Minimises all windows."), | ||
697 | 246 | shortcut::OptionType::COMPIZ_KEY, | ||
698 | 247 | CORE_PLUGIN_NAME, | ||
699 | 248 | CORE_OPTION_SHOW_DESKTOP_KEY)); | ||
700 | 249 | |||
701 | 250 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
702 | 251 | _("Maximises the current window."), | ||
703 | 252 | shortcut::OptionType::COMPIZ_KEY, | ||
704 | 253 | CORE_PLUGIN_NAME, | ||
705 | 254 | CORE_OPTION_MAXIMIZE_WINDOW_KEY)); | ||
706 | 255 | |||
707 | 256 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
708 | 257 | _("Restores or minimises the current window."), | ||
709 | 258 | shortcut::OptionType::COMPIZ_KEY, | ||
710 | 259 | CORE_PLUGIN_NAME, | ||
711 | 260 | CORE_OPTION_UNMAXIMIZE_WINDOW_KEY)); | ||
712 | 261 | |||
713 | 262 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" or Right"), | ||
714 | 263 | _("Semi-maximise the current window."), | ||
715 | 264 | shortcut::OptionType::COMPIZ_KEY, | ||
716 | 265 | GRID_PLUGIN_NAME, | ||
717 | 266 | GRID_OPTION_PUT_LEFT_KEY)); | ||
718 | 267 | |||
719 | 268 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
720 | 269 | _("Closes the current window."), | ||
721 | 270 | shortcut::OptionType::COMPIZ_KEY, | ||
722 | 271 | CORE_PLUGIN_NAME, | ||
723 | 272 | CORE_OPTION_CLOSE_WINDOW_KEY)); | ||
724 | 273 | |||
725 | 274 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
726 | 275 | _("Opens the window accessibility menu."), | ||
727 | 276 | shortcut::OptionType::COMPIZ_KEY, | ||
728 | 277 | CORE_PLUGIN_NAME, | ||
729 | 278 | CORE_OPTION_WINDOW_MENU_KEY)); | ||
730 | 279 | |||
731 | 280 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "", | ||
732 | 281 | _("Places the window in corresponding position."), | ||
733 | 282 | shortcut::OptionType::HARDCODED, | ||
734 | 283 | _("Ctrl + Alt + Num"))); | ||
735 | 284 | |||
736 | 285 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" Drag"), | ||
737 | 286 | _("Moves the window."), | ||
738 | 287 | shortcut::OptionType::COMPIZ_MOUSE, | ||
739 | 288 | MOVE_PLUGIN_NAME, | ||
740 | 289 | MOVE_OPTION_INITIATE_BUTTON)); | ||
741 | 290 | |||
742 | 291 | hints.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" Drag"), | ||
743 | 292 | _("Resizes the window."), | ||
744 | 293 | shortcut::OptionType::COMPIZ_MOUSE, | ||
745 | 294 | RESIZE_PLUGIN_NAME, | ||
746 | 295 | RESIZE_OPTION_INITIATE_BUTTON)); | ||
747 | 296 | |||
748 | 297 | model_ = std::make_shared<shortcut::Model>(hints); | ||
749 | 298 | } | ||
750 | 299 | |||
751 | 300 | } | ||
752 | 301 | } | ||
753 | 0 | 302 | ||
754 | === added file 'shortcuts/CompizShortcutModeller.h' | |||
755 | --- shortcuts/CompizShortcutModeller.h 1970-01-01 00:00:00 +0000 | |||
756 | +++ shortcuts/CompizShortcutModeller.h 2013-01-23 00:09:20 +0000 | |||
757 | @@ -0,0 +1,43 @@ | |||
758 | 1 | /* | ||
759 | 2 | * Copyright 2013 Canonical Ltd. | ||
760 | 3 | * | ||
761 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
762 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
763 | 6 | * by the Free Software Foundation. | ||
764 | 7 | * | ||
765 | 8 | * This program is distributed in the hope that it will be useful, but | ||
766 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
767 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
768 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
769 | 12 | * | ||
770 | 13 | * You should have received a copy of the GNU General Public License | ||
771 | 14 | * version 3 along with this program. If not, see | ||
772 | 15 | * <http://www.gnu.org/licenses/> | ||
773 | 16 | * | ||
774 | 17 | * Authored by: Marco Trevisan <marco.trevisan@canonical.com> | ||
775 | 18 | */ | ||
776 | 19 | |||
777 | 20 | #ifndef UNITYSHELL_COMPIZ_SHORTCUT_MODELLER_H | ||
778 | 21 | #define UNITYSHELL_COMPIZ_SHORTCUT_MODELLER_H | ||
779 | 22 | |||
780 | 23 | #include "AbstractShortcutModeller.h" | ||
781 | 24 | |||
782 | 25 | namespace unity | ||
783 | 26 | { | ||
784 | 27 | namespace shortcut | ||
785 | 28 | { | ||
786 | 29 | |||
787 | 30 | class CompizModeller : public AbstractModeller | ||
788 | 31 | { | ||
789 | 32 | public: | ||
790 | 33 | CompizModeller(); | ||
791 | 34 | Model::Ptr GetCurrentModel() const {return model_;} | ||
792 | 35 | |||
793 | 36 | private: | ||
794 | 37 | Model::Ptr model_; | ||
795 | 38 | }; | ||
796 | 39 | |||
797 | 40 | } | ||
798 | 41 | } | ||
799 | 42 | |||
800 | 43 | #endif | ||
801 | 0 | 44 | ||
802 | === modified file 'shortcuts/ShortcutController.cpp' | |||
803 | --- shortcuts/ShortcutController.cpp 2013-01-21 16:12:58 +0000 | |||
804 | +++ shortcuts/ShortcutController.cpp 2013-01-23 00:09:20 +0000 | |||
805 | @@ -18,6 +18,7 @@ | |||
806 | 18 | */ | 18 | */ |
807 | 19 | 19 | ||
808 | 20 | #include "ShortcutController.h" | 20 | #include "ShortcutController.h" |
809 | 21 | #include "ShortcutModel.h" | ||
810 | 21 | 22 | ||
811 | 22 | #include "unity-shared/UBusMessages.h" | 23 | #include "unity-shared/UBusMessages.h" |
812 | 23 | #include "unity-shared/UScreen.h" | 24 | #include "unity-shared/UScreen.h" |
813 | @@ -34,17 +35,15 @@ | |||
814 | 34 | const unsigned int FADE_DURATION = 100; | 35 | const unsigned int FADE_DURATION = 100; |
815 | 35 | } | 36 | } |
816 | 36 | 37 | ||
820 | 37 | Controller::Controller(std::list<AbstractHint::Ptr> const& hints, | 38 | Controller::Controller(BaseWindowRaiser::Ptr const& base_window_raiser, |
821 | 38 | BaseWindowRaiser::Ptr const& base_window_raiser) | 39 | AbstractModeller::Ptr const& modeller) |
822 | 39 | : model_(std::make_shared<Model>(hints)) | 40 | : modeller_(modeller) |
823 | 40 | , base_window_raiser_(base_window_raiser) | 41 | , base_window_raiser_(base_window_raiser) |
824 | 41 | , visible_(false) | 42 | , visible_(false) |
825 | 42 | , enabled_(true) | 43 | , enabled_(true) |
826 | 43 | , bg_color_(0.0, 0.0, 0.0, 0.5) | 44 | , bg_color_(0.0, 0.0, 0.0, 0.5) |
827 | 44 | , fade_animator_(FADE_DURATION) | 45 | , fade_animator_(FADE_DURATION) |
828 | 45 | { | 46 | { |
829 | 46 | model_->Fill(); | ||
830 | 47 | |||
831 | 48 | ubus_manager_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, | 47 | ubus_manager_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, |
832 | 49 | sigc::mem_fun(this, &Controller::OnBackgroundUpdate)); | 48 | sigc::mem_fun(this, &Controller::OnBackgroundUpdate)); |
833 | 50 | 49 | ||
834 | @@ -65,6 +64,16 @@ | |||
835 | 65 | fade_animator_.updated.connect([this] (double opacity) { | 64 | fade_animator_.updated.connect([this] (double opacity) { |
836 | 66 | SetOpacity(opacity); | 65 | SetOpacity(opacity); |
837 | 67 | }); | 66 | }); |
838 | 67 | |||
839 | 68 | modeller->model_changed.connect([this] (Model::Ptr const& model) { | ||
840 | 69 | if (!view_) | ||
841 | 70 | return; | ||
842 | 71 | |||
843 | 72 | if (visible_) | ||
844 | 73 | model->Fill(); | ||
845 | 74 | |||
846 | 75 | view_->SetModel(model); | ||
847 | 76 | }); | ||
848 | 68 | } | 77 | } |
849 | 69 | 78 | ||
850 | 70 | Controller::~Controller() | 79 | Controller::~Controller() |
851 | @@ -82,12 +91,9 @@ | |||
852 | 82 | 91 | ||
853 | 83 | bool Controller::Show() | 92 | bool Controller::Show() |
854 | 84 | { | 93 | { |
856 | 85 | if (enabled_) | 94 | if (enabled_ && modeller_->GetCurrentModel()) |
857 | 86 | { | 95 | { |
858 | 87 | EnsureView(); | ||
859 | 88 | |||
860 | 89 | show_timer_.reset(new glib::Timeout(SUPER_TAP_DURATION, sigc::mem_fun(this, &Controller::OnShowTimer))); | 96 | show_timer_.reset(new glib::Timeout(SUPER_TAP_DURATION, sigc::mem_fun(this, &Controller::OnShowTimer))); |
861 | 90 | model_->Fill(); | ||
862 | 91 | visible_ = true; | 97 | visible_ = true; |
863 | 92 | 98 | ||
864 | 93 | return true; | 99 | return true; |
865 | @@ -98,10 +104,11 @@ | |||
866 | 98 | 104 | ||
867 | 99 | bool Controller::OnShowTimer() | 105 | bool Controller::OnShowTimer() |
868 | 100 | { | 106 | { |
870 | 101 | if (!enabled_) | 107 | if (!enabled_ || !modeller_->GetCurrentModel()) |
871 | 102 | return false; | 108 | return false; |
872 | 103 | 109 | ||
874 | 104 | base_window_raiser_->Raise(view_window_); | 110 | modeller_->GetCurrentModel()->Fill(); |
875 | 111 | EnsureView(); | ||
876 | 105 | 112 | ||
877 | 106 | int monitor = UScreen::GetDefault()->GetMonitorWithMouse(); | 113 | int monitor = UScreen::GetDefault()->GetMonitorWithMouse(); |
878 | 107 | auto const& geo = GetGeometryPerMonitor(monitor); | 114 | auto const& geo = GetGeometryPerMonitor(monitor); |
879 | @@ -109,6 +116,7 @@ | |||
880 | 109 | if (geo.IsNull()) | 116 | if (geo.IsNull()) |
881 | 110 | return false; | 117 | return false; |
882 | 111 | 118 | ||
883 | 119 | base_window_raiser_->Raise(view_window_); | ||
884 | 112 | view_window_->SetGeometry(geo); | 120 | view_window_->SetGeometry(geo); |
885 | 113 | 121 | ||
886 | 114 | if (visible_) | 122 | if (visible_) |
887 | @@ -131,8 +139,7 @@ | |||
888 | 131 | 139 | ||
889 | 132 | nux::Geometry Controller::GetGeometryPerMonitor(int monitor) | 140 | nux::Geometry Controller::GetGeometryPerMonitor(int monitor) |
890 | 133 | { | 141 | { |
893 | 134 | if (!view_) | 142 | EnsureView(); |
892 | 135 | ConstructView(); | ||
894 | 136 | 143 | ||
895 | 137 | auto const& view_geo = view_->GetAbsoluteGeometry(); | 144 | auto const& view_geo = view_->GetAbsoluteGeometry(); |
896 | 138 | auto const& monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(monitor); | 145 | auto const& monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(monitor); |
897 | @@ -154,7 +161,7 @@ | |||
898 | 154 | { | 161 | { |
899 | 155 | view_ = View::Ptr(new View()); | 162 | view_ = View::Ptr(new View()); |
900 | 156 | AddChild(view_.GetPointer()); | 163 | AddChild(view_.GetPointer()); |
902 | 157 | view_->SetModel(model_); | 164 | view_->SetModel(modeller_->GetCurrentModel()); |
903 | 158 | view_->background_color = bg_color_; | 165 | view_->background_color = bg_color_; |
904 | 159 | 166 | ||
905 | 160 | if (!view_window_) | 167 | if (!view_window_) |
906 | @@ -165,7 +172,7 @@ | |||
907 | 165 | 172 | ||
908 | 166 | view_window_ = new nux::BaseWindow("ShortcutHint"); | 173 | view_window_ = new nux::BaseWindow("ShortcutHint"); |
909 | 167 | view_window_->SetLayout(main_layout_); | 174 | view_window_->SetLayout(main_layout_); |
911 | 168 | view_window_->SetBackgroundColor(nux::Color(0x00000000)); | 175 | view_window_->SetBackgroundColor(nux::color::Transparent); |
912 | 169 | } | 176 | } |
913 | 170 | 177 | ||
914 | 171 | main_layout_->AddView(view_.GetPointer()); | 178 | main_layout_->AddView(view_.GetPointer()); |
915 | 172 | 179 | ||
916 | === modified file 'shortcuts/ShortcutController.h' | |||
917 | --- shortcuts/ShortcutController.h 2013-01-21 16:06:36 +0000 | |||
918 | +++ shortcuts/ShortcutController.h 2013-01-23 00:09:20 +0000 | |||
919 | @@ -30,7 +30,7 @@ | |||
920 | 30 | #include <UnityCore/GLibSource.h> | 30 | #include <UnityCore/GLibSource.h> |
921 | 31 | 31 | ||
922 | 32 | #include "BaseWindowRaiser.h" | 32 | #include "BaseWindowRaiser.h" |
924 | 33 | #include "ShortcutModel.h" | 33 | #include "AbstractShortcutModeller.h" |
925 | 34 | #include "ShortcutView.h" | 34 | #include "ShortcutView.h" |
926 | 35 | #include "unity-shared/Introspectable.h" | 35 | #include "unity-shared/Introspectable.h" |
927 | 36 | #include "unity-shared/UBusWrapper.h" | 36 | #include "unity-shared/UBusWrapper.h" |
928 | @@ -45,8 +45,7 @@ | |||
929 | 45 | public: | 45 | public: |
930 | 46 | typedef std::shared_ptr<Controller> Ptr; | 46 | typedef std::shared_ptr<Controller> Ptr; |
931 | 47 | 47 | ||
934 | 48 | Controller(std::list<AbstractHint::Ptr> const& hints, | 48 | Controller(BaseWindowRaiser::Ptr const& raiser, AbstractModeller::Ptr const& modeller); |
933 | 49 | BaseWindowRaiser::Ptr const& raiser); | ||
935 | 50 | virtual ~Controller(); | 49 | virtual ~Controller(); |
936 | 51 | 50 | ||
937 | 52 | bool Show(); | 51 | bool Show(); |
938 | @@ -72,7 +71,7 @@ | |||
939 | 72 | bool OnShowTimer(); | 71 | bool OnShowTimer(); |
940 | 73 | 72 | ||
941 | 74 | View::Ptr view_; | 73 | View::Ptr view_; |
943 | 75 | Model::Ptr model_; | 74 | AbstractModeller::Ptr modeller_; |
944 | 76 | BaseWindowRaiser::Ptr base_window_raiser_; | 75 | BaseWindowRaiser::Ptr base_window_raiser_; |
945 | 77 | 76 | ||
946 | 78 | nux::Geometry workarea_; | 77 | nux::Geometry workarea_; |
947 | 79 | 78 | ||
948 | === modified file 'shortcuts/ShortcutModel.cpp' | |||
949 | --- shortcuts/ShortcutModel.cpp 2013-01-19 00:25:07 +0000 | |||
950 | +++ shortcuts/ShortcutModel.cpp 2013-01-23 00:09:20 +0000 | |||
951 | @@ -50,7 +50,6 @@ | |||
952 | 50 | hints_[hint->category()].push_back(hint); | 50 | hints_[hint->category()].push_back(hint); |
953 | 51 | } | 51 | } |
954 | 52 | 52 | ||
955 | 53 | |||
956 | 54 | void Model::Fill() | 53 | void Model::Fill() |
957 | 55 | { | 54 | { |
958 | 56 | for (auto const& category : categories_) | 55 | for (auto const& category : categories_) |
959 | 57 | 56 | ||
960 | === modified file 'shortcuts/ShortcutView.cpp' | |||
961 | --- shortcuts/ShortcutView.cpp 2013-01-21 21:12:57 +0000 | |||
962 | +++ shortcuts/ShortcutView.cpp 2013-01-23 00:09:20 +0000 | |||
963 | @@ -94,7 +94,9 @@ | |||
964 | 94 | void View::SetModel(Model::Ptr model) | 94 | void View::SetModel(Model::Ptr model) |
965 | 95 | { | 95 | { |
966 | 96 | model_ = model; | 96 | model_ = model; |
968 | 97 | model_->categories_per_column.changed.connect(sigc::hide(sigc::mem_fun(this, &View::RenderColumns))); | 97 | |
969 | 98 | if (model_) | ||
970 | 99 | model_->categories_per_column.changed.connect(sigc::hide(sigc::mem_fun(this, &View::RenderColumns))); | ||
971 | 98 | 100 | ||
972 | 99 | // Fills the columns... | 101 | // Fills the columns... |
973 | 100 | RenderColumns(); | 102 | RenderColumns(); |
974 | @@ -186,13 +188,10 @@ | |||
975 | 186 | 188 | ||
976 | 187 | nux::Geometry View::GetBackgroundGeometry() | 189 | nux::Geometry View::GetBackgroundGeometry() |
977 | 188 | { | 190 | { |
980 | 189 | nux::Geometry base = GetGeometry(); | 191 | nux::Geometry background_geo = GetGeometry(); |
979 | 190 | nux::Geometry background_geo; | ||
981 | 191 | 192 | ||
986 | 192 | background_geo.width = base.width; | 193 | background_geo.x = 0; |
987 | 193 | background_geo.height = base.height; | 194 | background_geo.y = 0; |
984 | 194 | background_geo.x = (base.width - background_geo.width)/2; | ||
985 | 195 | background_geo.y = (base.height - background_geo.height)/2; | ||
988 | 196 | 195 | ||
989 | 197 | return background_geo; | 196 | return background_geo; |
990 | 198 | } | 197 | } |
991 | @@ -206,6 +205,12 @@ | |||
992 | 206 | { | 205 | { |
993 | 207 | columns_layout_->Clear(); | 206 | columns_layout_->Clear(); |
994 | 208 | 207 | ||
995 | 208 | if (!model_) | ||
996 | 209 | { | ||
997 | 210 | QueueRelayout(); | ||
998 | 211 | return; | ||
999 | 212 | } | ||
1000 | 213 | |||
1001 | 209 | int i = 0; | 214 | int i = 0; |
1002 | 210 | int column_idx = 0; | 215 | int column_idx = 0; |
1003 | 211 | auto const& columns = columns_layout_->GetChildren(); | 216 | auto const& columns = columns_layout_->GetChildren(); |
1004 | 212 | 217 | ||
1005 | === modified file 'shortcuts/StandaloneShortcuts.cpp' | |||
1006 | --- shortcuts/StandaloneShortcuts.cpp 2013-01-21 16:07:47 +0000 | |||
1007 | +++ shortcuts/StandaloneShortcuts.cpp 2013-01-23 00:09:20 +0000 | |||
1008 | @@ -39,9 +39,8 @@ | |||
1009 | 39 | { | 39 | { |
1010 | 40 | struct StandaloneController : Controller | 40 | struct StandaloneController : Controller |
1011 | 41 | { | 41 | { |
1015 | 42 | StandaloneController(std::list<AbstractHint::Ptr> const& hints, | 42 | StandaloneController(BaseWindowRaiser::Ptr const& raiser, AbstractModeller::Ptr const& modeller) |
1016 | 43 | BaseWindowRaiser::Ptr const& raiser) | 43 | : Controller(raiser, modeller) |
1014 | 44 | : Controller(hints, raiser) | ||
1017 | 45 | {} | 44 | {} |
1018 | 46 | 45 | ||
1019 | 47 | nux::Geometry GetGeometryPerMonitor(int monitor) override | 46 | nux::Geometry GetGeometryPerMonitor(int monitor) override |
1020 | @@ -52,6 +51,216 @@ | |||
1021 | 52 | } | 51 | } |
1022 | 53 | } | 52 | } |
1023 | 54 | 53 | ||
1024 | 54 | struct StandaloneModeller : shortcut::AbstractModeller | ||
1025 | 55 | { | ||
1026 | 56 | StandaloneModeller() | ||
1027 | 57 | { | ||
1028 | 58 | std::list<shortcut::AbstractHint::Ptr> hints; | ||
1029 | 59 | |||
1030 | 60 | // Launcher... | ||
1031 | 61 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", _(" (Hold)"), | ||
1032 | 62 | _("Opens the Launcher, displays shortcuts."), | ||
1033 | 63 | shortcut::OptionType::COMPIZ_KEY, | ||
1034 | 64 | "unityshell", | ||
1035 | 65 | "show_launcher" ))); | ||
1036 | 66 | |||
1037 | 67 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", "", | ||
1038 | 68 | _("Opens Launcher keyboard navigation mode."), | ||
1039 | 69 | shortcut::OptionType::COMPIZ_KEY, | ||
1040 | 70 | "unityshell", | ||
1041 | 71 | "keyboard_focus"))); | ||
1042 | 72 | |||
1043 | 73 | // FIXME: Implemstd::shared_ptr<shortcut::AbstractHint>(ent it... | ||
1044 | 74 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", "", | ||
1045 | 75 | _("Switches applications via the Launcher."), | ||
1046 | 76 | shortcut::OptionType::HARDCODED, | ||
1047 | 77 | "Super + Tab"))); | ||
1048 | 78 | |||
1049 | 79 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", _(" + 1 to 9"), | ||
1050 | 80 | _("Same as clicking on a Launcher icon."), | ||
1051 | 81 | shortcut::OptionType::COMPIZ_KEY, | ||
1052 | 82 | "unityshell", | ||
1053 | 83 | "show_launcher"))); | ||
1054 | 84 | |||
1055 | 85 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", _(" + Shift + 1 to 9"), | ||
1056 | 86 | _("Opens a new window in the app."), | ||
1057 | 87 | shortcut::OptionType::COMPIZ_KEY, | ||
1058 | 88 | "unityshell", | ||
1059 | 89 | "show_launcher"))); | ||
1060 | 90 | |||
1061 | 91 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", " + T", | ||
1062 | 92 | _("Opens the Trash."), | ||
1063 | 93 | shortcut::OptionType::COMPIZ_KEY, | ||
1064 | 94 | "unityshell", | ||
1065 | 95 | "show_launcher"))); | ||
1066 | 96 | |||
1067 | 97 | // Dash... | ||
1068 | 98 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", _(" (Tap)"), | ||
1069 | 99 | _("Opens the Dash Home."), | ||
1070 | 100 | shortcut::OptionType::COMPIZ_KEY, | ||
1071 | 101 | "unityshell", | ||
1072 | 102 | "show_launcher"))); | ||
1073 | 103 | |||
1074 | 104 | // These are notstd::shared_ptr<shortcut::AbstractHint>( really hardcoded... | ||
1075 | 105 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", " + A", | ||
1076 | 106 | _("Opens the Dash App Lens."), | ||
1077 | 107 | shortcut::OptionType::COMPIZ_KEY, | ||
1078 | 108 | "unityshell", | ||
1079 | 109 | "show_launcher"))); | ||
1080 | 110 | |||
1081 | 111 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", " + F", | ||
1082 | 112 | _("Opens the Dash Files Lens."), | ||
1083 | 113 | shortcut::OptionType::COMPIZ_KEY, | ||
1084 | 114 | "unityshell", | ||
1085 | 115 | "show_launcher"))); | ||
1086 | 116 | |||
1087 | 117 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", " + M", | ||
1088 | 118 | _("Opens the Dash Music Lens."), | ||
1089 | 119 | shortcut::OptionType::COMPIZ_KEY, | ||
1090 | 120 | "unityshell", | ||
1091 | 121 | "show_launcher"))); | ||
1092 | 122 | |||
1093 | 123 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", "", | ||
1094 | 124 | _("Switches between Lenses."), | ||
1095 | 125 | shortcut::OptionType::HARDCODED, | ||
1096 | 126 | "Ctrl + Tab"))); | ||
1097 | 127 | |||
1098 | 128 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", "", | ||
1099 | 129 | _("Moves the focus."), | ||
1100 | 130 | shortcut::OptionType::HARDCODED, | ||
1101 | 131 | _("Arrow Keys")))); | ||
1102 | 132 | |||
1103 | 133 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", "", | ||
1104 | 134 | _("Opens the currently focused item."), | ||
1105 | 135 | shortcut::OptionType::HARDCODED, | ||
1106 | 136 | _("Enter")))); | ||
1107 | 137 | |||
1108 | 138 | // Hud Menu Bar | ||
1109 | 139 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("HUD & Menu Bar"), "", _(" (Tap)"), | ||
1110 | 140 | _("Opens the HUD."), | ||
1111 | 141 | shortcut::OptionType::COMPIZ_KEY, | ||
1112 | 142 | "unityshell", | ||
1113 | 143 | "show_hud"))); | ||
1114 | 144 | |||
1115 | 145 | // Is it really std::shared_ptr<shortcut::AbstractHint>(hard coded? | ||
1116 | 146 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("HUD & Menu Bar"), "", _(" (Hold)"), | ||
1117 | 147 | _("Reveals the application menu."), | ||
1118 | 148 | shortcut::OptionType::HARDCODED, | ||
1119 | 149 | "Alt"))); | ||
1120 | 150 | |||
1121 | 151 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("HUD & Menu Bar"), "", "", | ||
1122 | 152 | _("Opens the indicator menu."), | ||
1123 | 153 | shortcut::OptionType::COMPIZ_KEY, | ||
1124 | 154 | "unityshell", | ||
1125 | 155 | "panel_first_menu"))); | ||
1126 | 156 | |||
1127 | 157 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("HUD & Menu Bar"), "", "", | ||
1128 | 158 | _("Moves focus between indicators."), | ||
1129 | 159 | shortcut::OptionType::HARDCODED, | ||
1130 | 160 | _("Cursor Left or Right")))); | ||
1131 | 161 | |||
1132 | 162 | // Switching | ||
1133 | 163 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Switching"), "", "", | ||
1134 | 164 | _("Switches between applications."), | ||
1135 | 165 | shortcut::OptionType::COMPIZ_KEY, | ||
1136 | 166 | "unityshell", | ||
1137 | 167 | "alt_tab_forward"))); | ||
1138 | 168 | |||
1139 | 169 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Switching"), "", "", | ||
1140 | 170 | _("Switches windows of current applications."), | ||
1141 | 171 | shortcut::OptionType::COMPIZ_KEY, | ||
1142 | 172 | "unityshell", | ||
1143 | 173 | "alt_tab_next_window"))); | ||
1144 | 174 | |||
1145 | 175 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Switching"), "", "", | ||
1146 | 176 | _("Moves the focus."), | ||
1147 | 177 | shortcut::OptionType::HARDCODED, | ||
1148 | 178 | _("Cursor Left or Right")))); | ||
1149 | 179 | |||
1150 | 180 | // Workspaces | ||
1151 | 181 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Workspaces"), "", "", | ||
1152 | 182 | _("Switches between workspaces."), | ||
1153 | 183 | shortcut::OptionType::COMPIZ_KEY, | ||
1154 | 184 | "expo", | ||
1155 | 185 | "expo_key"))); | ||
1156 | 186 | |||
1157 | 187 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Workspaces"), "", "", | ||
1158 | 188 | _("Switches workspaces."), | ||
1159 | 189 | shortcut::OptionType::HARDCODED, | ||
1160 | 190 | _("Arrow Keys")))); | ||
1161 | 191 | |||
1162 | 192 | //hints.push_bacstd::shared_ptr<shortcut::AbstractHint>(k(new shortcut::MockHint(_("Workspaces"), "", "", _("Move focused window to other workspace."), ...) | ||
1163 | 193 | |||
1164 | 194 | // Windows | ||
1165 | 195 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1166 | 196 | _("Spreads all windows in the current workspace."), | ||
1167 | 197 | shortcut::OptionType::COMPIZ_KEY, | ||
1168 | 198 | "scale", | ||
1169 | 199 | "initiate_output_key"))); | ||
1170 | 200 | |||
1171 | 201 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1172 | 202 | _("Minimises all windows."), | ||
1173 | 203 | shortcut::OptionType::COMPIZ_KEY, | ||
1174 | 204 | "core", | ||
1175 | 205 | "show_desktop_key"))); | ||
1176 | 206 | |||
1177 | 207 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1178 | 208 | _("Maximises the current window."), | ||
1179 | 209 | shortcut::OptionType::COMPIZ_KEY, | ||
1180 | 210 | "core", | ||
1181 | 211 | "maximize_window_key"))); | ||
1182 | 212 | |||
1183 | 213 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1184 | 214 | _("Restores or minimises the current window."), | ||
1185 | 215 | shortcut::OptionType::COMPIZ_KEY, | ||
1186 | 216 | "core", | ||
1187 | 217 | "unmaximize_window_key"))); | ||
1188 | 218 | |||
1189 | 219 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", _(" or Right"), | ||
1190 | 220 | _("Semi-maximises the current window."), | ||
1191 | 221 | shortcut::OptionType::COMPIZ_KEY, | ||
1192 | 222 | "grid", | ||
1193 | 223 | "put_left_key"))); | ||
1194 | 224 | |||
1195 | 225 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1196 | 226 | _("Closes the current window."), | ||
1197 | 227 | shortcut::OptionType::COMPIZ_KEY, | ||
1198 | 228 | "core", | ||
1199 | 229 | "close_window_key"))); | ||
1200 | 230 | |||
1201 | 231 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1202 | 232 | _("Opens the window accessibility menu."), | ||
1203 | 233 | shortcut::OptionType::COMPIZ_KEY, | ||
1204 | 234 | "core", | ||
1205 | 235 | "window_menu_key"))); | ||
1206 | 236 | |||
1207 | 237 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1208 | 238 | _("Places the window in corresponding position."), | ||
1209 | 239 | shortcut::OptionType::HARDCODED, | ||
1210 | 240 | "Ctrl + Alt + Num"))); | ||
1211 | 241 | |||
1212 | 242 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1213 | 243 | _("Moves the window."), | ||
1214 | 244 | shortcut::OptionType::COMPIZ_KEY, | ||
1215 | 245 | "move", | ||
1216 | 246 | "initiate_key"))); | ||
1217 | 247 | |||
1218 | 248 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1219 | 249 | _("Resizes the current window."), | ||
1220 | 250 | shortcut::OptionType::COMPIZ_KEY, | ||
1221 | 251 | "resize", | ||
1222 | 252 | "initiate_key"))); | ||
1223 | 253 | model = std::make_shared<shortcut::Model>(hints); | ||
1224 | 254 | } | ||
1225 | 255 | |||
1226 | 256 | shortcut::Model::Ptr GetCurrentModel() const | ||
1227 | 257 | { | ||
1228 | 258 | return model; | ||
1229 | 259 | } | ||
1230 | 260 | |||
1231 | 261 | shortcut::Model::Ptr model; | ||
1232 | 262 | }; | ||
1233 | 263 | |||
1234 | 55 | struct ShortcutsWindow | 264 | struct ShortcutsWindow |
1235 | 56 | { | 265 | { |
1236 | 57 | ShortcutsWindow() | 266 | ShortcutsWindow() |
1237 | @@ -82,204 +291,9 @@ | |||
1238 | 82 | void ShortcutsWindow::Init() | 291 | void ShortcutsWindow::Init() |
1239 | 83 | { | 292 | { |
1240 | 84 | BackgroundEffectHelper::blur_type = BLUR_NONE; | 293 | BackgroundEffectHelper::blur_type = BLUR_NONE; |
1241 | 85 | std::list<std::shared_ptr<shortcut::AbstractHint>> hints; | ||
1242 | 86 | |||
1243 | 87 | // Launcher... | ||
1244 | 88 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", _(" (Hold)"), | ||
1245 | 89 | _("Opens the Launcher, displays shortcuts."), | ||
1246 | 90 | shortcut::OptionType::COMPIZ_KEY, | ||
1247 | 91 | "unityshell", | ||
1248 | 92 | "show_launcher" ))); | ||
1249 | 93 | |||
1250 | 94 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", "", | ||
1251 | 95 | _("Opens Launcher keyboard navigation mode."), | ||
1252 | 96 | shortcut::OptionType::COMPIZ_KEY, | ||
1253 | 97 | "unityshell", | ||
1254 | 98 | "keyboard_focus"))); | ||
1255 | 99 | |||
1256 | 100 | // FIXME: Implemstd::shared_ptr<shortcut::AbstractHint>(ent it... | ||
1257 | 101 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", "", | ||
1258 | 102 | _("Switches applications via the Launcher."), | ||
1259 | 103 | shortcut::OptionType::HARDCODED, | ||
1260 | 104 | "Super + Tab"))); | ||
1261 | 105 | |||
1262 | 106 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", _(" + 1 to 9"), | ||
1263 | 107 | _("Same as clicking on a Launcher icon."), | ||
1264 | 108 | shortcut::OptionType::COMPIZ_KEY, | ||
1265 | 109 | "unityshell", | ||
1266 | 110 | "show_launcher"))); | ||
1267 | 111 | |||
1268 | 112 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", _(" + Shift + 1 to 9"), | ||
1269 | 113 | _("Opens a new window in the app."), | ||
1270 | 114 | shortcut::OptionType::COMPIZ_KEY, | ||
1271 | 115 | "unityshell", | ||
1272 | 116 | "show_launcher"))); | ||
1273 | 117 | |||
1274 | 118 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", " + T", | ||
1275 | 119 | _("Opens the Trash."), | ||
1276 | 120 | shortcut::OptionType::COMPIZ_KEY, | ||
1277 | 121 | "unityshell", | ||
1278 | 122 | "show_launcher"))); | ||
1279 | 123 | |||
1280 | 124 | // Dash... | ||
1281 | 125 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", _(" (Tap)"), | ||
1282 | 126 | _("Opens the Dash Home."), | ||
1283 | 127 | shortcut::OptionType::COMPIZ_KEY, | ||
1284 | 128 | "unityshell", | ||
1285 | 129 | "show_launcher"))); | ||
1286 | 130 | |||
1287 | 131 | // These are notstd::shared_ptr<shortcut::AbstractHint>( really hardcoded... | ||
1288 | 132 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", " + A", | ||
1289 | 133 | _("Opens the Dash App Lens."), | ||
1290 | 134 | shortcut::OptionType::COMPIZ_KEY, | ||
1291 | 135 | "unityshell", | ||
1292 | 136 | "show_launcher"))); | ||
1293 | 137 | |||
1294 | 138 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", " + F", | ||
1295 | 139 | _("Opens the Dash Files Lens."), | ||
1296 | 140 | shortcut::OptionType::COMPIZ_KEY, | ||
1297 | 141 | "unityshell", | ||
1298 | 142 | "show_launcher"))); | ||
1299 | 143 | |||
1300 | 144 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", " + M", | ||
1301 | 145 | _("Opens the Dash Music Lens."), | ||
1302 | 146 | shortcut::OptionType::COMPIZ_KEY, | ||
1303 | 147 | "unityshell", | ||
1304 | 148 | "show_launcher"))); | ||
1305 | 149 | |||
1306 | 150 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", "", | ||
1307 | 151 | _("Switches between Lenses."), | ||
1308 | 152 | shortcut::OptionType::HARDCODED, | ||
1309 | 153 | "Ctrl + Tab"))); | ||
1310 | 154 | |||
1311 | 155 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", "", | ||
1312 | 156 | _("Moves the focus."), | ||
1313 | 157 | shortcut::OptionType::HARDCODED, | ||
1314 | 158 | _("Arrow Keys")))); | ||
1315 | 159 | |||
1316 | 160 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", "", | ||
1317 | 161 | _("Opens the currently focused item."), | ||
1318 | 162 | shortcut::OptionType::HARDCODED, | ||
1319 | 163 | _("Enter")))); | ||
1320 | 164 | |||
1321 | 165 | // Hud Menu Bar | ||
1322 | 166 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("HUD & Menu Bar"), "", _(" (Tap)"), | ||
1323 | 167 | _("Opens the HUD."), | ||
1324 | 168 | shortcut::OptionType::COMPIZ_KEY, | ||
1325 | 169 | "unityshell", | ||
1326 | 170 | "show_hud"))); | ||
1327 | 171 | |||
1328 | 172 | // Is it really std::shared_ptr<shortcut::AbstractHint>(hard coded? | ||
1329 | 173 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("HUD & Menu Bar"), "", _(" (Hold)"), | ||
1330 | 174 | _("Reveals the application menu."), | ||
1331 | 175 | shortcut::OptionType::HARDCODED, | ||
1332 | 176 | "Alt"))); | ||
1333 | 177 | |||
1334 | 178 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("HUD & Menu Bar"), "", "", | ||
1335 | 179 | _("Opens the indicator menu."), | ||
1336 | 180 | shortcut::OptionType::COMPIZ_KEY, | ||
1337 | 181 | "unityshell", | ||
1338 | 182 | "panel_first_menu"))); | ||
1339 | 183 | |||
1340 | 184 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("HUD & Menu Bar"), "", "", | ||
1341 | 185 | _("Moves focus between indicators."), | ||
1342 | 186 | shortcut::OptionType::HARDCODED, | ||
1343 | 187 | _("Cursor Left or Right")))); | ||
1344 | 188 | |||
1345 | 189 | // Switching | ||
1346 | 190 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Switching"), "", "", | ||
1347 | 191 | _("Switches between applications."), | ||
1348 | 192 | shortcut::OptionType::COMPIZ_KEY, | ||
1349 | 193 | "unityshell", | ||
1350 | 194 | "alt_tab_forward"))); | ||
1351 | 195 | |||
1352 | 196 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Switching"), "", "", | ||
1353 | 197 | _("Switches windows of current applications."), | ||
1354 | 198 | shortcut::OptionType::COMPIZ_KEY, | ||
1355 | 199 | "unityshell", | ||
1356 | 200 | "alt_tab_next_window"))); | ||
1357 | 201 | |||
1358 | 202 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Switching"), "", "", | ||
1359 | 203 | _("Moves the focus."), | ||
1360 | 204 | shortcut::OptionType::HARDCODED, | ||
1361 | 205 | _("Cursor Left or Right")))); | ||
1362 | 206 | |||
1363 | 207 | // Workspaces | ||
1364 | 208 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Workspaces"), "", "", | ||
1365 | 209 | _("Switches between workspaces."), | ||
1366 | 210 | shortcut::OptionType::COMPIZ_KEY, | ||
1367 | 211 | "expo", | ||
1368 | 212 | "expo_key"))); | ||
1369 | 213 | |||
1370 | 214 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Workspaces"), "", "", | ||
1371 | 215 | _("Switches workspaces."), | ||
1372 | 216 | shortcut::OptionType::HARDCODED, | ||
1373 | 217 | _("Arrow Keys")))); | ||
1374 | 218 | |||
1375 | 219 | //hints.push_bacstd::shared_ptr<shortcut::AbstractHint>(k(new shortcut::MockHint(_("Workspaces"), "", "", _("Move focused window to other workspace."), ...) | ||
1376 | 220 | |||
1377 | 221 | // Windows | ||
1378 | 222 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1379 | 223 | _("Spreads all windows in the current workspace."), | ||
1380 | 224 | shortcut::OptionType::COMPIZ_KEY, | ||
1381 | 225 | "scale", | ||
1382 | 226 | "initiate_output_key"))); | ||
1383 | 227 | |||
1384 | 228 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1385 | 229 | _("Minimises all windows."), | ||
1386 | 230 | shortcut::OptionType::COMPIZ_KEY, | ||
1387 | 231 | "core", | ||
1388 | 232 | "show_desktop_key"))); | ||
1389 | 233 | |||
1390 | 234 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1391 | 235 | _("Maximises the current window."), | ||
1392 | 236 | shortcut::OptionType::COMPIZ_KEY, | ||
1393 | 237 | "core", | ||
1394 | 238 | "maximize_window_key"))); | ||
1395 | 239 | |||
1396 | 240 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1397 | 241 | _("Restores or minimises the current window."), | ||
1398 | 242 | shortcut::OptionType::COMPIZ_KEY, | ||
1399 | 243 | "core", | ||
1400 | 244 | "unmaximize_window_key"))); | ||
1401 | 245 | |||
1402 | 246 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", _(" or Right"), | ||
1403 | 247 | _("Semi-maximises the current window."), | ||
1404 | 248 | shortcut::OptionType::COMPIZ_KEY, | ||
1405 | 249 | "grid", | ||
1406 | 250 | "put_left_key"))); | ||
1407 | 251 | |||
1408 | 252 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1409 | 253 | _("Closes the current window."), | ||
1410 | 254 | shortcut::OptionType::COMPIZ_KEY, | ||
1411 | 255 | "core", | ||
1412 | 256 | "close_window_key"))); | ||
1413 | 257 | |||
1414 | 258 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1415 | 259 | _("Opens the window accessibility menu."), | ||
1416 | 260 | shortcut::OptionType::COMPIZ_KEY, | ||
1417 | 261 | "core", | ||
1418 | 262 | "window_menu_key"))); | ||
1419 | 263 | |||
1420 | 264 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1421 | 265 | _("Places the window in corresponding position."), | ||
1422 | 266 | shortcut::OptionType::HARDCODED, | ||
1423 | 267 | "Ctrl + Alt + Num"))); | ||
1424 | 268 | |||
1425 | 269 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1426 | 270 | _("Moves the window."), | ||
1427 | 271 | shortcut::OptionType::COMPIZ_KEY, | ||
1428 | 272 | "move", | ||
1429 | 273 | "initiate_key"))); | ||
1430 | 274 | |||
1431 | 275 | hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "", | ||
1432 | 276 | _("Resizes the current window."), | ||
1433 | 277 | shortcut::OptionType::COMPIZ_KEY, | ||
1434 | 278 | "resize", | ||
1435 | 279 | "initiate_key"))); | ||
1436 | 280 | |||
1437 | 281 | auto base_window_raiser_ = std::make_shared<shortcut::BaseWindowRaiserImp>(); | 294 | auto base_window_raiser_ = std::make_shared<shortcut::BaseWindowRaiserImp>(); |
1439 | 282 | controller = std::make_shared<shortcut::StandaloneController>(hints, base_window_raiser_); | 295 | auto modeller = std::make_shared<StandaloneModeller>(); |
1440 | 296 | controller = std::make_shared<shortcut::StandaloneController>(base_window_raiser_, modeller); | ||
1441 | 283 | controller->Show(); | 297 | controller->Show(); |
1442 | 284 | } | 298 | } |
1443 | 285 | 299 | ||
1444 | 286 | 300 | ||
1445 | === modified file 'tests/test_shortcut_controller.cpp' | |||
1446 | --- tests/test_shortcut_controller.cpp 2013-01-21 16:08:34 +0000 | |||
1447 | +++ tests/test_shortcut_controller.cpp 2013-01-23 00:09:20 +0000 | |||
1448 | @@ -39,6 +39,14 @@ | |||
1449 | 39 | 39 | ||
1450 | 40 | MOCK_METHOD1 (Raise, void(nux::ObjectPtr<nux::BaseWindow> window)); | 40 | MOCK_METHOD1 (Raise, void(nux::ObjectPtr<nux::BaseWindow> window)); |
1451 | 41 | }; | 41 | }; |
1452 | 42 | |||
1453 | 43 | struct StandaloneModeller : shortcut::AbstractModeller | ||
1454 | 44 | { | ||
1455 | 45 | shortcut::Model::Ptr GetCurrentModel() const | ||
1456 | 46 | { | ||
1457 | 47 | return std::make_shared<shortcut::Model>(std::list<shortcut::AbstractHint::Ptr>()); | ||
1458 | 48 | } | ||
1459 | 49 | }; | ||
1460 | 42 | } | 50 | } |
1461 | 43 | 51 | ||
1462 | 44 | namespace unity | 52 | namespace unity |
1463 | @@ -49,9 +57,9 @@ | |||
1464 | 49 | { | 57 | { |
1465 | 50 | struct MockShortcutController : public Controller | 58 | struct MockShortcutController : public Controller |
1466 | 51 | { | 59 | { |
1470 | 52 | MockShortcutController(std::list<AbstractHint::Ptr> const& hints, | 60 | MockShortcutController(BaseWindowRaiser::Ptr const& base_window_raiser, |
1471 | 53 | BaseWindowRaiser::Ptr const& base_window_raiser) | 61 | AbstractModeller::Ptr const& modeller) |
1472 | 54 | : Controller(hints, base_window_raiser) | 62 | : Controller(base_window_raiser, modeller) |
1473 | 55 | {} | 63 | {} |
1474 | 56 | 64 | ||
1475 | 57 | MOCK_METHOD1(SetOpacity, void(double)); | 65 | MOCK_METHOD1(SetOpacity, void(double)); |
1476 | @@ -67,8 +75,9 @@ | |||
1477 | 67 | 75 | ||
1478 | 68 | public: | 76 | public: |
1479 | 69 | TestShortcutController() | 77 | TestShortcutController() |
1482 | 70 | : base_window_raiser_(std::make_shared<MockBaseWindowRaiser>()) | 78 | : base_window_raiser_(std::make_shared<NiceMock<MockBaseWindowRaiser>>()) |
1483 | 71 | , controller_(hints_, base_window_raiser_) | 79 | , modeller_(std::make_shared<StandaloneModeller>()) |
1484 | 80 | , controller_(base_window_raiser_, modeller_) | ||
1485 | 72 | , animation_controller_(tick_source_) | 81 | , animation_controller_(tick_source_) |
1486 | 73 | { | 82 | { |
1487 | 74 | ON_CALL(controller_, SetOpacity(_)) | 83 | ON_CALL(controller_, SetOpacity(_)) |
1488 | @@ -77,15 +86,15 @@ | |||
1489 | 77 | 86 | ||
1490 | 78 | MockUScreen uscreen; | 87 | MockUScreen uscreen; |
1491 | 79 | Settings unity_settings; | 88 | Settings unity_settings; |
1492 | 80 | std::list<shortcut::AbstractHint::Ptr> hints_; | ||
1493 | 81 | MockBaseWindowRaiser::Ptr base_window_raiser_; | 89 | MockBaseWindowRaiser::Ptr base_window_raiser_; |
1494 | 90 | AbstractModeller::Ptr const& modeller_; | ||
1495 | 82 | NiceMock<MockShortcutController> controller_; | 91 | NiceMock<MockShortcutController> controller_; |
1496 | 83 | 92 | ||
1497 | 84 | nux::animation::TickSource tick_source_; | 93 | nux::animation::TickSource tick_source_; |
1498 | 85 | nux::animation::AnimationController animation_controller_; | 94 | nux::animation::AnimationController animation_controller_; |
1499 | 86 | }; | 95 | }; |
1500 | 87 | 96 | ||
1502 | 88 | TEST_F (TestShortcutController, WindowIsRaisedOnShow) | 97 | TEST_F(TestShortcutController, WindowIsRaisedOnShow) |
1503 | 89 | { | 98 | { |
1504 | 90 | EXPECT_CALL(*base_window_raiser_, Raise(_)) | 99 | EXPECT_CALL(*base_window_raiser_, Raise(_)) |
1505 | 91 | .Times(1); | 100 | .Times(1); |
1506 | @@ -94,8 +103,7 @@ | |||
1507 | 94 | Utils::WaitForTimeout(1); | 103 | Utils::WaitForTimeout(1); |
1508 | 95 | } | 104 | } |
1509 | 96 | 105 | ||
1512 | 97 | 106 | TEST_F(TestShortcutController, HiddeenOnConstruction) | |
1511 | 98 | TEST_F (TestShortcutController, Hide) | ||
1513 | 99 | { | 107 | { |
1514 | 100 | { | 108 | { |
1515 | 101 | InSequence sequence; | 109 | InSequence sequence; |
1516 | @@ -105,13 +113,11 @@ | |||
1517 | 105 | .Times(0); | 113 | .Times(0); |
1518 | 106 | } | 114 | } |
1519 | 107 | 115 | ||
1522 | 108 | controller_.Show(); | 116 | controller_.ConstructView(); |
1521 | 109 | |||
1523 | 110 | controller_.Hide(); | 117 | controller_.Hide(); |
1524 | 111 | tick_source_.tick(1000); | ||
1525 | 112 | } | 118 | } |
1526 | 113 | 119 | ||
1528 | 114 | TEST_F (TestShortcutController, GetGeometryPerMonitor) | 120 | TEST_F(TestShortcutController, GetGeometryPerMonitor) |
1529 | 115 | { | 121 | { |
1530 | 116 | nux::Geometry good_monitor(0, 0, 1366, 768); | 122 | nux::Geometry good_monitor(0, 0, 1366, 768); |
1531 | 117 | nux::Geometry invalid_monitor(good_monitor.x + good_monitor.width, 0, 1, 1); | 123 | nux::Geometry invalid_monitor(good_monitor.x + good_monitor.width, 0, 1, 1); |
1532 | @@ -129,6 +135,17 @@ | |||
1533 | 129 | EXPECT_TRUE(controller_.GetGeometryPerMonitor(1).IsNull()); | 135 | EXPECT_TRUE(controller_.GetGeometryPerMonitor(1).IsNull()); |
1534 | 130 | } | 136 | } |
1535 | 131 | 137 | ||
1536 | 138 | TEST_F(TestShortcutController, ModelIsChangedOnModellerChange) | ||
1537 | 139 | { | ||
1538 | 140 | controller_.ConstructView(); | ||
1539 | 141 | auto old_model = controller_.view_->GetModel(); | ||
1540 | 142 | auto model = std::make_shared<Model>(std::list<AbstractHint::Ptr>()); | ||
1541 | 143 | modeller_->model_changed(model); | ||
1542 | 144 | |||
1543 | 145 | ASSERT_NE(controller_.view_->GetModel(), old_model); | ||
1544 | 146 | EXPECT_EQ(controller_.view_->GetModel(), model); | ||
1545 | 147 | } | ||
1546 | 148 | |||
1547 | 132 | 149 | ||
1548 | 133 | } | 150 | } |
1549 | 134 | } | 151 | } |
1550 | 135 | 152 | ||
1551 | === modified file 'tests/test_shortcut_view.cpp' | |||
1552 | --- tests/test_shortcut_view.cpp 2013-01-21 21:12:57 +0000 | |||
1553 | +++ tests/test_shortcut_view.cpp 2013-01-23 00:09:20 +0000 | |||
1554 | @@ -73,6 +73,14 @@ | |||
1555 | 73 | EXPECT_FALSE(model->categories_per_column.changed.empty()); | 73 | EXPECT_FALSE(model->categories_per_column.changed.empty()); |
1556 | 74 | } | 74 | } |
1557 | 75 | 75 | ||
1558 | 76 | TEST_F(TestShortcutView, SetNullModel) | ||
1559 | 77 | { | ||
1560 | 78 | view.SetModel(GetMockModel({}, 0)); | ||
1561 | 79 | view.SetModel(nullptr); | ||
1562 | 80 | EXPECT_EQ(view.GetModel(), nullptr); | ||
1563 | 81 | EXPECT_TRUE(view.columns_layout_->GetChildren().empty()); | ||
1564 | 82 | } | ||
1565 | 83 | |||
1566 | 76 | TEST_F(TestShortcutView, SettingModelAddsColumns) | 84 | TEST_F(TestShortcutView, SettingModelAddsColumns) |
1567 | 77 | { | 85 | { |
1568 | 78 | auto model = GetMockModel({"Cat1", "Cat2"}, 1); | 86 | auto model = GetMockModel({"Cat1", "Cat2"}, 1); |
+ AbstractModeller() {}
empty ctor?